aboutsummaryrefslogtreecommitdiffstats
path: root/community/java-jna/APKBUILD
blob: b91bf8e5988163385f959020661a0a75c259ce31 (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
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=java-jna
_pkgname=${pkgname#java-}
pkgver=4.5.1
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

	cd "$builddir"

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

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

	# Remove some bundled JARs.
	rm -r dist
	find lib/native -name "*.jar" -exec rm {} +
}

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
	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" ]

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

sha512sums="057e185011dc492fef3e9273f8df8dc9971752337bb39b6fa1d53d305bb2ff52e8408b96bddc288cbbd2ae08c126904fa278276dd79d93801bcac361adda8300  java-jna-4.5.1.tar.gz
dacfa03e1a957172502dd10007445e844df67288fde07f7ada80a5cbfe3186511aa7a866c8c757a0a94c894829fead9c67ad0993f2105d2fef1f18d22ee01cdb  0001-jar-without-natives.patch"