1 |
commit: 41315cbafab89e942f70befa0f6d0b51bdb9b583 |
2 |
Author: Florian Schmaus <flow <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 13 08:12:21 2022 +0000 |
4 |
Commit: Florian Schmaus <flow <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 13 08:12:21 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/java.git/commit/?id=41315cba |
7 |
|
8 |
dev-java/openjdk-loom: new package, add 19_pre20220513 |
9 |
|
10 |
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org> |
11 |
|
12 |
dev-java/openjdk-loom/files/openjdk-loom-19.env.sh | 16 ++ |
13 |
dev-java/openjdk-loom/metadata.xml | 30 +++ |
14 |
.../openjdk-loom-19_pre20220513.ebuild | 288 +++++++++++++++++++++ |
15 |
3 files changed, 334 insertions(+) |
16 |
|
17 |
diff --git a/dev-java/openjdk-loom/files/openjdk-loom-19.env.sh b/dev-java/openjdk-loom/files/openjdk-loom-19.env.sh |
18 |
new file mode 100644 |
19 |
index 00000000..7db6461b |
20 |
--- /dev/null |
21 |
+++ b/dev-java/openjdk-loom/files/openjdk-loom-19.env.sh |
22 |
@@ -0,0 +1,16 @@ |
23 |
+# Copyright 1999-2021 Gentoo Authors |
24 |
+# Distributed under the terms of the GNU General Public License v2 |
25 |
+ |
26 |
+VERSION="OpenJDK ${PV}" |
27 |
+JAVA_HOME="${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}" |
28 |
+JDK_HOME="${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}" |
29 |
+JAVAC="\${JAVA_HOME}/bin/javac" |
30 |
+PATH="\${JAVA_HOME}/bin" |
31 |
+ROOTPATH="\${JAVA_HOME}/bin" |
32 |
+LDPATH="\${JAVA_HOME}/lib/:\${JAVA_HOME}/lib/server/" |
33 |
+MANPATH="" |
34 |
+PROVIDES_TYPE="JDK JRE" |
35 |
+PROVIDES_VERSION="${SLOT}" |
36 |
+BOOTCLASSPATH="" |
37 |
+GENERATION="2" |
38 |
+ENV_VARS="JAVA_HOME JDK_HOME JAVAC PATH ROOTPATH LDPATH MANPATH" |
39 |
|
40 |
diff --git a/dev-java/openjdk-loom/metadata.xml b/dev-java/openjdk-loom/metadata.xml |
41 |
new file mode 100644 |
42 |
index 00000000..e53a64e3 |
43 |
--- /dev/null |
44 |
+++ b/dev-java/openjdk-loom/metadata.xml |
45 |
@@ -0,0 +1,30 @@ |
46 |
+<?xml version="1.0" encoding="UTF-8"?> |
47 |
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> |
48 |
+<pkgmetadata> |
49 |
+ <maintainer type="person"> |
50 |
+ <email>flow@g.o</email> |
51 |
+ <name>Florian Schmaus</name> |
52 |
+ </maintainer> |
53 |
+ <maintainer type="project"> |
54 |
+ <email>java@g.o</email> |
55 |
+ <name>Java</name> |
56 |
+ </maintainer> |
57 |
+ <longdescription> |
58 |
+ Java™ is the world's leading programming language and platform. |
59 |
+ The code for Java is open source and available at OpenJDK™. |
60 |
+ </longdescription> |
61 |
+ <slots> |
62 |
+ <slot name="8">Java™ 8 is Java™ 1.8, where 8 is the version number, and 1.8 is the version string</slot> |
63 |
+ <slot name="11">Java™ version 11</slot> |
64 |
+ </slots> |
65 |
+ <use> |
66 |
+ <flag name="headless-awt">Don't install the X backend for AWT, needed by some GUIs</flag> |
67 |
+ <flag name="gentoo-vm">Allow this JDK to be recognised by Gentoo (package manager, eselect, java-config, EXPERIMENTAL!)</flag> |
68 |
+ <flag name="javafx" restrict="<=dev-java/openjdk-9">Provide JavaFX support via <pkg>dev-java/openjfx</pkg></flag> |
69 |
+ <flag name="javafx" restrict=">=dev-java/openjdk-11">Import OpenJFX modules at build time, via <pkg>dev-java/openjfx</pkg></flag> |
70 |
+ <flag name="jbootstrap">Build OpenJDK twice, the second time using the result of the first</flag> |
71 |
+ <flag name="source">Install JVM sources</flag> |
72 |
+ <flag name="system-bootstrap">Bootstrap using installed openjdk</flag> |
73 |
+ <flag name="systemtap" restrict=">=dev-java/openjdk-11">Enable SystemTAP/DTrace tracing</flag> |
74 |
+ </use> |
75 |
+</pkgmetadata> |
76 |
|
77 |
diff --git a/dev-java/openjdk-loom/openjdk-loom-19_pre20220513.ebuild b/dev-java/openjdk-loom/openjdk-loom-19_pre20220513.ebuild |
78 |
new file mode 100644 |
79 |
index 00000000..245c7bcd |
80 |
--- /dev/null |
81 |
+++ b/dev-java/openjdk-loom/openjdk-loom-19_pre20220513.ebuild |
82 |
@@ -0,0 +1,288 @@ |
83 |
+# Copyright 1999-2022 Gentoo Authors |
84 |
+# Distributed under the terms of the GNU General Public License v2 |
85 |
+ |
86 |
+EAPI=7 |
87 |
+ |
88 |
+inherit check-reqs eapi8-dosym flag-o-matic git-r3 java-pkg-2 java-vm-2 multiprocessing toolchain-funcs |
89 |
+ |
90 |
+MY_PV="${PV//_p/+}" |
91 |
+SLOT="$(ver_cut 1)" |
92 |
+ |
93 |
+DESCRIPTION="Experimental OpenJDK with Project Loom (Fibers / Virtual Threads)" |
94 |
+HOMEPAGE="https://openjdk.java.net" |
95 |
+EGIT_REPO_URI="https://github.com/openjdk/loom.git" |
96 |
+EGIT_COMMIT="6520b71a62baf64d214ff94c9291bfc513dfbe51" |
97 |
+ |
98 |
+LICENSE="GPL-2" |
99 |
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86" |
100 |
+ |
101 |
+IUSE="alsa big-endian cups debug doc examples gentoo-vm headless-awt javafx jbootstrap selinux source +system-bootstrap systemtap" |
102 |
+ |
103 |
+REQUIRED_USE=" |
104 |
+ javafx? ( alsa !headless-awt ) |
105 |
+ !system-bootstrap? ( jbootstrap ) |
106 |
+" |
107 |
+ |
108 |
+COMMON_DEPEND=" |
109 |
+ media-libs/freetype:2= |
110 |
+ media-libs/giflib:0/7 |
111 |
+ media-libs/harfbuzz:= |
112 |
+ media-libs/libpng:0= |
113 |
+ media-libs/lcms:2= |
114 |
+ sys-libs/zlib |
115 |
+ virtual/jpeg:0= |
116 |
+ systemtap? ( dev-util/systemtap ) |
117 |
+" |
118 |
+ |
119 |
+# Many libs are required to build, but not to run, make is possible to remove |
120 |
+# by listing conditionally in RDEPEND unconditionally in DEPEND |
121 |
+RDEPEND=" |
122 |
+ ${COMMON_DEPEND} |
123 |
+ >=sys-apps/baselayout-java-0.1.0-r1 |
124 |
+ !headless-awt? ( |
125 |
+ x11-libs/libX11 |
126 |
+ x11-libs/libXext |
127 |
+ x11-libs/libXi |
128 |
+ x11-libs/libXrandr |
129 |
+ x11-libs/libXrender |
130 |
+ x11-libs/libXt |
131 |
+ x11-libs/libXtst |
132 |
+ ) |
133 |
+ alsa? ( media-libs/alsa-lib ) |
134 |
+ cups? ( net-print/cups ) |
135 |
+ selinux? ( sec-policy/selinux-java ) |
136 |
+" |
137 |
+ |
138 |
+DEPEND=" |
139 |
+ ${COMMON_DEPEND} |
140 |
+ app-arch/zip |
141 |
+ media-libs/alsa-lib |
142 |
+ net-print/cups |
143 |
+ x11-base/xorg-proto |
144 |
+ x11-libs/libX11 |
145 |
+ x11-libs/libXext |
146 |
+ x11-libs/libXi |
147 |
+ x11-libs/libXrandr |
148 |
+ x11-libs/libXrender |
149 |
+ x11-libs/libXt |
150 |
+ x11-libs/libXtst |
151 |
+ javafx? ( dev-java/openjfx:${SLOT}= ) |
152 |
+ system-bootstrap? ( |
153 |
+ || ( |
154 |
+ dev-java/openjdk-bin:18 |
155 |
+ dev-java/openjdk:18 |
156 |
+ dev-java/openjdk-bin:${SLOT} |
157 |
+ dev-java/openjdk:${SLOT} |
158 |
+ ) |
159 |
+ ) |
160 |
+" |
161 |
+ |
162 |
+# The space required to build varies wildly depending on USE flags, |
163 |
+# ranging from 2GB to 16GB. This function is certainly not exact but |
164 |
+# should be close enough to be useful. |
165 |
+openjdk_check_requirements() { |
166 |
+ local M |
167 |
+ M=2048 |
168 |
+ M=$(( $(usex jbootstrap 2 1) * $M )) |
169 |
+ M=$(( $(usex debug 3 1) * $M )) |
170 |
+ M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M )) |
171 |
+ |
172 |
+ CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE} |
173 |
+} |
174 |
+ |
175 |
+pkg_pretend() { |
176 |
+ openjdk_check_requirements |
177 |
+ if [[ ${MERGE_TYPE} != binary ]]; then |
178 |
+ has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}, bug #677876" |
179 |
+ fi |
180 |
+} |
181 |
+ |
182 |
+pkg_setup() { |
183 |
+ openjdk_check_requirements |
184 |
+ java-vm-2_pkg_setup |
185 |
+ |
186 |
+ [[ ${MERGE_TYPE} == "binary" ]] && return |
187 |
+ |
188 |
+ JAVA_PKG_WANT_BUILD_VM="openjdk-18 openjdk-bin-18 openjdk-${SLOT} openjdk-bin-${SLOT}" |
189 |
+ JAVA_PKG_WANT_SOURCE="${SLOT}" |
190 |
+ JAVA_PKG_WANT_TARGET="${SLOT}" |
191 |
+ |
192 |
+ # The nastiness below is necessary while the gentoo-vm USE flag is |
193 |
+ # masked. First we call java-pkg-2_pkg_setup if it looks like the |
194 |
+ # flag was unmasked against one of the possible build VMs. If not, |
195 |
+ # we try finding one of them in their expected locations. This would |
196 |
+ # have been slightly less messy if openjdk-bin had been installed to |
197 |
+ # /opt/${PN}-${SLOT} or if there was a mechanism to install a VM env |
198 |
+ # file but disable it so that it would not normally be selectable. |
199 |
+ |
200 |
+ local vm |
201 |
+ for vm in ${JAVA_PKG_WANT_BUILD_VM}; do |
202 |
+ if [[ -d ${EPREFIX}/usr/lib/jvm/${vm} ]]; then |
203 |
+ java-pkg-2_pkg_setup |
204 |
+ return |
205 |
+ fi |
206 |
+ done |
207 |
+ |
208 |
+ if has_version dev-java/openjdk:${SLOT}; then |
209 |
+ export JDK_HOME=${EPREFIX}/usr/$(get_libdir)/openjdk-${SLOT} |
210 |
+ elif use !system-bootstrap ; then |
211 |
+ local xpakvar="${ARCH^^}_XPAK" |
212 |
+ export JDK_HOME="${WORKDIR}/openjdk-bootstrap-${!xpakvar}" |
213 |
+ else |
214 |
+ JDK_HOME=$(best_version dev-java/openjdk-bin:${SLOT}) |
215 |
+ [[ -n ${JDK_HOME} ]] || die "Build VM not found!" |
216 |
+ JDK_HOME=${JDK_HOME#*/} |
217 |
+ JDK_HOME=${EPREFIX}/opt/${JDK_HOME%-r*} |
218 |
+ export JDK_HOME |
219 |
+ fi |
220 |
+} |
221 |
+ |
222 |
+src_prepare() { |
223 |
+ default |
224 |
+ chmod +x configure || die |
225 |
+} |
226 |
+ |
227 |
+src_configure() { |
228 |
+ # Work around stack alignment issue, bug #647954. in case we ever have x86 |
229 |
+ use x86 && append-flags -mincoming-stack-boundary=2 |
230 |
+ |
231 |
+ # Work around -fno-common ( GCC10 default ), bug #713180 |
232 |
+ append-flags -fcommon |
233 |
+ |
234 |
+ # Strip some flags users may set, but should not. #818502 |
235 |
+ filter-flags -fexceptions |
236 |
+ |
237 |
+ # Enabling full docs appears to break doc building. If not |
238 |
+ # explicitly disabled, the flag will get auto-enabled if pandoc and |
239 |
+ # graphviz are detected. pandoc has loads of dependencies anyway. |
240 |
+ |
241 |
+ local version_build=1 |
242 |
+ |
243 |
+ local myconf=( |
244 |
+ --disable-ccache |
245 |
+ --disable-precompiled-headers |
246 |
+ --disable-warnings-as-errors |
247 |
+ --enable-full-docs=no |
248 |
+ --with-boot-jdk="${JDK_HOME}" |
249 |
+ --with-extra-cflags="${CFLAGS}" |
250 |
+ --with-extra-cxxflags="${CXXFLAGS}" |
251 |
+ --with-extra-ldflags="${LDFLAGS}" |
252 |
+ --with-freetype="${XPAK_BOOTSTRAP:-system}" |
253 |
+ --with-giflib="${XPAK_BOOTSTRAP:-system}" |
254 |
+ --with-harfbuzz="${XPAK_BOOTSTRAP:-system}" |
255 |
+ --with-lcms="${XPAK_BOOTSTRAP:-system}" |
256 |
+ --with-libjpeg="${XPAK_BOOTSTRAP:-system}" |
257 |
+ --with-libpng="${XPAK_BOOTSTRAP:-system}" |
258 |
+ --with-native-debug-symbols=$(usex debug internal none) |
259 |
+ --with-vendor-name="Gentoo" |
260 |
+ --with-vendor-url="https://gentoo.org" |
261 |
+ --with-vendor-bug-url="https://bugs.gentoo.org" |
262 |
+ --with-vendor-vm-bug-url="https://bugs.openjdk.java.net" |
263 |
+ --with-vendor-version-string="${PVR}" |
264 |
+ --with-version-pre="" |
265 |
+ --with-version-string="${PV%_p*}" |
266 |
+ --with-version-pre="${PV#*_pre}" |
267 |
+ --with-zlib="${XPAK_BOOTSTRAP:-system}" |
268 |
+ --enable-dtrace=$(usex systemtap yes no) |
269 |
+ --enable-headless-only=$(usex headless-awt yes no) |
270 |
+ $(tc-is-clang && echo "--with-toolchain-type=clang") |
271 |
+ ) |
272 |
+ |
273 |
+ if use javafx; then |
274 |
+ local zip="${EPREFIX}/usr/$(get_libdir)/openjfx-${SLOT}/javafx-exports.zip" |
275 |
+ if [[ -r ${zip} ]]; then |
276 |
+ myconf+=( --with-import-modules="${zip}" ) |
277 |
+ else |
278 |
+ die "${zip} not found or not readable" |
279 |
+ fi |
280 |
+ fi |
281 |
+ |
282 |
+ if use !system-bootstrap ; then |
283 |
+ addpredict /dev/random |
284 |
+ addpredict /proc/self/coredump_filter |
285 |
+ fi |
286 |
+ |
287 |
+ ( |
288 |
+ unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC XARGS |
289 |
+ CFLAGS= CXXFLAGS= LDFLAGS= \ |
290 |
+ CONFIG_SITE=/dev/null \ |
291 |
+ econf "${myconf[@]}" |
292 |
+ ) |
293 |
+} |
294 |
+ |
295 |
+src_compile() { |
296 |
+ local myemakeargs=( |
297 |
+ JOBS=$(makeopts_jobs) |
298 |
+ LOG=debug |
299 |
+ CFLAGS_WARNINGS_ARE_ERRORS= # No -Werror |
300 |
+ NICE= # Use PORTAGE_NICENESS, don't adjust further down |
301 |
+ $(usex doc docs '') |
302 |
+ $(usex jbootstrap bootcycle-images product-images) |
303 |
+ ) |
304 |
+ emake "${myemakeargs[@]}" -j1 #nowarn |
305 |
+} |
306 |
+ |
307 |
+src_install() { |
308 |
+ local dest="/usr/$(get_libdir)/${PN}-${SLOT}" |
309 |
+ local ddest="${ED}/${dest#/}" |
310 |
+ |
311 |
+ cd "${S}"/build/*-release/images/jdk || die |
312 |
+ |
313 |
+ # Create files used as storage for system preferences. |
314 |
+ mkdir .systemPrefs || die |
315 |
+ touch .systemPrefs/.system.lock || die |
316 |
+ touch .systemPrefs/.systemRootModFile || die |
317 |
+ |
318 |
+ # Oracle and IcedTea have libjsoundalsa.so depending on |
319 |
+ # libasound.so.2 but OpenJDK only has libjsound.so. Weird. |
320 |
+ if ! use alsa ; then |
321 |
+ rm -v lib/libjsound.* || die |
322 |
+ fi |
323 |
+ |
324 |
+ if ! use examples ; then |
325 |
+ rm -vr demo/ || die |
326 |
+ fi |
327 |
+ |
328 |
+ if ! use source ; then |
329 |
+ rm -v lib/src.zip || die |
330 |
+ fi |
331 |
+ |
332 |
+ rm -v lib/security/cacerts || die |
333 |
+ |
334 |
+ dodir "${dest}" |
335 |
+ cp -pPR * "${ddest}" || die |
336 |
+ |
337 |
+ dosym -r /etc/ssl/certs/java/cacerts "${dest}"/lib/security/cacerts |
338 |
+ |
339 |
+ # must be done before running itself |
340 |
+ java-vm_set-pax-markings "${ddest}" |
341 |
+ |
342 |
+ einfo "Creating the Class Data Sharing archives and disabling usage tracking" |
343 |
+ "${ddest}/bin/java" -server -Xshare:dump -Djdk.disableLastUsageTracking || die |
344 |
+ |
345 |
+ use gentoo-vm && java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh |
346 |
+ java-vm_revdep-mask |
347 |
+ java-vm_sandbox-predict /dev/random /proc/self/coredump_filter |
348 |
+ |
349 |
+ if use doc ; then |
350 |
+ docinto html |
351 |
+ dodoc -r "${S}"/build/*-release/images/docs/* |
352 |
+ dosym ../../../usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}" |
353 |
+ fi |
354 |
+} |
355 |
+ |
356 |
+pkg_postinst() { |
357 |
+ java-vm-2_pkg_postinst |
358 |
+ |
359 |
+ if use gentoo-vm ; then |
360 |
+ ewarn "WARNING! You have enabled the gentoo-vm USE flag, making this JDK" |
361 |
+ ewarn "recognised by the system. This will almost certainly break" |
362 |
+ ewarn "many java ebuilds as they are not ready for openjdk-${SLOT}" |
363 |
+ else |
364 |
+ ewarn "The experimental gentoo-vm USE flag has not been enabled so this JDK" |
365 |
+ ewarn "will not be recognised by the system. For example, simply calling" |
366 |
+ ewarn "\"java\" will launch a different JVM. This is necessary until Gentoo" |
367 |
+ ewarn "fully supports Java ${SLOT}. This JDK must therefore be invoked using its" |
368 |
+ ewarn "absolute location under ${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}." |
369 |
+ fi |
370 |
+} |