Gentoo Archives: gentoo-commits

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