summaryrefslogtreecommitdiff
path: root/user/openjdk7/APKBUILD
blob: e87060a192c461c5700bda5d82ff869f10a094bc (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# Contributor: Timo Teras <timo.teras@iki.fi>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=openjdk7
_icedteaver=2.6.16
# pkgver is <JDK version>.<JDK update>
# check icedtea JDK when updating
pkgver=7.201.$_icedteaver
pkgrel=0
pkgdesc="OpenJDK 7 via IcedTea"
url="https://icedtea.classpath.org/"
arch="all"
license="GPL-2.0-only WITH Classpath-exception-2.0"
depends="$pkgname-jre java-cacerts"
options="sover-namecheck"
makedepends="bash findutils zip file mawk util-linux libxslt
	autoconf automake linux-headers coreutils cmd:which
	ca-certificates
	nss-dev cups-dev libjpeg-turbo-dev giflib-dev libpng-dev libxt-dev
	lcms2-dev libxp-dev libxtst-dev libxinerama-dev zlib-dev
	libxrender-dev alsa-lib-dev freetype-dev fontconfig-dev
	gtk+2.0-dev krb5-dev attr-dev pcsc-lite-dev lksctp-tools-dev
	libxcomposite-dev nss-static"
install=""

# upstream binary versions
RHINO_VER=1.7.7.2
ANT_VER=1.9.11

case $CARCH in
x86|pmmx)	_jarch=i386;;
x86_64)		_jarch=amd64;;
aarch64)	_jarch=aarch64;;
arm*)		_jarch=arm
		# openjdk has quite a bit of arm assembly producing textrels
		# and it's non trivial to fix. allow it for now.
		options="$options textrels";;
s390x)		_jarch=s390x;;
ppc64le)	_jarch=ppc64le;;
ppc64)		_jarch=ppc64
		export CFLAGS="$CFLAGS -DABI_ELFv2";;
ppc)		_jarch=ppc;;
esac

INSTALL_BASE=/usr/lib/jvm/java-1.7-openjdk
_jrelib="$INSTALL_BASE/jre/lib/$_jarch"

# exclude xawt from ldpath to avoid duplicate provides for libmawt.so
# (also in headless). in future this should be a virtual provides.
ldpath="$_jrelib:$_jrelib/native_threads:$_jrelib/headless:$_jrelib/server:$_jrelib/jli"
sonameprefix="$pkgname:"

subpackages="$pkgname-jre-lib:jrelib:noarch $pkgname-jre $pkgname-jre-base:jrebase
	$pkgname-doc:doc"

if [ "$BOOTSTRAP" != "no" ]; then
	makedepends="$makedepends java-gcj-compat"
	BOOTSTRAP_JAVA_HOME=/usr/lib/jvm/java-1.5-gcj/
else
	makedepends="$makedepends $pkgname fastjar"
	BOOTSTRAP_JAVA_HOME="$INSTALL_BASE"
fi

_dropsver=$_icedteaver
_dropsurl=https://icedtea.classpath.org/download/drops/icedtea7/$_dropsver

source="https://icedtea.classpath.org/download/source/icedtea-$_icedteaver.tar.gz
	openjdk-$_dropsver.tar.bz2::$_dropsurl/openjdk.tar.bz2
	corba-$_dropsver.tar.bz2::$_dropsurl/corba.tar.bz2
	jaxp-$_dropsver.tar.bz2::$_dropsurl/jaxp.tar.bz2
	jaxws-$_dropsver.tar.bz2::$_dropsurl/jaxws.tar.bz2
	jdk-$_dropsver.tar.bz2::$_dropsurl/jdk.tar.bz2
	langtools-$_dropsver.tar.bz2::$_dropsurl/langtools.tar.bz2
	hotspot-$_dropsver.tar.bz2::$_dropsurl/hotspot.tar.bz2
	https://archive.apache.org/dist/ant/binaries/apache-ant-$ANT_VER-bin.tar.gz
	https://github.com/mozilla/rhino/releases/download/Rhino${RHINO_VER//./_}_Release/rhino-$RHINO_VER.zip

	icedtea-hotspot-musl.patch
	icedtea-hotspot-musl-ppc.patch
	icedtea-hotspot-noagent-musl.patch
	icedtea-hotspot-uclibc-fixes.patch
	icedtea-jdk-fix-build.patch
	icedtea-jdk-execinfo.patch
	icedtea-jdk-fix-ipv6-init.patch
	icedtea-jdk-musl.patch
	icedtea-jdk-no-soname.patch
	icedtea-cpio.patch
	icedtea-tar.patch
	icedtea-remove-gawk.patch
	icedtea-xattr.patch
	remove-gawk.patch
	xattr.patch
	"

# secfixes:
#   7.201.2.6.16-r0:
#   - CVE-2018-3136
#   - CVE-2018-3139
#   - CVE-2018-3149
#   - CVE-2018-3169
#   - CVE-2018-3180
#   - CVE-2018-3214
#   - CVE-2018-13785

builddir="$srcdir/icedtea-$_icedteaver"

unpack() {
	if [ -z "$force" ]; then
		verify
		initdcheck
	fi
	mkdir -p "$srcdir"
	msg "Unpacking sources..."
	tar -C "$srcdir" -zxf icedtea-$_icedteaver.tar.gz
	tar -C "$srcdir" -zxf apache-ant-$ANT_VER-bin.tar.gz
	unzip -o -q "rhino-$RHINO_VER.zip" -d "$srcdir"
}

prepare() {
	cd "$builddir"

	# Busybox sha256 does not support longopts
	sed -e "s/--check/-c/g" -i Makefile.am

	for patch in $source; do
		case $patch in
		icedtea-*.patch)
			cp ../$patch patches
			;;
		*.patch)
			msg "Applying patch $patch"
			patch -p1 -i "$srcdir"/$patch
			;;
		esac
	done

	./autogen.sh
}

build() {
	[ -z "$JOBS" ] && export JOBS=$(echo $MAKEFLAGS | sed -n -e 's/.*-j\([0-9]\+\).*/\1/p')
	export ALT_PARALLEL_COMPILE_JOBS="${JOBS:-2}"
	export HOTSPOT_BUILD_JOBS="${JOBS:-2}"

	export JAVA_HOME=$BOOTSTRAP_JAVA_HOME
	export PATH=$JAVA_HOME/bin:$srcdir/apache-ant-$ANT_VER/bin:$PATH
	export DISTRIBUTION_PATCHES=""

	# Explicitly set the C++ standard as the default has changed on GCC 6+
	# and disable optimizations that lead to a broken JVM. These options
	# has been adopted from the Fedora package.
	export EXTRA_CPP_FLAGS="$CXXFLAGS -std=gnu++98 -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-strict-overflow"
	# CXXFLAGS doesn't make it to all calls, so we set the C++ standard
	# version for C too.
	export EXTRA_CFLAGS="$CFLAGS -std=gnu++98 -Wno-error -fno-delete-null-pointer-checks -fno-lifetime-dse -fno-strict-overflow"

	local patch
	for patch in $source; do
		case $patch in
		icedtea-*.patch)
			export DISTRIBUTION_PATCHES="$DISTRIBUTION_PATCHES patches/$patch"
			;;
		esac
	done
	echo "icedtea patches: $DISTRIBUTION_PATCHES"

	# --disable-arm32-jit: https://icedtea.classpath.org/bugzilla/show_bug.cgi?id=2942
	cd "$builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=$INSTALL_BASE \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--with-parallel-jobs=${JOBS:-2} \
		--disable-dependency-tracking \
		--disable-downloading \
		--disable-arm32-jit \
		--with-rhino=$srcdir/rhino$RHINO_VER/lib/rhino-$RHINO_VER.jar \
		--with-openjdk-src-zip=$srcdir/openjdk-$_dropsver.tar.bz2 \
		--with-hotspot-src-zip=$srcdir/hotspot-$_dropsver.tar.bz2 \
		--with-corba-src-zip=$srcdir/corba-$_dropsver.tar.bz2 \
		--with-jaxp-src-zip=$srcdir/jaxp-$_dropsver.tar.bz2 \
		--with-jaxws-src-zip=$srcdir/jaxws-$_dropsver.tar.bz2 \
		--with-jdk-src-zip=$srcdir/jdk-$_dropsver.tar.bz2 \
		--with-langtools-src-zip=$srcdir/langtools-$_dropsver.tar.bz2 \
		--with-jdk-home=$BOOTSTRAP_JAVA_HOME \
		--with-pkgversion="Adelie ${pkgver}-r${pkgrel}"

	msg "Icedtea boot"
	make -j1 icedtea-boot SHELL=/bin/bash
	msg "Icedtea boot done"
	make
}

