From 3b139826026a8f2d7d425a92da196b734cf7bc5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Mon, 3 Jan 2022 17:21:28 +0000 Subject: [PATCH] Fix openjdk-12 build with GCC 10. --- dev-java/openjdk/Manifest | 3 +- .../openjdk/files/patches/12/gcc-10.patch | 131 ++++++++++++++++++ dev-java/openjdk/openjdk-12.0.2_p01.ebuild | 21 ++- 3 files changed, 149 insertions(+), 6 deletions(-) create mode 100644 dev-java/openjdk/files/patches/12/gcc-10.patch diff --git a/dev-java/openjdk/Manifest b/dev-java/openjdk/Manifest index a5b899a..5030c20 100644 --- a/dev-java/openjdk/Manifest +++ b/dev-java/openjdk/Manifest @@ -61,6 +61,7 @@ AUX patches/10/aarch64_gcc_fix.patch 371 BLAKE2B 4662b97aba0022cfbf8f781425ffbf6 AUX patches/10/make-4.3.patch 741 BLAKE2B 6dab3601e6a6260f9813fab663211d8afe7fc08ff1af243bbd8ad90f8c58df5c713aec5cea7788eeabee9fce17e0aec5cf9b6f19becd5baf37a772773a445b36 SHA512 7d6ada121fbd7a4b29459b000fca225b3fb7d95d855459d43749d6ece60b8282418bd349cf235ccd41b86ac36b158e81f3184884883a551c240cb30dfe66fccd AUX patches/10/pointer-comparison.patch 471 BLAKE2B 807c0970dc766d5fea54b8af1d2d0cdddfe75368bca32c6a8cb2c516db21c5e8056fce7715eb1b33ece68970ce6e0686bd061194ac2829432ad44da010767858 SHA512 48faf682eeb2d57873148d3fd948c66d20eebab360ce31352761ff5400bafbeca55a85dded04c38a0e4263d14521b4da41fd02b608b774e4d8e3784452c5c847 AUX patches/12/aarch64_gcc_fix.patch 371 BLAKE2B 1678b268d692fa7c187d822620e3d48475426090a5ecda6f89aa565260ace98a60f7215958b8ac18aff30dbfebb144469d9ac39021105ed9ccde62c695f4e946 SHA512 805b07b95066407a22bfb7d2b6650e7dfbe76b27f8b1f7172ed0955d75704e71150679303e8c0fe07407aaf771501e9adc91b7016fc46e2c0b39e72f21061b10 +AUX patches/12/gcc-10.patch 5469 BLAKE2B a59e305a4eda03e8062619e2dad864227f3eb9e561fa566c521ea057be27a717ad3f5050f4e4f5e59ec524b1040c00426e15f181b98fb928fe92e088f5c0c213 SHA512 339506b521b219a9268b8b3eb5147f27f3ef9c73cc7ee73259b40c7af63464b1ac06c83a7f3eda69a00e3920eeaf7f4af348f79a13d23b9de5d79159443ac5c9 AUX patches/12/make-4.3.patch 740 BLAKE2B 973e21bfbfae8ead6184179f62594cfadecd14f9fa2fd0bce7c063899c4233bba2c36388284cc7adaaf2176391257543fe0df09560979f882d0c61916f12c9ed SHA512 ee8ba62ab5909648dccc1d5e1d12b4f35e813320a7919476bc1ff35bc2ef51030df3426616e0f636dd64a8b07021201f7bcb477253bb33a97cd0db8a6684137c AUX patches/16/1001_ppc64le.patch 9158 BLAKE2B 6bf533c332ac2684216c394e13008bc8d806f2d938b94052cf7f8b267afe585b2bc607b3721c135c7516916595a5ab6ac84fcd96db5754c6cc05279c8c993698 SHA512 05845450afd2d8be9f9f3a69d24c92f2e18593beeb43d748efee53e92edaedacdde2bfcf46b07eb702e036fd3defe2e6418628c26d8e6114653aa521a5d309ce AUX patches/17/1001_ppc64le.patch 9158 BLAKE2B 6bf533c332ac2684216c394e13008bc8d806f2d938b94052cf7f8b267afe585b2bc607b3721c135c7516916595a5ab6ac84fcd96db5754c6cc05279c8c993698 SHA512 05845450afd2d8be9f9f3a69d24c92f2e18593beeb43d748efee53e92edaedacdde2bfcf46b07eb702e036fd3defe2e6418628c26d8e6114653aa521a5d309ce @@ -102,7 +103,7 @@ DIST openjdk-nashorn-8.272_p10.tar.bz2 2850055 BLAKE2B 2348c0f45916101d9fcb4aaa2 DIST openjdk-nashorn-9.0.4_p12.tar.bz2 8961760 BLAKE2B 2ff03adf87a0e0561d52529cf95b8fb827e75773462be7ecddd60dc966e1a229b897eb65a0301a531dfcaff884122e612f1a24b5d5fbc8f0352a8d84218423d7 SHA512 848c6ece418e250561572ad704baeb565580098cfc5f849d4e1a3b41b916aae3487eb4d8d0b319f3a503d122ec064ed4de0678d06821c9a2bdb09c990e589c97 EBUILD openjdk-10.0.2_p13.ebuild 8436 BLAKE2B bd131f53e24af1017840de009275b8529e7f63fa564f58aa04824d8b8c56a92d2773db7fd941ed4048dd403ca2504d16f8e664a2cf0677e82471b4e6dc34a4f5 SHA512 8c066b1479e6e5a0428ae8ac6dae9fd7e133c05173b80e72031049dd83624401ca250d7a28e3212d123bb53f4ee2964794dabc71202a67d1110f1725971d128f EBUILD openjdk-11.0.9_p11.ebuild 8408 BLAKE2B d191259f7cab2db1841825832104a3eaf1755bdf6f05d5325b13402771102b2dee85af652e290b91c050c1f7a0ecb43718b2d050eae08b68aa5319be7d7c0d40 SHA512 be78a0edc4eeacadde35ebdca9f1bd5f09af08d890cde1fa97df9587205bc84efd181b2980436dad0b2f6e378d398ce4a4d15f3c003900a6d40f0a7ba0fb2064 -EBUILD openjdk-12.0.2_p01.ebuild 8499 BLAKE2B 68256c0c8973a223cc6e1b5679b3951477035167a6e7c0fcf5de18484c4bcff4c74c42b3cd7a784f3dba66935418937aeea4d13d97a7ca385412cf1e8499cfe7 SHA512 a0807e4ef5b65c950c9dddff0320cfb81748e8f04df969796e7500c13839b26f66cf70edec53a75c69fe67488d8e56f43c80362436fa506febf3ebfed82079d5 +EBUILD openjdk-12.0.2_p01.ebuild 8914 BLAKE2B 7a331d4bfddd1a6a8d4c79d86cf47a287864bb6923e60be6b6311e3e192756b3f8f3c6a513cc07ff7a772c5549efea02bfbf269afeb8c3082e60f2ec3c1547fd SHA512 b26f970c72c59d7ad9d570db39e5d4c2d647afb51b44e8498b9a8c81fc2afbf98a814dc9d34a94b4524b3e536c7c8cb0b6bdbb9fc8f8f3b1f967eeb47e011910 EBUILD openjdk-13.0.4_p01.ebuild 8417 BLAKE2B 521f065801713eec3290d6fca3ae224f8fae56c026dedcc9e609d9ad92bf2c21ba195d785b8936a1099bb69109fc744132e8876f8e15dcd85f8304cbf1771c4e SHA512 5c08b3a707929881bdac4b8759851f4f0b80482245890568149adadded1e597a8260e707264cf85ea082f610a1f290ca9a00961f78af38466e433f867bd8a8c9 EBUILD openjdk-14.0.2_p01.ebuild 8419 BLAKE2B cdf793ba4d051f57c89027fca2a42666227974d2d1dc9191d9ef21f18110fa302fa6dfbe0a1daf3a6609e1458319f2a6150c1c07180096f1ccd66206160e77fd SHA512 d18978808c7ee2c530eabe1d749681ad50314366590d7683b39854dee9b07f6a609b115ecfc58e021bda493c0eec8e17ff0178fe3b8261675feaf152b9c97f4a EBUILD openjdk-15.0.0_p36.ebuild 8645 BLAKE2B 8a4516e98f32bb038b6a5b0123bba4615842c6d19ed1fc1416c71f789d5ca6e366d8a71501d650c3a77304d80f3140a1e437b98b3045186ee538a81307d5f457 SHA512 7e637fae9f756c290479602175f8c9ca5d31a5d75fe69b21fb54e0aba2b559d4329e03f20935b8109a946bcf6063996f6f42a25693c3f2ad62590ff6bbb1a379 diff --git a/dev-java/openjdk/files/patches/12/gcc-10.patch b/dev-java/openjdk/files/patches/12/gcc-10.patch new file mode 100644 index 0000000..eb6e8d9 --- /dev/null +++ b/dev-java/openjdk/files/patches/12/gcc-10.patch @@ -0,0 +1,131 @@ +# HG changeset patch +# User qpzhang +# Date 1576233515 -28800 +# Fri Dec 13 18:38:35 2019 +0800 +# Node ID 61ac7220fffc3bb2661a31820d86a603f3b35103 +# Parent d6a38e8f738972804e4bae6324d3cd9c8c891859 +8235903: GCC default -fno-common exposes "multiple definition" link errors +Summary: Fixed C standard tentative definitions with extern keyword +Reviewed-by: alanb + +diff --git a/src/java.base/unix/native/libjava/childproc.c b/src/java.base/unix/native/libjava/childproc.c +--- a/src/java.base/unix/native/libjava/childproc.c ++++ b/src/java.base/unix/native/libjava/childproc.c +@@ -34,6 +34,7 @@ + + #include "childproc.h" + ++const char * const *parentPathv; + + ssize_t + restartableWrite(int fd, const void *buf, size_t count) +diff --git a/src/java.base/unix/native/libjava/childproc.h b/src/java.base/unix/native/libjava/childproc.h +--- a/src/java.base/unix/native/libjava/childproc.h ++++ b/src/java.base/unix/native/libjava/childproc.h +@@ -126,7 +126,7 @@ + * The cached and split version of the JDK's effective PATH. + * (We don't support putenv("PATH=...") in native code) + */ +-const char * const *parentPathv; ++extern const char * const *parentPathv; + + ssize_t restartableWrite(int fd, const void *buf, size_t count); + int restartableDup2(int fd_from, int fd_to); +diff --git a/src/java.security.jgss/share/native/libj2gss/NativeFunc.c b/src/java.security.jgss/share/native/libj2gss/NativeFunc.c +--- a/src/java.security.jgss/share/native/libj2gss/NativeFunc.c ++++ b/src/java.security.jgss/share/native/libj2gss/NativeFunc.c +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -27,6 +27,9 @@ + #include + #include "NativeFunc.h" + ++/* global GSS function table */ ++GSS_FUNCTION_TABLE_PTR ftab; ++ + /* standard GSS method names (ordering is from mapfile) */ + static const char RELEASE_NAME[] = "gss_release_name"; + static const char IMPORT_NAME[] = "gss_import_name"; +diff --git a/src/java.security.jgss/share/native/libj2gss/NativeFunc.h b/src/java.security.jgss/share/native/libj2gss/NativeFunc.h +--- a/src/java.security.jgss/share/native/libj2gss/NativeFunc.h ++++ b/src/java.security.jgss/share/native/libj2gss/NativeFunc.h +@@ -277,6 +277,6 @@ + typedef GSS_FUNCTION_TABLE *GSS_FUNCTION_TABLE_PTR; + + /* global GSS function table */ +-GSS_FUNCTION_TABLE_PTR ftab; ++extern GSS_FUNCTION_TABLE_PTR ftab; + + #endif +diff --git a/src/jdk.sctp/unix/native/libsctp/Sctp.c b/src/jdk.sctp/unix/native/libsctp/Sctp.c +new file mode 100644 +--- /dev/null ++++ b/src/jdk.sctp/unix/native/libsctp/Sctp.c +@@ -0,0 +1,33 @@ ++/* ++ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. ++ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. ++ * ++ * This code is free software; you can redistribute it and/or modify it ++ * under the terms of the GNU General Public License version 2 only, as ++ * published by the Free Software Foundation. Oracle designates this ++ * particular file as subject to the "Classpath" exception as provided ++ * by Oracle in the LICENSE file that accompanied this code. ++ * ++ * This code is distributed in the hope that it will be useful, but WITHOUT ++ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or ++ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License ++ * version 2 for more details (a copy is included in the LICENSE file that ++ * accompanied this code). ++ * ++ * You should have received a copy of the GNU General Public License version ++ * 2 along with this work; if not, write to the Free Software Foundation, ++ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. ++ * ++ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA ++ * or visit www.oracle.com if you need additional information or have any ++ * questions. ++ */ ++ ++#include "Sctp.h" ++ ++sctp_getladdrs_func* nio_sctp_getladdrs; ++sctp_freeladdrs_func* nio_sctp_freeladdrs; ++sctp_getpaddrs_func* nio_sctp_getpaddrs; ++sctp_freepaddrs_func* nio_sctp_freepaddrs; ++sctp_bindx_func* nio_sctp_bindx; ++sctp_peeloff_func* nio_sctp_peeloff; +diff --git a/src/jdk.sctp/unix/native/libsctp/Sctp.h b/src/jdk.sctp/unix/native/libsctp/Sctp.h +--- a/src/jdk.sctp/unix/native/libsctp/Sctp.h ++++ b/src/jdk.sctp/unix/native/libsctp/Sctp.h +@@ -1,5 +1,5 @@ + /* +- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. ++ * Copyright (c) 2009, 2019, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it +@@ -322,12 +322,12 @@ + + #endif /* __linux__ */ + +-sctp_getladdrs_func* nio_sctp_getladdrs; +-sctp_freeladdrs_func* nio_sctp_freeladdrs; +-sctp_getpaddrs_func* nio_sctp_getpaddrs; +-sctp_freepaddrs_func* nio_sctp_freepaddrs; +-sctp_bindx_func* nio_sctp_bindx; +-sctp_peeloff_func* nio_sctp_peeloff; ++extern sctp_getladdrs_func* nio_sctp_getladdrs; ++extern sctp_freeladdrs_func* nio_sctp_freeladdrs; ++extern sctp_getpaddrs_func* nio_sctp_getpaddrs; ++extern sctp_freepaddrs_func* nio_sctp_freepaddrs; ++extern sctp_bindx_func* nio_sctp_bindx; ++extern sctp_peeloff_func* nio_sctp_peeloff; + + jboolean loadSocketExtensionFuncs(JNIEnv* env); + diff --git a/dev-java/openjdk/openjdk-12.0.2_p01.ebuild b/dev-java/openjdk/openjdk-12.0.2_p01.ebuild index 4764445..66499df 100644 --- a/dev-java/openjdk/openjdk-12.0.2_p01.ebuild +++ b/dev-java/openjdk/openjdk-12.0.2_p01.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2021 Gentoo Authors +# Copyright 1999-2022 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=6 @@ -90,7 +90,7 @@ openjdk_check_requirements() { pkg_pretend() { openjdk_check_requirements if [[ ${MERGE_TYPE} != binary ]]; then - has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}" + has ccache ${FEATURES} && die "FEATURES=ccache doesn't work with ${PN}, bug #677876" fi } @@ -152,6 +152,7 @@ src_prepare() { eapply "${FILESDIR}/patches/${SLOT}/make-4.3.patch" eapply "${FILESDIR}/patches/${SLOT}/aarch64_gcc_fix.patch" + eapply "${FILESDIR}/patches/${SLOT}/gcc-10.patch" chmod +x configure || die } @@ -160,8 +161,11 @@ 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 + # GCC 10 fixes + append-flags -fno-delete-null-pointer-checks -fno-lifetime-dse + + # 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 @@ -174,6 +178,7 @@ src_configure() { --with-extra-cflags="${CFLAGS}" --with-extra-cxxflags="${CXXFLAGS}" --with-extra-ldflags="${LDFLAGS}" + --with-freetype=system --with-giflib=system --with-lcms=system --with-libjpeg=system @@ -191,10 +196,16 @@ src_configure() { --disable-warnings-as-errors --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="${EROOT%/}/usr/$(get_libdir)/openjfx-${SLOT}/javafx-exports.zip" + # 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