commit:     172f0fbbf621687622ffa0f67a55817470779495
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  7 12:34:59 2022 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Jun  7 12:34:59 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=172f0fbb

eclass: sync with gx86

Closes: https://bugs.gentoo.org/850406
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 eclass/autotools.eclass       |  42 ++++++-------
 eclass/java-utils-2.eclass    | 139 +++++++++++++++++++++---------------------
 eclass/python-utils-r1.eclass |  15 +----
 eclass/toolchain-funcs.eclass |  34 +++++++++--
 eclass/toolchain.eclass       | 112 +++++++++++++++++++++-------------
 5 files changed, 195 insertions(+), 147 deletions(-)

diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index cf1c3461f9..ecfa3c2cf9 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -13,13 +13,13 @@
 # Note: We require GNU m4, as does autoconf.  So feel free to use any features
 # from the GNU version of m4 without worrying about other variants (i.e. BSD).
 
-if [[ ${__AUTOTOOLS_AUTO_DEPEND+set} == "set" ]] ; then
+if [[ ${_AUTOTOOLS_AUTO_DEPEND+set} == "set" ]] ; then
        # See if we were included already, but someone changed the value
        # of AUTOTOOLS_AUTO_DEPEND on us.  We could reload the entire
        # eclass at that point, but that adds overhead, and it's trivial
        # to re-order inherit in eclasses/ebuilds instead.  #409611
-       if [[ ${__AUTOTOOLS_AUTO_DEPEND} != ${AUTOTOOLS_AUTO_DEPEND} ]] ; then
-               die "AUTOTOOLS_AUTO_DEPEND changed value between inherits; 
please inherit ${ECLASS} first! ${__AUTOTOOLS_AUTO_DEPEND} -> 
${AUTOTOOLS_AUTO_DEPEND}"
+       if [[ ${_AUTOTOOLS_AUTO_DEPEND} != ${AUTOTOOLS_AUTO_DEPEND} ]] ; then
+               die "AUTOTOOLS_AUTO_DEPEND changed value between inherits; 
please inherit ${ECLASS} first! ${_AUTOTOOLS_AUTO_DEPEND} -> 
${AUTOTOOLS_AUTO_DEPEND}"
        fi
 fi
 
@@ -37,25 +37,25 @@ esac
 
 inherit gnuconfig libtool
 
-# @ECLASS-VARIABLE: WANT_AUTOCONF
+# @ECLASS_VARIABLE: WANT_AUTOCONF
 # @PRE_INHERIT
 # @DESCRIPTION:
 # The major version of autoconf your package needs
 : ${WANT_AUTOCONF:=latest}
 
-# @ECLASS-VARIABLE: WANT_AUTOMAKE
+# @ECLASS_VARIABLE: WANT_AUTOMAKE
 # @PRE_INHERIT
 # @DESCRIPTION:
 # The major version of automake your package needs
 : ${WANT_AUTOMAKE:=latest}
 
-# @ECLASS-VARIABLE: WANT_LIBTOOL
+# @ECLASS_VARIABLE: WANT_LIBTOOL
 # @PRE_INHERIT
 # @DESCRIPTION:
 # Do you want libtool?  Valid values here are "latest" and "none".
 : ${WANT_LIBTOOL:=latest}
 
-# @ECLASS-VARIABLE: _LATEST_AUTOMAKE
+# @ECLASS_VARIABLE: _LATEST_AUTOMAKE
 # @INTERNAL
 # @DESCRIPTION:
 # CONSTANT!
@@ -74,7 +74,7 @@ inherit gnuconfig libtool
 # Do NOT change this variable in your ebuilds!
 # If you want to force a newer minor version, you can specify the correct
 # WANT value by using a colon:  <PV>:<WANT_AUTOMAKE>
-_LATEST_AUTOMAKE=( 1.16.4:1.16 )
+_LATEST_AUTOMAKE=( 1.16.5:1.16 )
 
 _automake_atom="sys-devel/automake"
 _autoconf_atom="sys-devel/autoconf"
@@ -111,7 +111,7 @@ if [[ -n ${WANT_LIBTOOL} ]] ; then
        export WANT_LIBTOOL
 fi
 
-# @ECLASS-VARIABLE: AUTOTOOLS_DEPEND
+# @ECLASS_VARIABLE: AUTOTOOLS_DEPEND
 # @OUTPUT_VARIABLE
 # @DESCRIPTION:
 # Contains the combination of requested automake/autoconf/libtool
@@ -121,7 +121,7 @@ AUTOTOOLS_DEPEND="${_automake_atom}
        ${_libtool_atom}"
 RDEPEND=""
 
-# @ECLASS-VARIABLE: AUTOTOOLS_AUTO_DEPEND
+# @ECLASS_VARIABLE: AUTOTOOLS_AUTO_DEPEND
 # @PRE_INHERIT
 # @DESCRIPTION:
 # Set to 'no' to disable automatically adding to DEPEND.  This lets
@@ -134,25 +134,25 @@ if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then
                *) BDEPEND=${AUTOTOOLS_DEPEND} ;;
        esac
 fi
-__AUTOTOOLS_AUTO_DEPEND=${AUTOTOOLS_AUTO_DEPEND} # See top of eclass
+_AUTOTOOLS_AUTO_DEPEND=${AUTOTOOLS_AUTO_DEPEND} # See top of eclass
 
 unset _automake_atom _autoconf_atom
 
-# @ECLASS-VARIABLE: AM_OPTS
+# @ECLASS_VARIABLE: AM_OPTS
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # Additional options to pass to automake during
 # eautoreconf call.
 : ${AM_OPTS:=}
 
-# @ECLASS-VARIABLE: AT_NOEAUTOHEADER
+# @ECLASS_VARIABLE: AT_NOEAUTOHEADER
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # Don't run eautoheader command if set to 'yes'; only used to work around
 # packages that don't want their headers being modified.
 : ${AT_NOEAUTOHEADER:=}
 
-# @ECLASS-VARIABLE: AT_NOEAUTOMAKE
+# @ECLASS_VARIABLE: AT_NOEAUTOMAKE
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # Don't run eautomake command if set to 'yes'; only used to workaround
@@ -160,7 +160,7 @@ unset _automake_atom _autoconf_atom
 # not call AM_INIT_AUTOMAKE if it doesn't actually use automake.
 : ${AT_NOEAUTOMAKE:=}
 
-# @ECLASS-VARIABLE: AT_NOELIBTOOLIZE
+# @ECLASS_VARIABLE: AT_NOELIBTOOLIZE
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # Don't run elibtoolize command if set to 'yes',
@@ -168,13 +168,13 @@ unset _automake_atom _autoconf_atom
 # particular options
 : ${AT_NOELIBTOOLIZE:=}
 
-# @ECLASS-VARIABLE: AT_M4DIR
+# @ECLASS_VARIABLE: AT_M4DIR
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # Additional director(y|ies) aclocal should search
 : ${AT_M4DIR:=}
 
-# @ECLASS-VARIABLE: AT_SYS_M4DIR
+# @ECLASS_VARIABLE: AT_SYS_M4DIR
 # @DEFAULT_UNSET
 # @INTERNAL
 # @DESCRIPTION:
@@ -283,7 +283,7 @@ _at_uses_pkg() {
                for macro ; do
                        args+=( -e "^[[:space:]]*${macro}\>" )
                done
-               egrep -q "${args[@]}" configure.??
+               grep -E -q "${args[@]}" configure.??
        fi
 }
 _at_uses_autoheader()  { _at_uses_pkg A{C,M}_CONFIG_HEADER{S,}; }
@@ -393,8 +393,8 @@ eautoconf() {
 
 
        if [[ ${WANT_AUTOCONF} != "2.1" && -e configure.in ]] ; then
-               case ${EAPI:-0} in
-                       0|1|2|3|4|5|6|7)
+               case ${EAPI} in
+                       5|6|7)
                                eqawarn "This package has a configure.in file 
which has long been deprecated.  Please"
                                eqawarn "update it to use configure.ac instead 
as newer versions of autotools will die"
                                eqawarn "when it finds this file.  See 
https://bugs.gentoo.org/426262 for details."
@@ -523,7 +523,7 @@ autotools_env_setup() {
                                5|6)
                                        hv_args="--host-root"
                                        ;;
-                               7)
+                               *)
                                        hv_args="-b"
                                        ;;
                        esac

diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index a778b387b3..fa46b72b3d 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 2004-2021 Gentoo Authors
+# Copyright 2004-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: java-utils-2.eclass
@@ -29,8 +29,6 @@ _JAVA_UTILS_2_ECLASS=1
 # Keep versionator inheritance in case consumers are using it implicitly.
 [[ ${EAPI} == [56] ]] && inherit eapi7-ver eutils multilib versionator
 
-IUSE="elibc_FreeBSD"
-
 # Make sure we use java-config-2
 export WANT_JAVA_CONFIG="2"
 
@@ -45,22 +43,7 @@ has test ${JAVA_PKG_IUSE} && RESTRICT+=" !test? ( test )"
 JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.2.0-r3"
 has source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? 
( app-arch/zip )"
 
-# @ECLASS-VARIABLE: JAVA_PKG_WANT_BOOTCLASSPATH
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The version of bootclasspath the package needs to work. Translates to a 
proper
-# dependency. The bootclasspath can then be obtained by 
java-ant_rewrite-bootclasspath
-if [[ -n "${JAVA_PKG_WANT_BOOTCLASSPATH}" ]]; then
-       if [[ "${JAVA_PKG_WANT_BOOTCLASSPATH}" == "1.5" ]]; then
-               JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} 
>=dev-java/gnu-classpath-0.98-r1:0.98"
-       else
-               eerror "Unknown value of JAVA_PKG_WANT_BOOTCLASSPATH"
-               # since die in global scope doesn't work, this will make 
repoman fail
-               JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} 
BAD_JAVA_PKG_WANT_BOOTCLASSPATH"
-       fi
-fi
-
-# @ECLASS-VARIABLE: JAVA_PKG_ALLOW_VM_CHANGE
+# @ECLASS_VARIABLE: JAVA_PKG_ALLOW_VM_CHANGE
 # @DESCRIPTION:
 # Allow this eclass to change the active VM?
 # If your system VM isn't sufficient for the package, the build will fail
