Name:           fop
Version:        2.2
Release:        8
Summary:        Formatter for printing XSL-driven XML Files
License:        BSD and Apache-2.0 and MIT and Apache-1.1
URL:            https://xmlgraphics.apache.org/fop
Source0:        https://archive.apache.org/dist/xmlgraphics/fop/source/%{name}-%{version}-src.tar.gz
Source1:        https://www.apache.org/licenses/LICENSE-1.1.txt
Source2:        batik-pdf-MANIFEST.MF
Source3:        %{name}.script
Source4:        https://maven.ibiblio.org/maven2/org/apache/xmlgraphics/%{name}/%{version}/%{name}-%{version}.pom

Patch0001:      Disable-javadoc-doclint.patch
Patch0002:      Port-to-QDox-2.0.patch
Patch0003:      Allow-javascript-in-javadoc.patch
Patch0004:      Non-free-colour-profile-was-removed.patch
Patch0005:      Update-to-newer-batik.patch
Patch0006:      Remove-the-mif-parameter-in-the-help-message.patch
BuildRequires:  ant apache-commons-io apache-commons-logging avalon-framework
BuildRequires:  batik fontbox javapackages-local junit qdox servlet
BuildRequires:  xmlunit xmlgraphics-commons >= 1.5

BuildArch:      noarch

Requires:       apache-commons-io >= 1.2 apache-commons-logging >= 1.0.4
Requires:       avalon-framework >= 4.1.4 batik >= 1.7 fontbox
Requires:       java jakarta-commons-httpclient xalan-j2 >= 2.7.0
Requires:       xmlgraphics-commons >= 1.5 xml-commons-apis >= 1.3.04

Provides:       fop-javadoc = %{version}-%{release}
Obsoletes:      fop-javadoc < %{version}-%{release}

%description
FOP (Formatting Objects Processor) is a print formatter driven by XSL
formatting objects (XSL-FO) and an output independent formatter. It
is a Java application that reads a formatting object (FO) tree and
renders the resulting pages to a specified output. Output formats
currently supported include PDF, PS, PCL, AFP, XML (area tree
representation), Print, AWT and PNG, and to a lesser extent, RTF and
TXT. The primary output target is PDF.

%prep
%autosetup -p1

cp %{SOURCE1} LICENSE-1.1
rm -f fop/lib/*.jar fop/lib/build/*.jar
ln -s %{_javadir}/qdox.jar fop/lib/build/qdox.jar

%build
export CLASSPATH=$(build-classpath apache-commons-logging apache-commons-io \
    avalon-framework-api avalon-framework-impl batik-all batik/batik-svg-dom \
    fontbox servlet objectweb-asm/asm-all xml-commons-apis \
    xml-commons-apis-ext xmlgraphics-commons xmlunit)
export JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF8
ant -f fop/build.xml jar-main transcoder-pkg javadocs


%install
jar ufm fop/build/%{name}.jar %{SOURCE2}


install -D -p -m 644 fop/build/%{name}.jar %{buildroot}%{_javadir}/%{name}.jar
install -p -m 644 fop/build/%{name}-transcoder.jar %{buildroot}%{_javadir}/pdf-transcoder.jar

install -D -p -m 755 %{SOURCE3} %{buildroot}%{_bindir}/fop

install -d -m 755 %{buildroot}%{_datadir}/%{name}/conf
cp -rp fop/conf/* %{buildroot}%{_datadir}/%{name}/conf

install -d -m 755 %{buildroot}%{_javadocdir}/%{name}
cp -rp fop/build/javadocs/* %{buildroot}%{_javadocdir}/%{name}

install -D -p -m 644 %{SOURCE4} %{buildroot}%{_mavenpomdir}/JPP-%{name}.pom
%add_maven_depmap JPP-%{name}.pom %{name}.jar


%files -f .mfiles
%doc README NOTICE
%doc %{_javadocdir}/%{name}
%license LICENSE LICENSE-1.1
%{_bindir}/fop
%{_datadir}/%{name}
%{_javadir}/pdf-transcoder.jar


%changelog
* Sat Sep 16 2023 liyanan <thistleslyn@163.com> - 2.2-8
- Remove the mif parameter in the help message

* Fri Sep 08 2023 yaoxin <yao_xin001@hoperun.com> - 2.2-7
- Fix build failure caused by batik upgrade to 1.17

* Mon Nov 21 2022 xu_ping <xuping33@h-partners.com> - 2.2-6
- Modify invalid source

* Mon Jan 18 2021 caodongxia <caodongxia@huawei.com> - 2.2-5
- Modify license information.

* Tue Dec 10 2019 huyan <hu.huyan@huawei.com> - 2.2-4
- Package Initialization
