APKBUILD 11.2 KB
Newer Older
Timo Teräs's avatar
Timo Teräs committed
1
# Contributor: Timo Teras <timo.teras@iki.fi>
2
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
Timo Teräs's avatar
Timo Teräs committed
3 4
# Maintainer: Timo Teras <timo.teras@iki.fi>
pkgname=openjdk8
5
_icedteaver=3.12.0
6
# pkgver is <JDK version>.<JDK update>.<JDK build>
7
# Check https://icedtea.classpath.org/wiki/Main_Page when updating!
8 9
pkgver=8.212.04
pkgrel=0
10
pkgdesc="OpenJDK 8 provided by IcedTea"
11
url="https://icedtea.classpath.org/"
12
arch="all"
Timo Teräs's avatar
Timo Teräs committed
13
license="custom"
14
depends="$pkgname-jre java-cacerts nss"
Timo Teräs's avatar
Timo Teräs committed
15 16
options="sover-namecheck"
makedepends="bash findutils tar zip file paxmark gawk util-linux libxslt
17
	autoconf automake linux-headers sed xz coreutils
18
	openjdk7 ca-certificates
Natanael Copa's avatar
Natanael Copa committed
19
	nss-dev nss-static cups-dev jpeg-dev giflib-dev libpng-dev libxt-dev
20 21
	lcms2-dev libxp-dev libxtst-dev libxinerama-dev zlib-dev
	libxrender-dev alsa-lib-dev freetype-dev fontconfig-dev
22 23
	gtk+2.0-dev krb5-dev attr-dev pcsc-lite-dev lksctp-tools-dev
	libxcomposite-dev"
Timo Teräs's avatar
Timo Teräs committed
24 25 26 27

case $CARCH in
x86)	_jarch=i386;;
x86_64)	_jarch=amd64;;
28
arm*)	_jarch=aarch32;;
29
*)	_jarch="$CARCH";;
Timo Teräs's avatar
Timo Teräs committed
30 31
esac

32 33 34
_bootstrap_java_home="/usr/lib/jvm/java-1.7-openjdk"
_java_home="/usr/lib/jvm/java-1.8-openjdk"
_jrelib="$_java_home/jre/lib/$_jarch"
Timo Teräs's avatar
Timo Teräs committed
35

36
# Exclude xawt from ldpath to avoid duplicate provides for libmawt.so
Timo Teräs's avatar
Timo Teräs committed
37 38
# (also in headless). in future this should be a virtual provides.
ldpath="$_jrelib:$_jrelib/native_threads:$_jrelib/headless:$_jrelib/server:$_jrelib/jli"
39
sonameprefix="$pkgname:"
Timo Teräs's avatar
Timo Teräs committed
40

41
subpackages="$pkgname-dbg $pkgname-jre-lib:jrelib:noarch $pkgname-jre $pkgname-jre-base:jrebase
42
	$pkgname-doc $pkgname-demos"
Timo Teräs's avatar
Timo Teräs committed
43

44
_dropsver=$_icedteaver
45
_dropsurl="https://icedtea.classpath.org/download/drops/icedtea8/$_dropsver"
Timo Teräs's avatar
Timo Teräs committed
46

47
source="https://icedtea.classpath.org/download/source/icedtea-$_icedteaver.tar.xz
48 49 50 51 52 53 54 55
	openjdk-$_dropsver.tar.xz::$_dropsurl/openjdk.tar.xz
	corba-$_dropsver.tar.xz::$_dropsurl/corba.tar.xz
	jaxp-$_dropsver.tar.xz::$_dropsurl/jaxp.tar.xz
	jaxws-$_dropsver.tar.xz::$_dropsurl/jaxws.tar.xz
	jdk-$_dropsver.tar.xz::$_dropsurl/jdk.tar.xz
	langtools-$_dropsver.tar.xz::$_dropsurl/langtools.tar.xz
	hotspot-$_dropsver.tar.xz::$_dropsurl/hotspot.tar.xz
	nashorn-$_dropsver.tar.xz::$_dropsurl/nashorn.tar.xz