@@ -70,7 +53,7 @@ fi
 # should not be used in the final ebuild.
 JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
 
-# @ECLASS-VARIABLE: JAVA_PKG_FORCE_VM
+# @ECLASS_VARIABLE: JAVA_PKG_FORCE_VM
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # Explicitly set a particular VM to use. If its not valid, it'll fall back to
@@ -78,12 +61,12 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
 #
 # Should only be used for testing and debugging.
 #
-# Example: use sun-jdk-1.5 to emerge foo:
+# Example: use openjdk-11 to emerge foo:
 # @CODE
-#      JAVA_PKG_FORCE_VM=sun-jdk-1.5 emerge foo
+#      JAVA_PKG_FORCE_VM=openjdk-11 emerge foo
 # @CODE
 
-# @ECLASS-VARIABLE: JAVA_PKG_WANT_BUILD_VM
+# @ECLASS_VARIABLE: JAVA_PKG_WANT_BUILD_VM
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # A list of VM handles to choose a build VM from. If the list contains the
@@ -95,7 +78,7 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
 # covered by DEPEND.
 # Requires JAVA_PKG_WANT_SOURCE and JAVA_PKG_WANT_TARGET to be set as well.
 
-# @ECLASS-VARIABLE: JAVA_PKG_WANT_SOURCE
+# @ECLASS_VARIABLE: JAVA_PKG_WANT_SOURCE
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # Specify a non-standard Java source version for compilation (via javac -source
@@ -105,12 +88,12 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
 #
 # Should generally only be used for testing and debugging.
 #
-# Use 1.4 source to emerge baz
+# Use 1.8 source to emerge baz
 # @CODE
-#      JAVA_PKG_WANT_SOURCE=1.4 emerge baz
+#      JAVA_PKG_WANT_SOURCE=1.8 emerge baz
 # @CODE
 
-# @ECLASS-VARIABLE: JAVA_PKG_WANT_TARGET
+# @ECLASS_VARIABLE: JAVA_PKG_WANT_TARGET
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # Same as JAVA_PKG_WANT_SOURCE (see above) but for javac -target parameter,
@@ -120,12 +103,12 @@ 
JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
 #
 # Should generally only be used for testing and debugging.
 #
-# emerge bar to be compatible with 1.3
+# emerge bar to be compatible with 1.8
 # @CODE
-#      JAVA_PKG_WANT_TARGET=1.3 emerge bar
+#      JAVA_PKG_WANT_TARGET=1.8 emerge bar
 # @CODE
 
-# @ECLASS-VARIABLE: JAVA_TEST_EXTRA_ARGS
+# @ECLASS_VARIABLE: JAVA_TEST_EXTRA_ARGS
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # Array of extra arguments that should be passed to java command when running 
tests.
@@ -141,7 +124,21 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
 #      )
 # @CODE
 
-# @ECLASS-VARIABLE: JAVA_PKG_DEBUG
+# @ECLASS-VARIABLE: JAVA_TEST_RUNNER_EXTRA_ARGS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array of extra arguments that should be passed to the test runner when 
running tests.
+# It is useful when you need to pass an extra argument to the test runner.
+#
+# It is used only when running tests.
+#
+# @CODE
+#      JAVA_TEST_RUNNER_EXTRA_ARGS=(
+#              -verbose 3
+#      )
+# @CODE
+
+# @ECLASS_VARIABLE: JAVA_PKG_DEBUG
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # A variable to be set with "yes" or "y", or ANY string of length non equal to
@@ -151,7 +148,7 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
 #      JAVA_PKG_DEBUG="yes"
 # @CODE
 
