Name:                freemarker
Version:             2.3.28
Release:             1
Summary:             The Apache FreeMarker Template Engine
License:             ASL 2.0
URL:                 https://freemarker.apache.org/
Source0:             https://github.com/apache/incubator-freemarker/archive/v%{version}/%{name}-%{version}.tar.gz
Patch1:              jsp-api.patch
Patch2:              jython-compatibility.patch
Patch3:              fix-javadoc-encoding.patch
Patch5:              no-javarebel.patch
Patch6:              enable-jdom.patch
Patch7:              javacc-7.patch
BuildArch:           noarch
BuildRequires:       ant apache-parent apache-commons-logging aqute-bnd dom4j >= 1.6.1 hamcrest
BuildRequires:       ivy-local glassfish-jsp-api glassfish-servlet-api javacc >= 7.0 jaxen >= 1.1
BuildRequires:       jcl-over-slf4j jdom >= 1.0 junit jython log4j-over-slf4j rhino >= 1.6 slf4j
BuildRequires:       xalan-j2 >= 2.7.0
%description
Apache FreeMarker is a template engine: a Java library to generate text output
(HTML web pages, e-mails, configuration files, source code, etc.) based on
templates and changing data. Templates are written in the FreeMarker Template
Language (FTL), which is a simple, specialized language (not a full-blown
programming language like PHP).

%package javadoc
Summary:             Javadoc for %{name}
%description javadoc
This package contains the API documentation for %{name}.

%prep
%setup -q
find -type f -name "*.jar" -delete
find -type f -name "*.class" -delete
%patch1
%patch2
%patch3
%patch5
%patch6
%patch7 -p1
rm ivysettings.xml
sed -i 's/cachepath conf="IDE"/cachepath conf="javadoc"/' build.xml
sed -i '/conf name="IDE"/i<conf name="javadoc" extends="build.jython2.5,build.jsp2.1" />' ivy.xml
sed -i -e '/saxpath/d' -e '/avalon-logkit/d' ivy.xml
rm src/main/java/freemarker/log/_AvalonLoggerFactory.java
%mvn_file org.%{name}:%{name} %{name}

%build
ant -Divy.mode=local -Ddeps.available=true javacc jar javadoc maven-pom

%install
%mvn_artifact build/pom.xml build/%{name}.jar
%mvn_install -J build/api

%files -f .mfiles
%doc README.md RELEASE-NOTES
%license LICENSE NOTICE

%files javadoc -f .mfiles-javadoc
%license LICENSE NOTICE

%changelog
* Mon Aug 3 2020 yanan li <liyanan032@huawei.com> - 2.3.28-1
- Package init
