aboutsummaryrefslogtreecommitdiffstats
path: root/community/java-gcj-compat/APKBUILD
blob: caa62e5e0ef2a823dfa2a68d0b2e7cdcb2731cd8 (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
72
73
74
75
76
77
78
79
80
81
82
# Contributor: Timo Teras <timo.teras@iki.fi>
# Maintainer: Timo Teras <timo.teras@iki.fi>

_gccver=6.4.0
_gccpkgrel=8

pkgname=java-gcj-compat
pkgver=$_gccver
_mypkgrel=5
pkgrel=$(( $_mypkgrel + $_gccpkgrel ))
pkgdesc="JDK like environment using GCJ"
url="https://git.alpinelinux.org/aports.git"
arch="all"
license="GPL"
depends="fastjar gcc6-java=$_gccver-r$_gccpkgrel java-common"
makedepends="gcc6-java=$_gccver-r$_gccpkgrel zlib-dev paxmark"
source=

builddir="$srcdir/$pkgname-$pkgver"

prepare() {
	(
	gccver=`(. ../../community/gcc6/APKBUILD ; echo "$pkgver")`
	gccpkgrel=`(. ../../community/gcc6/APKBUILD ; echo "$pkgrel")`
	if [ "$gccver" != "$_gccver" ] || [ "$gccpkgrel" != "$_gccpkgrel" ]; then
		die "gcc6 version ($gccver) needs to match _gccver ($_gccver)"
	fi
	)
}


build() {
	mkdir -p $builddir
	cd $builddir
	gcj-6 -Wl,-Bsymbolic -findirect-dispatch -o ecj \
		--main=org.eclipse.jdt.internal.compiler.batch.Main \
		/usr/share/java/ecj.jar -lgcj
	paxmark -msp ecj
}

check() {
	$builddir/ecj > /dev/null
}

package() {
	JVM_DIR=$pkgdir/usr/lib/jvm
	JDK_DIR=$JVM_DIR/java-1.5-gcj
	JDK_BIN_DIR=$JDK_DIR/bin
	JDK_LIB_DIR=$JDK_DIR/lib
	JRE_DIR=$JDK_DIR/jre
	JRE_BIN_DIR=$JRE_DIR/bin
	JRE_LIB_DIR=$JRE_DIR/lib

	CPU=$(uname -m | sed -e 's/i.86/i386/g' -e 's/x86_64/amd64/g')

	mkdir -p $JDK_BIN_DIR $JDK_LIB_DIR
	ln -sf ../../../../bin/gij-6 $JDK_BIN_DIR/java
	ln -sf ../../../../bin/fastjar $JDK_BIN_DIR/fastjar
	ln -sf ../../../../bin/sinjdoc $JDK_BIN_DIR/javadoc
	ln -sf ../../../../bin/grmic-6 $JDK_BIN_DIR/rmic
	ln -sf ../../../../bin/gjavah-6 $JDK_BIN_DIR/javah
	install -s $builddir/ecj $JDK_BIN_DIR/javac
	ln -sf ../../../../bin/gappletviewer-6 $JDK_BIN_DIR/appletviewer
	ln -sf ../../../../bin/gjarsigner-6 $JDK_BIN_DIR/jarsigner
	ln -sf ../../../../bin/grmiregistry-6 $JDK_BIN_DIR/rmiregistry
	ln -sf ../../../../bin/gkeytool-6 $JDK_BIN_DIR/keytool
	ln -sf ../../../../bin/gjar-6 $JDK_BIN_DIR/gjar
	ln -sf ../../../../bin/gnative2ascii-6 $JDK_BIN_DIR/gnative2ascii
	ln -sf ../../../../share/java/libgcj-tools-$_gccver.jar $JDK_LIB_DIR/tools.jar

	gcjrel=`ls -d /usr/lib/gcj-$_gccver-* | cut -d '-' -f 3`

	mkdir -p $JRE_BIN_DIR $JRE_LIB_DIR/$CPU
	ln -sf ../../../../../bin/gij-6 $JRE_BIN_DIR/java
	ln -sf ../../../../../bin/grmiregistry-6 $JRE_BIN_DIR/rmiregistry
	ln -sf ../../../../../bin/gkeytool-6 $JRE_BIN_DIR/keytool
	ln -sf ../../../../../share/java/libgcj-$_gccver.jar $JRE_LIB_DIR/rt.jar
	ln -sf ../../../../../../lib/gcj-$_gccver-$gcjrel/libjvm.so $JRE_LIB_DIR/$CPU
	ln -sf ../../../../../../lib/gcj-$_gccver-$gcjrel/libjavamath.so $JRE_LIB_DIR/$CPU
	ln -sf ../../../../../../lib/gcj-$_gccver-$gcjrel/classmap.db $JRE_LIB_DIR/$CPU
}