-# @ECLASS-VARIABLE: JAVA_RM_FILES
+# @ECLASS_VARIABLE: JAVA_RM_FILES
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # An array containing a list of files to remove. If defined, this array will be
@@ -179,7 +176,7 @@ 
JAVA_PKG_COMPILER_DIR=${JAVA_PKG_COMPILER_DIR:="${EPREFIX}/usr/share/java-config
 # Can be overloaded, but it should be overloaded only for local testing.
 
JAVA_PKG_COMPILERS_CONF=${JAVA_PKG_COMPILERS_CONF:="${EPREFIX}/etc/java-config-2/build/compilers.conf"}
 
-# @ECLASS-VARIABLE: JAVA_PKG_FORCE_COMPILER
+# @ECLASS_VARIABLE: JAVA_PKG_FORCE_COMPILER
 # @INTERNAL
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -193,7 +190,7 @@ 
JAVA_PKG_COMPILERS_CONF=${JAVA_PKG_COMPILERS_CONF:="${EPREFIX}/etc/java-config-2
 #      JAVA_PKG_FORCE_COMPILER="jikes javac"
 # @CODE
 
-# @ECLASS-VARIABLE: JAVA_PKG_FORCE_ANT_TASKS
+# @ECLASS_VARIABLE: JAVA_PKG_FORCE_ANT_TASKS
 # @DEFAULT_UNSET
 # @DESCRIPTION:
 # An $IFS separated list of ant tasks. Can be set in environment before calling
@@ -373,7 +370,7 @@ java-pkg_dojar() {
                                        insinto "${JAVA_PKG_JARDEST}"
                                        doins "${jar}"
                                ) || die "failed to install ${jar}"
-                               java-pkg_append_ JAVA_PKG_CLASSPATH 
"${EPREFIX}/${JAVA_PKG_JARDEST}/${jar_basename}"
+                               java-pkg_append_ JAVA_PKG_CLASSPATH 
"${EPREFIX}${JAVA_PKG_JARDEST}/${jar_basename}"
                                debug-print "installed ${jar} to 
${ED}${JAVA_PKG_JARDEST}"
                        # make a symlink to the original jar if it's symlink
                        else
@@ -402,16 +399,16 @@ java-pkg_dojar() {
 # @FUNCTION: java-pkg_regjar
 # @USAGE: </path/to/installed/jar>
 # @DESCRIPTION:
-# Records an already installed (in ${ED}) jar in the package.env
+# Records an already installed (in ${D}) jar in the package.env
 # This would mostly be used if the package has make or a custom script to
 # install things.
 #
 # WARNING:
-# if you want to use shell expansion, you have to use ${ED}/... as the for in
+# if you want to use shell expansion, you have to use ${D}/... as the for in
 # this function will not be able to expand the path, here's an example:
 #
 # @CODE
-#   java-pkg_regjar ${ED}/opt/my-java/lib/*.jar
+#   java-pkg_regjar ${D}/opt/my-java/lib/*.jar
 # @CODE
 #
 
@@ -1375,7 +1372,7 @@ java-pkg_register-environment-variable() {
 # @DESCRIPTION:
 # Returns classpath of a given bootclasspath-providing package version.
 #
-# @param $1 - the version of bootclasspath (e.g. 1.5), 'auto' for bootclasspath
+# @param $1 - the version of bootclasspath (e.g. 1.8), 'auto' for bootclasspath
 #             of the current JDK
 java-pkg_get-bootclasspath() {
        local version="${1}"
@@ -1385,9 +1382,6 @@ java-pkg_get-bootclasspath() {
                auto)
                        bcp="$(java-config -g BOOTCLASSPATH)"
                        ;;
-               1.5)
-                       bcp="$(java-pkg_getjars --build-only 
gnu-classpath-0.98)"
-                       ;;
                *)
                        eerror "unknown parameter of java-pkg_get-bootclasspath"
                        die "unknown parameter of java-pkg_get-bootclasspath"
@@ -1816,8 +1810,18 @@ ejunit_() {
        if [[ "${junit}" == "junit-4" ]] ; then
                runner=org.junit.runner.JUnitCore
        fi
-       debug-print "Calling: java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\" 
-Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]} ${runner} ${@}"
-       java -cp "${cp}" -Djava.io.tmpdir="${T}/" -Djava.awt.headless=true 
${JAVA_TEST_EXTRA_ARGS[@]} ${runner} "${@}" || die "Running junit failed"
+
+       local args=(
+               -cp ${cp}
+               -Djava.io.tmpdir="${T}"
+               -Djava.awt.headless=true
+               ${JAVA_TEST_EXTRA_ARGS[@]}
+               ${runner}
+               ${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}
+               ${@}
+       )
+       debug-print "Calling: java ${args[@]}"
+       java "${args[@]}" || die "Running junit failed"
 }
 
 # @FUNCTION: ejunit
@@ -1895,12 +1899,21 @@ etestng() {
                tests+="${test},"
        done
 
-       debug-print "java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\""\
-               "-Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]} ${runner}"\
-               "-usedefaultlisteners false -testclass ${tests}"
-       java -cp "${cp}" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true 
${JAVA_TEST_EXTRA_ARGS[@]}\
-               ${runner} -usedefaultlisteners false -testclass ${tests}\
-               || die "Running TestNG failed."
+       local args=(
+               -cp ${cp}
+               -Djava.io.tmpdir="${T}"
+               -Djava.awt.headless=true
+               ${JAVA_TEST_EXTRA_ARGS[@]}
+               ${runner}
+               ${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}
+       )
+
+       [[ ! "${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}" =~ "-usedefaultlisteners" ]] 
&& args+=( -usedefaultlisteners false )
+
+       args+=( -testclass ${tests} )
+
+       debug-print "java ${args[@]}"
+       java ${args[@]} || die "Running TestNG failed."
 }
 
 # @FUNCTION: java-utils-2_src_prepare
