From 981f42bb86a0f21db95538575ca9a51008d7b1782517067fcd7030efe40dd3ea Mon Sep 17 00:00:00 2001 From: Fridrich Strba Date: Fri, 15 Sep 2017 07:21:38 +0000 Subject: [PATCH] Fix build with jdk9 OBS-URL: https://build.opensuse.org/package/show/Java:packages/apache-pdfbox?expand=0&rev=11 --- apache-pdfbox.changes | 12 +++++++ apache-pdfbox.spec | 37 +++++++++----------- pdfbox-1.8.12-bouncycastle.patch | 48 ++++++++++++++++++++++++++ pdfbox-1.8.12-sourcetarget.patch | 59 ++++++++++++++++++++++++++++++++ 4 files changed, 136 insertions(+), 20 deletions(-) create mode 100644 pdfbox-1.8.12-bouncycastle.patch create mode 100644 pdfbox-1.8.12-sourcetarget.patch diff --git a/apache-pdfbox.changes b/apache-pdfbox.changes index bb17494..fded6d0 100644 --- a/apache-pdfbox.changes +++ b/apache-pdfbox.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Fri Sep 15 07:16:49 UTC 2017 - fstrba@suse.com + +- Added patches: + * pdfbox-1.8.12-bouncycastle.patch + + Fix build of javadoc against bouncycastle API >= 1.4.7 + * pdfbox-1.8.12-sourcetarget.patch + + Make java source and target level ant properties + + Leave the default 1.5 +- Specify java source and target level 1.6 in order to allow + building with jdk9 + ------------------------------------------------------------------- Fri May 19 10:09:40 UTC 2017 - pcervinka@suse.com diff --git a/apache-pdfbox.spec b/apache-pdfbox.spec index 4c92f22..7d4295b 100644 --- a/apache-pdfbox.spec +++ b/apache-pdfbox.spec @@ -1,7 +1,7 @@ # # spec file for package apache-pdfbox # -# Copyright (c) 2017 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,6 @@ # Only fontbox and jempbox are built as pdfbox itself depends on Adobe's pcif. - Name: apache-pdfbox Version: 1.8.12 Release: 0 @@ -29,20 +28,23 @@ Source0: http://www-us.apache.org/dist/pdfbox/%{version}/pdfbox-%{version Source1: http://central.maven.org/maven2/org/apache/pdfbox/pdfbox/%{version}/pdfbox-%{version}.pom Source2: http://central.maven.org/maven2/org/apache/pdfbox/fontbox/%{version}/fontbox-%{version}.pom Source3: http://central.maven.org/maven2/org/apache/pdfbox/jempbox/%{version}/jempbox-%{version}.pom +Patch0: pdfbox-1.8.12-bouncycastle.patch +Patch1: disable-downloads.patch +Patch2: fix-javadoc-dep.patch +Patch3: pdfbox-1.8.12-sourcetarget.patch BuildRequires: ant BuildRequires: apache-commons-logging +BuildRequires: bouncycastle +BuildRequires: fdupes BuildRequires: icu4j -BuildRequires: java-devel >= 1.5 +BuildRequires: java-devel >= 1.6 BuildRequires: javapackages-local BuildRequires: javapackages-tools BuildRequires: junit BuildRequires: unzip Requires: apache-commons-logging Requires: icu4j -BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch -Patch1: disable-downloads.patch -Patch2: fix-javadoc-dep.patch %description The Apache PDFBox library is an open source Java tool for working with PDF documents. @@ -60,22 +62,18 @@ JavaDoc documentation for %{name} %prep %setup -q -n pdfbox-%{version} +%patch0 -p1 %patch1 -p1 %patch2 -p1 +%patch3 -p1 %build -# Link dependencies -mkdir -p pdfbox/external -DEPS="junit4 icu4j commons-logging" -build-jar-repository -s -p pdfbox/external $DEPS -# build.xml uses hardcoded version numbers, so it doesn't find the jars... -for dep in $DEPS; do - CLASSPATH="$PWD/pdfbox/external/${dep}.jar:$CLASSPATH" -done -export CLASSPATH - # Build -ant -buildfile pdfbox/build.xml -Dbuild.sysclasspath=first fontbox.package jempbox.package javadoc +ant -buildfile pdfbox/build.xml \ + -Dbcprov.jar=$(build-classpath bcprov) -Djunit.jar=$(build-classpath junit4) \ + -Dicu4j.jar=$(build-classpath icu4j) -Dlogging.jar=$(build-classpath commons-logging) \ + -Dbuild.sysclasspath=first -Dcompile.source=1.6 -Dcompile.target=1.6 \ + fontbox.package jempbox.package javadoc %install # Code @@ -94,21 +92,20 @@ install -m 0644 %{SOURCE3} %{buildroot}/%{_mavenpomdir}/JPP-jempbox.pom # JavaDoc install -dm 755 %{buildroot}%{_javadocdir}/%{name}-%{version} cp -pr pdfbox/target/javadoc/* %{buildroot}%{_javadocdir}/%{name}-%{version} +%fdupes %{buildroot}%{_javadocdir}/%{name}-%{version} ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name} %files javadoc -%defattr(0644,root,root,0755) %{_javadocdir}/%{name}-%{version} %{_javadocdir}/%{name} %files -%defattr(-,root,root,-) %doc RELEASE-NOTES.txt LICENSE.txt NOTICE.txt README.txt %{_javadir}/fontbox.jar %{_javadir}/jempbox.jar %{_mavenpomdir}/JPP-fontbox.pom %{_mavenpomdir}/JPP-jempbox.pom -%if %suse_version >= 1330 +%if 0%{?suse_version} >= 1330 %{_datadir}/maven-metadata/%{name}.xml* %else %{_mavendepmapfragdir}/%{name} diff --git a/pdfbox-1.8.12-bouncycastle.patch b/pdfbox-1.8.12-bouncycastle.patch new file mode 100644 index 0000000..76b3d41 --- /dev/null +++ b/pdfbox-1.8.12-bouncycastle.patch @@ -0,0 +1,48 @@ +--- pdfbox-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java 2017-09-15 07:55:42.552501155 +0200 ++++ pdfbox-1.8.12/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/encryption/PublicKeySecurityHandler.java 2017-09-15 08:21:29.621212330 +0200 +@@ -38,7 +38,7 @@ + import org.apache.commons.logging.LogFactory; + + import org.bouncycastle.asn1.ASN1InputStream; +-import org.bouncycastle.asn1.DERObject; ++import org.bouncycastle.asn1.ASN1Primitive; + import org.bouncycastle.asn1.DERObjectIdentifier; + import org.bouncycastle.asn1.DEROctetString; + import org.bouncycastle.asn1.DEROutputStream; +@@ -53,9 +53,6 @@ + import org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers; + import org.bouncycastle.asn1.x509.AlgorithmIdentifier; + import org.bouncycastle.asn1.x509.TBSCertificateStructure; +-import org.bouncycastle.cms.CMSEnvelopedData; +-import org.bouncycastle.cms.CMSException; +-import org.bouncycastle.cms.RecipientInformation; + import org.apache.pdfbox.cos.COSArray; + import org.apache.pdfbox.cos.COSString; + import org.apache.pdfbox.exceptions.CryptographyException; +@@ -311,7 +308,7 @@ + pkcs7input[22] = two; + pkcs7input[23] = one; + +- DERObject obj = createDERForRecipient(pkcs7input, certificate); ++ ASN1Primitive obj = createDERForRecipient(pkcs7input, certificate); + + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + +@@ -378,7 +375,7 @@ + + } + +- private DERObject createDERForRecipient(byte[] in, X509Certificate cert) ++ private ASN1Primitive createDERForRecipient(byte[] in, X509Certificate cert) + throws IOException, + GeneralSecurityException + { +@@ -389,7 +386,7 @@ + AlgorithmParameters algorithmparameters = algorithmparametergenerator.generateParameters(); + ByteArrayInputStream bytearrayinputstream = new ByteArrayInputStream(algorithmparameters.getEncoded("ASN.1")); + ASN1InputStream asn1inputstream = new ASN1InputStream(bytearrayinputstream); +- DERObject derobject = asn1inputstream.readObject(); ++ ASN1Primitive derobject = asn1inputstream.readObject(); + KeyGenerator keygenerator = KeyGenerator.getInstance(s); + keygenerator.init(128); + SecretKey secretkey = keygenerator.generateKey(); diff --git a/pdfbox-1.8.12-sourcetarget.patch b/pdfbox-1.8.12-sourcetarget.patch new file mode 100644 index 0000000..5ac8af1 --- /dev/null +++ b/pdfbox-1.8.12-sourcetarget.patch @@ -0,0 +1,59 @@ +--- pdfbox-1.8.12/pdfbox/build.xml 2017-09-15 07:55:42.584501156 +0200 ++++ pdfbox-1.8.12/pdfbox/build.xml 2017-09-15 08:46:31.257902337 +0200 +@@ -23,6 +23,9 @@ + + + ++ ++ ++ + + + +@@ -175,10 +178,10 @@ + description="Compile Java source files"> + + + + + +@@ -186,10 +189,10 @@ + description="Compile Java source files"> + + + + + +@@ -197,10 +200,10 @@ + description="Compile Java source files"> + + + + + +@@ -809,6 +812,7 @@ + doctitle="${project.name}" + verbose="no" + classpathref="pdfbox.build.classpath" ++ source="${compile.source}" + encoding="ISO-8859-1" + breakiterator="yes"> +