public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] rfc: java-vm-2.eclass eapi 8 support
@ 2021-11-27  9:54 Miroslav Šulc
  2021-11-27 15:58 ` Sam James
  0 siblings, 1 reply; 2+ messages in thread
From: Miroslav Šulc @ 2021-11-27  9:54 UTC (permalink / raw
  To: gentoo-dev@lists.gentoo.org, java

[-- Attachment #1: Type: text/plain, Size: 1152 bytes --]

hello devs,

please find attached patch for upgrade of java-vm-2.eclass to support 
eapi 8. eapi 5 is not used by any package inheriting this eclass so i 
dropped it.

i also attach update of the ebuilds of packages that use this eclass and 
can be updated to eapi 8 (dev-java/icedtea can't atm, it also inherits 
another java eclass that does not support eapi 8 yet, and 
dev-java/gcj-jdk is masked in profiles/releases/17.0/package.mask). all 
works fine except dev-java/openjdk (all slots) where the configuration 
phase fails or does not finish correctly. all those packages merge fine 
with eapi 6 (in-tree ebuilds).

openjdk:8 - configuration finishes but no configuration file is created 
(and hence compilation fails) as during the configuration phase it 
complains with this:
configure: error: Could not find freetype!

openjdk:11 and openjdk:17 - configuration fails with this error (i was 
told by sam it is a known bug):
configure: error: unrecognized options: --disable-static

i'd like to merge the patches asap (except the broken openjdk) so please 
let me know if you find anything that could be improved or all's ok.

thanks

fordfrog

[-- Attachment #2: java-vm-2.eclass-eapi8.patch --]
[-- Type: text/x-patch, Size: 898 bytes --]

diff --git a/eclass/java-vm-2.eclass b/eclass/java-vm-2.eclass
index 5f14493f18a1..d24339200ce0 100644
--- a/eclass/java-vm-2.eclass
+++ b/eclass/java-vm-2.eclass
@@ -4,14 +4,14 @@
 # @ECLASS: java-vm-2.eclass
 # @MAINTAINER:
 # java@gentoo.org
-# @SUPPORTED_EAPIS: 5 6
+# @SUPPORTED_EAPIS: 6 8
 # @BLURB: Java Virtual Machine eclass
 # @DESCRIPTION:
 # This eclass provides functionality which assists with installing
 # virtual machines, and ensures that they are recognized by java-config.
 
 case ${EAPI:-0} in
-	5|6) ;;
+	[68]) ;;
 	*) die "EAPI=${EAPI} is not supported" ;;
 esac
 
@@ -20,8 +20,9 @@ inherit multilib pax-utils prefix xdg-utils
 EXPORT_FUNCTIONS pkg_setup pkg_postinst pkg_prerm pkg_postrm
 
 RDEPEND="
-	>=dev-java/java-config-2.2.0-r3
-	>=app-eselect/eselect-java-0.4.0"
+	dev-java/java-config
+	app-eselect/eselect-java
+"
 DEPEND="${RDEPEND}"
 
 export WANT_JAVA_CONFIG=2

[-- Attachment #3: java-vm-2-ebuilds-eapi8.patch --]
[-- Type: text/x-patch, Size: 45490 bytes --]

diff --git a/dev-java/icedtea-bin/icedtea-bin-3.16.0-r1.ebuild b/dev-java/icedtea-bin/icedtea-bin-3.16.0-r1.ebuild
new file mode 100644
index 000000000000..79aca0a922b8
--- /dev/null
+++ b/dev-java/icedtea-bin/icedtea-bin-3.16.0-r1.ebuild
@@ -0,0 +1,132 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit java-vm-2 toolchain-funcs
+
+abi_uri() {
+	echo "${2-$1}? (
+			${BASE_URI}/${PN}-core-${PV}${3+-r${3}}-${1}.tar.xz
+			examples? ( ${BASE_URI}/${PN}-examples-${PV}${3+-r${3}}-${1}.tar.xz )
+		)"
+}
+
+BASE_URI="https://dev.gentoo.org/~gyakovlev/distfiles"
+SRC_URI="
+	doc? ( ${BASE_URI}/${PN}-doc-${PV}.tar.xz )
+	source? ( ${BASE_URI}/${PN}-src-${PV}.tar.xz )
+	big-endian? ( $(abi_uri ppc64) )
+	!big-endian? ( $(abi_uri ppc64le ppc64) )
+	$(abi_uri amd64)
+	$(abi_uri arm)
+	$(abi_uri arm64)
+	$(abi_uri x86)
+"
+
+DESCRIPTION="A Gentoo-made binary build of the IcedTea JDK"
+HOMEPAGE="http://icedtea.classpath.org"
+
+LICENSE="GPL-2-with-classpath-exception"
+SLOT="8"
+KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc64 ~x86"
+IUSE="+alsa big-endian cups doc examples +gtk headless-awt pulseaudio selinux source"
+
+REQUIRED_USE="gtk? ( !headless-awt )"
+
+RESTRICT="preserve-libs strip"
+QA_PREBUILT="opt/.*"
+
+DEPEND="app-arch/xz-utils"
+
+RDEPEND="
+	>=dev-libs/glib-2.60.7:2
+	>=media-libs/fontconfig-2.13:1.0
+	>=media-libs/freetype-2.9.1:2
+	>=media-libs/lcms-2.9:2
+	>=sys-apps/baselayout-java-0.1.0-r1
+	>=sys-libs/zlib-1.2.11-r2
+	virtual/jpeg-compat:62
+	alsa? ( >=media-libs/alsa-lib-1.2 )
+	cups? ( >=net-print/cups-2.0 )
+	gtk? (
+		>=dev-libs/atk-2.32.0
+		>=x11-libs/cairo-1.16.0
+		x11-libs/gdk-pixbuf:2
+		>=x11-libs/gtk+-2.24:2
+		>=x11-libs/pango-1.42
+	)
+	selinux? ( sec-policy/selinux-java )
+	virtual/ttf-fonts
+	!headless-awt? (
+		media-libs/giflib:0/7
+		=media-libs/libpng-1.6*
+		>=x11-libs/libX11-1.6
+		>=x11-libs/libXcomposite-0.4
+		>=x11-libs/libXext-1.3
+		>=x11-libs/libXi-1.7
+		>=x11-libs/libXrender-0.9.10
+		>=x11-libs/libXtst-1.2
+	)
+"
+
+PDEPEND="pulseaudio? ( dev-java/icedtea-sound )"
+
+S="${WORKDIR}"
+
+pkg_pretend() {
+	if [[ "$(tc-is-softfloat)" != "no" ]]; then
+		die "These binaries require a hardfloat system."
+	fi
+}
+
+src_prepare() {
+	default
+
+	# I wouldn't normally use -f below but symlinks in the arm files
+	# make this fail otherwise and any other approach would be tedious.
+
+	if ! use alsa; then
+		rm -fv */jre/lib/*/libjsoundalsa.* || die
+	fi
+
+	if use headless-awt; then
+		rm -fvr */jre/lib/*/lib*{[jx]awt,splashscreen}* \
+		   */{,jre/}bin/policytool */bin/appletviewer || die
+	fi
+}
+
+src_install() {
+	local dest="/opt/${P}"
+	local ddest="${ED}/${dest#/}"
+	dodir "${dest}"
+
+	dodoc ${P}-${ABI}/doc/{ASSEMBLY_EXCEPTION,AUTHORS,NEWS,README,THIRD_PARTY_README}
+	use doc && dodoc -r ${P}/doc/html
+
+	# doins doesn't preserve executable bits.
+	cp -pRP ${P}-${ABI}/{bin,include,jre,lib,man} "${ddest}" || die
+
+	if use examples; then
+		cp -pRP ${P}-${ABI}/{demo,sample} "${ddest}" || die
+	fi
+
+	if use source; then
+		cp ${P}/src.zip "${ddest}" || die
+	fi
+
+	# use system-wide cacert store
+	rm "${ddest}"/jre/lib/security/cacerts || die
+	dosym ../../../../../etc/ssl/certs/java/cacerts "${dest}"/jre/lib/security/cacerts
+
+	java-vm_install-env "${FILESDIR}/icedtea-bin.env.sh"
+
+	# Both icedtea itself and the icedtea ebuild set PAX markings but we
+	# disable them for the icedtea-bin build because the line below will
+	# respect end-user settings when icedtea-bin is actually installed.
+	java-vm_set-pax-markings "${ddest}"
+
+	# Each invocation appends to the config.
+	java-vm_revdep-mask "${EPREFIX}${dest}"
+	java-vm_sandbox-predict /proc/self/coredump_filter
+}
diff --git a/dev-java/openjdk-bin/openjdk-bin-11.0.13_p8-r1.ebuild b/dev-java/openjdk-bin/openjdk-bin-11.0.13_p8-r1.ebuild
new file mode 100644
index 000000000000..95bcdeba00a6
--- /dev/null
+++ b/dev-java/openjdk-bin/openjdk-bin-11.0.13_p8-r1.ebuild
@@ -0,0 +1,136 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit java-vm-2 toolchain-funcs
+
+abi_uri() {
+	local os=linux
+	case ${2} in
+		*-macos)    os=mac      ;;
+		*-solaris)  os=solaris  ;;
+	esac
+	echo "${2-$1}? (
+			https://github.com/adoptium/temurin${SLOT}-binaries/releases/download/jdk-${MY_PV}/OpenJDK${SLOT}U-jdk_${1}_${os}_hotspot_${MY_PV//+/_}.tar.gz
+		)"
+}
+
+MY_PV=${PV/_p/+}
+SLOT=${MY_PV%%[.+]*}
+
+SRC_URI="
+	$(abi_uri arm)
+	$(abi_uri aarch64 arm64)
+	$(abi_uri ppc64le ppc64)
+	$(abi_uri x64 amd64)
+	$(abi_uri x64 x64-macos)
+"
+
+DESCRIPTION="Prebuilt Java JDK binaries provided by Eclipse Temurin"
+HOMEPAGE="https://adoptium.net"
+LICENSE="GPL-2-with-classpath-exception"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x64-macos"
+IUSE="alsa cups +gentoo-vm headless-awt selinux source"
+
+RDEPEND="
+	>=sys-apps/baselayout-java-0.1.0-r1
+	kernel_linux? (
+		media-libs/fontconfig:1.0
+		media-libs/freetype:2
+		media-libs/harfbuzz
+		>=sys-libs/glibc-2.2.5:*
+		sys-libs/zlib
+		alsa? ( media-libs/alsa-lib )
+		cups? ( net-print/cups )
+		selinux? ( sec-policy/selinux-java )
+		!headless-awt? (
+			x11-libs/libX11
+			x11-libs/libXext
+			x11-libs/libXi
+			x11-libs/libXrender
+			x11-libs/libXtst
+		)
+	)"
+
+RESTRICT="preserve-libs splitdebug"
+QA_PREBUILT="*"
+
+S="${WORKDIR}/jdk-${MY_PV}"
+
+pkg_pretend() {
+	if [[ "$(tc-is-softfloat)" != "no" ]]; then
+		die "These binaries require a hardfloat system."
+	fi
+}
+
+src_unpack() {
+	default
+	if [[ ${A} == *_mac_* ]] ; then
+		mv -v "${S}/Contents/Home/"* "${S}" || die
+		rm -Rf "${S}/Contents"  # drop macOS executable
+	fi
+}
+
+src_install() {
+	local dest="/opt/${P}"
+	local ddest="${ED%/}/${dest#/}"
+
+	# on macOS if they would exist they would be called .dylib, but most
+	# importantly, there are no different providers, so everything
+	# that's shipped works.
+	if [[ ${A} != *_mac_* ]] ; then
+		# Not sure why they bundle this as it's commonly available and they
+		# only do so on x86_64. It's needed by libfontmanager.so. IcedTea
+		# also has an explicit dependency while Oracle seemingly dlopens it.
+		rm -vf lib/libfreetype.so || die
+
+		# prefer system copy # https://bugs.gentoo.org/776676
+		rm -vf lib/libharfbuzz.so || die
+
+		# Oracle and IcedTea have libjsoundalsa.so depending on
+		# libasound.so.2 but AdoptOpenJDK only has libjsound.so. Weird.
+		if ! use alsa ; then
+			rm -v lib/libjsound.* || die
+		fi
+
+		if use headless-awt ; then
+			rm -v lib/lib*{[jx]awt,splashscreen}* || die
+		fi
+	fi
+
+	if ! use source ; then
+		rm -v lib/src.zip || die
+	fi
+
+	rm -v lib/security/cacerts || die
+	dosym ../../../../etc/ssl/certs/java/cacerts \
+		"${dest}"/lib/security/cacerts
+
+	dodir "${dest}"
+	cp -pPR * "${ddest}" || die
+
+	# provide stable symlink
+	dosym "${P}" "/opt/${PN}-${SLOT}"
+
+	use gentoo-vm && java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
+	java-vm_set-pax-markings "${ddest}"
+	java-vm_revdep-mask
+	java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
+}
+
+pkg_postinst() {
+	java-vm-2_pkg_postinst
+
+	if use gentoo-vm ; then
+		ewarn "WARNING! You have enabled the gentoo-vm USE flag, making this JDK"
+		ewarn "recognised by the system. This will almost certainly break"
+		ewarn "many java ebuilds as they are not ready for openjdk-11"
+	else
+		ewarn "The experimental gentoo-vm USE flag has not been enabled so this JDK"
+		ewarn "will not be recognised by the system. For example, simply calling"
+		ewarn "\"java\" will launch a different JVM. This is necessary until Gentoo"
+		ewarn "fully supports Java 11. This JDK must therefore be invoked using its"
+		ewarn "absolute location under ${EPREFIX}/opt/${P}."
+	fi
+}
diff --git a/dev-java/openjdk-bin/openjdk-bin-17.0.1_p12-r1.ebuild b/dev-java/openjdk-bin/openjdk-bin-17.0.1_p12-r1.ebuild
new file mode 100644
index 000000000000..e95578814cd8
--- /dev/null
+++ b/dev-java/openjdk-bin/openjdk-bin-17.0.1_p12-r1.ebuild
@@ -0,0 +1,147 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit java-vm-2 toolchain-funcs
+
+abi_uri() {
+	local baseuri="https://github.com/adoptium/temurin${SLOT}-binaries/releases/download/jdk-${MY_PV}/"
+	local musl=
+	local os=linux
+
+	case ${2} in
+		*-macos)    os=mac      ;;
+		*-solaris)  os=solaris  ;;
+	esac
+
+	if [[ ${3} == musl ]]; then
+		os=alpine-linux
+		musl=true
+	fi
+
+	echo "${2-$1}? (
+		${musl:+ elibc_musl? ( }
+			${baseuri}/OpenJDK${SLOT}U-jdk_${1}_${os}_hotspot_${MY_PV//+/_}.tar.gz
+		${musl:+ ) } )"
+}
+
+MY_PV=${PV/_p/+}
+SLOT=${MY_PV%%[.+]*}
+
+SRC_URI="
+	$(abi_uri arm)
+	$(abi_uri aarch64 arm64)
+	$(abi_uri ppc64le ppc64)
+	$(abi_uri x64 amd64)
+	$(abi_uri x64 amd64 musl)
+	$(abi_uri x64 x64-macos)
+"
+
+DESCRIPTION="Prebuilt Java JDK binaries provided by Eclipse Temurin"
+HOMEPAGE="https://adoptium.net"
+LICENSE="GPL-2-with-classpath-exception"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x64-macos"
+IUSE="alsa cups +gentoo-vm headless-awt selinux source"
+
+RDEPEND="
+	>=sys-apps/baselayout-java-0.1.0-r1
+	kernel_linux? (
+		media-libs/fontconfig:1.0
+		media-libs/freetype:2
+		media-libs/harfbuzz
+		elibc_glibc? ( >=sys-libs/glibc-2.2.5:* )
+		sys-libs/zlib
+		alsa? ( media-libs/alsa-lib )
+		cups? ( net-print/cups )
+		selinux? ( sec-policy/selinux-java )
+		!headless-awt? (
+			x11-libs/libX11
+			x11-libs/libXext
+			x11-libs/libXi
+			x11-libs/libXrender
+			x11-libs/libXtst
+		)
+	)"
+
+RESTRICT="preserve-libs splitdebug"
+QA_PREBUILT="*"
+
+S="${WORKDIR}/jdk-${MY_PV}"
+
+pkg_pretend() {
+	if [[ "$(tc-is-softfloat)" != "no" ]]; then
+		die "These binaries require a hardfloat system."
+	fi
+}
+
+src_unpack() {
+	default
+	if [[ ${A} == *_mac_* ]] ; then
+		mv -v "${S}/Contents/Home/"* "${S}" || die
+		rm -Rf "${S}/Contents"  # drop macOS executable
+	fi
+}
+
+src_install() {
+	local dest="/opt/${P}"
+	local ddest="${ED%/}/${dest#/}"
+
+	# on macOS if they would exist they would be called .dylib, but most
+	# importantly, there are no different providers, so everything
+	# that's shipped works.
+	if [[ ${A} != *_mac_* ]] ; then
+		# Not sure why they bundle this as it's commonly available and they
+		# only do so on x86_64. It's needed by libfontmanager.so. IcedTea
+		# also has an explicit dependency while Oracle seemingly dlopens it.
+		rm -vf lib/libfreetype.so || die
+
+		# prefer system copy # https://bugs.gentoo.org/776676
+		rm -vf lib/libharfbuzz.so || die
+
+		# Oracle and IcedTea have libjsoundalsa.so depending on
+		# libasound.so.2 but AdoptOpenJDK only has libjsound.so. Weird.
+		if ! use alsa ; then
+			rm -v lib/libjsound.* || die
+		fi
+
+		if use headless-awt ; then
+			rm -v lib/lib*{[jx]awt,splashscreen}* || die
+		fi
+	fi
+
+	if ! use source ; then
+		rm -v lib/src.zip || die
+	fi
+
+	rm -v lib/security/cacerts || die
+	dosym ../../../../etc/ssl/certs/java/cacerts \
+		"${dest}"/lib/security/cacerts
+
+	dodir "${dest}"
+	cp -pPR * "${ddest}" || die
+
+	# provide stable symlink
+	dosym "${P}" "/opt/${PN}-${SLOT}"
+
+	use gentoo-vm && java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
+	java-vm_set-pax-markings "${ddest}"
+	java-vm_revdep-mask
+	java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
+}
+
+pkg_postinst() {
+	java-vm-2_pkg_postinst
+
+	if use gentoo-vm ; then
+		ewarn "WARNING! You have enabled the gentoo-vm USE flag, making this JDK"
+		ewarn "recognised by the system. This will almost certainly break"
+		ewarn "many java ebuilds as they are not ready for openjdk-${SLOT}"
+	else
+		ewarn "The experimental gentoo-vm USE flag has not been enabled so this JDK"
+		ewarn "will not be recognised by the system. For example, simply calling"
+		ewarn "\"java\" will launch a different JVM. This is necessary until Gentoo"
+		ewarn "fully supports Java ${SLOT}. This JDK must therefore be invoked using its"
+		ewarn "absolute location under ${EPREFIX}/opt/${P}."
+	fi
+}
diff --git a/dev-java/openjdk-bin/openjdk-bin-8.312_p07-r1.ebuild b/dev-java/openjdk-bin/openjdk-bin-8.312_p07-r1.ebuild
new file mode 100644
index 000000000000..465e0a290547
--- /dev/null
+++ b/dev-java/openjdk-bin/openjdk-bin-8.312_p07-r1.ebuild
@@ -0,0 +1,123 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit java-vm-2
+
+abi_uri() {
+	local os=linux
+	case ${2} in
+		*-macos)    os=mac      ;;
+		*-solaris)  os=solaris  ;;
+	esac
+	echo "${2-$1}? (
+			https://github.com/adoptium/temurin${SLOT}-binaries/releases/download/jdk${MY_PV}/OpenJDK8U-jdk_${1}_${os}_hotspot_${3-${MY_PV/-/}}.tar.gz
+		)"
+}
+
+# they have different tarball names for different arches...
+# https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u282-b08/OpenJDK8U-jdk_x64_linux_hotspot_8u282b08.tar.gz
+# https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u282-b08/OpenJDK8U-jdk_aarch64_linux_hotspot_jdk8u282-b08.tar.gz
+
+MY_PV=$(ver_rs 1 'u' 2 '-' ${PV//p/b})
+SLOT="$(ver_cut 1)"
+
+DESCRIPTION="Prebuilt Java JDK binaries provided by Eclipse Temurin"
+HOMEPAGE="https://adoptium.net"
+SRC_URI="
+	$(abi_uri aarch64 arm64)
+	$(abi_uri arm)
+	$(abi_uri ppc64le ppc64)
+	$(abi_uri x64 amd64)
+	$(abi_uri x64 x64-macos)
+"
+
+LICENSE="GPL-2-with-classpath-exception"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x64-macos"
+
+IUSE="alsa cups examples headless-awt selinux source"
+
+RDEPEND="
+	>=sys-apps/baselayout-java-0.1.0-r1
+	kernel_linux? (
+		media-libs/fontconfig:1.0
+		media-libs/freetype:2
+		>=sys-libs/glibc-2.2.5:*
+		sys-libs/zlib
+		alsa? ( media-libs/alsa-lib )
+		arm? ( dev-libs/libffi-compat:6 )
+		cups? ( net-print/cups )
+		selinux? ( sec-policy/selinux-java )
+		!headless-awt? (
+			x11-libs/libX11
+			x11-libs/libXext
+			x11-libs/libXi
+			x11-libs/libXrender
+			x11-libs/libXtst
+		)
+	)
+"
+
+RESTRICT="preserve-libs strip"
+QA_PREBUILT="*"
+
+S="${WORKDIR}/jdk${MY_PV}"
+
+src_unpack() {
+	default
+	# 753575
+	if use arm; then
+		mv -v "${S}"* "${S}" || die
+	elif [[ ${A} == *_mac_* ]] ; then
+		mv -v "${S}/Contents/Home/"* "${S}" || die
+		rm -Rf "${S}/Contents"  # drop macOS executable
+	fi
+}
+
+src_install() {
+	local dest="/opt/${P}"
+	local ddest="${ED%/}/${dest#/}"
+
+	rm ASSEMBLY_EXCEPTION LICENSE THIRD_PARTY_README || die
+
+	# on macOS if they would exist they would be called .dylib, but most
+	# importantly, there are no different providers, so everything
+	# that's shipped works.
+	if [[ ${A} != *_mac_* ]] ; then
+		# this does not exist on arm64 hence -f
+		rm -fv jre/lib/*/libfreetype.so* || die
+
+		if ! use alsa ; then
+			rm -v jre/lib/*/libjsoundalsa.so* || die
+		fi
+
+		if ! use examples ; then
+			rm -vr sample || die
+		fi
+
+		if use headless-awt ; then
+			rm -fvr {,jre/}lib/*/lib*{[jx]awt,splashscreen}* \
+				{,jre/}bin/policytool bin/appletviewer || die
+		fi
+	fi
+
+	if ! use source ; then
+		rm -v src.zip || die
+	fi
+
+	rm -v jre/lib/security/cacerts || die
+	dosym ../../../../../etc/ssl/certs/java/cacerts \
+		"${dest}"/jre/lib/security/cacerts
+
+	dodir "${dest}"
+	cp -pPR * "${ddest}" || die
+
+	# provide stable symlink
+	dosym "${P}" "/opt/${PN}-${SLOT}"
+
+	java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
+	java-vm_set-pax-markings "${ddest}"
+	java-vm_revdep-mask
+	java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
+}
diff --git a/dev-java/openjdk-jre-bin/openjdk-jre-bin-11.0.13_p8-r1.ebuild b/dev-java/openjdk-jre-bin/openjdk-jre-bin-11.0.13_p8-r1.ebuild
new file mode 100644
index 000000000000..57f5b0dac68d
--- /dev/null
+++ b/dev-java/openjdk-jre-bin/openjdk-jre-bin-11.0.13_p8-r1.ebuild
@@ -0,0 +1,97 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit java-vm-2
+
+abi_uri() {
+	echo "${2-$1}? (
+			https://github.com/adoptium/temurin${SLOT}-binaries/releases/download/jdk-${MY_PV}/OpenJDK${SLOT}U-jre_${1}_linux_hotspot_${MY_PV//+/_}.tar.gz
+		)"
+}
+
+MY_PV=${PV/_p/+}
+SLOT=${MY_PV%%[.+]*}
+
+SRC_URI="
+	$(abi_uri x64 amd64)
+"
+
+DESCRIPTION="Prebuilt Java JRE binaries provided by AdoptOpenJDK"
+HOMEPAGE="https://adoptopenjdk.net"
+LICENSE="GPL-2-with-classpath-exception"
+KEYWORDS="~amd64"
+IUSE="alsa cups +gentoo-vm headless-awt selinux"
+
+RDEPEND="
+	media-libs/fontconfig:1.0
+	media-libs/freetype:2
+	>net-libs/libnet-1.1
+	>=sys-apps/baselayout-java-0.1.0-r1
+	>=sys-libs/glibc-2.2.5:*
+	sys-libs/zlib
+	alsa? ( media-libs/alsa-lib )
+	cups? ( net-print/cups )
+	selinux? ( sec-policy/selinux-java )
+	!headless-awt? (
+		x11-libs/libX11
+		x11-libs/libXext
+		x11-libs/libXi
+		x11-libs/libXrender
+		x11-libs/libXtst
+	)"
+
+RESTRICT="preserve-libs splitdebug"
+QA_PREBUILT="*"
+
+S="${WORKDIR}/jdk-${MY_PV}-jre"
+
+src_install() {
+	local dest="/opt/${P}"
+	local ddest="${ED%/}/${dest#/}"
+
+	# Not sure why they bundle this as it's commonly available and they
+	# only do so on x86_64. It's needed by libfontmanager.so. IcedTea
+	# also has an explicit dependency while Oracle seemingly dlopens it.
+	rm -vf lib/libfreetype.so || die
+
+	# Oracle and IcedTea have libjsoundalsa.so depending on
+	# libasound.so.2 but AdoptOpenJDK only has libjsound.so. Weird.
+	if ! use alsa ; then
+		rm -v lib/libjsound.* || die
+	fi
+
+	if use headless-awt ; then
+		rm -v lib/lib*{[jx]awt,splashscreen}* || die
+	fi
+
+	rm -v lib/security/cacerts || die
+	dosym ../../../../etc/ssl/certs/java/cacerts "${dest}"/lib/security/cacerts
+
+	dodir "${dest}"
+	cp -pPR * "${ddest}" || die
+
+	# provide stable symlink
+	dosym "${P}" "/opt/${PN}-${SLOT}"
+
+	use gentoo-vm && java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
+	java-vm_set-pax-markings "${ddest}"
+	java-vm_revdep-mask
+	java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
+}
+
+pkg_postinst() {
+	java-vm-2_pkg_postinst
+
+	if use gentoo-vm ; then
+		ewarn "WARNING! You have enabled the gentoo-vm USE flag, making this JRE"
+		ewarn "recognised by the system. This will almost certainly break things."
+	else
+		ewarn "The experimental gentoo-vm USE flag has not been enabled so this JRE"
+		ewarn "will not be recognised by the system. For example, simply calling"
+		ewarn "\"java\" will launch a different JVM. This is necessary until Gentoo"
+		ewarn "fully supports Java 11. This JRE must therefore be invoked using its"
+		ewarn "absolute location under ${EPREFIX}/opt/${P}."
+	fi
+}
diff --git a/dev-java/openjdk-jre-bin/openjdk-jre-bin-8.312_p07-r1.ebuild b/dev-java/openjdk-jre-bin/openjdk-jre-bin-8.312_p07-r1.ebuild
new file mode 100644
index 000000000000..2d5ee85aa434
--- /dev/null
+++ b/dev-java/openjdk-jre-bin/openjdk-jre-bin-8.312_p07-r1.ebuild
@@ -0,0 +1,83 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit java-vm-2
+
+abi_uri() {
+	echo "${2-$1}? (
+			https://github.com/adoptium/temurin${SLOT}-binaries/releases/download/jdk${MY_PV}/OpenJDK8U-jre_${1}_linux_hotspot_${MY_PV/-/}.tar.gz
+		)"
+}
+
+MY_PV=$(ver_rs 1 'u' 2 '-' ${PV//p/b})
+SLOT="$(ver_cut 1)"
+
+DESCRIPTION="Prebuilt Java JRE binaries provided by Eclipse Temurin"
+HOMEPAGE="https://adoptium.net"
+SRC_URI="
+	$(abi_uri x64 amd64)
+"
+
+LICENSE="GPL-2-with-classpath-exception"
+KEYWORDS="~amd64"
+
+IUSE="alsa cups headless-awt selinux"
+
+RDEPEND="
+	media-libs/fontconfig:1.0
+	media-libs/freetype:2
+	>net-libs/libnet-1.1
+	>=sys-apps/baselayout-java-0.1.0-r1
+	>=sys-libs/glibc-2.2.5:*
+	sys-libs/zlib
+	alsa? ( media-libs/alsa-lib )
+	cups? ( net-print/cups )
+	selinux? ( sec-policy/selinux-java )
+	!headless-awt? (
+		x11-libs/libX11
+		x11-libs/libXext
+		x11-libs/libXi
+		x11-libs/libXrender
+		x11-libs/libXtst
+	)"
+
+RESTRICT="preserve-libs splitdebug"
+QA_PREBUILT="*"
+
+S="${WORKDIR}/jdk${MY_PV}-jre"
+
+src_install() {
+	local dest="/opt/${P}"
+	local ddest="${ED%/}/${dest#/}"
+
+	rm ASSEMBLY_EXCEPTION LICENSE THIRD_PARTY_README || die
+
+	# this does not exist on arm64 hence -f
+	rm -fv lib/*/libfreetype.so* || die
+
+	if ! use alsa ; then
+		rm -v lib/*/libjsoundalsa.so* || die
+	fi
+
+	if use headless-awt ; then
+		rm -fvr lib/*/lib*{[jx]awt,splashscreen}* \
+			bin/policytool || die
+	fi
+
+	rm -v lib/security/cacerts || die
+	dosym ../../../../../etc/ssl/certs/java/cacerts \
+		"${dest}"/lib/security/cacerts
+
+	dodir "${dest}"
+	cp -pPR * "${ddest}" || die
+
+	# provide stable symlink
+	dosym "${P}" "/opt/${PN}-${SLOT}"
+
+	java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
+	java-vm_set-pax-markings "${ddest}"
+	java-vm_revdep-mask
+	java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
+}
diff --git a/dev-java/openjdk/openjdk-11.0.13_p8-r1.ebuild b/dev-java/openjdk/openjdk-11.0.13_p8-r1.ebuild
new file mode 100644
index 000000000000..e2c98382a600
--- /dev/null
+++ b/dev-java/openjdk/openjdk-11.0.13_p8-r1.ebuild
@@ -0,0 +1,283 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit check-reqs flag-o-matic java-pkg-2 java-vm-2 multiprocessing pax-utils toolchain-funcs
+
+# we need -ga tag to fetch tarball and unpack it, but exact number everywhere else to
+# set build version properly
+MY_PV="${PV%_p*}-ga"
+SLOT="${MY_PV%%[.+]*}"
+
+DESCRIPTION="Open source implementation of the Java programming language"
+HOMEPAGE="https://openjdk.java.net"
+SRC_URI="https://github.com/${PN}/jdk${SLOT}u-dev/archive/refs/tags/jdk-${MY_PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64"
+
+IUSE="alsa cups debug doc examples gentoo-vm headless-awt javafx +jbootstrap +pch selinux source systemtap"
+
+COMMON_DEPEND="
+	media-libs/freetype:2=
+	media-libs/giflib:0/7
+	media-libs/harfbuzz:=
+	media-libs/libpng:0=
+	media-libs/lcms:2=
+	sys-libs/zlib
+	virtual/jpeg:0=
+	systemtap? ( dev-util/systemtap )
+"
+
+# Many libs are required to build, but not to run, make is possible to remove
+# by listing conditionally in RDEPEND unconditionally in DEPEND
+RDEPEND="
+	${COMMON_DEPEND}
+	>=sys-apps/baselayout-java-0.1.0-r1
+	!headless-awt? (
+		x11-libs/libX11
+		x11-libs/libXext
+		x11-libs/libXi
+		x11-libs/libXrandr
+		x11-libs/libXrender
+		x11-libs/libXt
+		x11-libs/libXtst
+	)
+	alsa? ( media-libs/alsa-lib )
+	cups? ( net-print/cups )
+	selinux? ( sec-policy/selinux-java )
+"
+
+DEPEND="
+	${COMMON_DEPEND}
+	app-arch/zip
+	media-libs/alsa-lib
+	net-print/cups
+	x11-base/xorg-proto
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXi
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	x11-libs/libXt
+	x11-libs/libXtst
+	javafx? ( dev-java/openjfx:${SLOT}= )
+	|| (
+		dev-java/openjdk-bin:${SLOT}
+		dev-java/openjdk:${SLOT}
+	)
+"
+
+REQUIRED_USE="javafx? ( alsa !headless-awt )"
+
+S="${WORKDIR}/jdk${SLOT}u-dev-jdk-${MY_PV}"
+
+# The space required to build varies wildly depending on USE flags,
+# ranging from 2GB to 16GB. This function is certainly not exact but
+# should be close enough to be useful.
+openjdk_check_requirements() {
+	local M
+	M=2048
+	M=$(( $(usex jbootstrap 2 1) * $M ))
+	M=$(( $(usex debug 3 1) * $M ))
+	M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
+
+	CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
+}
+
+pkg_pretend() {
+	openjdk_check_requirements
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}, bug #677876"
+	fi
+}
+
+pkg_setup() {
+	openjdk_check_requirements
+	java-vm-2_pkg_setup
+
+	JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT}"
+	JAVA_PKG_WANT_SOURCE="${SLOT}"
+	JAVA_PKG_WANT_TARGET="${SLOT}"
+
+	# The nastiness below is necessary while the gentoo-vm USE flag is
+	# masked. First we call java-pkg-2_pkg_setup if it looks like the
+	# flag was unmasked against one of the possible build VMs. If not,
+	# we try finding one of them in their expected locations. This would
+	# have been slightly less messy if openjdk-bin had been installed to
+	# /opt/${PN}-${SLOT} or if there was a mechanism to install a VM env
+	# file but disable it so that it would not normally be selectable.
+
+	local vm
+	for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
+		if [[ -d ${EPREFIX}/usr/lib/jvm/${vm} ]]; then
+			java-pkg-2_pkg_setup
+			return
+		fi
+	done
+
+	if has_version --host-root dev-java/openjdk:${SLOT}; then
+		export JDK_HOME=${EPREFIX}/usr/$(get_libdir)/openjdk-${SLOT}
+	else
+		if [[ ${MERGE_TYPE} != "binary" ]]; then
+			JDK_HOME=$(best_version --host-root dev-java/openjdk-bin:${SLOT})
+			[[ -n ${JDK_HOME} ]] || die "Build VM not found!"
+			JDK_HOME=${JDK_HOME#*/}
+			JDK_HOME=${EPREFIX}/opt/${JDK_HOME%-r*}
+			export JDK_HOME
+		fi
+	fi
+}
+
+src_prepare() {
+	default
+	chmod +x configure || die
+}
+
+src_configure() {
+	# Work around stack alignment issue, bug #647954. in case we ever have x86
+	use x86 && append-flags -mincoming-stack-boundary=2
+
+	# Work around -fno-common ( GCC10 default ), bug #713180
+	append-flags -fcommon
+
+	# Strip some flags users may set, but should not. #818502
+	filter-flags -fexceptions
+
+	# Enabling full docs appears to break doc building. If not
+	# explicitly disabled, the flag will get auto-enabled if pandoc and
+	# graphviz are detected. pandoc has loads of dependencies anyway.
+
+	local myconf=(
+		--disable-ccache
+		--enable-full-docs=no
+		--with-boot-jdk="${JDK_HOME}"
+		--with-extra-cflags="${CFLAGS}"
+		--with-extra-cxxflags="${CXXFLAGS}"
+		--with-extra-ldflags="${LDFLAGS}"
+		--with-freetype=system
+		--with-giflib=system
+		--with-harfbuzz=system
+		--with-lcms=system
+		--with-libjpeg=system
+		--with-libpng=system
+		--with-native-debug-symbols=$(usex debug internal none)
+		--with-vendor-name="Gentoo"
+		--with-vendor-url="https://gentoo.org"
+		--with-vendor-bug-url="https://bugs.gentoo.org"
+		--with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
+		--with-vendor-version-string="${PVR}"
+		--with-version-pre=""
+		--with-version-string="${PV%_p*}"
+		--with-version-build="${PV#*_p}"
+		--with-zlib=system
+		--enable-dtrace=$(usex systemtap yes no)
+		--enable-headless-only=$(usex headless-awt yes no)
+		$(tc-is-clang && echo "--with-toolchain-type=clang")
+	)
+
+	if use javafx; then
+		# this is not useful for users, just for upstream developers
+		# build system compares mesa version in md file
+		# https://bugs.gentoo.org/822612
+		export LEGAL_EXCLUDES=mesa3d.md
+
+		local zip="${EPREFIX%/}/usr/$(get_libdir)/openjfx-${SLOT}/javafx-exports.zip"
+		if [[ -r ${zip} ]]; then
+			myconf+=( --with-import-modules="${zip}" )
+		else
+			die "${zip} not found or not readable"
+		fi
+	fi
+
+	# PaX breaks pch, bug #601016
+	if use pch && ! host-is-pax; then
+		myconf+=( --enable-precompiled-headers )
+	else
+		myconf+=( --disable-precompiled-headers )
+	fi
+
+	(
+		unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC XARGS
+		CFLAGS= CXXFLAGS= LDFLAGS= \
+		CONFIG_SITE=/dev/null \
+		econf "${myconf[@]}"
+	)
+}
+
+src_compile() {
+	local myemakeargs=(
+		JOBS=$(makeopts_jobs)
+		LOG=debug
+		CFLAGS_WARNINGS_ARE_ERRORS= # No -Werror
+		$(usex doc docs '')
+		$(usex jbootstrap bootcycle-images product-images)
+	)
+	emake "${myemakeargs[@]}" -j1 #nowarn
+}
+
+src_install() {
+	local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
+	local ddest="${ED}${dest#/}"
+
+	cd "${S}"/build/*-release/images/jdk || die
+
+	# Create files used as storage for system preferences.
+	mkdir .systemPrefs || die
+	touch .systemPrefs/.system.lock || die
+	touch .systemPrefs/.systemRootModFile || die
+
+	# Oracle and IcedTea have libjsoundalsa.so depending on
+	# libasound.so.2 but OpenJDK only has libjsound.so. Weird.
+	if ! use alsa ; then
+		rm -v lib/libjsound.* || die
+	fi
+
+	if ! use examples ; then
+		rm -vr demo/ || die
+	fi
+
+	if ! use source ; then
+		rm -v lib/src.zip || die
+	fi
+
+	rm -v lib/security/cacerts || die
+
+	dodir "${dest}"
+	cp -pPR * "${ddest}" || die
+
+	dosym ../../../../../etc/ssl/certs/java/cacerts "${dest}"/lib/security/cacerts
+
+	# must be done before running itself
+	java-vm_set-pax-markings "${ddest}"
+
+	einfo "Creating the Class Data Sharing archives and disabling usage tracking"
+	"${ddest}/bin/java" -server -Xshare:dump -Djdk.disableLastUsageTracking || die
+
+	use gentoo-vm && java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
+	java-vm_revdep-mask
+	java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
+
+	if use doc ; then
+		docinto html
+		dodoc -r "${S}"/build/*-release/images/docs/*
+		dosym ../../../usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}"
+	fi
+}
+
+pkg_postinst() {
+	java-vm-2_pkg_postinst
+
+	if use gentoo-vm ; then
+		ewarn "WARNING! You have enabled the gentoo-vm USE flag, making this JDK"
+		ewarn "recognised by the system. This will almost certainly break"
+		ewarn "many java ebuilds as they are not ready for openjdk-11"
+	else
+		ewarn "The experimental gentoo-vm USE flag has not been enabled so this JDK"
+		ewarn "will not be recognised by the system. For example, simply calling"
+		ewarn "\"java\" will launch a different JVM. This is necessary until Gentoo"
+		ewarn "fully supports Java ${SLOT}. This JDK must therefore be invoked using its"
+		ewarn "absolute location under ${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}."
+	fi
+}
diff --git a/dev-java/openjdk/openjdk-17.0.1_p12-r1.ebuild b/dev-java/openjdk/openjdk-17.0.1_p12-r1.ebuild
new file mode 100644
index 000000000000..82c5264e4737
--- /dev/null
+++ b/dev-java/openjdk/openjdk-17.0.1_p12-r1.ebuild
@@ -0,0 +1,277 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit check-reqs flag-o-matic java-pkg-2 java-vm-2 multiprocessing pax-utils toolchain-funcs
+
+MY_PV="${PV//_p/+}"
+SLOT="$(ver_cut 1)"
+
+DESCRIPTION="Open source implementation of the Java programming language"
+HOMEPAGE="https://openjdk.java.net"
+SRC_URI="https://github.com/openjdk/jdk${SLOT}u/archive/refs/tags/jdk-${MY_PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-2"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64"
+
+IUSE="alsa cups debug doc examples gentoo-vm headless-awt javafx +jbootstrap +pch selinux source systemtap"
+
+COMMON_DEPEND="
+	media-libs/freetype:2=
+	media-libs/giflib:0/7
+	media-libs/harfbuzz:=
+	media-libs/libpng:0=
+	media-libs/lcms:2=
+	sys-libs/zlib
+	virtual/jpeg:0=
+	systemtap? ( dev-util/systemtap )
+"
+
+# Many libs are required to build, but not to run, make is possible to remove
+# by listing conditionally in RDEPEND unconditionally in DEPEND
+RDEPEND="
+	${COMMON_DEPEND}
+	>=sys-apps/baselayout-java-0.1.0-r1
+	!headless-awt? (
+		x11-libs/libX11
+		x11-libs/libXext
+		x11-libs/libXi
+		x11-libs/libXrandr
+		x11-libs/libXrender
+		x11-libs/libXt
+		x11-libs/libXtst
+	)
+	alsa? ( media-libs/alsa-lib )
+	cups? ( net-print/cups )
+	selinux? ( sec-policy/selinux-java )
+"
+
+DEPEND="
+	${COMMON_DEPEND}
+	app-arch/zip
+	media-libs/alsa-lib
+	net-print/cups
+	x11-base/xorg-proto
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXi
+	x11-libs/libXrandr
+	x11-libs/libXrender
+	x11-libs/libXt
+	x11-libs/libXtst
+	javafx? ( dev-java/openjfx:${SLOT}= )
+	|| (
+		dev-java/openjdk-bin:${SLOT}
+		dev-java/openjdk:${SLOT}
+	)
+"
+
+REQUIRED_USE="javafx? ( alsa !headless-awt )"
+
+S="${WORKDIR}/jdk${SLOT}u-jdk-${MY_PV//+/-}"
+
+# The space required to build varies wildly depending on USE flags,
+# ranging from 2GB to 16GB. This function is certainly not exact but
+# should be close enough to be useful.
+openjdk_check_requirements() {
+	local M
+	M=2048
+	M=$(( $(usex jbootstrap 2 1) * $M ))
+	M=$(( $(usex debug 3 1) * $M ))
+	M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
+
+	CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
+}
+
+pkg_pretend() {
+	openjdk_check_requirements
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}, bug #677876"
+	fi
+}
+
+pkg_setup() {
+	openjdk_check_requirements
+	java-vm-2_pkg_setup
+
+	JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT}"
+	JAVA_PKG_WANT_SOURCE="${SLOT}"
+	JAVA_PKG_WANT_TARGET="${SLOT}"
+
+	# The nastiness below is necessary while the gentoo-vm USE flag is
+	# masked. First we call java-pkg-2_pkg_setup if it looks like the
+	# flag was unmasked against one of the possible build VMs. If not,
+	# we try finding one of them in their expected locations. This would
+	# have been slightly less messy if openjdk-bin had been installed to
+	# /opt/${PN}-${SLOT} or if there was a mechanism to install a VM env
+	# file but disable it so that it would not normally be selectable.
+
+	local vm
+	for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
+		if [[ -d ${EPREFIX}/usr/lib/jvm/${vm} ]]; then
+			java-pkg-2_pkg_setup
+			return
+		fi
+	done
+
+	if has_version --host-root dev-java/openjdk:${SLOT}; then
+		export JDK_HOME=${EPREFIX}/usr/$(get_libdir)/openjdk-${SLOT}
+	else
+		if [[ ${MERGE_TYPE} != "binary" ]]; then
+			JDK_HOME=$(best_version --host-root dev-java/openjdk-bin:${SLOT})
+			[[ -n ${JDK_HOME} ]] || die "Build VM not found!"
+			JDK_HOME=${JDK_HOME#*/}
+			JDK_HOME=${EPREFIX}/opt/${JDK_HOME%-r*}
+			export JDK_HOME
+		fi
+	fi
+}
+
+src_prepare() {
+	default
+	chmod +x configure || die
+}
+
+src_configure() {
+	# Work around stack alignment issue, bug #647954. in case we ever have x86
+	use x86 && append-flags -mincoming-stack-boundary=2
+
+	# Work around -fno-common ( GCC10 default ), bug #713180
+	append-flags -fcommon
+
+	# Strip some flags users may set, but should not. #818502
+	filter-flags -fexceptions
+
+	# Enabling full docs appears to break doc building. If not
+	# explicitly disabled, the flag will get auto-enabled if pandoc and
+	# graphviz are detected. pandoc has loads of dependencies anyway.
+
+	local myconf=(
+		--disable-ccache
+		--disable-warnings-as-errors
+		--enable-full-docs=no
+		--with-boot-jdk="${JDK_HOME}"
+		--with-extra-cflags="${CFLAGS}"
+		--with-extra-cxxflags="${CXXFLAGS}"
+		--with-extra-ldflags="${LDFLAGS}"
+		--with-freetype=system
+		--with-giflib=system
+		--with-harfbuzz=system
+		--with-lcms=system
+		--with-libjpeg=system
+		--with-libpng=system
+		--with-native-debug-symbols=$(usex debug internal none)
+		--with-vendor-name="Gentoo"
+		--with-vendor-url="https://gentoo.org"
+		--with-vendor-bug-url="https://bugs.gentoo.org"
+		--with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
+		--with-vendor-version-string="${PVR}"
+		--with-version-pre=""
+		--with-version-string="${PV%_p*}"
+		--with-version-build="${PV#*_p}"
+		--with-zlib=system
+		--enable-dtrace=$(usex systemtap yes no)
+		--enable-headless-only=$(usex headless-awt yes no)
+		$(tc-is-clang && echo "--with-toolchain-type=clang")
+	)
+
+	if use javafx; then
+		local zip="${EPREFIX%/}/usr/$(get_libdir)/openjfx-${SLOT}/javafx-exports.zip"
+		if [[ -r ${zip} ]]; then
+			myconf+=( --with-import-modules="${zip}" )
+		else
+			die "${zip} not found or not readable"
+		fi
+	fi
+
+	# PaX breaks pch, bug #601016
+	if use pch && ! host-is-pax; then
+		myconf+=( --enable-precompiled-headers )
+	else
+		myconf+=( --disable-precompiled-headers )
+	fi
+
+	(
+		unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC XARGS
+		CFLAGS= CXXFLAGS= LDFLAGS= \
+		CONFIG_SITE=/dev/null \
+		econf "${myconf[@]}"
+	)
+}
+
+src_compile() {
+	local myemakeargs=(
+		JOBS=$(makeopts_jobs)
+		LOG=debug
+		CFLAGS_WARNINGS_ARE_ERRORS= # No -Werror
+		$(usex doc docs '')
+		$(usex jbootstrap bootcycle-images product-images)
+	)
+	emake "${myemakeargs[@]}" -j1 #nowarn
+}
+
+src_install() {
+	local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
+	local ddest="${ED}${dest#/}"
+
+	cd "${S}"/build/*-release/images/jdk || die
+
+	# Create files used as storage for system preferences.
+	mkdir .systemPrefs || die
+	touch .systemPrefs/.system.lock || die
+	touch .systemPrefs/.systemRootModFile || die
+
+	# Oracle and IcedTea have libjsoundalsa.so depending on
+	# libasound.so.2 but OpenJDK only has libjsound.so. Weird.
+	if ! use alsa ; then
+		rm -v lib/libjsound.* || die
+	fi
+
+	if ! use examples ; then
+		rm -vr demo/ || die
+	fi
+
+	if ! use source ; then
+		rm -v lib/src.zip || die
+	fi
+
+	rm -v lib/security/cacerts || die
+
+	dodir "${dest}"
+	cp -pPR * "${ddest}" || die
+
+	dosym ../../../../../etc/ssl/certs/java/cacerts "${dest}"/lib/security/cacerts
+
+	# must be done before running itself
+	java-vm_set-pax-markings "${ddest}"
+
+	einfo "Creating the Class Data Sharing archives and disabling usage tracking"
+	"${ddest}/bin/java" -server -Xshare:dump -Djdk.disableLastUsageTracking || die
+
+	use gentoo-vm && java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
+	java-vm_revdep-mask
+	java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
+
+	if use doc ; then
+		docinto html
+		dodoc -r "${S}"/build/*-release/images/docs/*
+		dosym ../../../usr/share/doc/"${PF}" /usr/share/doc/"${PN}-${SLOT}"
+	fi
+}
+
+pkg_postinst() {
+	java-vm-2_pkg_postinst
+
+	if use gentoo-vm ; then
+		ewarn "WARNING! You have enabled the gentoo-vm USE flag, making this JDK"
+		ewarn "recognised by the system. This will almost certainly break"
+		ewarn "many java ebuilds as they are not ready for openjdk-${SLOT}"
+	else
+		ewarn "The experimental gentoo-vm USE flag has not been enabled so this JDK"
+		ewarn "will not be recognised by the system. For example, simply calling"
+		ewarn "\"java\" will launch a different JVM. This is necessary until Gentoo"
+		ewarn "fully supports Java ${SLOT}. This JDK must therefore be invoked using its"
+		ewarn "absolute location under ${EPREFIX}/usr/$(get_libdir)/${PN}-${SLOT}."
+	fi
+}
diff --git a/dev-java/openjdk/openjdk-8.312_p07-r1.ebuild b/dev-java/openjdk/openjdk-8.312_p07-r1.ebuild
new file mode 100644
index 000000000000..9370e7e3616c
--- /dev/null
+++ b/dev-java/openjdk/openjdk-8.312_p07-r1.ebuild
@@ -0,0 +1,256 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit check-reqs flag-o-matic java-pkg-2 java-vm-2 multiprocessing pax-utils toolchain-funcs
+
+# we need latest -ga tag from hg, but want to keep build number as well
+# as _p component of the gentoo version string.
+
+MY_PV=$(ver_rs 1 'u' 2 '-' ${PV%_p*}-ga)
+MY_PN_AARCH64="${PN}-aarch64-shenandoah"
+MY_PV_AARCH64="$(ver_rs 1 'u' 2 '-' ${PV/_p/-b})"
+MY_P_AARCH64="${MY_PN_AARCH64/#${PN}-}-jdk${MY_PV_AARCH64}"
+
+BASE_URI="https://hg.${PN}.java.net/jdk8u/jdk8u"
+AARCH64_URI="https://hg.${PN}.java.net/aarch64-port/jdk8u-shenandoah"
+
+DESCRIPTION="Open source implementation of the Java programming language"
+HOMEPAGE="https://openjdk.java.net"
+SRC_URI="
+	!arm64? (
+		${BASE_URI}/archive/jdk${MY_PV}.tar.bz2 -> ${P}.tar.bz2
+		${BASE_URI}/corba/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-corba-${PV}.tar.bz2
+		${BASE_URI}/hotspot/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-hotspot-${PV}.tar.bz2
+		${BASE_URI}/jaxp/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jaxp-${PV}.tar.bz2
+		${BASE_URI}/jaxws/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jaxws-${PV}.tar.bz2
+		${BASE_URI}/jdk/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-jdk-${PV}.tar.bz2
+		${BASE_URI}/langtools/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-langtools-${PV}.tar.bz2
+		${BASE_URI}/nashorn/archive/jdk${MY_PV}.tar.bz2 -> ${PN}-nashorn-${PV}.tar.bz2
+	)
+	arm64? (
+		${AARCH64_URI}/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-${PV}.tar.bz2
+		${AARCH64_URI}/corba/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-corba-${PV}.tar.bz2
+		${AARCH64_URI}/hotspot/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-hotspot-${PV}.tar.bz2
+		${AARCH64_URI}/jaxp/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-jaxp-${PV}.tar.bz2
+		${AARCH64_URI}/jaxws/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-jaxws-${PV}.tar.bz2
+		${AARCH64_URI}/jdk/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-jdk-${PV}.tar.bz2
+		${AARCH64_URI}/langtools/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-langtools-${PV}.tar.bz2
+		${AARCH64_URI}/nashorn/archive/${MY_P_AARCH64}.tar.bz2 -> ${MY_PN_AARCH64}-nashorn-jdk${PV}.tar.bz2
+	)
+"
+
+LICENSE="GPL-2"
+SLOT="$(ver_cut 1)"
+KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
+IUSE="alsa debug cups doc examples headless-awt javafx +jbootstrap +pch selinux source"
+
+COMMON_DEPEND="
+	media-libs/freetype:2=
+	media-libs/giflib:0/7
+	sys-libs/zlib
+"
+# Many libs are required to build, but not to run, make is possible to remove
+# by listing conditionally in RDEPEND unconditionally in DEPEND
+RDEPEND="
+	${COMMON_DEPEND}
+	>=sys-apps/baselayout-java-0.1.0-r1
+	!headless-awt? (
+		x11-libs/libX11
+		x11-libs/libXext
+		x11-libs/libXi
+		x11-libs/libXrender
+		x11-libs/libXt
+		x11-libs/libXtst
+	)
+	alsa? ( media-libs/alsa-lib )
+	cups? ( net-print/cups )
+	selinux? ( sec-policy/selinux-java )
+"
+
+DEPEND="
+	${COMMON_DEPEND}
+	app-arch/zip
+	media-libs/alsa-lib
+	net-print/cups
+	virtual/pkgconfig
+	x11-base/xorg-proto
+	x11-libs/libX11
+	x11-libs/libXext
+	x11-libs/libXi
+	x11-libs/libXrender
+	x11-libs/libXt
+	x11-libs/libXtst
+	|| (
+		dev-java/openjdk-bin:${SLOT}
+		dev-java/icedtea-bin:${SLOT}
+		dev-java/openjdk:${SLOT}
+		dev-java/icedtea:${SLOT}
+	)
+"
+
+PDEPEND="javafx? ( dev-java/openjfx:${SLOT} )"
+
+PATCHES=( "${FILESDIR}/openjdk-8-insantiate-arrayallocator.patch" )
+
+# The space required to build varies wildly depending on USE flags,
+# ranging from 2GB to 16GB. This function is certainly not exact but
+# should be close enough to be useful.
+openjdk_check_requirements() {
+	local M
+	M=2048
+	M=$(( $(usex debug 3 1) * $M ))
+	M=$(( $(usex jbootstrap 2 1) * $M ))
+	M=$(( $(usex doc 320 0) + $(usex source 128 0) + 192 + $M ))
+
+	CHECKREQS_DISK_BUILD=${M}M check-reqs_pkg_${EBUILD_PHASE}
+}
+
+pkg_pretend() {
+	openjdk_check_requirements
+	if [[ ${MERGE_TYPE} != binary ]]; then
+		has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}, bug #677876"
+	fi
+}
+
+pkg_setup() {
+	openjdk_check_requirements
+
+	JAVA_PKG_WANT_BUILD_VM="openjdk-${SLOT} openjdk-bin-${SLOT} icedtea-${SLOT} icedtea-bin-${SLOT}"
+	JAVA_PKG_WANT_SOURCE="${SLOT}"
+	JAVA_PKG_WANT_TARGET="${SLOT}"
+
+	java-vm-2_pkg_setup
+	java-pkg-2_pkg_setup
+}
+
+src_unpack() {
+	default
+	mv -v "jdk${SLOT}u"* "${P}" || die
+
+	local repo
+	for repo in corba hotspot jdk jaxp jaxws langtools nashorn; do
+		mv -v "${repo}-"* "${P}/${repo}" || die
+	done
+}
+
+src_prepare() {
+	default
+
+	# new warnings in new gcc https://bugs.gentoo.org/685426
+	sed -i '/^WARNINGS_ARE_ERRORS/ s/-Werror/-Wno-error/' \
+		hotspot/make/linux/makefiles/gcc.make || die
+
+	chmod +x configure || die
+}
+
+src_configure() {
+	# general build info found here:
+	#https://hg.openjdk.java.net/jdk8/jdk8/raw-file/tip/README-builds.html
+
+	# Work around stack alignment issue, bug #647954.
+	use x86 && append-flags -mincoming-stack-boundary=2
+
+	# Work around -fno-common ( GCC10 default ), bug #706638
+	append-flags -fcommon
+
+	# Strip some flags users may set, but should not. #818502
+	filter-flags -fexceptions
+
+	tc-export_build_env CC CXX PKG_CONFIG STRIP
+
+	local myconf=(
+			--disable-ccache
+			--enable-unlimited-crypto
+			--with-boot-jdk="${JDK_HOME}"
+			--with-extra-cflags="${CFLAGS}"
+			--with-extra-cxxflags="${CXXFLAGS}"
+			--with-extra-ldflags="${LDFLAGS}"
+			--with-giflib=system
+			--with-jtreg=no
+			--with-jobs=1
+			--with-num-cores=1
+			--with-update-version="$(ver_cut 2)"
+			--with-build-number="b$(ver_cut 4)"
+			--with-milestone="fcs" # magic variable that means "release version"
+			--with-vendor-name="Gentoo"
+			--with-vendor-url="https://gentoo.org"
+			--with-vendor-bug-url="https://bugs.gentoo.org"
+			--with-vendor-vm-bug-url="https://bugs.openjdk.java.net"
+			--with-zlib=system
+			--with-native-debug-symbols=$(usex debug internal none)
+			$(usex headless-awt --disable-headful '')
+			$(tc-is-clang && echo "--with-toolchain-type=clang")
+		)
+
+	# PaX breaks pch, bug #601016
+	if use pch && ! host-is-pax; then
+		myconf+=( --enable-precompiled-headers )
+	else
+		myconf+=( --disable-precompiled-headers )
+	fi
+
+	(
+		unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC MAKE XARGS
+		CFLAGS= CXXFLAGS= LDFLAGS= \
+		CONFIG_SITE=/dev/null \
+		CONFIG_SHELL="${EPREFIX}/bin/bash"
+		econf "${myconf[@]}"
+	)
+}
+
+src_compile() {
+	local myemakeargs=(
+		JOBS=$(makeopts_jobs)
+		LOG=debug
+		$(usex doc docs '')
+		$(usex jbootstrap bootcycle-images images)
+	)
+	emake "${myemakeargs[@]}" -j1 #nowarn
+}
+
+src_install() {
+	local dest="/usr/$(get_libdir)/${PN}-${SLOT}"
+	local ddest="${ED%/}/${dest#/}"
+
+	cd "${S}"/build/*-release/images/j2sdk-image || die
+
+	if ! use alsa; then
+		rm -v jre/lib/$(get_system_arch)/libjsoundalsa.* || die
+	fi
+
+	# build system does not remove that
+	if use headless-awt ; then
+		rm -fvr jre/lib/$(get_system_arch)/lib*{[jx]awt,splashscreen}* \
+		{,jre/}bin/policytool bin/appletviewer || die
+	fi
+
+	if ! use examples ; then
+		rm -vr demo/ || die
+	fi
+
+	if ! use source ; then
+		rm -v src.zip || die
+	fi
+
+	dodir "${dest}"
+	cp -pPR * "${ddest}" || die
+
+	dosym ../../../../../../etc/ssl/certs/java/cacerts "${dest}"/jre/lib/security/cacerts
+
+	java-vm_install-env "${FILESDIR}"/${PN}-${SLOT}.env.sh
+	java-vm_set-pax-markings "${ddest}"
+	java-vm_revdep-mask
+	java-vm_sandbox-predict /dev/random /proc/self/coredump_filter
+
+	if use doc ; then
+		docinto html
+		dodoc -r "${S}"/build/*-release/docs/*
+	fi
+}
+
+pkg_postinst() {
+	java-vm-2_pkg_postinst
+	einfo "JavaWebStart functionality provided by icedtea-web package"
+}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-dev] rfc: java-vm-2.eclass eapi 8 support
  2021-11-27  9:54 [gentoo-dev] rfc: java-vm-2.eclass eapi 8 support Miroslav Šulc
@ 2021-11-27 15:58 ` Sam James
  0 siblings, 0 replies; 2+ messages in thread
