dev-qt/qtx11extras: stable 5.14.2 for ppc, bug #719732
[gentoo.git] / eclass / autotools.eclass
index 988b23eba8261cc7c24d5ee81e39b99b7c6d5669..625abd0e9d12e1bcd85464f3d35dbe7e92cecb2b 100644 (file)
@@ -1,9 +1,10 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: autotools.eclass
 # @MAINTAINER:
 # base-system@gentoo.org
+# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
 # @BLURB: Regenerates auto* build scripts
 # @DESCRIPTION:
 # This eclass is for safely handling autotooled software packages that need to
@@ -25,6 +26,11 @@ fi
 if [[ -z ${_AUTOTOOLS_ECLASS} ]]; then
 _AUTOTOOLS_ECLASS=1
 
+case ${EAPI:-0} in
+       0|1|2|3|4|5|6|7) ;;
+       *) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
+esac
+
 inherit libtool
 
 # @ECLASS-VARIABLE: WANT_AUTOCONF
@@ -46,16 +52,20 @@ inherit libtool
 # @INTERNAL
 # @DESCRIPTION:
 # CONSTANT!
-# The latest major version/slot of automake available on each arch.  #312315
-# We should list both the latest stable, and the latest unstable.  #465732
-# This way the stable builds will still work, but the unstable are allowed
-# to build & test things for us ahead of time (if they have it installed).
+# The latest major unstable and stable version/slot of automake available
+# on each arch.
+# List latest unstable version first to boost testing adoption rate because
+# most package manager dependency resolver will pick the first suitable
+# version.
 # If a newer slot is stable on any arch, and is NOT reflected in this list,
 # then circular dependencies may arise during emerge @system bootstraps.
+# 
+# See bug 312315 and 465732 for further information and context.
+# 
 # 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.15:1.15 1.16:1.16 )
+_LATEST_AUTOMAKE=( 1.16.1:1.16 1.15.1:1.15 )
 
 _automake_atom="sys-devel/automake"
 _autoconf_atom="sys-devel/autoconf"
@@ -99,10 +109,7 @@ if [[ -n ${WANT_LIBTOOL} ]] ; then
        export WANT_LIBTOOL
 fi
 
-# Force people (nicely) to upgrade to a newer version of gettext as
-# older ones are known to be crappy.  #496454
-AUTOTOOLS_DEPEND="!<sys-devel/gettext-0.18.1.1-r3
-       ${_automake_atom}
+AUTOTOOLS_DEPEND="${_automake_atom}
        ${_autoconf_atom}
        ${_libtool_atom}"
 RDEPEND=""
@@ -114,7 +121,10 @@ RDEPEND=""
 # their own DEPEND string.
 : ${AUTOTOOLS_AUTO_DEPEND:=yes}
 if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then
-       DEPEND=${AUTOTOOLS_DEPEND}
+       case ${EAPI:-0} in
+               0|1|2|3|4|5|6) DEPEND=${AUTOTOOLS_DEPEND} ;;
+               7) BDEPEND=${AUTOTOOLS_DEPEND} ;;
+       esac
 fi
 __AUTOTOOLS_AUTO_DEPEND=${AUTOTOOLS_AUTO_DEPEND} # See top of eclass
 
@@ -438,9 +448,17 @@ autotools_env_setup() {
        if [[ ${WANT_AUTOMAKE} == "latest" ]]; then
                local pv
                for pv in ${_LATEST_AUTOMAKE[@]/#*:} ; do
-                       # has_version respects ROOT, but in this case, we don't want it to,
-                       # thus "ROOT=/" prefix:
-                       ROOT=/ has_version "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="${pv}"
+                       # Break on first hit to respect _LATEST_AUTOMAKE order.
+                       local hv_args=""
+                       case ${EAPI:-0} in
+                               5|6)
+                                       hv_args="--host-root"
+                                       ;;
+                               7)
+                                       hv_args="-b"
+                                       ;;
+                       esac
+                       ROOT=/ has_version ${hv_args} "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="${pv}" && break
                done
                [[ ${WANT_AUTOMAKE} == "latest" ]] && \
                        die "Cannot find the latest automake! Tried ${_LATEST_AUTOMAKE[*]}"
@@ -494,7 +512,7 @@ autotools_run_tool() {
        fi
 
        if ${m4flags} ; then
-               set -- "${1}" $(autotools_m4dir_include) "${@:2}" $(autotools_m4sysdir_include)
+               set -- "${1}" $(autotools_m4dir_include) $(autotools_m4sysdir_include) "${@:2}"
        fi
 
        # If the caller wants to probe something, then let them do it directly.