@@ -2108,8 +2121,9 @@ ejavac() {
                einfo "${compiler_executable} ${javac_args} ${@}"
        fi
 
-       ebegin "Compiling"
-       ${compiler_executable} ${javac_args} "${@}" || die "ejavac failed"
+       local args=( ${compiler_executable} ${javac_args} "${@}" )
+       echo "${args[@]}" >&2
+       "${args[@]}" || die "ejavac failed"
 }
 
 # @FUNCTION: ejavadoc
@@ -2134,8 +2148,9 @@ ejavadoc() {
                einfo "javadoc ${javadoc_args} ${@}"
        fi
 
-       ebegin "Generating JavaDoc"
-       javadoc ${javadoc_args} "${@}" || die "ejavadoc failed"
+       local args=( javadoc ${javadoc_args} "${@}" )
+       echo "${args[@]}" >&2
+       "${args[@]}" || die "ejavadoc failed"
 }
 
 # @FUNCTION: java-pkg_filter-compiler
@@ -2203,8 +2218,7 @@ java-pkg_init() {
        java-config --help >/dev/null || {
                eerror ""
                eerror "Can't run java-config --help"
-               eerror "Have you upgraded python recently but haven't"
-               eerror "run python-updater yet?"
+               eerror "Have you upgraded Python recently but not completed a 
world upgrade yet?"
                die "Can't run java-config --help"
        }
 
@@ -2557,20 +2571,9 @@ java-pkg_setup-vm() {
        debug-print-function ${FUNCNAME} $*
 
        local vendor="$(java-pkg_get-vm-vendor)"
-       if [[ "${vendor}" == "sun" ]] && java-pkg_is-vm-version-ge "1.5" ; then
-               addpredict "/dev/random"
-       elif [[ "${vendor}" == "ibm" ]]; then
-               addpredict "/proc/self/maps"
-               addpredict "/proc/cpuinfo"
-               addpredict "/proc/self/coredump_filter"
-       elif [[ "${vendor}" == "oracle" ]]; then
-               addpredict "/dev/random"
-               addpredict "/proc/self/coredump_filter"
-       elif [[ "${vendor}" == icedtea* ]] && java-pkg_is-vm-version-ge "1.7" ; 
then
+       if [[ "${vendor}" == icedtea* ]] && java-pkg_is-vm-version-ge "1.8" ; 
then
                addpredict "/dev/random"
                addpredict "/proc/self/coredump_filter"
-       elif [[ "${vendor}" == "jrockit" ]]; then
-               addpredict "/proc/cpuinfo"
        fi
 }
 

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 48b6ea484b..b9102cd320 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -352,18 +352,6 @@ _python_export() {
                                fi
                                debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
                                ;;
-                       PYTHON_EPREFIX)
-                               export PYTHON_EPREFIX=${EPREFIX}
-                               if [[ " python jython pypy pypy3 " != *" ${PN} 
"* ]] \
-                               && [[ ! -x ${EPREFIX}/usr/bin/${impl} ]] \
-                               && { has prefix-stack ${USE} || has 
stacked-prefix ${FEATURES} ;} ; then
-                                       # Need to look in build prefix
-                                       if [[ -x 
${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}/usr/bin/${impl} ]]; then
-                                               
PYTHON_EPREFIX=${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}
-                                       fi
-                               fi
-                               debug-print "${FUNCNAME}: PYTHON_EPREFIX = 
${PYTHON_EPREFIX}"
-                               ;;
                        PYTHON_SITEDIR)
                                [[ -n ${PYTHON} ]] || die "PYTHON needs to be 
set for ${var} to be exported, or requested before it"
                                PYTHON_SITEDIR=$(
@@ -1327,6 +1315,9 @@ epytest() {
                -p no:flake8
                -p no:flakes
                -p no:pylint
+               # sterilize pytest-markdown as it runs code snippets from all
+               # *.md files found without any warning
+               -p no:markdown
        )
        local x
        for x in "${EPYTEST_DESELECT[@]}"; do

diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 170ea19057..b86a9682b1 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1,4 +1,4 @@
-# Copyright 2002-2021 Gentoo Authors
+# Copyright 2002-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: toolchain-funcs.eclass
@@ -571,11 +571,12 @@ tc-ld-force-bfd() {
        fi
 }
 
-# @FUNCTION: tc-has-openmp
+# @FUNCTION: _tc-has-openmp
+# @INTERNAL
 # @USAGE: [toolchain prefix]
 # @DESCRIPTION:
 # See if the toolchain supports OpenMP.
-tc-has-openmp() {
+_tc-has-openmp() {
        local base="${T}/test-tc-openmp"
        cat <<-EOF > "${base}.c"
        #include <omp.h>
@@ -595,6 +596,16 @@ tc-has-openmp() {
        return ${ret}
 }
 
+# @FUNCTION: tc-has-openmp
+# @DEPRECATED: tc-check-openmp
+# @USAGE: [toolchain prefix]
+# @DESCRIPTION:
+# See if the toolchain supports OpenMP.  This function is deprecated and will 
be
+# removed on 2023-01-01.
+tc-has-openmp() {
+       _tc-has-openmp "$@"
+}
+
 # @FUNCTION: tc-check-openmp
 # @DESCRIPTION:
 # Test for OpenMP support with the current compiler and error out with
@@ -602,8 +613,21 @@ tc-has-openmp() {
 # OpenMP support that has been requested by the ebuild. Using this function
 # to test for OpenMP support should be preferred over tc-has-openmp and
 # printing a custom message, as it presents a uniform interface to the user.
+#
+# You should test for any necessary OpenMP support in pkg_pretend in order to
+# warn the user of required toolchain changes.  You must still check for OpenMP
+# support at build-time, e.g.
+# @CODE
+# pkg_pretend() {
+#      [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+# }
+#
+# pkg_setup() {
+#      [[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+# }
+# @CODE
 tc-check-openmp() {
-       if ! tc-has-openmp; then
+       if ! _tc-has-openmp; then
                eerror "Your current compiler does not support OpenMP!"
 
                if tc-is-gcc; then
@@ -692,6 +716,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
                        fi
                        ;;
                ia64*)          echo ia64;;
+               loongarch*)     ninj loongarch loong;;
                m68*)           echo m68k;;
                metag*)         echo metag;;
                microblaze*)    echo microblaze;;
@@ -769,6 +794,7 @@ tc-endian() {
                hppa*)          echo big;;
                i?86*)          echo little;;
                ia64*)          echo little;;