package() {
	mkdir -p "$pkgdir"/$INSTALL_BASE
	cp -a "$builddir"/openjdk.build/j2sdk-image/* "$pkgdir"/$INSTALL_BASE
	rm "$pkgdir"/$INSTALL_BASE/src.zip

	# symlink to shared java cacerts store
	rm -f "$pkgdir"/$INSTALL_BASE/jre/lib/security/cacerts
	ln -sf /etc/ssl/certs/java/cacerts \
		"$pkgdir"/$INSTALL_BASE/jre/lib/security/cacerts
}

jrelib() {
	pkgdesc="OpenJDK 7 Java Runtime (class libraries)"
	depends=""

	local A; for A in jre/lib/zi jre/lib/images jre/lib/*.jar \
			jre/lib/security jre/lib/ext/*.jar jre/lib/cmm \
			jre/ASSEMBLY_EXCEPTION jre/THIRD_PARTY_README jre/LICENSE; do

		local dirname="${A%/*}"
		mkdir -p "$subpkgdir"/$INSTALL_BASE/$dirname
		mv "$pkgdir"/$INSTALL_BASE/$A "$subpkgdir"/$INSTALL_BASE/$dirname
	done
}

jrebase() {
	pkgdesc="OpenJDK 7 Java Runtime (no GUI support)"
	depends="$pkgname-jre-lib java-common java-cacerts"

	mkdir -p "$subpkgdir"/$INSTALL_BASE/bin

	local A; for A in java orbd rmid servertool unpack200 keytool \
			pack200 rmiregistry tnameserv; do
		mv "$pkgdir"/$INSTALL_BASE/bin/$A "$subpkgdir"/$INSTALL_BASE/bin
	done

	# rest of the jre subdir (which were not taken by -jre subpkg)
	mv "$pkgdir"/$INSTALL_BASE/jre "$subpkgdir"/$INSTALL_BASE
}

jre() {
	pkgdesc="OpenJDK 7 Java Runtime"
	# manually depend to avoid clash with libgcj's libjvm.so
	depends="so:openjdk7:libjvm.so=0"

	mkdir -p "$subpkgdir"
	local A; for A in jre/bin/policytool \
			bin/appletviewer \
			bin/policytool \
			jre/lib/$_jarch/xawt \
			jre/lib/$_jarch/libsplashscreen.so; do

		local dirname="${A%/*}"
		mkdir -p "$subpkgdir"/$INSTALL_BASE/$dirname
		mv "$pkgdir"/$INSTALL_BASE/$A "$subpkgdir"/$INSTALL_BASE/$dirname
	done
}

doc() {
	default_doc
	mkdir -p "$subpkgdir"/$INSTALL_BASE/
	mv "$pkgdir"/$INSTALL_BASE/man "$subpkgdir"/$INSTALL_BASE/
}

sha512sums="cc782e1c5b1ce158be315cff5be61676373870c2062eb34688583a875ab68413bbabd909ce83e79a9c46c3d0c8ec10aad3c015276ddf782ce2079cb5a7098f82  icedtea-2.6.16.tar.gz
ee2443da63ab6b1a525d0633a577f28d28d3916cb47b312d61d71b4795ae3bde4a70478017b7639133fb65cfb63aa0fcbc397afbde18f20d605a50286163e4a2  openjdk-2.6.16.tar.bz2
3926a1c889d0ff5386dd78e8fb1ff71b553744fe574ab9655d9e1677da9aea3306d65e631866afcbb533b8e0fefbb34ae655400c9bc7c2058aaa34f8fb0a04d8  corba-2.6.16.tar.bz2
2b37ba6f235b684682d9590c292b6af5fb6f41d4001f92dcf4945570e13fe760f91bbc7068d071e3e935829c9719936ae96940874ee211fd32cba187e05f0255  jaxp-2.6.16.tar.bz2
41dc2b7a610cd5f4c9155c14670bb97f1c57924af2737faf6beb7b284c0ad7c0f0b33f4276cde5674a57db3f88ba4503f94f2dff7a52db3273ee53ed0b14be64  jaxws-2.6.16.tar.bz2
2703b7bf7455aa3997426f2ce3d4c2285ee44640a940d15c1c3434414c295d87b44e749fece5a7b966661910c8768a79774fb03b43ab5605df9dc8965b600fd7  jdk-2.6.16.tar.bz2
192dd5fac399c52bcb547617832428b40af493089b4bb63159cd9363c78af76c7acdc051d461eb4e4692b2090e05ed769b9fec460a328973b36b57bbb28cee39  langtools-2.6.16.tar.bz2
73b0338ec293d0d87cc7251f63ef453ec10c7de978c56d8ff455b16ee0506175aed681a9a95fbdcc8b747ba00ef6cf914f63d0c5d22268b40620d4dbc7390a98  hotspot-2.6.16.tar.bz2
0da12cb0f761b8cb76e042449e7d93f43236e7bc948e337215470a70031f0a2dda6d1b508f9397b283808d84c4ebddb31558fe1cd8e6e6469c1dd390d69ec6e7  apache-ant-1.9.11-bin.tar.gz
1b9e8721749e81c5420a00af1e00ee0e4f48624ccb4e9aa969032114116ad50f59b254d4d16d74feff74de64157cc8b0a2ead9b555907c84b7055b796fba9a75  rhino-1.7.7.2.zip
f62b942f0bacda8e37d0f1876d8ba14ddb4fc55a7d5fd1019463744927f40f422a85e9ee051948d566242f5a785aa28f275eb58768611283cba89af91235f43c  icedtea-hotspot-musl.patch
e5cf4d70f96fc1e72ae8b97a887adb96092ff36584711cbb8de9d9fa9e859cb8731d638838de0d9591239fc44ffe5c74422d1842bd9f10a0c00dff1627bdeeef  icedtea-hotspot-musl-ppc.patch
e7a2c1771bb582d427041f8d22e48c0daf8f20d7c0926cbce3549d49c4e949359ee25a35682b486e82f3e390535c950c5beee3bd8d06fb5a717b50f2d9b2a6bc  icedtea-hotspot-noagent-musl.patch
822eee0dc4d3ba677a289dfeb3668b536d2d626708390a9d9702fb4144a481fd443a215a0d2041c6026113837aafa4ba0b5e9ead8589d2da6717a238bbc95a5a  icedtea-hotspot-uclibc-fixes.patch
213a537de5f011cb39d608515c3413513ac75fb93593f9a9ef4205f71d72bdd8b097c80db185f7b26021d5bb85045b866f34f3478482dc4189972d8614a13458  icedtea-jdk-fix-build.patch
0391970e6a32946aa3cccf38fdef9c0fe2af26cd0df824b98aa2fcfa1bf661d4a68e339bffcfd16f386c565fc68bb28a29208a67d4bad8a0e847ad02bd8becbb  icedtea-jdk-execinfo.patch
48533f87fc2cf29d26b259be0df51087d2fe5b252e72d00c6ea2f4add7b0fb113141718c116279c5905e03f64a1118082e719393786811367cf4d472b5d36774  icedtea-jdk-fix-ipv6-init.patch
44a35941c80f408d0607e32763b3b6ccee21e1d39886309327d3d74d2900117e4346ef59e77c663fd022fec10ee8f365eeb46c1260014d5765d226ce175ce3c5  icedtea-jdk-musl.patch
bf4b184e170f7b0ff64ab30d2162784fe2bd5460d1fa31973259f7065fd4c511c46f97724fe2bd72bb94e9006cb568d0e0c87d1a9c90819e65880f8f44830bb1  icedtea-jdk-no-soname.patch
a54c79c82afa1bc95265397b274260584c8b8c6be1651ddfb907d9523a809ea4581409e0d3fb0bbb63ef5a204e8ce29b7940e78cd640af1f490ae938c59129b6  icedtea-cpio.patch
dc5f59068395e9501b17308c91ec80670c195117e22cb7bef78d551d118f180a11d7f0b5d47f4c7106909d9a9a8c060ddd60b78f251fd35afa6c72a1515af53e  icedtea-tar.patch
049061b97d6e744b7ad9bad4a3dbfa1d236400003175e49740830dcb78a1f164b5c67b066e76c970eb27e09707f948cac0f5b7073abe0f49bcecfdd747f0107d  icedtea-remove-gawk.patch
b9950ddf9c5ebb53d1e029a1fe8ef843860128ceb05872313b33fd2696a4acadbc8291110ca6513ce7531e0f943e42b167068e603f7ecd0e36f5b16d6bb827ab  icedtea-xattr.patch
fda1ba46276475cced16c4f380dbc0a0ac07ae2d66a8da10e88455a299bd40ff04a63dae1c5f3d3de6adbb3c6c240db5d37df0be2fc3391764cb21c9ad83eb8b  remove-gawk.patch
3dd758e04e3b852398d81356c02a89afce0c664938d3f0179ee32e358d7057f5f969379329dd1ebcbf4bc3d37bd5e0d94102cd3f023326db5175968cfbbc9c35  xattr.patch"