summaryrefslogtreecommitdiff
path: root/java/jna/PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'java/jna/PKGBUILD')
-rw-r--r--java/jna/PKGBUILD115
1 files changed, 115 insertions, 0 deletions
diff --git a/java/jna/PKGBUILD b/java/jna/PKGBUILD
new file mode 100644
index 000000000..f7248a637
--- /dev/null
+++ b/java/jna/PKGBUILD
@@ -0,0 +1,115 @@
+# 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=2
+arch=('i686' 'x86_64')
+depends=('java-environment' 'libffi')
+makedepends=('apache-ant' 'zip' 'makepkg-git' 'git')
+checkdepends=('icedtea-web-java7' 'junit' 'libxtst')
+options=('!makeflags')
+
+unset _JAVA_OPTIONS
+_M2_LOCALREPO='/usr/share/maven/repository'
+
+_ant_options=(
+ '-Ddynlink.native=true' # use the system install of libffi
+)
+
+####
+
+prepare() {
+ 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() {
+ 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 -Djava.awt.headless=true"
+
+ # 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')