+               loongarch*)     echo little;;
                m68*)           echo big;;
                mips*l*)        echo little;;
                mips*)          echo big;;

diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index afd81cfc08..642bf54a89 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1212,7 +1212,7 @@ toolchain_src_configure() {
        local with_abi_map=()
        case $(tc-arch) in
                arm)
-                       # bug 264534, bug #414395
+                       # bug #264534, bug #414395
                        local a arm_arch=${CTARGET%%-*}
                        # Remove trailing endian variations first: eb el be bl 
b l
                        for a in e{b,l} {b,l}e b l ; do
@@ -1233,7 +1233,7 @@ toolchain_src_configure() {
                                confgcc+=( --with-arch=${arm_arch} )
                        fi
 
-                       # Make default mode thumb for microcontroller classes 
#418209
+                       # Make default mode thumb for microcontroller classes, 
bug #418209
                        [[ ${arm_arch} == *-m ]] && confgcc+=( 
--with-mode=thumb )
 
                        # Enable hardvfp
@@ -1262,7 +1262,7 @@ toolchain_src_configure() {
                        fi
                        ;;
                x86)
-                       # Default arch for x86 is normally i386, lets give it a 
bump
+                       # Default arch for x86 is normally i386, let's give it 
a bump
                        # since glibc will do so based on CTARGET anyways
                        confgcc+=( --with-arch=${CTARGET%%-*} )
                        ;;
@@ -1276,12 +1276,13 @@ toolchain_src_configure() {
                        [[ ${CTARGET//_/-} == *-e500v2-* ]] && confgcc+=( 
--enable-e500-double )
                        ;;
                ppc64)
-                       # On ppc64 big endian target gcc assumes elfv1 by 
default,
-                       # and elfv2 on little endian
-                       # but musl does not support elfv1 at all on any endian 
ppc64
-                       # see https://git.musl-libc.org/cgit/musl/tree/INSTALL
-                       # bug #704784
-                       # https://gcc.gnu.org/PR93157
+                       # On ppc64, the big endian target gcc assumes elfv1 by 
default,
+                       # and elfv2 on little endian.
+                       # But musl does not support elfv1 at all on any endian 
ppc64.
+                       # See:
+                       # - https://git.musl-libc.org/cgit/musl/tree/INSTALL
+                       # - bug #704784
+                       # - https://gcc.gnu.org/PR93157
                        [[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( 
--with-abi=elfv2 )
                        ;;
                riscv)
@@ -1290,7 +1291,7 @@ toolchain_src_configure() {
                        ;;
        esac
 
-       # if the target can do biarch (-m32/-m64), enable it.  overhead should
+       # If the target can do biarch (-m32/-m64), enable it.  overhead should
        # be small, and should simplify building of 64bit kernels in a 32bit
        # userland by not needing sys-devel/kgcc64. bug #349405
        case $(tc-arch) in
@@ -1326,14 +1327,14 @@ toolchain_src_configure() {
        if in_iuse openmp ; then
                # Make sure target has pthreads support: bug #326757, bug 
#335883
                # There shouldn't be a chicken & egg problem here as openmp 
won't
-               # build without a C library, and you can't build that w/out
-               # already having a compiler ...
+               # build without a C library, and you can't build that w/o
+               # already having a compiler...
                if ! is_crosscompile || \
                   $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& 
/dev/null
                then
                        confgcc+=( $(use_enable openmp libgomp) )
                else
-                       # Force disable as the configure script can be dumb 
#359855
+                       # Force disable as the configure script can be dumb, 
bug #359855
                        confgcc+=( --disable-libgomp )
                fi
        else
@@ -1347,9 +1348,10 @@ toolchain_src_configure() {
                if hardened_gcc_is_stable ssp; then
                        export gcc_cv_libc_provides_ssp=yes
                fi
+
                if _tc_use_if_iuse ssp; then
                        # On some targets USE="ssp -libssp" is an invalid
-                       # configuration as target libc does not provide
+                       # configuration as the target libc does not provide
                        # stack_chk_* functions. Do not disable libssp there.
                        case ${CTARGET} in
                                mingw*|*-mingw*)
@@ -1465,13 +1467,12 @@ toolchain_src_configure() {
        einfo "LIBPATH:         ${LIBPATH}"
        einfo "DATAPATH:        ${DATAPATH}"
        einfo "STDCXX_INCDIR:   ${STDCXX_INCDIR}"
-       echo
        einfo "Languages:       ${GCC_LANG}"
        echo
 
        # Build in a separate build tree
        mkdir -p "${WORKDIR}"/build || die
-       pushd "${WORKDIR}"/build > /dev/null
+       pushd "${WORKDIR}"/build > /dev/null || die
 
        # ...and now to do the actual configuration
        addwrite /dev/zero
@@ -1636,7 +1637,7 @@ gcc_do_filter_flags() {
                append-flags -O2
        fi
 
-       # Don't want to funk ourselves
+       # Avoid shooting self in foot
        filter-flags '-mabi*' -m31 -m32 -m64
 
        # bug #490738
@@ -1703,14 +1704,17 @@ setup_minispecs_gcc_build_specs() {
        if hardened_gcc_works pie ; then
                cat "${WORKDIR}"/specs/pie.specs >> "${WORKDIR}"/build.specs
        fi
+
        if hardened_gcc_works ssp ; then
                for s in ssp sspall ; do
                        cat "${WORKDIR}"/specs/${s}.specs >> 
"${WORKDIR}"/build.specs
                done
        fi
+
        for s in nostrict znow ; do
                cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs
        done
+
        export GCC_SPECS="${WORKDIR}"/build.specs
 }
 
@@ -1731,10 +1735,11 @@ gcc-multilib-configure() {
                local l=$(gcc-abi-map ${abi})
                [[ -n ${l} ]] && list+=",${l}"
        done
+
        if [[ -n ${list} ]] ; then
                case ${CTARGET} in
-               x86_64*)
-                       tc_version_is_at_least 4.8 && confgcc+=( 
--with-multilib-list=${list:1} )
+                       x86_64*)
+                               tc_version_is_at_least 4.8 && confgcc+=( 
--with-multilib-list=${list:1} )
                        ;;
                esac
        fi
@@ -1765,7 +1770,7 @@ gcc-abi-map() {
 #----> src_compile <----
 
 toolchain_src_compile() {
-       touch "${S}"/gcc/c-gperf.h
+       touch "${S}"/gcc/c-gperf.h || die
 
        # Do not make manpages if we do not have perl ...
        [[ ! -x /usr/bin/perl ]] \
@@ -1777,10 +1782,15 @@ toolchain_src_compile() {
        unset ADAFLAGS
 
        # Older gcc versions did not detect bash and re-exec itself, so force 
the
-       # use of bash.  Newer ones will auto-detect, but this is not harmful.
+       # use of bash for them.
        # This needs to be set for compile as well, as it's used in libtool
        # generation, which will break install otherwise (at least in 3.3.6): 
bug #664486
-       CONFIG_SHELL="${BROOT}/bin/bash" \
+       local gcc_shell="${BROOT}"/bin/bash
+       if tc_version_is_at_least 11.2 ; then
+               gcc_shell="${BROOT}"/bin/sh
+       fi
+
+       CONFIG_SHELL="${gcc_shell}" \
                gcc_do_make ${GCC_MAKE_TARGET}
 }
 
@@ -1800,7 +1810,13 @@ gcc_do_make() {
                # resulting binaries natively
                GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
        else
-               if _tc_use_if_iuse pgo; then
+               if [[ ${EXTRA_ECONF} == *--disable-bootstrap* ]] ; then
+                       GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
+
+                       ewarn "Disabling bootstrapping. ONLY recommended for 
development."
+                       ewarn "This is NOT a safe configuration for endusers!"
+                       ewarn "This compiler may not be safe or reliable for 
production use!"
+               elif _tc_use_if_iuse pgo; then
                        GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap}
                else
                        GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
@@ -1809,7 +1825,7 @@ gcc_do_make() {
 
        # Older versions of GCC could not do profiledbootstrap in parallel due 
to
        # collisions with profiling info.
-       if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]]; then
+       if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] ; then
                ! tc_version_is_at_least 4.6 && export MAKEOPTS="${MAKEOPTS} 
-j1"
        fi
 
@@ -1846,7 +1862,7 @@ gcc_do_make() {
 
        einfo "Compiling ${PN} (${GCC_MAKE_TARGET})..."
 
-       pushd "${WORKDIR}"/build >/dev/null
+       pushd "${WORKDIR}"/build >/dev/null || die
 
        # we "undef" T because the GCC makefiles use this variable, and if it's 
set
        # in the environment (like Portage does) the build fails, bug #286494
@@ -1859,10 +1875,11 @@ gcc_do_make() {
                ${GCC_MAKE_TARGET}
 
        if is_ada; then
-               # Without these links it is not getting the good compiler
-               # Need to check why
+               # Without these links, it is not getting the good compiler
+               # TODO: Need to check why
                ln -s gcc ../build/prev-gcc || die
                ln -s ${CHOST} ../build/prev-${CHOST} || die
+
                # Building standard ada library
                emake -C gcc gnatlib-shared
                # Building gnat toold
@@ -1891,31 +1908,40 @@ gcc_do_make() {
                fi
        fi
 
-       popd >/dev/null
+       popd >/dev/null || die
 }
 
 #---->> src_test <<----
 
 toolchain_src_test() {
-       cd "${WORKDIR}"/build
+       cd "${WORKDIR}"/build || die
+
+       # From opensuse's spec file:
+       # "asan needs a whole shadow address space"
+       ulimit -v unlimited
 
        # 'asan' wants to be preloaded first, so does 'sandbox'.
        # To make asan tests work disable sandbox for all of test suite.
        # 'backtrace' tests also does not like 'libsandbox.so' presence.
        SANDBOX_ON=0 LD_PRELOAD= emake -k check
+
+       einfo "Testing complete."
+       einfo "Please ignore any 'mail' lines in the summary output below (no 
mail is sent)."
+       einfo "Summary:"
+       "${S}"/contrib/test_summary
 }
 
 #---->> src_install <<----
 
 toolchain_src_install() {
-       cd "${WORKDIR}"/build
+       cd "${WORKDIR}"/build || die
 
        # Don't allow symlinks in private gcc include dir as this can break the 
build
-       find gcc/include*/ -type l -delete
+       find gcc/include*/ -type l -delete || die
 
        # Copy over the info pages.  We disabled their generation earlier, but 
the
        # build system only expects to install out of the build dir, not the 
source. bug #464008
-       mkdir -p gcc/doc
+       mkdir -p gcc/doc || die
        local x=
        for x in "${S}"/gcc/doc/*.info* ; do
                if [[ -f ${x} ]] ; then
@@ -1988,7 +2014,7 @@ toolchain_src_install() {
        gcc_slot_java
 
        dodir /usr/bin
-       cd "${D}"${BINPATH}
+       cd "${D}"${BINPATH} || die
        # Ugh: we really need to auto-detect this list.
        #      It's constantly out of date.
        for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo gnat* ; do
@@ -2129,14 +2155,14 @@ toolchain_src_install() {
 
        # Disable RANDMMAP so PCH works, bug #301299
        if tc_version_is_at_least 4.3 ; then
-               pax-mark -r 
"${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
-               pax-mark -r 
"${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
+               pax-mark -r "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
+               pax-mark -r 
"${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
        fi
 
        # Disable MPROTECT so java works, bug #574808
        if is_gcj ; then
-               pax-mark -m 
"${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/ecj1"
-               pax-mark -m 
"${D}${PREFIX}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}/gij"
+               pax-mark -m 
"${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/ecj1"
+               pax-mark -m "${ED}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}/gij"
        fi
 }
 
@@ -2207,6 +2233,7 @@ gcc_movelibs() {
        for FROMDIR in ${removedirs} ; do
                rmdir "${D}"${FROMDIR} >& /dev/null
        done
+
        find -depth "${ED}" -type d -exec rmdir {} + >& /dev/null
 }
 
@@ -2216,13 +2243,13 @@ gcc_movelibs() {
 fix_libtool_libdir_paths() {
        local libpath="$1"
 
-       pushd "${D}" >/dev/null
+       pushd "${D}" >/dev/null || die
 
-       pushd "./${libpath}" >/dev/null
+       pushd "./${libpath}" >/dev/null || die
        local dir="${PWD#${D%/}}"
        local allarchives=$(echo *.la)
        allarchives="\(${allarchives// /\\|}\)"
-       popd >/dev/null
+       popd >/dev/null || die
 
        # The libdir might not have any .la files. bug #548782
        find "./${dir}" -maxdepth 1 -name '*.la' \
@@ -2234,13 +2261,13 @@ fix_libtool_libdir_paths() {
        find "./${dir}/" -maxdepth 1 -name '*.la' \
                -exec sed -i -e "/^dependency_libs=/s:/[^ 
]*/${allarchives}:${libpath}/\1:g" {} + || die
 
-       popd >/dev/null
+       popd >/dev/null || die
 }
 
 create_gcc_env_entry() {
        dodir /etc/env.d/gcc
-       local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
 
+       local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
        local gcc_specs_file
        local gcc_envd_file="${ED}${gcc_envd_base}"
        if [[ -z $1 ]] ; then
@@ -2374,6 +2401,7 @@ gcc_slot_java() {
 
 toolchain_pkg_postinst() {
        do_gcc_config
+
        if [[ ! ${ROOT} && -f 
${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
                eselect compiler-shadow update all
        fi

Reply via email to