Gentoo Archives: gentoo-commits

From: Florian Schmaus <flow@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/java:master commit in: dev-java/openjdk-loom/
Date: Sun, 29 Jan 2023 12:55:48
Message-Id: 1674996941.6f0fdac1521593a9ca20b7853bd4ed00971d0666.flow@gentoo
1 commit: 6f0fdac1521593a9ca20b7853bd4ed00971d0666
2 Author: Florian Schmaus <flow <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jan 29 12:55:41 2023 +0000
4 Commit: Florian Schmaus <flow <AT> gentoo <DOT> org>
5 CommitDate: Sun Jan 29 12:55:41 2023 +0000
6 URL: https://gitweb.gentoo.org/proj/java.git/commit/?id=6f0fdac1
7
8 dev-java/openjdk-loom: add 21_pre20230127
9
10 Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>
11
12 .../openjdk-loom-21_pre20230127.ebuild | 277 +++++++++++++++++++++
13 1 file changed, 277 insertions(+)
14
15 diff --git a/dev-java/openjdk-loom/openjdk-loom-21_pre20230127.ebuild b/dev-java/openjdk-loom/openjdk-loom-21_pre20230127.ebuild
16 new file mode 100644
17 index 00000000..5b3b1bdb
18 --- /dev/null
19 +++ b/dev-java/openjdk-loom/openjdk-loom-21_pre20230127.ebuild
20 @@ -0,0 +1,277 @@
21 +# Copyright 1999-2023 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=8
25 +
26 +inherit check-reqs flag-o-matic git-r3 java-pkg-2 java-vm-2 multiprocessing toolchain-funcs
27 +
28 +MY_PV="${PV//_p/+}"
29 +SLOT="$(ver_cut 1)"
30 +
31 +DESCRIPTION="Experimental OpenJDK with Project Loom (Fibers / Virtual Threads)"
32 +HOMEPAGE="https://openjdk.org"
33 +EGIT_REPO_URI="https://github.com/openjdk/loom.git"
34 +EGIT_COMMIT="b6f785d836dad7b7a2ac992cda02514d88fede95"
35 +
36 +LICENSE="GPL-2-with-classpath-exception"
37 +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
38 +
39 +IUSE="alsa big-endian cups debug doc examples headless-awt javafx jbootstrap selinux source +system-bootstrap systemtap"
40 +
41 +REQUIRED_USE="
42 + javafx? ( alsa !headless-awt )
43 + !system-bootstrap? ( jbootstrap )
44 +"
45 +
46 +COMMON_DEPEND="
47 + media-libs/freetype:2=
48 + media-libs/giflib:0/7
49 + media-libs/harfbuzz:=
50 + media-libs/libpng:0=
51 + media-libs/lcms:2=
52 + sys-libs/zlib
53 + media-libs/libjpeg-turbo:0=
54 + systemtap? ( dev-util/systemtap )
55 +"
56 +
57 +# Many libs are required to build, but not to run, make is possible to remove
58 +# by listing conditionally in RDEPEND unconditionally in DEPEND
59 +RDEPEND="
60 + ${COMMON_DEPEND}
61 + >=sys-apps/baselayout-java-0.1.0-r1
62 + !headless-awt? (
63 + x11-libs/libX11
64 + x11-libs/libXext
65 + x11-libs/libXi
66 + x11-libs/libXrandr
67 + x11-libs/libXrender
68 + x11-libs/libXt
69 + x11-libs/libXtst
70 + )
71 + alsa? ( media-libs/alsa-lib )
72 + cups? ( net-print/cups )
73 + selinux? ( sec-policy/selinux-java )
74 +"
75 +
76 +DEPEND="
77 + ${COMMON_DEPEND}
78 + app-arch/zip
79 + media-libs/alsa-lib
80 + net-print/cups
81 + x11-base/xorg-proto
82 + x11-libs/libX11
83 + x11-libs/libXext
84 + x11-libs/libXi
85 + x11-libs/libXrandr
86 + x11-libs/libXrender
87 + x11-libs/libXt
88 + x11-libs/libXtst
89 + javafx? ( dev-java/openjfx:${SLOT}= )
90 + system-bootstrap? (
91 + || (
92 + dev-java/openjdk-bin:20
93 + dev-java/openjdk:20
94 + dev-java/openjdk-bin:${SLOT}
95 + dev-java/openjdk:${SLOT}
96 + )
97 + )
98 +"
99 +
100 +# The space required to build varies wildly depending on USE flags,
101 +# ranging from 2GB to 16GB. This function is certainly not exact but
102 +# should be close enough to be useful.
103 +openjdk_check_requirements() {
104 + local M
105 + M=2048
106 + M=$(( $(usex jbootstrap 2 1) * $M ))
107 + M=$(( $(usex debug 3 1) * $M ))
108 + M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
109 +
110 + CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
111 +}
112 +
113 +pkg_pretend() {
114 + openjdk_check_requirements
115 + if [[ ${MERGE_TYPE} != binary ]]; then
116 + has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}, bug #677876"
117 + fi
118 +}
119 +
120 +pkg_setup() {
121 + openjdk_check_requirements
122 + java-vm-2_pkg_setup
123 +
124 + [[ ${MERGE_TYPE} == "binary" ]] && return
125 +
126 + JAVA_PKG_WANT_BUILD_VM="openjdk-20 openjdk-bin-20 openjdk-${SLOT} openjdk-bin-${SLOT}"
127 + JAVA_PKG_WANT_SOURCE="${SLOT}"
128 + JAVA_PKG_WANT_TARGET="${SLOT}"
129 +
130 + # The nastiness below is necessary while the gentoo-vm USE flag is
131 + # masked. First we call java-pkg-2_pkg_setup if it looks like the
132 + # flag was unmasked against one of the possible build VMs. If not,
133 + # we try finding one of them in their expected locations. This would
134 + # have been slightly less messy if openjdk-bin had been installed to
135 + # /opt/${PN}-${SLOT} or if there was a mechanism to install a VM env
136 + # file but disable it so that it would not normally be selectable.
137 +
138 + local vm
139 + for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
140 + if [[ -d ${BROOT}/usr/lib/jvm/${vm} ]]; then
141 + java-pkg-2_pkg_setup
142 + return
143 + fi
144 + done
145 +}
146 +
147 +src_prepare() {
148 + default
149 + chmod +x configure || die
150 +}
151 +
152 +src_configure() {
153 + local build_jdk_ver=20
154 + if has_version dev-java/openjdk:$build_jdk_ver; then
155 + export JDK_HOME=${BROOT}/usr/$(get_libdir)/openjdk-${SLOT}
156 + elif use !system-bootstrap ; then
157 + local xpakvar="${ARCH^^}_XPAK"
158 + export JDK_HOME="${WORKDIR}/openjdk-bootstrap-${!xpakvar}"
159 + else
160 + JDK_HOME=$(best_version -b dev-java/openjdk-bin:$build_jdk_ver)
161 + [[ -n ${JDK_HOME} ]] || die "Build VM not found!"
162 + JDK_HOME=${JDK_HOME#*/}
163 + JDK_HOME=${BROOT}/opt/${JDK_HOME%-r*}
164 + export JDK_HOME
165 + fi
166 +
167 + # Work around stack alignment issue, bug #647954. in case we ever have x86
168 + use x86 && append-flags -mincoming-stack-boundary=2
169 +
170 + # Work around -fno-common ( GCC10 default ), bug #713180
171 + append-flags -fcommon
172 +
173 + # Strip some flags users may set, but should not. #818502
174 + filter-flags -fexceptions
175 +
176 + # Enabling full docs appears to break doc building. If not
177 + # explicitly disabled, the flag will get auto-enabled if pandoc and
178 + # graphviz are detected. pandoc has loads of dependencies anyway.
179 +
180 + local version_build=1
181 +
182 + local myconf=(
183 + --disable-ccache
184 + --disable-precompiled-headers
185 + --disable-warnings-as-errors
186 + --enable-full-docs=no
187 + --with-boot-jdk="${JDK_HOME}"
188 + --with-extra-cflags="${CFLAGS}"
189 + --with-extra-cxxflags="${CXXFLAGS}"
190 + --with-extra-ldflags="${LDFLAGS}"
191 + --with-freetype="${XPAK_BOOTSTRAP:-system}"
192 + --with-giflib="${XPAK_BOOTSTRAP:-system}"
193 + --with-harfbuzz="${XPAK_BOOTSTRAP:-system}"
194 + --with-lcms="${XPAK_BOOTSTRAP:-system}"
195 + --with-libjpeg="${XPAK_BOOTSTRAP:-system}"
196 + --with-libpng="${XPAK_BOOTSTRAP:-system}"
197 + --with-native-debug-symbols=$(usex debug internal none)
198 + --with-vendor-name="Gentoo"
199 + --with-vendor-url="https://gentoo.org"
200 + --with-vendor-bug-url="https://bugs.gentoo.org"
201 + --with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
202 + --with-vendor-version-string="${PVR}"
203 + --with-version-pre=""
204 + --with-version-string="${PV%_p*}"
205 + --with-version-pre="${PV#*_pre}"
206 + --with-zlib="${XPAK_BOOTSTRAP:-system}"
207 + --enable-dtrace=$(usex systemtap yes no)
208 + --enable-headless-only=$(usex headless-awt yes no)
209 + $(tc-is-clang && echo "--with-toolchain-type=clang")
210 + )
211 +
212 + if use javafx; then
213 + local zip="${EPREFIX}/usr/$(get_libdir)/openjfx-${SLOT}/javafx-exports.zip"
214 + if [[ -r ${zip} ]]; then
215 + myconf+=( --with-import-modules="${zip}" )
216 + else
217 + die "${zip} not found or not readable"
218 + fi
219 + fi
220 +
221 + if use !system-bootstrap ; then
222 + addpredict /dev/random
223 + addpredict /proc/self/coredump_filter
224 + fi
225 +
226 + (
227 + unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC XARGS
228 + CFLAGS= CXXFLAGS= LDFLAGS= \
229 + CONFIG_SITE=/dev/null \
230 + econf "${myconf[@]}"
231 + )
232 +}
233 +
234 +src_compile() {
235 + local myemakeargs=(
236 + JOBS=$(makeopts_jobs)
237 + LOG=debug
238 + CFLAGS_WARNINGS_ARE_ERRORS= # No -Werror
239 + NICE= # Use PORTAGE_NICENESS, don't adjust further down
240 + $(usex doc docs '')
241 + $(usex jbootstrap bootcycle-images product-images)
242 + )
243 + emake "${myemakeargs[@]}" -j1 #nowarn
244 +}
245 +
246 +src_install() {
247 + local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
248 + local ddest="${ED}/${dest#/}"
249 +
250 + cd "${S}"/build/*-release/images/jdk || die
251 +
252 + # Create files used as storage for system preferences.
253 + mkdir .systemPrefs || die
254 + touch .systemPrefs/.system.lock || die
255 + touch .systemPrefs/.systemRootModFile || die
256 +
257 + # Oracle and IcedTea have libjsoundalsa.so depending on
258 + # libasound.so.2 but OpenJDK only has libjsound.so. Weird.
259 + if ! use alsa ; then
260 + rm -v lib/libjsound.* || die
261 + fi
262 +
263 + if ! use examples ; then
264 + rm -vr demo/ || die
265 + fi
266 +
267 + if ! use source ; then
268 + rm -v lib/src.zip || die
269 + fi
270 +
271 + rm -v lib/security/cacerts || die
272 +
273 + dodir "${dest}"
274 + cp -pPR * "${ddest}" || die
275 +
276 + dosym -r /etc/ssl/certs/java/cacerts "${dest}"/lib/security/cacerts
277 +
278 + # must be done before running itself
279 + java-vm_set-pax-markings "${ddest}"
280 +
281 + einfo "Creating the Class Data Sharing archives and disabling usage tracking"
282 + "${ddest}/bin/java" -server -Xshare:dump -Djdk.disableLastUsageTracking || die
283 +
284 + java-vm_install-env "${FILESDIR}"/${PN%-loom}.env.sh
285 + java-vm_revdep-mask
286 + java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
287 +
288 + if use doc ; then
289 + docinto html
290 + dodoc -r "${S}"/build/*-release/images/docs/*
291 + dosym ../../../usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}"
292 + fi
293 +}
294 +
295 +pkg_postinst() {
296 + java-vm-2_pkg_postinst
297 +}