aboutsummaryrefslogtreecommitdiffstats
path: root/community/java-jna/APKBUILD
blob: e2063b45902f5b9bab4748f66379427f4556c430 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=java-jna
_pkgname=${pkgname#java-}
pkgver=4.3.0
pkgrel=0
pkgdesc="JNA provides Java programs easy access to native shared libraries."
url="https://github.com/java-native-access/jna"
arch="all"
license="ASL-2.0 LGPL-2.1"
depends="openjdk8-jre-base"
makedepends="apache-ant autoconf automake libffi-dev>=3.2 libtool openjdk8"
subpackages="$pkgname-native"
source="$pkgname-$pkgver.tar.gz::https://github.com/java-native-access/$_pkgname/archive/$pkgver.tar.gz
	0001-jar-without-natives.patch
	"
builddir="$srcdir/$_pkgname-$pkgver"

prepare() {
	default_prepare || return 1

	cd "$builddir"

	# Disable Java AWT support (requires some X libs).
	sed -i -E "s/^(CDEFINES=.*)$/\1 -DNO_JAWT/g" native/Makefile || return 1

	# Remove bundled libffi sources, we're gonna use headers form libffi-dev.
	rm -r native/libffi || return 1

	find -name "*.jar" -exec rm {} + || return 1
}

build() {
	cd "$builddir"

	ant clean

	# Parallel build doesn't work here!
	MAKEFLAGS="-j1" \
		ant native -Drelease=true -Ddynlink.native=true \
		&& ant jar -Domit-jnilib=true
}

package() {
	depends="$depends $pkgname-native"

	install -m644 -D "$builddir"/build/jna.jar \
		"$pkgdir"/usr/share/java/$_pkgname-$pkgver.jar || return 1
	ln -sf $_pkgname-$pkgver.jar "$pkgdir"/usr/share/java/$_pkgname.jar
}

native() {
	local soname="libjnidispatch.so"

	cd "$builddir"

	local sover="$(sed -En 's/^JNA_JNI_VERSION=([^ ]+).*/\1/p' native/Makefile)"
	[ -n "$sover" ] || return 1

	install -m755 -D build/native-linux-*/$soname \
		"$subpkgdir"/usr/lib/$soname.$sover || return 1
	ln -sf $soname.$sover "$subpkgdir"/usr/lib/$soname
}

md5sums="2de8ba99fc91809935e6c2ab02f49a82  java-jna-4.3.0.tar.gz
2eceb51b9eafbe0a7f162fe6b3297c03  0001-jar-without-natives.patch"
sha256sums="f7e3ef21051ef7dcc2176db19aca6b759c2809bd93c363c6fe697cdf86908ae8  java-jna-4.3.0.tar.gz
bad5487a1c8aa4e227b1a27fbac787e9d84a6bf748325708cdf045b625bd1f82  0001-jar-without-natives.patch"
sha512sums="5e27771c114ead302196f7f99bc4928e12acd72687a481501a4c1753952517b7ed411828f9f4a7ae4631a4473a86720b4eba7bae9e22704c53dfc7a46609fa3d  java-jna-4.3.0.tar.gz
67110a14ef0879c590427c919ec0057aab5902ba1fb3a3a1aa9f9c395aefb31f4b2244d0a2a59fde1a2fae418ee45d666f3fd780784c6194abe533f4f5cbebbc  0001-jar-without-natives.patch"