56
	fix-paxmark.patch
Timo Teräs's avatar
Timo Teräs committed
57 58

	icedtea-hotspot-musl.patch
59
	icedtea-hotspot-musl-ppc.patch
Timo Teräs's avatar
Timo Teräs committed
60 61 62
	icedtea-hotspot-noagent-musl.patch
	icedtea-jdk-execinfo.patch
	icedtea-jdk-fix-ipv6-init.patch
63
	icedtea-jdk-fix-libjvm-load.patch
Timo Teräs's avatar
Timo Teräs committed
64 65
	icedtea-jdk-musl.patch
	icedtea-jdk-includes.patch
66
	icedtea-jdk-getmntent-buffer.patch
67
	icedtea-autoconf-config.patch
68
	icedtea-jdk-tls-nist-curves.patch
Timo Teräs's avatar
Timo Teräs committed
69
	"
70 71
builddir="$srcdir/icedtea-$_icedteaver"

72
# secfixes:
73 74 75 76
#   8.212.04-r0:
#     - CVE-2019-2602
#     - CVE-2019-2684
#     - CVE-2019-2698
77 78 79 80
#   8.201.08-r0:
#     - CVE-2019-2422
#     - CVE-2019-2426
#     - CVE-2018-11212
81 82 83 84 85 86 87 88 89 90
#   8.191.12-r0:
#     - CVE-2018-3136
#     - CVE-2018-3139
#     - CVE-2018-3149
#     - CVE-2018-3169
#     - CVE-2018-3180
#     - CVE-2018-3183
#     - CVE-2018-3214
#     - CVE-2018-13785
#     - CVE-2018-16435
91 92 93 94 95 96 97
#   8.181.13-r0:
#     - CVE-2018-2938
#     - CVE-2018-2940
#     - CVE-2018-2952
#     - CVE-2018-2973
#     - CVE-2018-3639

98 99
unpack() {
	if [ -z "$force" ]; then
100 101
		verify
		initdcheck
102 103 104
	fi
	mkdir -p "$srcdir"
	msg "Unpacking sources..."
105
	tar -C "$srcdir" -Jxf icedtea-$_icedteaver.tar.xz
106
}
Timo Teräs's avatar
Timo Teräs committed
107 108

prepare() {
109
	cd "$builddir"
Timo Teräs's avatar
Timo Teräs committed
110

111 112
	local ver_u=$(sed -En 's/^\s*JDK_UPDATE_VERSION\s*=\s*(\S+).*/\1/p' acinclude.m4)
	local ver_b=$(sed -En 's/^\s*BUILD_VERSION\s*=\s*b(\S+).*/\1/p' acinclude.m4)
113 114 115
	[ "${pkgver#*.}" = "$ver_u.$ver_b" ] \
		|| die "Version mismatch, source is 8.$ver_u.$ver_b, but abuild defines $pkgver!"

116 117
	# Busybox sha256 does not support longopts.
	sed -e "s/--check/-c/g" -i Makefile.am
Timo Teräs's avatar
Timo Teräs committed
118

119
	local patch; for patch in $source; do
120
		case $patch in
121 122 123
		icedtea-*.patch)
			cp ../$patch patches
			;;
124 125
		*.patch)
			msg "Applying patch $patch"
126
			patch -p1 -i "$srcdir"/$patch
127 128 129
			;;
		esac
	done
130 131

	./autogen.sh
Timo Teräs's avatar
Timo Teräs committed
132 133 134
}

build() {
135
	export JAVA_HOME="$_bootstrap_java_home"
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
	export PATH="$JAVA_HOME/bin:$PATH"

	if [ -z "$JOBS" ]; then
		export JOBS=$(printf '%s\n' "$MAKEFLAGS" | sed -n -e 's/.*-j\([0-9]\+\).*/\1/p')
	fi

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

153
	cd "$builddir"
154
	bash ./configure \
Timo Teräs's avatar
Timo Teräs committed
155 156
		--build=$CBUILD \
		--host=$CHOST \
157
		--prefix="$_java_home" \
Timo Teräs's avatar
Timo Teräs committed
158 159 160 161
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
162 163
		--disable-dependency-tracking \
		--disable-downloading \
164
		--disable-precompiled-headers \
165
		--with-parallel-jobs=${JOBS:-2} \
166
		--with-hotspot-build=default \
167 168 169 170 171 172 173 174 175
		--with-openjdk-src-zip="$srcdir/openjdk-$_dropsver.tar.xz" \
		--with-hotspot-src-zip="$srcdir/hotspot-$_dropsver.tar.xz" \
		--with-corba-src-zip="$srcdir/corba-$_dropsver.tar.xz" \
		--with-jaxp-src-zip="$srcdir/jaxp-$_dropsver.tar.xz" \
		--with-jaxws-src-zip="$srcdir/jaxws-$_dropsver.tar.xz" \
		--with-jdk-src-zip="$srcdir/jdk-$_dropsver.tar.xz" \
		--with-langtools-src-zip="$srcdir/langtools-$_dropsver.tar.xz" \
		--with-nashorn-src-zip="$srcdir/nashorn-$_dropsver.tar.xz" \
		--with-pax=paxmark \
176
		--with-jdk-home="$_bootstrap_java_home" \
177
		--with-pkgversion="Alpine ${pkgver}-r${pkgrel}" \
178 179
		--enable-nss \
		--enable-sunec \
180 181
		--enable-non-nss-curves
	make
Timo Teräs's avatar
Timo Teräs committed
182 183
}

184 185 186 187 188 189 190
# TODO: Run tests or at least try to compile and run hello world.
check() {
	cd "$builddir"/openjdk.build/images/j2sdk-image

	./bin/java -version
}

Timo Teräs's avatar
Timo Teräs committed
191
package() {
192 193
	cd "$builddir"

194
	mkdir -p "$pkgdir"/$_java_home
195

196
	cp -a openjdk.build/images/j2sdk-image/* "$pkgdir"/$_java_home/
197
	rm "$pkgdir"/$_java_home/src.zip
Timo Teräs's avatar
Timo Teräs committed
198

199 200 201
	# This archive contains absolute paths from the build environment,
	# so it does not work on the target system. User can generate it
	# running `java -Xshare:dump`.
202
	rm -f "$pkgdir"/$_jrelib/server/classes.jsa
Timo Teräs's avatar
Timo Teräs committed
203

204
	# pax mark again (due to fakeroot xattr handling bug)
205
	./pax-mark-vm "$pkgdir"/$_java_home true
206

207 208
	# symlink to shared java cacerts store
	rm -f "$pkgdir"/$_java_home/jre/lib/security/cacerts
209
	ln -sf /etc/ssl/certs/java/cacerts \
210
		"$pkgdir"/$_java_home/jre/lib/security/cacerts
Timo Teräs's avatar
Timo Teräs committed
211 212 213 214 215 216
}

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

217 218 219 220 221 222 223 224 225 226 227
	local file dir
	for file in 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

		dir=${file%/*}
228
		mkdir -p "$subpkgdir"/$_java_home/$dir
229
		mv "$pkgdir"/$_java_home/$file "$subpkgdir"/$_java_home/$dir
Timo Teräs's avatar
Timo Teräs committed
230 231 232 233 234
	done
}

jre() {
	pkgdesc="OpenJDK 8 Java Runtime"
235
	local file dir
Timo Teräs's avatar
Timo Teräs committed
236 237

	mkdir -p "$subpkgdir"
238
	for file in jre/bin/policytool \
239 240 241 242 243
			bin/appletviewer \
			bin/policytool \
			jre/lib/$_jarch/libawt_xawt.so \
			jre/lib/$_jarch/libfontmanager.so \
			jre/lib/$_jarch/libjawt.so \
244
			jre/lib/$_jarch/libjsoundalsa.so \
245 246
			jre/lib/$_jarch/libsplashscreen.so; do

247
		dir=${file%/*}
248
		mkdir -p "$subpkgdir"/$_java_home/$dir
249
		mv "$pkgdir"/$_java_home/$file "$subpkgdir"/$_java_home/$dir
250 251 252
	done

	# Pax mark again (due to fakeroot xattr handling bug).
253
	"$builddir"/pax-mark-vm "$subpkgdir"/$_java_home true
254 255 256 257 258 259 260 261 262 263
}

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

	mkdir -p "$subpkgdir"/$_java_home/bin \
		"$subpkgdir"/$_java_home/lib/$_jarch

	mv "$pkgdir"/$_java_home/lib/$_jarch/jli \
264
		"$subpkgdir"/$_java_home/lib/$_jarch/
265 266 267

	local file; for file in java orbd rmid servertool unpack200 keytool \
			pack200 rmiregistry tnameserv; do
268
		mv "$pkgdir"/$_java_home/bin/$file "$subpkgdir"/$_java_home/bin/
Timo Teräs's avatar
Timo Teräs committed
269 270
	done

271
	# Rest of the jre subdir (which were not taken by -jre subpkg).
272
	mv "$pkgdir"/$_java_home/jre "$subpkgdir"/$_java_home/
273

274
	# Pax mark again (due to fakeroot xattr handling bug).
275
	"$builddir"/pax-mark-vm "$subpkgdir"/$_java_home true
Timo Teräs's avatar
Timo Teräs committed
276 277 278
}

doc() {
279
	default_doc
Timo Teräs's avatar
Timo Teräs committed
280

281 282
	mkdir -p "$subpkgdir"/$_java_home/
	mv "$pkgdir"/$_java_home/man "$subpkgdir"/$_java_home/
Timo Teräs's avatar
Timo Teräs committed
283 284
}

285 286 287 288
demos() {
	pkgdesc="OpenJDK 8 Java Demos and Samples"
	depends="$pkgname"

289 290 291
	mkdir -p "$subpkgdir"/$_java_home/
	mv "$pkgdir"/$_java_home/demo "$pkgdir"/$_java_home/sample \
		"$subpkgdir"/$_java_home/
292 293
}

294 295 296 297 298 299 300 301 302
sha512sums="22582d65b9114749c7cfee0fc58fa2cb70e4cf77f3bc62e8097a6c601ead0bf86f530b942e6b0f32ef7bbc5bd17130da236714d83d6e9857c3c5b85c984f2efa  icedtea-3.12.0.tar.xz
999aa17c0e73ebc465a982c5492043487b860b84dd6e4dda3fa51e3099b4642f3f5e03eb30252f835be81f1ea60dc28cf5f0905cbe347758a1f903db430fcc35  openjdk-3.12.0.tar.xz
d4ffe454a659db6c13b74c8e190beb3b427574d54fa44c80a3ba1dceb3af6f480ee99378d370ec2e9bfc6b5447a225eeb3e11821c83522479583fb21b0705bd7  corba-3.12.0.tar.xz
a5b8ca9b90797c5f0bc03b763fca50334a308bfd6955f5f488b661da6698abd991dbe08a7ac1a128922c546eb0061853e12a18971adb16c27302e2d9d0f13872  jaxp-3.12.0.tar.xz
f1deb09ccf6b1dff40d61f3bc54e55d430ebcbeb0cd53d6008cacf65b94824d486913b63034ee23a473298e0bee61ad1ea3e5520c2a3ab25e9e1e6d58d50d286  jaxws-3.12.0.tar.xz
2e15cdb58c9ce65c99ad5b5506343fb29cda02a4ea8490cfbe79f708deecee2ef28ad0e5a384d2113e72678aa857d821729b588e5ef53208ae06d0d5278ec326  jdk-3.12.0.tar.xz
838e3e458734d3fc8d2d968eb3bc7190838cd9a73bf3d61de662f9a992a9951a74021e25331d26545f0181b08c80f298de24e030dad4e076bd76368f3a14e960  langtools-3.12.0.tar.xz
2a0c18fea7b67c5042b39746f2c7ef53e252d6665efbcd74ebf9b171b13e311821310537e8b14cd4f9798c483afdb1107b9af6bb047262b97a526bfbb481777a  hotspot-3.12.0.tar.xz
918489daf6d2816d0fac85ed89cccbb0e350dc068502857f1a7e518135c40e5fcca2709a60ae51bad392592bdc459675ea3543e684ba1ed0d8debc7a451af6d5  nashorn-3.12.0.tar.xz
303
1f470432275d5beaa8b4e4352a2f24a4a00593546dc4f3bd857794c89e521e8e6d6abc540762bbd769be3e1e3da058e134dc5dc066d12b9b8a1f0656040a795c  fix-paxmark.patch
304
09104b19f647dce9ba0835163c05cc7e5e3ec9852b277f22b2d7a02bd483968853544125a09e384e96ba8811f2bbdc9546e05e378582ec6a554ede797ca5ad98  icedtea-hotspot-musl.patch
305
e5cf4d70f96fc1e72ae8b97a887adb96092ff36584711cbb8de9d9fa9e859cb8731d638838de0d9591239fc44ffe5c74422d1842bd9f10a0c00dff1627bdeeef  icedtea-hotspot-musl-ppc.patch
306
19459dbb922f5a71cd15b53199481498626a783c24f91d2544d55b7dddd2cdb34a64bbf0226b99548612dd1743af01b3f9ff32c30abbbc90ce727ca2dbbbd1f9  icedtea-hotspot-noagent-musl.patch
Timo Teräs's avatar
Timo Teräs committed
307 308
f6365cfafafa008bd6c1bf0ccec01a63f8a39bd1a8bc87baa492a27234d47793ba02d455e5667a873ef50148df3baaf6a8421e2da0b15faac675867da714dd5f  icedtea-jdk-execinfo.patch
48533f87fc2cf29d26b259be0df51087d2fe5b252e72d00c6ea2f4add7b0fb113141718c116279c5905e03f64a1118082e719393786811367cf4d472b5d36774  icedtea-jdk-fix-ipv6-init.patch
309
b135991c76b0db8fa7c363e0903624668e11eda7b54a943035c214aa4d7fc8c3e8110ed200edcec82792f3c9393150a9bd628625ddf7f3e55720ff163fbbb471  icedtea-jdk-fix-libjvm-load.patch
310
1fbc32ddc528c7c0099dbc1e48f88d29dccf55e7b8997793aa1d3d8408003a1223d898cca4248e1a12d343d3feec5144f875e6cdac8460d763c73ab3ad7e49f9  icedtea-jdk-musl.patch
311
e8d9f1b867bf4fc84aa00d1237b264bcf503b1ed5f34735e14b0b747a728953fe0051a5af69ed058d377fbf65d8be1ed9e38fe5fc6edb2d50b31f34bf3ba91dc  icedtea-jdk-includes.patch
312
7e6fa46b10c630517bfa46943858aea1d032c12d32ba3fcb7a2143ae1e896c34fa4cb8f925af80cb19f8e29149b835aa054adfd30ebb00539f6c78588d6f5211  icedtea-jdk-getmntent-buffer.patch
313
662d662d0a7a84be2978e921317589f212f3ba3b7629527ba0f1140b5ac4c1024893e0ed176211688ed1a4505968c4befc841ed57ffcdbb9d355c2cb0571b167  icedtea-autoconf-config.patch
314
9ea7ac942baf29cc619bc2e1acd59201b9f6d38f39a517b495d7613aec746459200c81afb57c5fcdcb856f6bc8b33f7566c8593fed07e5c73f43e08f1072d458  icedtea-jdk-tls-nist-curves.patch"