summaryrefslogtreecommitdiff
path: root/java/jna
diff options
context:
space:
mode:
Diffstat (limited to 'java/jna')
-rw-r--r--java/jna/PKGBUILD117
-rw-r--r--java/jna/bugfix-type-inference.patch13
-rw-r--r--java/jna/libre-without-clover.patch71
-rw-r--r--java/jna/webstart-test.keystorebin0 -> 679 bytes
4 files changed, 201 insertions, 0 deletions
diff --git a/java/jna/PKGBUILD b/java/jna/PKGBUILD
new file mode 100644
index 000000000..db5f552cb
--- /dev/null
+++ b/java/jna/PKGBUILD
@@ -0,0 +1,117 @@
+# Maintainer: Luke Shumaker <lukeshu@sbcglobal.net>
+
+pkgname=jna
+pkgver=3.4.2
+
+pkgdesc="Provides Java programs easy access to native shared libraries"
+url="https://github.com/twall/jna"
+license=('LGPL')
+source=("git://github.com/twall/jna.git#tag=${pkgver}"
+ 'libre-without-clover.patch'
+ 'bugfix-type-inference.patch'
+ 'webstart-test.keystore')
+
+####
+
+pkgrel=1
+arch=('i686' 'x86_64')
+depends=('java-environment' 'libffi')
+makedepends=('apache-ant' 'zip')
+checkdepends=('junit' 'icedtea-web-java7')
+options=('!makeflags')
+
+unset _JAVA_OPTIONS
+_M2_LOCALREPO='/usr/share/maven/repository'
+. /etc/profile.d/jdk.sh
+
+_ant_options=(
+ '-Ddynlink.native=true' # use the system install of libffi
+)
+
+####
+
+mksource() {
+ cd "$srcdir/jna"
+ find . -name '*.jar' -delete
+ rm -rf dist
+ rm -rf native/libffi # make sure it doesn't cheat
+ rm lib/clover.license
+ rm w32ce-test.lnk
+
+ ln -s /usr/share/java/junit.jar lib/
+
+ # Create an emtpy zip (jar) file
+ cd "$srcdir"
+ touch file
+ zip empty.zip file
+ zip -d empty.zip file
+ rm file
+}
+
+####
+
+build() {
+ mksource
+ cd "$srcdir/jna"
+
+ # Because JNA's release process is ridiculous, it wants a jar file for every
+ # architecture to be present. So let's just dump in an empty jar file!
+ sed -n 's|\s*<zipfileset src="${lib\.native}/\(.*\)"|\1|p' build.xml \
+ | while read jarfile; do
+ cp "$srcdir/empty.zip" lib/native/$jarfile
+ done
+
+ patch -p1 -i "$srcdir/libre-without-clover.patch"
+ patch -p1 -i "$srcdir/bugfix-type-inference.patch"
+
+ # Disable tests that intermittently fail
+ # crashes vm (segfault)
+ sed -i -e 's|testRegisterMethods|no&|' test/com/sun/jna/DirectTest.java
+ # crashes vm, java 7 only (icedtea-7, oracle-jdk-bin-1.7)
+ sed -i -e 's|testGCCallbackOnFinalize|no&|' test/com/sun/jna/CallbacksTest.java
+
+ # Actually build
+ ant "${_ant_options[@]}" dist
+}
+
+check() {
+ cd "$srcdir/jna"
+
+ # Create a foke home directory to trash
+ mkdir "$srcdir/user.home"
+ export _JAVA_OPTIONS="-Duser.home=$srcdir/user.home"
+
+ # The webstart test looks for this config file
+ mkdir -p "$srcdir/user.home/.java/deployment"
+ touch "$srcdir/user.home/.java/deployment/deployment.properties"
+
+ # Trust the cert used for the webstart test
+ mkdir -p "$srcdir/user.home/.icedtea/security"
+ cp "$srcdir/webstart-test.keystore" "$srcdir/user.home/.icedtea/security/trusted.certs"
+
+ _ant_options+=('-Dtests.exclude-patterns=**/DirectTest.java')
+
+ # Run the tests
+ ant "${_ant_options[@]}" test
+}
+
+package() {
+ cd "$srcdir/jna"
+
+ install -d "$pkgdir/usr/share/java/jna"
+
+ for pkg in jna platform; do
+ dir="$_M2_LOCALREPO"/net/java/dev/jna/$pkg/$pkgver
+ install -d "$pkgdir$dir"
+ cp dist/$pkg.jar "$pkgdir$dir/$pkg-$pkgver.jar"
+ cp pom-$pkg.xml "$pkgdir$dir/$pkg-$pkgver.pom"
+ ln -s "$dir/$pkg-$pkgver.jar" "$pkgdir/usr/share/java/jna/$pkg.jar"
+ done
+
+ ln -s jna/jna.jar "$pkgdir/usr/share/java/jna.jar"
+}
+
+md5sums=('SKIP'
+ '3a2f96b868f49ca125b677779e846484'
+ '932d9cb2da1531a2315ae132480683fa'
+ 'b704c7d2cb1fe7a93f8cad8d321d16f8')
diff --git a/java/jna/bugfix-type-inference.patch b/java/jna/bugfix-type-inference.patch
new file mode 100644
index 000000000..2322b13fc
--- /dev/null
+++ b/java/jna/bugfix-type-inference.patch
@@ -0,0 +1,13 @@
+diff -ru jna-3.4.2.orig/test/com/sun/jna/NativeTest.java jna-3.4.2/test/com/sun/jna/NativeTest.java
+--- jna-3.4.2.orig/test/com/sun/jna/NativeTest.java 2012-09-03 08:30:42.000000000 -0400
++++ jna-3.4.2/test/com/sun/jna/NativeTest.java 2012-09-24 15:29:48.000000000 -0400
+@@ -374,7 +374,8 @@
+ for (int i=0;i < args.length;i++) {
+ System.out.println("Running tests on class " + args[i]);
+ try {
+- junit.textui.TestRunner.run(Class.forName(args[i]));
++ Class<?> klass = Class.forName(args[i]);
++ junit.textui.TestRunner.run((Class<? extends TestCase>)klass);
+ }
+ catch(Throwable e) {
+ e.printStackTrace();
diff --git a/java/jna/libre-without-clover.patch b/java/jna/libre-without-clover.patch
new file mode 100644
index 000000000..b4947e8b2
--- /dev/null
+++ b/java/jna/libre-without-clover.patch
@@ -0,0 +1,71 @@
+diff -ru jna-3.4.2.orig/build.xml jna-3.4.2/build.xml
+--- jna-3.4.2.orig/build.xml 2012-09-06 06:55:52.000000000 -0400
++++ jna-3.4.2/build.xml 2012-09-24 15:49:59.000000000 -0400
+@@ -230,7 +230,6 @@
+ <path id="test.runpath">
+ <pathelement path="${build}/${jar}"/>
+ <pathelement path="${test.classes}"/>
+- <pathelement path="lib/clover.jar"/>
+ <path refid="test.libs"/>
+ </path>
+ </target>
+@@ -536,12 +535,11 @@
+ <copy todir="${build}/jws" file="${build}/${jar}"/>
+ <copy todir="${build}/jws" file="${build}/${testjar}"/>
+ <copy todir="${build}/jws" file="lib/junit.jar"/>
+- <copy todir="${build}/jws" file="lib/clover.jar"/>
+ <jar jarfile="${build}/jws/jnidispatch.jar">
+ <fileset dir="${build.native}" includes="*jnidispatch.*"/>
+ </jar>
+ <signjar alias="jna" keystore="jna.keystore" storepass="jnadev" lazy="true">
+- <fileset dir="${build}/jws" includes="jna.jar,jna-test.jar,junit.jar,jnidispatch.jar,clover.jar"/>
++ <fileset dir="${build}/jws" includes="jna.jar,jna-test.jar,junit.jar,jnidispatch.jar"/>
+ </signjar>
+ </target>
+
+@@ -626,7 +624,7 @@
+ <report todir="${reports.junit}"/>
+ </junitreport>
+ <echo>View test report in file://${reports.junit}/index.html</echo>
+- <fail if="testfailure" unless="clover">One or more tests failed</fail>
++ <fail if="testfailure">One or more tests failed</fail>
+ </target>
+
+ <target name="contrib-test" depends="contrib-jars,compile-tests">
+@@ -640,27 +638,6 @@
+ </subant>
+ </target>
+
+- <target name="with.clover" description="Enable code coverage for tests">
+- <taskdef resource="cloverlib.xml" classpath="lib/clover.jar"/>
+- <property name="clover" value="true"/>
+- <property name="build" value="build.clover"/>
+- <clover-setup/>
+- </target>
+-
+- <target name="clover" depends="with.clover,test"
+- description="Generate test code coverage reports">
+- <property name="reports.clover" value="${reports}/clover"/>
+- <mkdir dir="${reports.clover}"/>
+- <clover-report>
+- <current outfile="${reports.clover}" title="clover">
+- <fileset dir="." includes="**/*.java" />
+- <testresults dir="${results.junit}" includes="TEST-*.xml"/>
+- <format type="html"/>
+- </current>
+- </clover-report>
+- <echo>Reports generated in ${reports.clover}</echo>
+- </target>
+-
+ <target name="javadoc" depends="-setup">
+ <path id="javadoc.src.path">
+ <path refid="src.path"/>
+@@ -881,7 +858,7 @@
+ <!-- Full sources required to build and test everything -->
+ <zip zipfile="${dist}/src-full.zip">
+ <zipfileset src="${dist}/src.zip"/>
+- <zipfileset dir="lib" includes="junit.jar,clover.jar" prefix="lib"/>
++ <zipfileset dir="lib" includes="junit.jar" prefix="lib"/>
+ <zipfileset dir="." includes=".classpath,.project"/>
+ <zipfileset dir="${native}" includes="libffi,libffi/**/*" prefix="native"/>
+ </zip>
diff --git a/java/jna/webstart-test.keystore b/java/jna/webstart-test.keystore
new file mode 100644
index 000000000..1bbe8c829
--- /dev/null
+++ b/java/jna/webstart-test.keystore
Binary files differ