From: Sam James @ 2021-11-27 15:58 UTC (permalink / raw
  To: gentoo-dev; +Cc: java

[-- Attachment #1: Type: text/plain, Size: 1599 bytes --]



> On 27 Nov 2021, at 09:54, Miroslav Šulc <fordfrog@gentoo.org> wrote:
> 
> hello devs,
> 
> please find attached patch for upgrade of java-vm-2.eclass to support eapi 8. eapi 5 is not used by any package inheriting this eclass so i dropped it.
> 
> i also attach update of the ebuilds of packages that use this eclass and can be updated to eapi 8 (dev-java/icedtea can't atm, it also inherits another java eclass that does not support eapi 8 yet, and dev-java/gcj-jdk is masked in profiles/releases/17.0/package.mask). all works fine except dev-java/openjdk (all slots) where the configuration phase fails or does not finish correctly. all those packages merge fine with eapi 6 (in-tree ebuilds).
> 
> openjdk:8 - configuration finishes but no configuration file is created (and hence compilation fails) as during the configuration phase it complains with this:
> configure: error: Could not find freetype!
> 
> openjdk:11 and openjdk:17 - configuration fails with this error (i was told by sam it is a known bug):
> configure: error: unrecognized options: --disable-static
> 

When b.g.o is back, let's make sure we update the existing bug about it / file a new one.

> i'd like to merge the patches asap (except the broken openjdk) so please let me know if you find anything that could be improved or all's ok.
> 

lgtm. I'd send with git send-email in future to ease review.

I don't see a point in nitpicking the Java eclasses right now, especially as we might be looking at future improvements anyway for how we handle deps.

Thanks for doing this!

Best,
sam

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 618 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-27 15:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-27  9:54 [gentoo-dev] rfc: java-vm-2.eclass eapi 8 support Miroslav Šulc
2021-11-27 15:58 ` Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox