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: Sat, 01 Jun 2019 11:35:28
Message-Id: 1559388902.5d3963e40833c5f068408bc8a725b5d9d9a6e8d7.gyakovlev@gentoo
1 commit: 5d3963e40833c5f068408bc8a725b5d9d9a6e8d7
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jun 1 11:34:44 2019 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Sat Jun 1 11:35:02 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5d3963e4
7
8 dev-java/openjdk: revbump :11, some fixes and javafx useflag
9
10 Package-Manager: Portage-2.3.67, Repoman-2.3.13
11 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
12
13 dev-java/openjdk/metadata.xml | 1 +
14 dev-java/openjdk/openjdk-11.0.3_p7-r4.ebuild | 262 +++++++++++++++++++++++++++
15 2 files changed, 263 insertions(+)
16
17 diff --git a/dev-java/openjdk/metadata.xml b/dev-java/openjdk/metadata.xml
18 index 302f5698035..c9555ad9e77 100644
19 --- a/dev-java/openjdk/metadata.xml
20 +++ b/dev-java/openjdk/metadata.xml
21 @@ -20,6 +20,7 @@
22 <use>
23 <flag name="headless-awt">Don't install the X backend for AWT, needed by some GUIs</flag>
24 <flag name="gentoo-vm">Allow this JDK to be recognised by Gentoo (package manager, eselect, java-config, EXPERIMENTAL!)</flag>
25 + <flag name="javafx" restrict="&gt;=dev-java/openjdk-11">Import OpenJFX modules at build time, via <pkg>dev-java/openjfx</pkg></flag>
26 <flag name="jbootstrap">Build OpenJDK twice, the second time using the result of the first</flag>
27 <flag name="source">Install JVM sources</flag>
28 <flag name="systemtap" restrict="&gt;=dev-java/openjdk-11">Enable SystemTAP/DTrace tracing</flag>
29
30 diff --git a/dev-java/openjdk/openjdk-11.0.3_p7-r4.ebuild b/dev-java/openjdk/openjdk-11.0.3_p7-r4.ebuild
31 new file mode 100644
32 index 00000000000..ad003801a22
33 --- /dev/null
34 +++ b/dev-java/openjdk/openjdk-11.0.3_p7-r4.ebuild
35 @@ -0,0 +1,262 @@
36 +# Copyright 1999-2019 Gentoo Authors
37 +# Distributed under the terms of the GNU General Public License v2
38 +
39 +EAPI=6
40 +
41 +inherit autotools check-reqs flag-o-matic java-pkg-2 java-vm-2 multiprocessing pax-utils toolchain-funcs
42 +
43 +MY_PV=${PV/_p/+}
44 +SLOT=${MY_PV%%[.+]*}
45 +
46 +DESCRIPTION="Open source implementation of the Java programming language"
47 +HOMEPAGE="https://openjdk.java.net"
48 +SRC_URI="https://hg.${PN}.java.net/jdk-updates/jdk${SLOT}u/archive/jdk-${MY_PV}.tar.bz2"
49 +
50 +LICENSE="GPL-2"
51 +KEYWORDS="~amd64 ~arm64 ~ppc64"
52 +
53 +IUSE="alsa cups debug doc examples gentoo-vm headless-awt javafx +jbootstrap nsplugin +pch selinux source systemtap +webstart"
54 +
55 +COMMON_DEPEND="
56 + media-libs/freetype:2=
57 + media-libs/giflib:0/7
58 + media-libs/libpng:0=
59 + media-libs/lcms:2=
60 + sys-libs/zlib
61 + virtual/jpeg:0=
62 + systemtap? ( dev-util/systemtap )
63 +"
64 +
65 +# Many libs are required to build, but not to run, make is possible to remove
66 +# by listing conditionally in RDEPEND unconditionally in DEPEND
67 +RDEPEND="
68 + ${COMMON_DEPEND}
69 + >=sys-apps/baselayout-java-0.1.0-r1
70 + !headless-awt? (
71 + x11-libs/libX11
72 + x11-libs/libXext
73 + x11-libs/libXi
74 + x11-libs/libXrender
75 + x11-libs/libXt
76 + x11-libs/libXtst
77 + )
78 + alsa? ( media-libs/alsa-lib )
79 + cups? ( net-print/cups )
80 + selinux? ( sec-policy/selinux-java )
81 +"
82 +
83 +DEPEND="
84 + ${COMMON_DEPEND}
85 + app-arch/zip
86 + media-libs/alsa-lib
87 + net-print/cups
88 + x11-base/xorg-proto
89 + x11-libs/libX11
90 + x11-libs/libXext
91 + x11-libs/libXi
92 + x11-libs/libXrender
93 + x11-libs/libXt
94 + x11-libs/libXtst
95 + javafx? ( dev-java/openjfx:${SLOT} )
96 + || (
97 + dev-java/openjdk-bin:${SLOT}
98 + dev-java/openjdk:${SLOT}
99 + )
100 +"
101 +
102 +PDEPEND="
103 + webstart? ( >=dev-java/icedtea-web-1.6.1:0 )
104 + nsplugin? ( >=dev-java/icedtea-web-1.6.1:0[nsplugin] )
105 +"
106 +
107 +REQUIRED_USE="javafx? ( alsa !headless-awt )"
108 +
109 +S="${WORKDIR}/jdk${SLOT}u-jdk-${MY_PV}"
110 +
111 +# The space required to build varies wildly depending on USE flags,
112 +# ranging from 2GB to 16GB. This function is certainly not exact but
113 +# should be close enough to be useful.
114 +openjdk_check_requirements() {
115 + local M
116 + M=2048
117 + M=$(( $(usex jbootstrap 2 1) * $M ))
118 + M=$(( $(usex debug 3 1) * $M ))
119 + M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
120 +
121 + CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
122 +}
123 +
124 +pkg_pretend() {
125 + openjdk_check_requirements
126 + has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}"
127 +}
128 +
129 +pkg_setup() {
130 + openjdk_check_requirements
131 + java-vm-2_pkg_setup
132 +
133 + JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT}"
134 + JAVA_PKG_WANT_SOURCE="${SLOT}"
135 + JAVA_PKG_WANT_TARGET="${SLOT}"
136 +
137 + # The nastiness below is necessary while the gentoo-vm USE flag is
138 + # masked. First we call java-pkg-2_pkg_setup if it looks like the
139 + # flag was unmasked against one of the possible build VMs. If not,
140 + # we try finding one of them in their expected locations. This would
141 + # have been slightly less messy if openjdk-bin had been installed to
142 + # /opt/${PN}-${SLOT} or if there was a mechanism to install a VM env
143 + # file but disable it so that it would not normally be selectable.
144 +
145 + local vm
146 + for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
147 + if [[ -d ${EPREFIX}/usr/lib/jvm/${vm} ]]; then
148 + java-pkg-2_pkg_setup
149 + return
150 + fi
151 + done
152 +
153 + if has_version --host-root dev-java/openjdk:${SLOT}; then
154 + export JDK_HOME=${EPREFIX}/usr/$(get_libdir)/openjdk-${SLOT}
155 + else
156 + if [[ ${MERGE_TYPE} != "binary" ]]; then
157 + JDK_HOME=$(best_version --host-root dev-java/openjdk-bin:${SLOT})
158 + [[ -n ${JDK_HOME} ]] || die "Build VM not found!"
159 + JDK_HOME=${JDK_HOME#*/}
160 + JDK_HOME=${EPREFIX}/opt/${JDK_HOME%-r*}
161 + export JDK_HOME
162 + fi
163 + fi
164 +}
165 +
166 +src_prepare() {
167 + default
168 + chmod +x configure || die
169 +}
170 +
171 +src_configure() {
172 + # Work around stack alignment issue, bug #647954. in case we ever have x86
173 + use x86 && append-flags -mincoming-stack-boundary=2
174 +
175 + # Enabling full docs appears to break doc building. If not
176 + # explicitly disabled, the flag will get auto-enabled if pandoc and
177 + # graphviz are detected. pandoc has loads of dependencies anyway.
178 +
179 + local myconf=(
180 + --disable-ccache
181 + --enable-full-docs=no
182 + --with-boot-jdk="${JDK_HOME}"
183 + --with-extra-cflags="${CFLAGS}"
184 + --with-extra-cxxflags="${CXXFLAGS}"
185 + --with-extra-ldflags="${LDFLAGS}"
186 + --with-giflib=system
187 + --with-lcms=system
188 + --with-libjpeg=system
189 + --with-libpng=system
190 + --with-native-debug-symbols=$(usex debug internal none)
191 + --with-vendor-name="Gentoo"
192 + --with-vendor-url="https://gentoo.org"
193 + --with-vendor-bug-url="https://bugs.gentoo.org"
194 + --with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
195 + --with-vendor-version-string="${PV}"
196 + --with-version-pre=gentoo
197 + --with-version-string=${MY_PV%+*}
198 + --with-version-build=${MY_PV#*+}
199 + --with-zlib=system
200 + --enable-dtrace=$(usex systemtap yes no)
201 + --enable-headless-only=$(usex headless-awt yes no)
202 + )
203 +
204 + if use javafx; then
205 + local zip="${EROOT%/}/usr/$(get_libdir)/openjfx-${SLOT}/javafx-exports.zip"
206 + if [[ -r ${zip} ]]; then
207 + myconf+=( --with-import-modules="${zip}" )
208 + else
209 + die "${zip} not found or not readable"
210 + fi
211 + fi
212 +
213 + # PaX breaks pch, bug #601016
214 + if use pch && ! host-is-pax; then
215 + myconf+=( --enable-precompiled-headers )
216 + else
217 + myconf+=( --disable-precompiled-headers )
218 + fi
219 +
220 + (
221 + unset _JAVA_OPTIONS JAVA JAVAC XARGS
222 + CFLAGS= CXXFLAGS= LDFLAGS= \
223 + CONFIG_SITE=/dev/null \
224 + econf "${myconf[@]}"
225 + )
226 +}
227 +
228 +src_compile() {
229 + emake -j1 \
230 + $(usex doc docs '') \
231 + $(usex jbootstrap bootcycle-images product-images) \
232 + JOBS=$(makeopts_jobs) LOG=debug CFLAGS_WARNINGS_ARE_ERRORS= # No -Werror
233 +}
234 +
235 +src_install() {
236 + local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
237 + local ddest="${ED}${dest#/}"
238 +
239 + cd "${S}"/build/*-release/images/jdk || die
240 +
241 + # Create files used as storage for system preferences.
242 + mkdir .systemPrefs || die
243 + touch .systemPrefs/.system.lock || die
244 + touch .systemPrefs/.systemRootModFile || die
245 +
246 + # Oracle and IcedTea have libjsoundalsa.so depending on
247 + # libasound.so.2 but OpenJDK only has libjsound.so. Weird.
248 + if ! use alsa ; then
249 + rm -v lib/libjsound.* || die
250 + fi
251 +
252 + if ! use examples ; then
253 + rm -vr demo/ || die
254 + fi
255 +
256 + if ! use source ; then
257 + rm -v lib/src.zip || die
258 + fi
259 +
260 + mv lib/security/cacerts lib/security/cacerts.orig || die
261 +
262 + dodir "${dest}"
263 + cp -pPR * "${ddest}" || die
264 +
265 + dosym "${EPREFIX}"/etc/ssl/certs/java/cacerts "${dest}"/lib/security/cacerts
266 +
267 + # must be done before running itself
268 + java-vm_set-pax-markings "${ddest}"
269 +
270 + einfo "Creating the Class Data Sharing archives and disabling usage tracking"
271 + "${ddest}/bin/java" -server -Xshare:dump -Djdk.disableLastUsageTracking || die
272 +
273 + use gentoo-vm && java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
274 + java-vm_revdep-mask
275 + java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
276 +
277 + if use doc ; then
278 + insinto /usr/share/doc/"${PF}"/html
279 + doins -r "${S}"/build/*-release/images/docs/*
280 + dosym /usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}"
281 + fi
282 +}
283 +
284 +pkg_postinst() {
285 + java-vm-2_pkg_postinst
286 +
287 + if use gentoo-vm ; then
288 + ewarn "WARNING! You have enabled the gentoo-vm USE flag, making this JDK"
289 + ewarn "recognised by the system. This will almost certainly break things."
290 + else
291 + ewarn "The experimental gentoo-vm USE flag has not been enabled so this JDK"
292 + ewarn "will not be recognised by the system. For example, simply calling"
293 + ewarn "\"java\" will launch a different JVM. This is necessary until Gentoo"
294 + ewarn "fully supports Java ${SLOT}. This JDK must therefore be invoked using its"
295 + ewarn "absolute location under ${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}."
296 + fi
297 +}