diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2016-04-07 20:57:56 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-04-08 13:21:38 +0000 |
commit | a4d862480c9a34d9249104679e87f163fe0ef5fd (patch) | |
tree | 7e97ce0796dff1d847b254f49fdc3490555d2c86 /testing/java-lz4 | |
parent | b15afbdabc604489c12a988ab2b49660d67ae27a (diff) | |
download | aports-a4d862480c9a34d9249104679e87f163fe0ef5fd.tar.bz2 aports-a4d862480c9a34d9249104679e87f163fe0ef5fd.tar.xz |
testing/java-lz4: new abuild
https://github.com/jpountz/lz4-java
LZ4 compression for Java
Diffstat (limited to 'testing/java-lz4')
-rw-r--r-- | testing/java-lz4/0001-ivy-location.patch | 21 | ||||
-rw-r--r-- | testing/java-lz4/0002-dont-bundle-natives.patch | 23 | ||||
-rw-r--r-- | testing/java-lz4/0003-prefer-system-lib.patch | 35 | ||||
-rw-r--r-- | testing/java-lz4/APKBUILD | 65 |
4 files changed, 144 insertions, 0 deletions
diff --git a/testing/java-lz4/0001-ivy-location.patch b/testing/java-lz4/0001-ivy-location.patch new file mode 100644 index 0000000000..f51ffa35e9 --- /dev/null +++ b/testing/java-lz4/0001-ivy-location.patch @@ -0,0 +1,21 @@ +From: Jakub Jirutka <jakub@jirutka.cz> +Date: Thu, 7 Apr 2016 21:06:00 +0200 +Subject: [PATCH] Download Ivy to the current directory instead of home + +We don't want to clutter up home directory on the build server, do we? +--- +diff --git a/build.xml b/build.xml +index 841582e..2571f46 100644 +--- a/build.xml ++++ b/build.xml +@@ -56,8 +56,8 @@ + </target> + + <target name="-ivy-install" unless="ivy.available"> +- <mkdir dir="${user.home}/.ant/lib" /> +- <get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.jar.version}/${ivy.jar.name}" dest="${user.home}/.ant/lib/${ivy.jar.name}"/> ++ <mkdir dir=".ant" /> ++ <get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.jar.version}/${ivy.jar.name}" dest=".ant/${ivy.jar.name}"/> + </target> + + <target name="install-cpptasks" unless="cpptasks.available"> diff --git a/testing/java-lz4/0002-dont-bundle-natives.patch b/testing/java-lz4/0002-dont-bundle-natives.patch new file mode 100644 index 0000000000..ae90e29b1b --- /dev/null +++ b/testing/java-lz4/0002-dont-bundle-natives.patch @@ -0,0 +1,23 @@ +From: Jakub Jirutka <jakub@jirutka.cz> +Date: Thu, 7 Apr 2016 21:06:00 +0200 +Subject: [PATCH] Do not bundle native binaries into JAR + +The native library will be installed into /usr/lib as all other +platform-specific libraries. +--- +diff --git a/build.xml b/build.xml +index 841582e..901b880 100644 +--- a/build.xml ++++ b/build.xml +@@ -280,11 +280,9 @@ + <mkdir dir="${dist}" /> + <jar + destfile="${dist}/${ivy.module}.jar"> +- <fileset dir="${src}/resources" erroronmissingdir="false" /> + <fileset dir="${build}/classes" /> + <fileset dir="${build}/unsafe-classes" /> + <fileset dir="${build}/generated-classes" /> +- <fileset dir="${build}/jni" erroronmissingdir="false" /> + </jar> + </target> + diff --git a/testing/java-lz4/0003-prefer-system-lib.patch b/testing/java-lz4/0003-prefer-system-lib.patch new file mode 100644 index 0000000000..fd3720c746 --- /dev/null +++ b/testing/java-lz4/0003-prefer-system-lib.patch @@ -0,0 +1,35 @@ +From 4727fc60f17a67b40c2bdf200a518a5d5708804c Mon Sep 17 00:00:00 2001 +From: Jakub Jirutka <jakub@jirutka.cz> +Date: Thu, 7 Apr 2016 19:06:53 +0200 +Subject: [PATCH] Try to load lz4-java from java.library.path, then fallback to bundled + +Use system-provided lz4-java, if it's available on the java.library.path +(the default location where Java looks for native libraries), and fallback +to bundled binary if it's not. This allows user to use lz4 java even +on systems that are not directly supported, like Linux with musl libc, +uClibc etc. +--- + src/java/net/jpountz/util/Native.java | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/src/java/net/jpountz/util/Native.java b/src/java/net/jpountz/util/Native.java +index 1856841..e25708e 100644 +--- a/src/java/net/jpountz/util/Native.java ++++ b/src/java/net/jpountz/util/Native.java +@@ -71,6 +71,16 @@ public static synchronized void load() { + if (loaded) { + return; + } ++ ++ // Try to load lz4-java (liblz4-java.so on Linux) from the java.library.path. ++ try { ++ System.loadLibrary("lz4-java"); ++ loaded = true; ++ return; ++ } catch (UnsatisfiedLinkError ex) { ++ // Doesn't exist, so proceed to loading bundled library. ++ } ++ + String resourceName = resourceName(); + InputStream is = Native.class.getResourceAsStream(resourceName); + if (is == null) { diff --git a/testing/java-lz4/APKBUILD b/testing/java-lz4/APKBUILD new file mode 100644 index 0000000000..4dd92a4c4d --- /dev/null +++ b/testing/java-lz4/APKBUILD @@ -0,0 +1,65 @@ +# Contributor: Jakub Jirutka <jakub@jirutka.cz> +# Maintainer: Jakub Jirutka <jakub@jirutka.cz> +pkgname=java-lz4 +_pkgname=lz4-java +pkgver=1.3.0 +pkgrel=0 +pkgdesc="LZ4 compression for Java" +url="https://github.com/jpountz/lz4-java" +arch="all" +license="ASL-2.0" +depends="openjdk8-jre-base" +makedepends="apache-ant build-base openjdk8" +subpackages="$pkgname-native" +source="$_pkgname-$pkgver.tar.gz::https://github.com/jpountz/$_pkgname/archive/$pkgver.tar.gz + 0001-ivy-location.patch + 0002-dont-bundle-natives.patch + 0003-prefer-system-lib.patch + " +builddir="$srcdir/$_pkgname-$pkgver" + +prepare() { + cd "$builddir" + + local file; for file in $source; do + case $file in + *.patch) msg $file; patch -p1 -i "$srcdir"/$file || return 1;; + esac + done +} + +build() { + cd "$builddir" + + ant ivy-bootstrap || return 1 + ant jar -lib .ant -Divy.default.ivy.user.dir=/tmp/ivy2 +} + +package() { + arch="noarch" + + install -m644 -D "$builddir"/dist/lz4.jar \ + "$pkgdir"/usr/share/java/lz4-$pkgver.jar || return 1 + ln -sf lz4-$pkgver.jar "$pkgdir"/usr/share/java/lz4.jar +} + +native() { + local soname="liblz4-java.so" + + install -m755 -D "$builddir"/build/jni/*/*/$soname \ + "$subpkgdir"/usr/lib/$soname.$pkgver || return 1 + ln -sf $soname.$pkgver "$subpkgdir"/usr/lib/$soname +} + +md5sums="b9a4eb57fd0667df96135854c9e6f139 lz4-java-1.3.0.tar.gz +c87e95c4d7df4b89d17fef542078a61a 0001-ivy-location.patch +d131c75a10e298751f34c6d545ed94a2 0002-dont-bundle-natives.patch +ee4c9d7574586e74f2577523bfeab564 0003-prefer-system-lib.patch" +sha256sums="7fdfe31304a50a830f4f2e8207cdfe58126270e2f24d7c318540e2b263bead78 lz4-java-1.3.0.tar.gz +bb5a2779353a40a15d8ee24438a199c5c023db1605b491260afb3a628684001b 0001-ivy-location.patch +117acb8ff84b387cd91acec340b870fab3359804cdd76e9f0fc574f013d30141 0002-dont-bundle-natives.patch +548168e3344538e87be537b13d746c3e73fb3ed29f0daa1776eb62f7ba8240c1 0003-prefer-system-lib.patch" +sha512sums="417141a02b1ed599499b352d96e3e7a2b84376dbd84f7042563c90e30b3c6d5ebc132f9e96eeff717bc790e615123acb53887bfaea8566870cba78d05b2d8048 lz4-java-1.3.0.tar.gz +1e5d1f5bdb87ad89efa423af2ec83921ab7a7fc3de36e6398cbfa90e1b2e07d11834decddf97a17b3dbadf7d2575770b629b35435ce8f1d5ac078554026d1789 0001-ivy-location.patch +cc570080f7682525709ec1999fe5cf8e0ccc6f41dd34ab76159321c02ca504041d4d2bc008f04e312550bd1de611ed77d99dd7f2101a0a3600cbea7ab16ce09d 0002-dont-bundle-natives.patch +b94fd00b7a1410c55103a1a15422641970366a36dd3d87cb25cd39f90fc740cbf92affea6af6bae2595663bd1e2943ab129399c3907168528a91941e19e60804 0003-prefer-system-lib.patch" |