dev-java/openjdk: add 8.402_p06

* Fix various modern C issues - all by backporting parts of later JDK 11/17/21 patches.
* cgroup2 issues: Assuming bug #926247 affects the source build too, but not
  verified, so tagging that.
* Drop stale -fcommon workaround (bug #850505).
* Build with -std=gnu++14 because of -Wregister for Clang 17+ compat (bug #918655).
  (Part of the build uses -std=gnu++98 but not all of it.)

Bug: https://bugs.gentoo.org/926247
Closes: https://bugs.gentoo.org/850505
Closes: https://bugs.gentoo.org/874621
Closes: https://bugs.gentoo.org/918655
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James 2024-03-06 12:36:46 +00:00
parent bd00cf5ad2
commit 250d2f45f9
No known key found for this signature in database
GPG Key ID: 738409F520DF9190
6 changed files with 433 additions and 0 deletions

View File

@ -4,6 +4,7 @@ DIST openjdk-11.0.20.1_p1.tar.gz 116165519 BLAKE2B 3f3627d6535770c6654226ca2c188
DIST openjdk-17.0.8.1_p1.tar.gz 105878760 BLAKE2B e4d752dc87717855bfe4bd84c97056f0d93b554c67bdbb3e750e20479e2156628c85aea7b404577ea6ff40d49669d5f53aab06d0c4cf9aa926b060a0cd93cd03 SHA512 0d8e9e54173be855c15d121d4d6cd36996700e1e2fb194ad93ba8ad794a342c87b7d2f81a32d0bb215e45f1dc1f4efdfe1be5e8de99395730902d443ac773813
DIST openjdk-21.0.1_p12.tar.gz 112241360 BLAKE2B 68a542a1dd65cf74b826e255d08350ec662c37337e45aec18d91e0dbdcce5c6e50172ad482cc21f1aacbf356722e009d4b6431aecf5a1d6b67b74a5007ca702a SHA512 def4b6688f063758235bc454bbbdb4caefa45d2724a9f2296af11d684801f05f1375f0be771b52d9235676e7f89dec816a34b3a1a1cc972662ee50de89600455
DIST openjdk-8.382_p05.tar.gz 93105951 BLAKE2B 07e2961dbbd8de153650a1f92fd88960e6b1b39e7d212cc158bd943d35da5fdab0595583226ac12134eb176b1c550576e7aef5dfaf4a76ac0060daa42f4b4495 SHA512 5879cfbd5795f0260897c52fe2503754767faf1e229832e0c4c6dd9957055fd7105d14403d82ccf92eed0adfecc5bc858a89643e68d3c81d437fd543fbfce49a
DIST openjdk-8.402_p06.tar.gz 93136112 BLAKE2B 023422ca2b4dfc08fd3642e3cb3ec0503d57d09dbcb54841e4a04f67a6cd118712cba90b7760eaf9135f9f001f7c15221c4bcb19986547fb2b6b3fb852bb8af4 SHA512 476d195ef500d8dd2013b17de0669a77ef8076b55c2753eb88b1a13f7a48526b1be7a1befabd284eb9ee8411df19ab1f39c81287ab659984d2d67e8aa7192d79
DIST openjdk-bootstrap-11.0.13_p8-ppc64.tar.xz 108215404 BLAKE2B 5e6c0b905b34b437137922b73a9724da96b8832186fea945f8c73d941db822ca1cc5718f3ecb4607ed98d1f8241c9f365b54caaf978863e8b84680a94f067b5d SHA512 732e2220219d42be10589fcaf2420da87ebc8564b4afc6bd02f61f31cdca9c31b339366e34d374fb814499b92f8aa796435a18f28e10c8cb00d9a0f5953bb60e
DIST openjdk-bootstrap-11.0.13_p8-x86.tar.xz 105420236 BLAKE2B d3137ad497937a9a04dedf38776f3ac45bf3b115d275991fd8582b72ade48390b6aa8ad89e0b4d34fa6a787a3c413dab20b32ef347dc8733544e810150c55d29 SHA512 f71a7ef8fbf19b0595dd7d4ebe52bbe1c95b8c17f34d092472c5f5ce8caf52a053f22db8587f1649f9a96ad01c0c632be343342812f5a8cc4ff843b33b8d9b0f
DIST openjdk-bootstrap-11.0.14_p9-riscv.tar.xz 104601676 BLAKE2B 5f976e8a626a829fae70ad6c007f10bfeff79e29c85d6c75fb2f5ff8984fd2a2bd44ee6e07958dbbdaaed761c6839d375e1b5ba6cffc63b02ad9e2c9178310db SHA512 580dec81626553fe3e7afd0f6385a733ba80a0502cf0f9e8bdc973048887290c9ab6171267d61d8838c4ece4de58c9ca8b78540bd52b1757495a27175057ec64

View File

@ -0,0 +1,41 @@
From cc568d4d246ffc9bf08a96db0889d3b89c852718 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Wed, 6 Mar 2024 11:22:11 +0000
Subject: [PATCH 1/4] Fix -Wint-conversion
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Backport of upstream commit https://github.com/openjdk/jdk21u-dev/commit/7b1455163ed893639059b3d62b71b2ff347c2e3f.
Fixes the following warning/error:
```
jdk8u-jdk8u402-ga/jdk/src/share/bin/splashscreen_stubs.c:64:5: error: returning void * from a function with return type int makes integer from pointer without a cast [-Wint-conversion]
```
Signed-off-by: Sam James <sam@gentoo.org>
---
jdk/src/share/bin/splashscreen_stubs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/jdk/src/share/bin/splashscreen_stubs.c b/jdk/src/share/bin/splashscreen_stubs.c
index 9c1f514..666634f 100644
--- a/jdk/src/share/bin/splashscreen_stubs.c
+++ b/jdk/src/share/bin/splashscreen_stubs.c
@@ -61,11 +61,11 @@ typedef char* (*SplashGetScaledImageName_t)(const char* fileName,
#define INVOKEV(name) _INVOKE(name, ,;)
int DoSplashLoadMemory(void* pdata, int size) {
- INVOKE(SplashLoadMemory, NULL)(pdata, size);
+ INVOKE(SplashLoadMemory, 0)(pdata, size);
}
int DoSplashLoadFile(const char* filename) {
- INVOKE(SplashLoadFile, NULL)(filename);
+ INVOKE(SplashLoadFile, 0)(filename);
}
void DoSplashInit(void) {
--
2.44.0

View File

@ -0,0 +1,48 @@
From 57b8fef20b090ffdf99bcf2c3f5fc8d0d4472788 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Wed, 6 Mar 2024 11:54:24 +0000
Subject: [PATCH 2/4] Fix -Wincompatible-pointer-types
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Backport https://github.com/openjdk/jdk17u/commit/6632e6c6ca74101b45b052fb7962376fbe97605e.
```
jdk8u-jdk8u402-ga/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c: In function Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage:
jdk8u-jdk8u402-ga/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c:2853:19: error: passing argument 1 of freeArray from incompatible pointer type [-Wincompatible-pointer-types]
2853 | freeArray(scale, numBands);
| ^~~~~
| |
| UINT8 ** {aka unsigned char **}
jdk8u-jdk8u402-ga/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c:2689:30: note: expected void ** but argument is of type UINT8 ** {aka unsigned char **}
2689 | static void freeArray(void** arr, jint size) {
| ~~~~~~~^~~
jdk8u-jdk8u402-ga/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c:2860:19: error: passing argument 1 of freeArray from incompatible pointer type [-Wincompatible-pointer-types]
2860 | freeArray(scale, numBands);
| ^~~~~
| |
| UINT8 ** {aka unsigned char **}
```
Signed-off-by: Sam James <sam@gentoo.org>
---
jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
index 7e1d8c9..163003c 100644
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c
@@ -2686,7 +2686,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeTables
RELEASE_ARRAYS(env, data, NULL);
}
-static void freeArray(void** arr, jint size) {
+static void freeArray(UINT8** arr, jint size) {
int i;
if (arr != NULL) {
for (i = 0; i < size; i++) {
--
2.44.0

View File

@ -0,0 +1,38 @@
From 685bf942bdf5b265a3b343c2b682b01b11b6e58a Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Wed, 6 Mar 2024 12:20:03 +0000
Subject: [PATCH 3/4] Fix negative value left shift
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Backport of https://github.com/openjdk/jdk17u/commit/51be7db96f3fc32a7ddb24f8af19fb4fc0577aaf.
```
jdk/src/share/native/com/sun/java/util/jar/pack/constants.h:226:37: error: left operand of shift expression (-1 << 13) is negative [-fpermissive]
jdk/src/share/native/com/sun/java/util/jar/pack/constants.h:226:39: error: enumerator value for AO_UNUSED_MBZ is not an integer constant
226 | AO_UNUSED_MBZ = (-1)<<13, // options bits reserved for future use.
| ^~
```
Signed-off-by: Sam James <sam@gentoo.org>
---
jdk/src/share/native/com/sun/java/util/jar/pack/constants.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/constants.h b/jdk/src/share/native/com/sun/java/util/jar/pack/constants.h
index f1a1f73..536003b 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/constants.h
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/constants.h
@@ -223,7 +223,7 @@ enum {
AO_HAVE_FIELD_FLAGS_HI = 1<<10,
AO_HAVE_METHOD_FLAGS_HI = 1<<11,
AO_HAVE_CODE_FLAGS_HI = 1<<12,
- AO_UNUSED_MBZ = (-1)<<13, // options bits reserved for future use.
+ AO_UNUSED_MBZ = (int)((~0U)<<13), // options bits reserved for future use.
#define ARCHIVE_BIT_DO(F) \
F(AO_HAVE_SPECIAL_FORMATS) \
--
2.44.0

View File

@ -0,0 +1,61 @@
From 24f51a75b79aec29bd1631d320e051a646b9fae4 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Wed, 6 Mar 2024 12:23:41 +0000
Subject: [PATCH 4/4] Fix misc. warnings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Backport of https://github.com/openjdk/jdk11u/commit/49dec121161c162f4aa94caf8c09413253d89377.
```
jdk8u-jdk8u402-ga/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp: In function _jobject* Java_com_sun_java_util_jar_Unpack_getUnusedInput(JNIEnv*, jobject):
jdk8u-jdk8u402-ga/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp:295:12: error: cannot convert bool to jobject {aka _jobject*} in return
295 | return false;
| ^~~~~
jdk8u-jdk8u402-ga/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp: In function jlong Java_com_sun_java_util_jar_pack_NativeUnpack_finish(JNIEnv*, jobject):
jdk8u-jdk8u402-ga/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp:315:3: warning: converting to non-pointer type long int from NULL [-Wconversion-null]
315 | CHECK_EXCEPTION_RETURN_VALUE(uPtr, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
jdk8u-jdk8u402-ga/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp:315:3: warning: converting to non-pointer type long int from NULL [-Wconversion-null]
[...]
```
Signed-off-by: Sam James <sam@gentoo.org>
---
jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp b/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp
index 5fbc726..4c002e7 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/jni.cpp
@@ -292,7 +292,7 @@ Java_com_sun_java_util_jar_pack_NativeUnpack_getUnusedInput(JNIEnv *env, jobject
if (uPtr->aborting()) {
THROW_IOE(uPtr->get_abort_message());
- return false;
+ return null;
}
// We have fetched all the files.
@@ -312,7 +312,7 @@ Java_com_sun_java_util_jar_pack_NativeUnpack_finish(JNIEnv *env, jobject pObj) {
// There's no need to create a new unpacker here if we don't already have one
// just to immediatly free it afterwards.
unpacker* uPtr = get_unpacker(env, pObj, /* noCreate= */ true);
- CHECK_EXCEPTION_RETURN_VALUE(uPtr, NULL);
+ CHECK_EXCEPTION_RETURN_VALUE(uPtr, 0);
size_t consumed = uPtr->input_consumed();
// free_unpacker() will set the unpacker field on 'pObj' to null
free_unpacker(env, pObj, uPtr);
@@ -323,6 +323,7 @@ JNIEXPORT jboolean JNICALL
Java_com_sun_java_util_jar_pack_NativeUnpack_setOption(JNIEnv *env, jobject pObj,
jstring pProp, jstring pValue) {
unpacker* uPtr = get_unpacker(env, pObj);
+ CHECK_EXCEPTION_RETURN_VALUE(uPtr, false);
const char* prop = env->GetStringUTFChars(pProp, JNI_FALSE);
CHECK_EXCEPTION_RETURN_VALUE(prop, false);
const char* value = env->GetStringUTFChars(pValue, JNI_FALSE);
--
2.44.0

View File

@ -0,0 +1,244 @@
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit check-reqs eapi8-dosym flag-o-matic java-pkg-2 java-vm-2 multiprocessing toolchain-funcs
# don't change versioning scheme
# to find correct _p number, look at
# https://github.com/openjdk/jdk${SLOT}u/tags
# you will see, for example, jdk-17.0.4.1-ga and jdk-17.0.4.1+1, both point
# to exact same commit sha. we should always use the full version.
# -ga tag is just for humans to easily identify General Availability release tag.
# we need -ga tag to fetch tarball and unpack it, but exact number everywhere else to
# set build version properly
MY_PV="$(ver_rs 1 'u' 2 '-' ${PV%_p*}-ga)"
SLOT="${PV%%[.+]*}"
DESCRIPTION="Open source implementation of the Java programming language"
HOMEPAGE="https://openjdk.org"
SRC_URI="https://github.com/openjdk/jdk${SLOT}u/archive/refs/tags/jdk${MY_PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2-with-classpath-exception"
KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
IUSE="alsa debug cups doc examples headless-awt javafx +jbootstrap 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}
)
"
BDEPEND="
virtual/pkgconfig
"
PDEPEND="javafx? ( dev-java/openjfx:${SLOT} )"
S="${WORKDIR}/jdk${SLOT}u-jdk${MY_PV}"
PATCHES=(
"${FILESDIR}/openjdk-8-insantiate-arrayallocator.patch"
"${FILESDIR}/openjdk-8.402_p06-0001-Fix-Wint-conversion.patch"
"${FILESDIR}/openjdk-8.402_p06-0002-Fix-Wincompatible-pointer-types.patch"
"${FILESDIR}/openjdk-8.402_p06-0003-Fix-negative-value-left-shift.patch"
"${FILESDIR}/openjdk-8.402_p06-0004-Fix-misc.-warnings.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_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
# -Wregister use (bug #918655)
append-cxxflags -std=gnu++14
# Work around stack alignment issue, bug #647954.
use x86 && append-flags -mincoming-stack-boundary=2
# Strip some flags users may set, but should not. #818502
filter-flags -fexceptions
# Strip lto related flags, no support in this version.
# https://bugs.gentoo.org/833097
# https://bugs.gentoo.org/833098
filter-lto
filter-flags -fdevirtualize-at-ltrans
tc-export_build_env CC CXX PKG_CONFIG STRIP
local myconf=(
--disable-ccache
--disable-freetype-bundling
--disable-precompiled-headers
--enable-unlimited-crypto
--with-boot-jdk="${JDK_HOME}"
--with-extra-cflags="${CFLAGS}"
--with-extra-cxxflags="${CXXFLAGS}"
--with-extra-ldflags="${LDFLAGS}"
--with-freetype-lib="$( $(tc-getPKG_CONFIG) --variable=libdir freetype2 )"
--with-freetype-include="$( $(tc-getPKG_CONFIG) --variable=includedir freetype2)/freetype2"
--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")
)
(
unset _JAVA_OPTIONS JAVA JAVA_TOOL_OPTIONS JAVAC MAKE XARGS
CFLAGS= CXXFLAGS= LDFLAGS= \
CONFIG_SITE=/dev/null \
CONFIG_SHELL="${BROOT}/bin/bash"
econf "${myconf[@]}"
)
}
src_compile() {
# Too brittle - gets confused by e.g. -Oline
export MAKEOPTS="-j$(makeopts_jobs) -l$(makeopts_loadavg)"
unset GNUMAKEFLAGS MAKEFLAGS
local myemakeargs=(
JOBS=$(makeopts_jobs)
LOG=debug
CFLAGS_WARNINGS_ARE_ERRORS= # No -Werror
NICE= # Use PORTAGE_NICENESS, don't adjust further down
$(usex doc docs '')
$(usex jbootstrap bootcycle-images images)
)
emake "${myemakeargs[@]}" -j1
}
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
dosym8 -r /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"
}