Gentoo Archives: gentoo-commits

From: Florian Schmaus <flow@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-java/openjdk/
Date: Mon, 12 Sep 2022 18:18:10
Message-Id: 1663006677.464a2a49572bf2fb25a03363f88dc731f00e0328.flow@gentoo
1 commit: 464a2a49572bf2fb25a03363f88dc731f00e0328
2 Author: Florian Schmaus <flow <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 12 17:58:46 2022 +0000
4 Commit: Florian Schmaus <flow <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 12 18:17:57 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=464a2a49
7
8 dev-java/openjdk: add 17.0.4.1, 17.0.5_pre5
9
10 Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
11
12 dev-java/openjdk/Manifest | 2 +
13 dev-java/openjdk/openjdk-17.0.4.1.ebuild | 309 ++++++++++++++++++++++++++++
14 dev-java/openjdk/openjdk-17.0.5_pre5.ebuild | 307 +++++++++++++++++++++++++++
15 3 files changed, 618 insertions(+)
16
17 diff --git a/dev-java/openjdk/Manifest b/dev-java/openjdk/Manifest
18 index ab42df4cb815..bb7a8df0dd47 100644
19 --- a/dev-java/openjdk/Manifest
20 +++ b/dev-java/openjdk/Manifest
21 @@ -2,6 +2,8 @@ DIST openjdk-11.0.14-riscv.patch.xz 279088 BLAKE2B f67cf5707246b22285de8217b68fb
22 DIST openjdk-11.0.15_p10.tar.gz 122902351 BLAKE2B a2dabad415a92765d548b19261e22e2cd483a17b478c8ef98342b44e88b39b23d89d31aecc80f93b27fce8df50ba41f4e6e5f10b66035bbfc1e0c03fc4707a40 SHA512 9d9e631046769d3ad95229172f392649ef4162161eb2d6fa7371665619600a04db440e1b3d30c580e283ad2b6bd7580d1199fc854fad3cb962d79f18b2347c67
23 DIST openjdk-17.0.3-riscv.patch.xz 296268 BLAKE2B 9b2036493a485a1e245230488a5985af4f5d5c6a85912d73d8a712742fdfc26d5eb08ca8e69dac04f0d516fb361e6ed057c95a3839b04639d129581cf00f0620 SHA512 692b5e39e5c6eb1222f25c3012e9a73366d9c98f5c29c2f2d35f41991cdcb026a644398b6f3fdd8c9d8368b4b1f5dc4d89b3dbd594a2e7751de96a140551d445
24 DIST openjdk-17.0.3_p7.tar.gz 104797560 BLAKE2B 025ff6be360c74288990622bce31769e5780f3f326b0eed2b78a776cc4df8bdf8cb99dfb0d7dd3f03f8558ca9a66acc5c5bd04b227ba4dffe18f8586a287b74b SHA512 3bebaaf0469cd6558a3f033b768005e880ec95d5bb2a24b8929d2f6a05f18ca9977b291ad49b220a904f661cf6b47780a1cfd776109ed11d4e34d5345be8f66c
25 +DIST openjdk-17.0.4.1.tar.gz 104917916 BLAKE2B f01101aa5c1fa17ab92134d2d238df266a734ad0d523e0030853b4386c9e021364e1a98644a8f6fd075f42dff1ff2b0d2a0b958c6d99c10c4250043bee36f6a3 SHA512 5b134a93addf17bb9c91e7ea69e25a9db4dbdc27760de3a128e48b20bbfb004722851c27cea4f9d83e3fdab929e89af09cf7879b1d87334cffe600b12ee53150
26 +DIST openjdk-17.0.5_pre5.tar.gz 105040319 BLAKE2B 658df2630e1938d7787031e498474c347a10770a133d4d8234cb7450777264c07441ca56a1b09f368b837a182627d3a104848aa5e521d95b1b58e1f21f4645b1 SHA512 19b2466339db697a8564e44423878b5c5ed310478bf56aa7ace90d34458912c5f544fcea2c31eaba559c2fff33f818745e8160376eae8f6c3c694090aed7de09
27 DIST openjdk-8.332_p09.tar.gz 88130953 BLAKE2B 9c7419851588dfbca92610f8fbb8b74fa7516282f82e8c7c37af88c776ba0c83a22fb3d4a1c2c2b98d44e394025217d095cff9c79fba53f9c5a32a43eb91ad70 SHA512 f6a717f77cc0e85bc2eb3c3c599d09e06a4004e4987a2caf0773b1197336722469e2abcca9d39c1f4c534d15cd77408d6405c9ee6edb3815bccd8e4872571aaa
28 DIST openjdk-bootstrap-11.0.13_p8-ppc64.tar.xz 108215404 BLAKE2B 5e6c0b905b34b437137922b73a9724da96b8832186fea945f8c73d941db822ca1cc5718f3ecb4607ed98d1f8241c9f365b54caaf978863e8b84680a94f067b5d SHA512 732e2220219d42be10589fcaf2420da87ebc8564b4afc6bd02f61f31cdca9c31b339366e34d374fb814499b92f8aa796435a18f28e10c8cb00d9a0f5953bb60e
29 DIST openjdk-bootstrap-11.0.13_p8-x86.tar.xz 105420236 BLAKE2B d3137ad497937a9a04dedf38776f3ac45bf3b115d275991fd8582b72ade48390b6aa8ad89e0b4d34fa6a787a3c413dab20b32ef347dc8733544e810150c55d29 SHA512 f71a7ef8fbf19b0595dd7d4ebe52bbe1c95b8c17f34d092472c5f5ce8caf52a053f22db8587f1649f9a96ad01c0c632be343342812f5a8cc4ff843b33b8d9b0f
30
31 diff --git a/dev-java/openjdk/openjdk-17.0.4.1.ebuild b/dev-java/openjdk/openjdk-17.0.4.1.ebuild
32 new file mode 100644
33 index 000000000000..5219b95c61ad
34 --- /dev/null
35 +++ b/dev-java/openjdk/openjdk-17.0.4.1.ebuild
36 @@ -0,0 +1,309 @@
37 +# Copyright 1999-2022 Gentoo Authors
38 +# Distributed under the terms of the GNU General Public License v2
39 +
40 +EAPI=7
41 +
42 +inherit check-reqs eapi8-dosym flag-o-matic java-pkg-2 java-vm-2 multiprocessing toolchain-funcs
43 +
44 +# variable name format: <UPPERCASE_KEYWORD>_XPAK
45 +ARM64_XPAK="17.0.2_p8" # musl bootstrap install
46 +PPC64_XPAK="17.0.1_p12" # big-endian bootstrap tarball
47 +RISCV_XPAK="17.0.3_p7"
48 +X86_XPAK="17.0.1_p12"
49 +
50 +# Usage: bootstrap_uri <keyword> <version> [extracond]
51 +# Example: $(bootstrap_uri ppc64 17.0.1_p12 big-endian)
52 +# Output: ppc64? ( big-endian? ( https://...17.0.1_p12-ppc64.tar.xz ) )
53 +bootstrap_uri() {
54 + local baseuri="https://dev.gentoo.org/~arthurzam/distfiles/dev-java/${PN}/${PN}-bootstrap"
55 + local suff="tar.xz"
56 + local kw="${1:?${FUNCNAME[0]}: keyword not specified}"
57 + local ver="${2:?${FUNCNAME[0]}: version not specified}"
58 + local cond="${3-}"
59 + [[ ${cond} == elibc_musl* ]] && local musl=yes
60 +
61 + # here be dragons
62 + echo "${kw}? ( ${cond:+${cond}? (} ${baseuri}-${ver}-${kw}${musl:+-musl}.${suff} ${cond:+) })"
63 +}
64 +
65 +MY_PV="${PV//_pre/+}-ga"
66 +SLOT="$(ver_cut 1)"
67 +
68 +DESCRIPTION="Open source implementation of the Java programming language"
69 +HOMEPAGE="https://openjdk.org"
70 +SRC_URI="
71 + https://github.com/${PN}/jdk${SLOT}u/archive/refs/tags/jdk-${MY_PV}.tar.gz
72 + -> ${P}.tar.gz
73 + !system-bootstrap? (
74 + $(bootstrap_uri arm64 ${ARM64_XPAK} elibc_musl)
75 + $(bootstrap_uri ppc64 ${PPC64_XPAK} big-endian)
76 + $(bootstrap_uri x86 ${X86_XPAK})
77 + $(bootstrap_uri riscv ${RISCV_XPAK})
78 + )
79 + riscv? ( https://dev.gentoo.org/~arthurzam/distfiles/dev-java/openjdk/openjdk-17.0.3-riscv.patch.xz )
80 +"
81 +
82 +LICENSE="GPL-2"
83 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
84 +
85 +IUSE="alsa big-endian cups debug doc examples +gentoo-vm headless-awt javafx +jbootstrap selinux source system-bootstrap systemtap"
86 +
87 +REQUIRED_USE="
88 + javafx? ( alsa !headless-awt )
89 + !system-bootstrap? ( jbootstrap )
90 +"
91 +
92 +COMMON_DEPEND="
93 + media-libs/freetype:2=
94 + media-libs/giflib:0/7
95 + media-libs/harfbuzz:=
96 + media-libs/libpng:0=
97 + media-libs/lcms:2=
98 + sys-libs/zlib
99 + media-libs/libjpeg-turbo:0=
100 + systemtap? ( dev-util/systemtap )
101 +"
102 +
103 +# Many libs are required to build, but not to run, make is possible to remove
104 +# by listing conditionally in RDEPEND unconditionally in DEPEND
105 +RDEPEND="
106 + ${COMMON_DEPEND}
107 + >=sys-apps/baselayout-java-0.1.0-r1
108 + !headless-awt? (
109 + x11-libs/libX11
110 + x11-libs/libXext
111 + x11-libs/libXi
112 + x11-libs/libXrandr
113 + x11-libs/libXrender
114 + x11-libs/libXt
115 + x11-libs/libXtst
116 + )
117 + alsa? ( media-libs/alsa-lib )
118 + cups? ( net-print/cups )
119 + selinux? ( sec-policy/selinux-java )
120 +"
121 +
122 +DEPEND="
123 + ${COMMON_DEPEND}
124 + app-arch/zip
125 + media-libs/alsa-lib
126 + net-print/cups
127 + x11-base/xorg-proto
128 + x11-libs/libX11
129 + x11-libs/libXext
130 + x11-libs/libXi
131 + x11-libs/libXrandr
132 + x11-libs/libXrender
133 + x11-libs/libXt
134 + x11-libs/libXtst
135 + javafx? ( dev-java/openjfx:${SLOT}= )
136 + system-bootstrap? (
137 + || (
138 + dev-java/openjdk-bin:${SLOT}
139 + dev-java/openjdk:${SLOT}
140 + )
141 + )
142 +"
143 +
144 +S="${WORKDIR}/jdk${SLOT}u-jdk-${MY_PV//+/-}"
145 +
146 +PATCHES=( "${FILESDIR}"/${PN}-17.0.3-fix-nullptr-cast.patch )
147 +
148 +# The space required to build varies wildly depending on USE flags,
149 +# ranging from 2GB to 16GB. This function is certainly not exact but
150 +# should be close enough to be useful.
151 +openjdk_check_requirements() {
152 + local M
153 + M=2048
154 + M=$(( $(usex jbootstrap 2 1) * $M ))
155 + M=$(( $(usex debug 3 1) * $M ))
156 + M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
157 +
158 + CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
159 +}
160 +
161 +pkg_pretend() {
162 + openjdk_check_requirements
163 + if [[ ${MERGE_TYPE} != binary ]]; then
164 + has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}, bug #677876"
165 + fi
166 +}
167 +
168 +pkg_setup() {
169 + openjdk_check_requirements
170 + java-vm-2_pkg_setup
171 +
172 + [[ ${MERGE_TYPE} == "binary" ]] && return
173 +
174 + JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT}"
175 + JAVA_PKG_WANT_SOURCE="${SLOT}"
176 + JAVA_PKG_WANT_TARGET="${SLOT}"
177 +
178 + # The nastiness below is necessary while the gentoo-vm USE flag is
179 + # masked. First we call java-pkg-2_pkg_setup if it looks like the
180 + # flag was unmasked against one of the possible build VMs. If not,
181 + # we try finding one of them in their expected locations. This would
182 + # have been slightly less messy if openjdk-bin had been installed to
183 + # /opt/${PN}-${SLOT} or if there was a mechanism to install a VM env
184 + # file but disable it so that it would not normally be selectable.
185 +
186 + local vm
187 + for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
188 + if [[ -d ${BROOT}/usr/lib/jvm/${vm} ]]; then
189 + java-pkg-2_pkg_setup
190 + return
191 + fi
192 + done
193 +}
194 +
195 +src_prepare() {
196 + use riscv && eapply "${WORKDIR}"/openjdk-17.0.3-riscv.patch
197 + default
198 + chmod +x configure || die
199 +}
200 +
201 +src_configure() {
202 + if has_version dev-java/openjdk:${SLOT}; then
203 + export JDK_HOME=${BROOT}/usr/$(get_libdir)/openjdk-${SLOT}
204 + elif use !system-bootstrap ; then
205 + local xpakvar="${ARCH^^}_XPAK"
206 + export JDK_HOME="${WORKDIR}/openjdk-bootstrap-${!xpakvar}"
207 + else
208 + JDK_HOME=$(best_version -b dev-java/openjdk-bin:${SLOT})
209 + [[ -n ${JDK_HOME} ]] || die "Build VM not found!"
210 + JDK_HOME=${JDK_HOME#*/}
211 + JDK_HOME=${BROOT}/opt/${JDK_HOME%-r*}
212 + export JDK_HOME
213 + fi
214 +
215 + # Work around stack alignment issue, bug #647954. in case we ever have x86
216 + use x86 && append-flags -mincoming-stack-boundary=2
217 +
218 + # Work around -fno-common ( GCC10 default ), bug #713180
219 + append-flags -fcommon
220 +
221 + # Strip some flags users may set, but should not. #818502
222 + filter-flags -fexceptions
223 +
224 + # Enabling full docs appears to break doc building. If not
225 + # explicitly disabled, the flag will get auto-enabled if pandoc and
226 + # graphviz are detected. pandoc has loads of dependencies anyway.
227 +
228 + local myconf=(
229 + --disable-ccache
230 + --disable-precompiled-headers
231 + --disable-warnings-as-errors
232 + --enable-full-docs=no
233 + --with-boot-jdk="${JDK_HOME}"
234 + --with-extra-cflags="${CFLAGS}"
235 + --with-extra-cxxflags="${CXXFLAGS}"
236 + --with-extra-ldflags="${LDFLAGS}"
237 + --with-freetype="${XPAK_BOOTSTRAP:-system}"
238 + --with-giflib="${XPAK_BOOTSTRAP:-system}"
239 + --with-harfbuzz="${XPAK_BOOTSTRAP:-system}"
240 + --with-lcms="${XPAK_BOOTSTRAP:-system}"
241 + --with-libjpeg="${XPAK_BOOTSTRAP:-system}"
242 + --with-libpng="${XPAK_BOOTSTRAP:-system}"
243 + --with-native-debug-symbols=$(usex debug internal none)
244 + --with-vendor-name="Gentoo"
245 + --with-vendor-url="https://gentoo.org"
246 + --with-vendor-bug-url="https://bugs.gentoo.org"
247 + --with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
248 + --with-vendor-version-string="${PVR}"
249 + --with-version-pre=""
250 + --with-version-string="${PV%_p*}"
251 + --with-version-build="${SLOT}"
252 + --with-zlib="${XPAK_BOOTSTRAP:-system}"
253 + --enable-dtrace=$(usex systemtap yes no)
254 + --enable-headless-only=$(usex headless-awt yes no)
255 + $(tc-is-clang && echo "--with-toolchain-type=clang")
256 + )
257 +
258 + use riscv && myconf+=( --with-boot-jdk-jvmargs="-Djdk.lang.Process.launchMechanism=vfork" )
259 +
260 + if use javafx; then
261 + local zip="${EPREFIX}/usr/$(get_libdir)/openjfx-${SLOT}/javafx-exports.zip"
262 + if [[ -r ${zip} ]]; then
263 + myconf+=( --with-import-modules="${zip}" )
264 + else
265 + die "${zip} not found or not readable"
266 + fi
267 + fi
268 +
269 + if use !system-bootstrap ; then
270 + addpredict /dev/random
271 + addpredict /proc/self/coredump_filter
272 + fi
273 +
274 + (
275 + unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC XARGS
276 + CFLAGS= CXXFLAGS= LDFLAGS= \
277 + CONFIG_SITE=/dev/null \
278 + econf "${myconf[@]}"
279 + )
280 +}
281 +
282 +src_compile() {
283 + local myemakeargs=(
284 + JOBS=$(makeopts_jobs)
285 + LOG=debug
286 + CFLAGS_WARNINGS_ARE_ERRORS= # No -Werror
287 + NICE= # Use PORTAGE_NICENESS, don't adjust further down
288 + $(usex doc docs '')
289 + $(usex jbootstrap bootcycle-images product-images)
290 + )
291 + emake "${myemakeargs[@]}" -j1 #nowarn
292 +}
293 +
294 +src_install() {
295 + local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
296 + local ddest="${ED}/${dest#/}"
297 +
298 + cd "${S}"/build/*-release/images/jdk || die
299 +
300 + # Create files used as storage for system preferences.
301 + mkdir .systemPrefs || die
302 + touch .systemPrefs/.system.lock || die
303 + touch .systemPrefs/.systemRootModFile || die
304 +
305 + # Oracle and IcedTea have libjsoundalsa.so depending on
306 + # libasound.so.2 but OpenJDK only has libjsound.so. Weird.
307 + if ! use alsa ; then
308 + rm -v lib/libjsound.* || die
309 + fi
310 +
311 + if ! use examples ; then
312 + rm -vr demo/ || die
313 + fi
314 +
315 + if ! use source ; then
316 + rm -v lib/src.zip || die
317 + fi
318 +
319 + rm -v lib/security/cacerts || die
320 +
321 + dodir "${dest}"
322 + cp -pPR * "${ddest}" || die
323 +
324 + dosym8 -r /etc/ssl/certs/java/cacerts "${dest}"/lib/security/cacerts
325 +
326 + # must be done before running itself
327 + java-vm_set-pax-markings "${ddest}"
328 +
329 + einfo "Creating the Class Data Sharing archives and disabling usage tracking"
330 + "${ddest}/bin/java" -server -Xshare:dump -Djdk.disableLastUsageTracking || die
331 +
332 + use gentoo-vm && java-vm_install-env "${FILESDIR}"/${PN}.env.sh
333 + java-vm_revdep-mask
334 + java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
335 +
336 + if use doc ; then
337 + docinto html
338 + dodoc -r "${S}"/build/*-release/images/docs/*
339 + dosym ../../../usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}"
340 + fi
341 +}
342 +
343 +pkg_postinst() {
344 + java-vm-2_pkg_postinst
345 +}
346
347 diff --git a/dev-java/openjdk/openjdk-17.0.5_pre5.ebuild b/dev-java/openjdk/openjdk-17.0.5_pre5.ebuild
348 new file mode 100644
349 index 000000000000..daf4447e9d86
350 --- /dev/null
351 +++ b/dev-java/openjdk/openjdk-17.0.5_pre5.ebuild
352 @@ -0,0 +1,307 @@
353 +# Copyright 1999-2022 Gentoo Authors
354 +# Distributed under the terms of the GNU General Public License v2
355 +
356 +EAPI=7
357 +
358 +inherit check-reqs eapi8-dosym flag-o-matic java-pkg-2 java-vm-2 multiprocessing toolchain-funcs
359 +
360 +# variable name format: <UPPERCASE_KEYWORD>_XPAK
361 +ARM64_XPAK="17.0.2_p8" # musl bootstrap install
362 +PPC64_XPAK="17.0.1_p12" # big-endian bootstrap tarball
363 +RISCV_XPAK="17.0.3_p7"
364 +X86_XPAK="17.0.1_p12"
365 +
366 +# Usage: bootstrap_uri <keyword> <version> [extracond]
367 +# Example: $(bootstrap_uri ppc64 17.0.1_p12 big-endian)
368 +# Output: ppc64? ( big-endian? ( https://...17.0.1_p12-ppc64.tar.xz ) )
369 +bootstrap_uri() {
370 + local baseuri="https://dev.gentoo.org/~arthurzam/distfiles/dev-java/${PN}/${PN}-bootstrap"
371 + local suff="tar.xz"
372 + local kw="${1:?${FUNCNAME[0]}: keyword not specified}"
373 + local ver="${2:?${FUNCNAME[0]}: version not specified}"
374 + local cond="${3-}"
375 + [[ ${cond} == elibc_musl* ]] && local musl=yes
376 +
377 + # here be dragons
378 + echo "${kw}? ( ${cond:+${cond}? (} ${baseuri}-${ver}-${kw}${musl:+-musl}.${suff} ${cond:+) })"
379 +}
380 +
381 +MY_PV="${PV//_pre/+}"
382 +SLOT="$(ver_cut 1)"
383 +
384 +DESCRIPTION="Open source implementation of the Java programming language"
385 +HOMEPAGE="https://openjdk.org"
386 +SRC_URI="
387 + https://github.com/${PN}/jdk${SLOT}u/archive/refs/tags/jdk-${MY_PV}.tar.gz
388 + -> ${P}.tar.gz
389 + !system-bootstrap? (
390 + $(bootstrap_uri arm64 ${ARM64_XPAK} elibc_musl)
391 + $(bootstrap_uri ppc64 ${PPC64_XPAK} big-endian)
392 + $(bootstrap_uri x86 ${X86_XPAK})
393 + $(bootstrap_uri riscv ${RISCV_XPAK})
394 + )
395 + riscv? ( https://dev.gentoo.org/~arthurzam/distfiles/dev-java/openjdk/openjdk-17.0.3-riscv.patch.xz )
396 +"
397 +
398 +LICENSE="GPL-2"
399 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
400 +
401 +IUSE="alsa big-endian cups debug doc examples +gentoo-vm headless-awt javafx +jbootstrap selinux source system-bootstrap systemtap"
402 +
403 +REQUIRED_USE="
404 + javafx? ( alsa !headless-awt )
405 + !system-bootstrap? ( jbootstrap )
406 +"
407 +
408 +COMMON_DEPEND="
409 + media-libs/freetype:2=
410 + media-libs/giflib:0/7
411 + media-libs/harfbuzz:=
412 + media-libs/libpng:0=
413 + media-libs/lcms:2=
414 + sys-libs/zlib
415 + media-libs/libjpeg-turbo:0=
416 + systemtap? ( dev-util/systemtap )
417 +"
418 +
419 +# Many libs are required to build, but not to run, make is possible to remove
420 +# by listing conditionally in RDEPEND unconditionally in DEPEND
421 +RDEPEND="
422 + ${COMMON_DEPEND}
423 + >=sys-apps/baselayout-java-0.1.0-r1
424 + !headless-awt? (
425 + x11-libs/libX11
426 + x11-libs/libXext
427 + x11-libs/libXi
428 + x11-libs/libXrandr
429 + x11-libs/libXrender
430 + x11-libs/libXt
431 + x11-libs/libXtst
432 + )
433 + alsa? ( media-libs/alsa-lib )
434 + cups? ( net-print/cups )
435 + selinux? ( sec-policy/selinux-java )
436 +"
437 +
438 +DEPEND="
439 + ${COMMON_DEPEND}
440 + app-arch/zip
441 + media-libs/alsa-lib
442 + net-print/cups
443 + x11-base/xorg-proto
444 + x11-libs/libX11
445 + x11-libs/libXext
446 + x11-libs/libXi
447 + x11-libs/libXrandr
448 + x11-libs/libXrender
449 + x11-libs/libXt
450 + x11-libs/libXtst
451 + javafx? ( dev-java/openjfx:${SLOT}= )
452 + system-bootstrap? (
453 + || (
454 + dev-java/openjdk-bin:${SLOT}
455 + dev-java/openjdk:${SLOT}
456 + )
457 + )
458 +"
459 +
460 +S="${WORKDIR}/jdk${SLOT}u-jdk-${MY_PV//+/-}"
461 +
462 +# The space required to build varies wildly depending on USE flags,
463 +# ranging from 2GB to 16GB. This function is certainly not exact but
464 +# should be close enough to be useful.
465 +openjdk_check_requirements() {
466 + local M
467 + M=2048
468 + M=$(( $(usex jbootstrap 2 1) * $M ))
469 + M=$(( $(usex debug 3 1) * $M ))
470 + M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
471 +
472 + CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
473 +}
474 +
475 +pkg_pretend() {
476 + openjdk_check_requirements
477 + if [[ ${MERGE_TYPE} != binary ]]; then
478 + has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}, bug #677876"
479 + fi
480 +}
481 +
482 +pkg_setup() {
483 + openjdk_check_requirements
484 + java-vm-2_pkg_setup
485 +
486 + [[ ${MERGE_TYPE} == "binary" ]] && return
487 +
488 + JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT}"
489 + JAVA_PKG_WANT_SOURCE="${SLOT}"
490 + JAVA_PKG_WANT_TARGET="${SLOT}"
491 +
492 + # The nastiness below is necessary while the gentoo-vm USE flag is
493 + # masked. First we call java-pkg-2_pkg_setup if it looks like the
494 + # flag was unmasked against one of the possible build VMs. If not,
495 + # we try finding one of them in their expected locations. This would
496 + # have been slightly less messy if openjdk-bin had been installed to
497 + # /opt/${PN}-${SLOT} or if there was a mechanism to install a VM env
498 + # file but disable it so that it would not normally be selectable.
499 +
500 + local vm
501 + for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
502 + if [[ -d ${BROOT}/usr/lib/jvm/${vm} ]]; then
503 + java-pkg-2_pkg_setup
504 + return
505 + fi
506 + done
507 +}
508 +
509 +src_prepare() {
510 + use riscv && eapply "${WORKDIR}"/openjdk-17.0.3-riscv.patch
511 + default
512 + chmod +x configure || die
513 +}
514 +
515 +src_configure() {
516 + if has_version dev-java/openjdk:${SLOT}; then
517 + export JDK_HOME=${BROOT}/usr/$(get_libdir)/openjdk-${SLOT}
518 + elif use !system-bootstrap ; then
519 + local xpakvar="${ARCH^^}_XPAK"
520 + export JDK_HOME="${WORKDIR}/openjdk-bootstrap-${!xpakvar}"
521 + else
522 + JDK_HOME=$(best_version -b dev-java/openjdk-bin:${SLOT})
523 + [[ -n ${JDK_HOME} ]] || die "Build VM not found!"
524 + JDK_HOME=${JDK_HOME#*/}
525 + JDK_HOME=${BROOT}/opt/${JDK_HOME%-r*}
526 + export JDK_HOME
527 + fi
528 +
529 + # Work around stack alignment issue, bug #647954. in case we ever have x86
530 + use x86 && append-flags -mincoming-stack-boundary=2
531 +
532 + # Work around -fno-common ( GCC10 default ), bug #713180
533 + append-flags -fcommon
534 +
535 + # Strip some flags users may set, but should not. #818502
536 + filter-flags -fexceptions
537 +
538 + # Enabling full docs appears to break doc building. If not
539 + # explicitly disabled, the flag will get auto-enabled if pandoc and
540 + # graphviz are detected. pandoc has loads of dependencies anyway.
541 +
542 + local myconf=(
543 + --disable-ccache
544 + --disable-precompiled-headers
545 + --disable-warnings-as-errors
546 + --enable-full-docs=no
547 + --with-boot-jdk="${JDK_HOME}"
548 + --with-extra-cflags="${CFLAGS}"
549 + --with-extra-cxxflags="${CXXFLAGS}"
550 + --with-extra-ldflags="${LDFLAGS}"
551 + --with-freetype="${XPAK_BOOTSTRAP:-system}"
552 + --with-giflib="${XPAK_BOOTSTRAP:-system}"
553 + --with-harfbuzz="${XPAK_BOOTSTRAP:-system}"
554 + --with-lcms="${XPAK_BOOTSTRAP:-system}"
555 + --with-libjpeg="${XPAK_BOOTSTRAP:-system}"
556 + --with-libpng="${XPAK_BOOTSTRAP:-system}"
557 + --with-native-debug-symbols=$(usex debug internal none)
558 + --with-vendor-name="Gentoo"
559 + --with-vendor-url="https://gentoo.org"
560 + --with-vendor-bug-url="https://bugs.gentoo.org"
561 + --with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
562 + --with-vendor-version-string="${PVR}"
563 + --with-version-pre=""
564 + --with-version-string="${PV%_p*}"
565 + --with-version-build="${SLOT}"
566 + --with-zlib="${XPAK_BOOTSTRAP:-system}"
567 + --enable-dtrace=$(usex systemtap yes no)
568 + --enable-headless-only=$(usex headless-awt yes no)
569 + $(tc-is-clang && echo "--with-toolchain-type=clang")
570 + )
571 +
572 + use riscv && myconf+=( --with-boot-jdk-jvmargs="-Djdk.lang.Process.launchMechanism=vfork" )
573 +
574 + if use javafx; then
575 + local zip="${EPREFIX}/usr/$(get_libdir)/openjfx-${SLOT}/javafx-exports.zip"
576 + if [[ -r ${zip} ]]; then
577 + myconf+=( --with-import-modules="${zip}" )
578 + else
579 + die "${zip} not found or not readable"
580 + fi
581 + fi
582 +
583 + if use !system-bootstrap ; then
584 + addpredict /dev/random
585 + addpredict /proc/self/coredump_filter
586 + fi
587 +
588 + (
589 + unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC XARGS
590 + CFLAGS= CXXFLAGS= LDFLAGS= \
591 + CONFIG_SITE=/dev/null \
592 + econf "${myconf[@]}"
593 + )
594 +}
595 +
596 +src_compile() {
597 + local myemakeargs=(
598 + JOBS=$(makeopts_jobs)
599 + LOG=debug
600 + CFLAGS_WARNINGS_ARE_ERRORS= # No -Werror
601 + NICE= # Use PORTAGE_NICENESS, don't adjust further down
602 + $(usex doc docs '')
603 + $(usex jbootstrap bootcycle-images product-images)
604 + )
605 + emake "${myemakeargs[@]}" -j1 #nowarn
606 +}
607 +
608 +src_install() {
609 + local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
610 + local ddest="${ED}/${dest#/}"
611 +
612 + cd "${S}"/build/*-release/images/jdk || die
613 +
614 + # Create files used as storage for system preferences.
615 + mkdir .systemPrefs || die
616 + touch .systemPrefs/.system.lock || die
617 + touch .systemPrefs/.systemRootModFile || die
618 +
619 + # Oracle and IcedTea have libjsoundalsa.so depending on
620 + # libasound.so.2 but OpenJDK only has libjsound.so. Weird.
621 + if ! use alsa ; then
622 + rm -v lib/libjsound.* || die
623 + fi
624 +
625 + if ! use examples ; then
626 + rm -vr demo/ || die
627 + fi
628 +
629 + if ! use source ; then
630 + rm -v lib/src.zip || die
631 + fi
632 +
633 + rm -v lib/security/cacerts || die
634 +
635 + dodir "${dest}"
636 + cp -pPR * "${ddest}" || die
637 +
638 + dosym8 -r /etc/ssl/certs/java/cacerts "${dest}"/lib/security/cacerts
639 +
640 + # must be done before running itself
641 + java-vm_set-pax-markings "${ddest}"
642 +
643 + einfo "Creating the Class Data Sharing archives and disabling usage tracking"
644 + "${ddest}/bin/java" -server -Xshare:dump -Djdk.disableLastUsageTracking || die
645 +
646 + use gentoo-vm && java-vm_install-env "${FILESDIR}"/${PN}.env.sh
647 + java-vm_revdep-mask
648 + java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
649 +
650 + if use doc ; then
651 + docinto html
652 + dodoc -r "${S}"/build/*-release/images/docs/*
653 + dosym ../../../usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}"
654 + fi
655 +}
656 +
657 +pkg_postinst() {
658 + java-vm-2_pkg_postinst
659 +}