aboutsummaryrefslogtreecommitdiffstats
path: root/community/java-jna/APKBUILD
blob: cd2d10b9526ecd246ebcef7625b5ae2fe10eefcb (plain) (blame)
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
71
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=java-jna
_pkgname=${pkgname#java-}
pkgver=4.2.2
pkgrel=1
pkgdesc="JNA provides Java programs easy access to native shared libraries."
url="https://github.com/java-native-access/jna"
arch="x86 x86_64"
license="ASL-2.0 LGPL-2.1"
depends="openjdk8-jre-base"
makedepends="apache-ant autoconf automake build-base 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() {
	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

	default_prepare  # apply patches
}

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="$pkgname"

	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() {
	arch="all"
	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="51d0359bcdb999ec0a655c68d399f304  java-jna-4.2.2.tar.gz
2eceb51b9eafbe0a7f162fe6b3297c03  0001-jar-without-natives.patch"
sha256sums="46330123be97fa5c11b1747c74470a39f2b1a3396d66fd6ead4d034660eb094a  java-jna-4.2.2.tar.gz
bad5487a1c8aa4e227b1a27fbac787e9d84a6bf748325708cdf045b625bd1f82  0001-jar-without-natives.patch"
sha512sums="11ab524f87f6dc7fe3ac8eb0620f9ba392445147770304be7b7fa5cd49de8efed983ad30c16077bfa6419eaf1ff50311a3ded811a78fdcd09bc686ef93ad7f9f  java-jna-4.2.2.tar.gz
67110a14ef0879c590427c919ec0057aab5902ba1fb3a3a1aa9f9c395aefb31f4b2244d0a2a59fde1a2fae418ee45d666f3fd780784c6194abe533f4f5cbebbc  0001-jar-without-natives.patch"