%global fmpp_version 0.9.14
Name:                fmpp
Version:             0.9.14
Release:             1
Summary:             FreeMarker-based text file PreProcessor
License:             BSD
URL:                 http://fmpp.sourceforge.net
Source0:             http://prdownloads.sourceforge.net/fmpp/fmpp_%{version}.tar.gz
Patch0:              fmpp-0.9.14-build.xml.patch
Patch1:              fmpp-0.9.14-excise-imageinfo.patch
BuildRequires:       javapackages-local ant
BuildRequires:       mvn(oro:oro) mvn(org.freemarker:freemarker) mvn(org.beanshell:bsh)
BuildRequires:       mvn(xml-resolver:xml-resolver) mvn(xml-apis:xml-apis)
Requires:            mvn(oro:oro) mvn(org.freemarker:freemarker) mvn(org.beanshell:bsh)
Requires:            mvn(xml-resolver:xml-resolver) mvn(xml-apis:xml-apis)
BuildArch:           noarch
%description
FMPP is a general-purpose text file preprocessor tool that uses
FreeMarker templates. It is particularly designed for HTML
preprocessor, to generate complete (static) homepages: directory
structure that contains HTML-s, image files, etc. But of course it can
be used to generate source code or whatever text files. FMPP is
extendable with Java classes to pull data from any data sources
(database, etc.) and embed the data into the generated files.

%package help
Summary:             Javadoc for %{name}
BuildArch:           noarch
Provides:            %{name}-javadoc = %{version}-%{release}
Obsoletes:           %{name}-javadoc < %{version}-%{release}
%description help
Javadoc for %{name}.

%prep
%setup -q -n %{name}_%{fmpp_version}
%patch0 -p1
%patch1 -p1
find lib -name \*.jar -delete
rm -rf lib/forbuild/classes
find . -name always_create_dirs_\* -and -type d | xargs rm -rf
find . -name \*.fmpp -or\
 -name package-list -or\
 -name \*.bsh -or\
 -name \*.txt -or\
 -name \*.xml -or\
 -name \*.c -or \
 -name \*.css -or \
 -name \*.csv -or \
 -name \*.dtd -or \
 -name \*.ent -or \
 -name \*.ftl -or \
 -name \*.html -or \
 -name \*.tdd| xargs sed -i 's/\r$//'

%build
ant build
ant make-pom
%mvn_artifact build/pom.xml lib/fmpp.jar

%check
ant test

%install
%mvn_install -J docs

%files -f .mfiles
%doc LICENSE.txt README.txt

%files help -f .mfiles-javadoc
%doc LICENSE.txt README.txt

%changelog
* Sat Aug 22 2020 liyanan <liyanan32@huawei.com> - 0.9.14-1
- package init
