* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2016-03-20 18:22 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2016-03-20 18:22 UTC (permalink / raw
To: gentoo-commits
commit: 7ce7d487acf67d28db2eea56569c6fcb499bf6c9
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 18:22:24 2016 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 18:22:24 2016 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=7ce7d487
eclass/toolchain-funcs: sync, bug #576680
eclass/toolchain-funcs.eclass | 125 ++++++++++++++++++++++++++++++++++--------
1 file changed, 102 insertions(+), 23 deletions(-)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index e6ebd49..4a5c5e1 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1,6 +1,6 @@
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.131 2014/11/01 05:19:20 vapier Exp $
+# $Id$
# @ECLASS: toolchain-funcs.eclass
# @MAINTAINER:
@@ -84,6 +84,10 @@ tc-getRANLIB() { tc-getPROG RANLIB ranlib "$@"; }
# @USAGE: [toolchain prefix]
# @RETURN: name of the object copier
tc-getOBJCOPY() { tc-getPROG OBJCOPY objcopy "$@"; }
+# @FUNCTION: tc-getOBJDUMP
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the object dumper
+tc-getOBJDUMP() { tc-getPROG OBJDUMP objdump "$@"; }
# @FUNCTION: tc-getF77
# @USAGE: [toolchain prefix]
# @RETURN: name of the Fortran 77 compiler
@@ -96,6 +100,10 @@ tc-getFC() { tc-getPROG FC gfortran "$@"; }
# @USAGE: [toolchain prefix]
# @RETURN: name of the java compiler
tc-getGCJ() { tc-getPROG GCJ gcj "$@"; }
+# @FUNCTION: tc-getGO
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the Go compiler
+tc-getGO() { tc-getPROG GO gccgo "$@"; }
# @FUNCTION: tc-getPKG_CONFIG
# @USAGE: [toolchain prefix]
# @RETURN: name of the pkg-config tool
@@ -219,10 +227,13 @@ tc-is-static-only() {
# Export common build related compiler settings.
tc-export_build_env() {
tc-export "$@"
+ # Some build envs will initialize vars like:
+ # : ${BUILD_LDFLAGS:-${LDFLAGS}}
+ # So make sure all variables are non-empty. #526734
: ${BUILD_CFLAGS:=-O1 -pipe}
: ${BUILD_CXXFLAGS:=-O1 -pipe}
- : ${BUILD_CPPFLAGS:=}
- : ${BUILD_LDFLAGS:=}
+ : ${BUILD_CPPFLAGS:= }
+ : ${BUILD_LDFLAGS:= }
export BUILD_{C,CXX,CPP,LD}FLAGS
# Some packages use XXX_FOR_BUILD.
@@ -297,7 +308,78 @@ tc-env_build() {
# }
# @CODE
econf_build() {
- tc-env_build econf --build=${CBUILD:-${CHOST}} "$@"
+ local CBUILD=${CBUILD:-${CHOST}}
+ tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@"
+}
+
+# @FUNCTION: tc-ld-is-gold
+# @USAGE: [toolchain prefix]
+# @DESCRIPTION:
+# Return true if the current linker is set to gold.
+tc-ld-is-gold() {
+ local out
+
+ # First check the linker directly.
+ out=$($(tc-getLD "$@") --version 2>&1)
+ if [[ ${out} == *"GNU gold"* ]] ; then
+ return 0
+ fi
+
+ # Then see if they're selecting gold via compiler flags.
+ # Note: We're assuming they're using LDFLAGS to hold the
+ # options and not CFLAGS/CXXFLAGS.
+ local base="${T}/test-tc-gold"
+ cat <<-EOF > "${base}.c"
+ int main() { return 0; }
+ EOF
+ out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1)
+ rm -f "${base}"*
+ if [[ ${out} == *"GNU gold"* ]] ; then
+ return 0
+ fi
+
+ # No gold here!
+ return 1
+}
+
+# @FUNCTION: tc-ld-disable-gold
+# @USAGE: [toolchain prefix]
+# @DESCRIPTION:
+# If the gold linker is currently selected, configure the compilation
+# settings so that we use the older bfd linker instead.
+tc-ld-disable-gold() {
+ if ! tc-ld-is-gold "$@" ; then
+ # They aren't using gold, so nothing to do!
+ return
+ fi
+
+ ewarn "Forcing usage of the BFD linker instead of GOLD"
+
+ # Set up LD to point directly to bfd if it's available.
+ # We need to extract the first word in case there are flags appended
+ # to its value (like multilib). #545218
+ local ld=$(tc-getLD "$@")
+ local bfd_ld="${ld%% *}.bfd"
+ local path_ld=$(which "${bfd_ld}" 2>/dev/null)
+ [[ -e ${path_ld} ]] && export LD=${bfd_ld}
+
+ # Set up LDFLAGS to select gold based on the gcc version.
+ local major=$(gcc-major-version "$@")
+ local minor=$(gcc-minor-version "$@")
+ if [[ ${major} -lt 4 ]] || [[ ${major} -eq 4 && ${minor} -lt 8 ]] ; then
+ # <=gcc-4.7 requires some coercion. Only works if bfd exists.
+ if [[ -e ${path_ld} ]] ; then
+ local d="${T}/bfd-linker"
+ mkdir -p "${d}"
+ ln -sf "${path_ld}" "${d}"/ld
+ export LDFLAGS="${LDFLAGS} -B${d}"
+ else
+ die "unable to locate a BFD linker to bypass gold"
+ fi
+ else
+ # gcc-4.8+ supports -fuse-ld directly.
+ export LDFLAGS="${LDFLAGS} -fuse-ld=bfd"
+ fi
}
# @FUNCTION: tc-has-openmp
@@ -397,10 +479,10 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
arm*) echo arm;;
avr*) ninj avr32 avr;;
bfin*) ninj blackfin bfin;;
- c6x) echo c6x;;
+ c6x*) echo c6x;;
cris*) echo cris;;
- frv) echo frv;;
- hexagon) echo hexagon;;
+ frv*) echo frv;;
+ hexagon*) echo hexagon;;
hppa*) ninj parisc hppa;;
i?86*)
# Starting with linux-2.6.24, the 'x86_64' and 'i386'
@@ -414,11 +496,12 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
;;
ia64*) echo ia64;;
m68*) echo m68k;;
- metag) echo metag;;
+ metag*) echo metag;;
+ microblaze*) echo microblaze;;
mips*) echo mips;;
nios2*) echo nios2;;
nios*) echo nios;;
- or32) echo openrisc;;
+ or32*) echo openrisc;;
powerpc*)
# Starting with linux-2.6.15, the 'ppc' and 'ppc64' trees
# have been unified into simply 'powerpc', but until 2.6.16,
@@ -441,7 +524,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
;;
riscv*) echo riscv;;
s390*) echo s390;;
- score) echo score;;
+ score*) echo score;;
sh64*) ninj sh64 sh;;
sh*) echo sh;;
sparc64*) ninj sparc64 sparc;;
@@ -674,7 +757,9 @@ gen_usr_ldscript() {
# Eventually we'd like to get rid of this func completely #417451
case ${CTARGET:-${CHOST}} in
*-darwin*) type -P scanmacho > /dev/null || return ;; # excluded for now due to known breakage
- *linux*|*-freebsd*|*-openbsd*|*-netbsd*|*-solaris*) type -P scanelf > /dev/null || return;; # Prefix
+ *-android*) return 0 ;;
+ *linux*|*-freebsd*|*-openbsd*|*-netbsd*)
+ use prefix && return 0 ;;
*) return 0 ;;
esac
@@ -719,10 +804,7 @@ gen_usr_ldscript() {
else
tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib})
fi
- if [[ -z ${tlib} ]] ; then
- ewarn "gen_usr_ldscript: unable to read install_name from ${lib}"
- tlib=${lib}
- fi
+ [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}"
tlib=${tlib##*/}
if ${auto} ; then
@@ -731,7 +813,7 @@ gen_usr_ldscript() {
if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]] ; then
mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die
fi
- [[ ${tlib} != ${lib} ]] && rm -f "${ED}"/${libdir}/${lib}
+ rm -f "${ED}"/${libdir}/${lib}
fi
# Mach-O files have an id, which is like a soname, it tells how
@@ -778,16 +860,13 @@ gen_usr_ldscript() {
*)
if ${auto} ; then
tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib})
- if [[ -z ${tlib} ]] ; then
- ewarn "gen_usr_ldscript: unable to read SONAME from ${lib}"
- tlib=${lib}
- fi
+ [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}"
mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die
# some SONAMEs are funky: they encode a version before the .so
if [[ ${tlib} != ${lib}* ]] ; then
mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die
fi
- [[ ${tlib} != ${lib} ]] && rm -f "${ED}"/${libdir}/${lib}
+ rm -f "${ED}"/${libdir}/${lib}
else
tlib=${lib}
fi
@@ -799,7 +878,7 @@ gen_usr_ldscript() {
redirects the linker to the real lib. And yes, this works in the cross-
compiling scenario as the sysroot-ed linker will prepend the real path.
- See bug http://bugs.gentoo.org/4411 for more info.
+ See bug https://bugs.gentoo.org/4411 for more info.
*/
${output_format}
GROUP ( ${EPREFIX}/${libdir}/${tlib} )
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2016-04-18 8:07 Michael Haubenwallner
0 siblings, 0 replies; 89+ messages in thread
From: Michael Haubenwallner @ 2016-04-18 8:07 UTC (permalink / raw
To: gentoo-commits
commit: c658ad8cc73fde6590c34fce7af7340b76c01d21
Author: Michael Haubenwallner <michael.haubenwallner <AT> ssi-schaefer <DOT> com>
AuthorDate: Fri Apr 15 09:15:09 2016 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Apr 18 08:06:00 2016 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=c658ad8c
toolchain.eclass: support CYGWINPORTS_GITREV to take patches from github.com/cygwinports/gcc
eclass/toolchain.eclass | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 2696110..149a991 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -366,6 +366,10 @@ get_gcc_src_uri() {
fi
fi
+ # Cygwin patches from https://github.com/cygwinports/gcc
+ [[ -n ${CYGWINPORTS_GITREV} ]] && \
+ GCC_SRC_URI+=" elibc_Cygwin? ( https://github.com/cygwinports/gcc/archive/${CYGWINPORTS_GITREV}.zip )"
+
echo "${GCC_SRC_URI}"
}
@@ -484,6 +488,8 @@ gcc_quick_unpack() {
use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
+ [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin && unpack "${CYGWINPORTS_GITREV}.zip"
+
popd > /dev/null
}
@@ -508,6 +514,7 @@ toolchain_src_prepare() {
fi
do_gcc_HTB_patches
do_gcc_PIE_patches
+ do_gcc_CYGWINPORTS_patches
epatch_user
if ( tc_version_is_at_least 4.8.2 || use hardened ) && ! use vanilla ; then
@@ -656,6 +663,19 @@ do_gcc_PIE_patches() {
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
}
+do_gcc_CYGWINPORTS_patches() {
+ [[ -n ${CYGWINPORTS_GITREV} ]] || return 0
+ use elibc_Cygwin || return 0
+
+ local p d="${WORKDIR}/gcc-${CYGWINPORTS_GITREV}"
+ for p in $(
+ eval "$(sed -ne '/PATCH_URI="/,/"/p' < "${d}"/gcc.cygport)"
+ echo ${PATCH_URI}
+ ); do
+ epatch "${d}/${p}"
+ done
+}
+
# configure to build with the hardened GCC specs as the default
make_gcc_hard() {
# we want to be able to control the pie patch logic via something other
@@ -1010,7 +1030,7 @@ toolchain_src_configure() {
confgcc+=( --enable-shared )
fi
case ${CHOST} in
- mingw*|*-mingw*|*-cygwin)
+ mingw*|*-mingw*)
confgcc+=( --enable-threads=win32 ) ;;
*)
confgcc+=( --enable-threads=posix ) ;;
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
2016-06-15 11:32 [gentoo-commits] repo/proj/prefix:rap0 " Benda XU
@ 2016-06-15 11:05 ` Benda XU
0 siblings, 0 replies; 89+ messages in thread
From: Benda XU @ 2016-06-15 11:05 UTC (permalink / raw
To: gentoo-commits
commit: 97556ea18ef948aac8f56f039a3cc086f1b7a061
Author: Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 15 11:04:55 2016 +0000
Commit: Benda XU <heroxbd <AT> gentoo <DOT> org>
CommitDate: Wed Jun 15 11:04:55 2016 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=97556ea1
remove kernel-2.eclass, merged.
Bug: 478436
eclass/kernel-2.eclass | 1321 ------------------------------------------------
1 file changed, 1321 deletions(-)
diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
deleted file mode 100644
index e8cb8f2..0000000
--- a/eclass/kernel-2.eclass
+++ /dev/null
@@ -1,1321 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.297 2014/11/28 17:40:20 mpagano Exp $
-
-# Description: kernel.eclass rewrite for a clean base regarding the 2.6
-# series of kernel with back-compatibility for 2.4
-#
-# Original author: John Mylchreest <johnm@gentoo.org>
-# Maintainer: kernel-misc@gentoo.org
-#
-# Please direct your bugs to the current eclass maintainer :)
-
-# added functionality:
-# unipatch - a flexible, singular method to extract, add and remove patches.
-
-# A Couple of env vars are available to effect usage of this eclass
-# These are as follows:
-#
-# K_USEPV - When setting the EXTRAVERSION variable, it should
-# add PV to the end.
-# this is useful for thigns like wolk. IE:
-# EXTRAVERSION would be something like : -wolk-4.19-r1
-# K_NOSETEXTRAVERSION - if this is set then EXTRAVERSION will not be
-# automatically set within the kernel Makefile
-# K_NOUSENAME - if this is set then EXTRAVERSION will not include the
-# first part of ${PN} in EXTRAVERSION
-# K_NOUSEPR - if this is set then EXTRAVERSION will not include the
-# anything based on ${PR}.
-# K_PREPATCHED - if the patchset is prepatched (ie: mm-sources,
-# ck-sources, ac-sources) it will use PR (ie: -r5) as
-# the patchset version for
-# and not use it as a true package revision
-# K_EXTRAEINFO - this is a new-line seperated list of einfo displays in
-# postinst and can be used to carry additional postinst
-# messages
-# K_EXTRAELOG - same as K_EXTRAEINFO except using elog instead of einfo
-# K_EXTRAEWARN - same as K_EXTRAEINFO except using ewarn instead of einfo
-# K_SYMLINK - if this is set, then forcably create symlink anyway
-#
-# K_DEFCONFIG - Allow specifying a different defconfig target.
-# If length zero, defaults to "defconfig".
-# K_WANT_GENPATCHES - Apply genpatches to kernel source. Provide any
-# combination of "base", "extras" or "experimental".
-# K_EXP_GENPATCHES_PULL - If set, we pull "experimental" regardless of the USE FLAG
-# but expect the ebuild maintainer to use K_EXP_GENPATCHES_LIST.
-# K_EXP_GENPATCHES_NOUSE - If set, no USE flag will be provided for "experimental";
-# as a result the user cannot choose to apply those patches.
-# K_EXP_GENPATCHES_LIST - A list of patches to pick from "experimental" to apply when
-# the USE flag is unset and K_EXP_GENPATCHES_PULL is set.
-# K_GENPATCHES_VER - The version of the genpatches tarball(s) to apply.
-# A value of "5" would apply genpatches-2.6.12-5 to
-# my-sources-2.6.12.ebuild
-# K_SECURITY_UNSUPPORTED- If set, this kernel is unsupported by Gentoo Security
-# K_DEBLOB_AVAILABLE - A value of "0" will disable all of the optional deblob
-# code. If empty, will be set to "1" if deblobbing is
-# possible. Test ONLY for "1".
-# K_PREDEBLOBBED - This kernel was already deblobbed elsewhere.
-# If false, either optional deblobbing will be available
-# or the license will note the inclusion of freedist
-# code.
-# K_LONGTERM - If set, the eclass will search for the kernel source
-# in the long term directories on the upstream servers
-# as the location has been changed by upstream
-# H_SUPPORTEDARCH - this should be a space separated list of ARCH's which
-# can be supported by the headers ebuild
-
-# UNIPATCH_LIST - space delimetered list of patches to be applied to the
-# kernel
-# UNIPATCH_EXCLUDE - an addition var to support exlusion based completely
-# on "<passedstring>*" and not "<passedno#>_*"
-# - this should _NOT_ be used from the ebuild as this is
-# reserved for end users passing excludes from the cli
-# UNIPATCH_DOCS - space delimemeted list of docs to be installed to
-# the doc dir
-# UNIPATCH_STRICTORDER - if this is set places patches into directories of
-# order, so they are applied in the order passed
-
-# Changing any other variable in this eclass is not supported; you can request
-# for additional variables to be added by contacting the current maintainer.
-# If you do change them, there is a chance that we will not fix resulting bugs;
-# that of course does not mean we're not willing to help.
-
-PYTHON_COMPAT=( python{2_6,2_7} )
-
-inherit eutils toolchain-funcs versionator multilib python-any-r1
-EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm
-
-# Added by Daniel Ostrow <dostrow@gentoo.org>
-# This is an ugly hack to get around an issue with a 32-bit userland on ppc64.
-# I will remove it when I come up with something more reasonable.
-[[ ${PROFILE_ARCH} == "ppc64" ]] && CHOST="powerpc64-${CHOST#*-}"
-
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} && ${CATEGORY/cross-} != ${CATEGORY} ]]; then
- export CTARGET=${CATEGORY/cross-}
-fi
-
-HOMEPAGE="http://www.kernel.org/ http://www.gentoo.org/ ${HOMEPAGE}"
-: ${LICENSE:="GPL-2"}
-
-# This is the latest KV_PATCH of the deblob tool available from the
-# libre-sources upstream. If you bump this, you MUST regenerate the Manifests
-# for ALL kernel-2 consumer packages where deblob is available.
-: ${DEBLOB_MAX_VERSION:=38}
-
-# No need to run scanelf/strip on kernel sources/headers (bug #134453).
-RESTRICT="binchecks strip"
-
-# set LINUX_HOSTCFLAGS if not already set
-: ${LINUX_HOSTCFLAGS:="-Wall -Wstrict-prototypes -Os -fomit-frame-pointer -I${S}/include"}
-
-# debugging functions
-#==============================================================
-# this function exists only to help debug kernel-2.eclass
-# if you are adding new functionality in, put a call to it
-# at the start of src_unpack, or during SRC_URI/dep generation.
-debug-print-kernel2-variables() {
- for v in PVR CKV OKV KV KV_FULL KV_MAJOR KV_MINOR KV_PATCH RELEASETYPE \
- RELEASE UNIPATCH_LIST_DEFAULT UNIPATCH_LIST_GENPATCHES \
- UNIPATCH_LIST S KERNEL_URI K_WANT_GENPATCHES ; do
- debug-print "${v}: ${!v}"
- done
-}
-
-#Eclass functions only from here onwards ...
-#==============================================================
-handle_genpatches() {
- local tarball
- [[ -z ${K_WANT_GENPATCHES} || -z ${K_GENPATCHES_VER} ]] && return 1
-
- debug-print "Inside handle_genpatches"
- local OKV_ARRAY
- IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
-
- # for > 3.0 kernels, handle genpatches tarball name
- # genpatches for 3.0 and 3.0.1 might be named
- # genpatches-3.0-1.base.tar.xz and genpatches-3.0-2.base.tar.xz
- # respectively. Handle this.
-
- for i in ${K_WANT_GENPATCHES} ; do
- if [[ ${KV_MAJOR} -ge 3 ]]; then
- if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
- tarball="genpatches-${KV_MAJOR}.${KV_MINOR}-${K_GENPATCHES_VER}.${i}.tar.xz"
- else
- tarball="genpatches-${KV_MAJOR}.${KV_PATCH}-${K_GENPATCHES_VER}.${i}.tar.xz"
- fi
- else
- tarball="genpatches-${OKV}-${K_GENPATCHES_VER}.${i}.tar.xz"
- fi
-
- local use_cond_start="" use_cond_end=""
-
- if [[ "${i}" == "experimental" && -z ${K_EXP_GENPATCHES_PULL} && -z ${K_EXP_GENPATCHES_NOUSE} ]] ; then
- use_cond_start="experimental? ( "
- use_cond_end=" )"
-
- if use experimental ; then
- UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
- debug-print "genpatches tarball: $tarball"
- fi
- else
- UNIPATCH_LIST_GENPATCHES+=" ${DISTDIR}/${tarball}"
- debug-print "genpatches tarball: $tarball"
- fi
-
- GENPATCHES_URI+=" ${use_cond_start}mirror://gentoo/${tarball}${use_cond_end}"
- done
-}
-
-detect_version() {
- # this function will detect and set
- # - OKV: Original Kernel Version (2.6.0/2.6.0-test11)
- # - KV: Kernel Version (2.6.0-gentoo/2.6.0-test11-gentoo-r1)
- # - EXTRAVERSION: The additional version appended to OKV (-gentoo/-gentoo-r1)
-
- # We've already run, so nothing to do here.
- [[ -n ${KV_FULL} ]] && return 0
-
- # CKV is used as a comparison kernel version, which is used when
- # PV doesnt reflect the genuine kernel version.
- # this gets set to the portage style versioning. ie:
- # CKV=2.6.11_rc4
- CKV=${CKV:-${PV}}
- OKV=${OKV:-${CKV}}
- OKV=${OKV/_beta/-test}
- OKV=${OKV/_rc/-rc}
- OKV=${OKV/-r*}
- OKV=${OKV/_p*}
-
- KV_MAJOR=$(get_version_component_range 1 ${OKV})
- # handle if OKV is X.Y or X.Y.Z (e.g. 3.0 or 3.0.1)
- local OKV_ARRAY
- IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
-
- # if KV_MAJOR >= 3, then we have no more KV_MINOR
- #if [[ ${KV_MAJOR} -lt 3 ]]; then
- if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
- KV_MINOR=$(get_version_component_range 2 ${OKV})
- KV_PATCH=$(get_version_component_range 3 ${OKV})
- if [[ ${KV_MAJOR}${KV_MINOR}${KV_PATCH} -ge 269 ]]; then
- KV_EXTRA=$(get_version_component_range 4- ${OKV})
- KV_EXTRA=${KV_EXTRA/[-_]*}
- else
- KV_PATCH=$(get_version_component_range 3- ${OKV})
- fi
- else
- KV_PATCH=$(get_version_component_range 2 ${OKV})
- KV_EXTRA=$(get_version_component_range 3- ${OKV})
- KV_EXTRA=${KV_EXTRA/[-_]*}
- fi
-
- debug-print "KV_EXTRA is ${KV_EXTRA}"
-
- KV_PATCH=${KV_PATCH/[-_]*}
-
- local v n=0 missing
- #if [[ ${KV_MAJOR} -lt 3 ]]; then
- if [[ ${#OKV_ARRAY[@]} -ge 3 ]]; then
- for v in CKV OKV KV_{MAJOR,MINOR,PATCH} ; do
- [[ -z ${!v} ]] && n=1 && missing="${missing}${v} ";
- done
- else
- for v in CKV OKV KV_{MAJOR,PATCH} ; do
- [[ -z ${!v} ]] && n=1 && missing="${missing}${v} ";
- done
- fi
-
- [[ $n -eq 1 ]] && \
- eerror "Missing variables: ${missing}" && \
- die "Failed to extract kernel version (try explicit CKV in ebuild)!"
- unset v n missing
-
-# if [[ ${KV_MAJOR} -ge 3 ]]; then
- if [[ ${#OKV_ARRAY[@]} -lt 3 ]]; then
- KV_PATCH_ARR=(${KV_PATCH//\./ })
-
- # at this point 031412, Linus is putting all 3.x kernels in a
- # 3.x directory, may need to revisit when 4.x is released
- KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.x"
-
- [[ -n "${K_LONGTERM}" ]] &&
- KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_PATCH_ARR}"
- else
- #KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.0"
- #KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}"
- if [[ ${KV_MAJOR} -ge 3 ]]; then
- KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.x"
- else
- KERNEL_BASE_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}"
- fi
-
- [[ -n "${K_LONGTERM}" ]] &&
- #KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm"
- KERNEL_BASE_URI="${KERNEL_BASE_URI}/longterm/v${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
- fi
-
- debug-print "KERNEL_BASE_URI is ${KERNEL_BASE_URI}"
-
- if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then
- # handle non genpatch using sources correctly
- if [[ -z ${K_WANT_GENPATCHES} && -z ${K_GENPATCHES_VER} && ${KV_PATCH} -gt 0 ]]; then
- KERNEL_URI="${KERNEL_BASE_URI}/patch-${OKV}.xz"
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.xz"
- fi
- KERNEL_URI="${KERNEL_URI} ${KERNEL_BASE_URI}/linux-${KV_MAJOR}.${KV_MINOR}.tar.xz"
- else
- KERNEL_URI="${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
- fi
-
- RELEASE=${CKV/${OKV}}
- RELEASE=${RELEASE/_beta}
- RELEASE=${RELEASE/_rc/-rc}
- RELEASE=${RELEASE/_pre/-pre}
- # We cannot trivally call kernel_is here, because it calls us to detect the
- # version
- #kernel_is ge 2 6 && RELEASE=${RELEASE/-pre/-git}
- [ $(($KV_MAJOR * 1000 + ${KV_MINOR:-0})) -ge 2006 ] && RELEASE=${RELEASE/-pre/-git}
- RELEASETYPE=${RELEASE//[0-9]}
-
- # Now we know that RELEASE is the -rc/-git
- # and RELEASETYPE is the same but with its numerics stripped
- # we can work on better sorting EXTRAVERSION.
- # first of all, we add the release
- EXTRAVERSION="${RELEASE}"
- debug-print "0 EXTRAVERSION:${EXTRAVERSION}"
- [[ -n ${KV_EXTRA} ]] && [[ ${KV_MAJOR} -lt 3 ]] && EXTRAVERSION=".${KV_EXTRA}${EXTRAVERSION}"
-
- debug-print "1 EXTRAVERSION:${EXTRAVERSION}"
- if [[ -n "${K_NOUSEPR}" ]]; then
- # Don't add anything based on PR to EXTRAVERSION
- debug-print "1.0 EXTRAVERSION:${EXTRAVERSION}"
- elif [[ -n ${K_PREPATCHED} ]]; then
- debug-print "1.1 EXTRAVERSION:${EXTRAVERSION}"
- EXTRAVERSION="${EXTRAVERSION}-${PN/-*}${PR/r}"
- elif [[ "${ETYPE}" = "sources" ]]; then
- debug-print "1.2 EXTRAVERSION:${EXTRAVERSION}"
- # For some sources we want to use the PV in the extra version
- # This is because upstream releases with a completely different
- # versioning scheme.
- case ${PN/-*} in
- wolk) K_USEPV=1;;
- vserver) K_USEPV=1;;
- esac
-
- [[ -z "${K_NOUSENAME}" ]] && EXTRAVERSION="${EXTRAVERSION}-${PN/-*}"
- [[ -n "${K_USEPV}" ]] && EXTRAVERSION="${EXTRAVERSION}-${PV//_/-}"
- [[ -n "${PR//r0}" ]] && EXTRAVERSION="${EXTRAVERSION}-${PR}"
- fi
- debug-print "2 EXTRAVERSION:${EXTRAVERSION}"
-
- # The only messing around which should actually effect this is for KV_EXTRA
- # since this has to limit OKV to MAJ.MIN.PAT and strip EXTRA off else
- # KV_FULL evaluates to MAJ.MIN.PAT.EXT.EXT after EXTRAVERSION
-
- if [[ -n ${KV_EXTRA} ]]; then
- if [[ -n ${KV_MINOR} ]]; then
- OKV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
- else
- OKV="${KV_MAJOR}.${KV_PATCH}"
- fi
- KERNEL_URI="${KERNEL_BASE_URI}/patch-${CKV}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV}.xz"
- fi
-
- # We need to set this using OKV, but we need to set it before we do any
- # messing around with OKV based on RELEASETYPE
- KV_FULL=${OKV}${EXTRAVERSION}
-
- # we will set this for backwards compatibility.
- S=${WORKDIR}/linux-${KV_FULL}
- KV=${KV_FULL}
-
- # -rc-git pulls can be achieved by specifying CKV
- # for example:
- # CKV="2.6.11_rc3_pre2"
- # will pull:
- # linux-2.6.10.tar.xz & patch-2.6.11-rc3.xz & patch-2.6.11-rc3-git2.xz
-
- if [[ ${KV_MAJOR}${KV_MINOR} -eq 26 ]]; then
-
- if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then
- OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))"
- KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.xz"
- fi
-
- if [[ ${RELEASETYPE} == -git ]]; then
- KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${OKV}${RELEASE}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.xz"
- fi
-
- if [[ ${RELEASETYPE} == -rc-git ]]; then
- OKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_PATCH} - 1))"
- KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.xz
- ${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
-
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}${RELEASE}.xz"
- fi
- else
- if [[ ${RELEASETYPE} == -rc ]] || [[ ${RELEASETYPE} == -pre ]]; then
- if [[ ${KV_MAJOR}${KV_PATCH} -eq 30 ]]; then
- OKV="2.6.39"
- else
- KV_PATCH_ARR=(${KV_PATCH//\./ })
- OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))"
- fi
- KERNEL_URI="${KERNEL_BASE_URI}/testing/patch-${CKV//_/-}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${CKV//_/-}.xz"
- fi
-
- if [[ ${RELEASETYPE} == -git ]]; then
- KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${OKV}${RELEASE}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${OKV}${RELEASE}.xz"
- fi
-
- if [[ ${RELEASETYPE} == -rc-git ]]; then
- if [[ ${KV_MAJOR}${KV_PATCH} -eq 30 ]]; then
- OKV="2.6.39"
- else
- KV_PATCH_ARR=(${KV_PATCH//\./ })
- OKV="${KV_MAJOR}.$((${KV_PATCH_ARR} - 1))"
- fi
- KERNEL_URI="${KERNEL_BASE_URI}/snapshots/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz
- ${KERNEL_BASE_URI}/testing/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz
- ${KERNEL_BASE_URI}/linux-${OKV}.tar.xz"
-
- UNIPATCH_LIST_DEFAULT="${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE/-git*}.xz ${DISTDIR}/patch-${KV_MAJOR}.${KV_PATCH}${RELEASE}.xz"
- fi
-
-
- fi
-
-
- debug-print-kernel2-variables
-
- handle_genpatches
-}
-
-# Note: duplicated in linux-info.eclass
-kernel_is() {
- # ALL of these should be set before we can safely continue this function.
- # some of the sources have in the past had only one set.
- local v n=0
- for v in OKV KV_{MAJOR,MINOR,PATCH} ; do [[ -z ${!v} ]] && n=1 ; done
- [[ $n -eq 1 ]] && detect_version
- unset v n
-
- # Now we can continue
- local operator test value
-
- case ${1#-} in
- lt) operator="-lt"; shift;;
- gt) operator="-gt"; shift;;
- le) operator="-le"; shift;;
- ge) operator="-ge"; shift;;
- eq) operator="-eq"; shift;;
- *) operator="-eq";;
- esac
- [[ $# -gt 3 ]] && die "Error in kernel-2_kernel_is(): too many parameters"
-
- : $(( test = (KV_MAJOR << 16) + (KV_MINOR << 8) + KV_PATCH ))
- : $(( value = (${1:-${KV_MAJOR}} << 16) + (${2:-${KV_MINOR}} << 8) + ${3:-${KV_PATCH}} ))
- [ ${test} ${operator} ${value} ]
-}
-
-kernel_is_2_4() {
- kernel_is 2 4
-}
-
-kernel_is_2_6() {
- kernel_is 2 6 || kernel_is 2 5
-}
-
-# Capture the sources type and set DEPENDs
-if [[ ${ETYPE} == sources ]]; then
- DEPEND="!build? (
- sys-apps/sed
- >=sys-devel/binutils-2.11.90.0.31
- )"
- RDEPEND="!build? (
- >=sys-libs/ncurses-5.2
- sys-devel/make
- dev-lang/perl
- sys-devel/bc
- )"
- PDEPEND="!build? ( virtual/dev-manager )"
-
- SLOT="${PVR}"
- DESCRIPTION="Sources based on the Linux Kernel."
- IUSE="symlink build"
-
- # Bug #266157, deblob for libre support
- if [[ -z ${K_PREDEBLOBBED} ]] ; then
- # Bug #359865, force a call to detect_version if needed
- kernel_is ge 2 6 27 && \
- [[ -z "${K_DEBLOB_AVAILABLE}" ]] && \
- kernel_is le 2 6 ${DEBLOB_MAX_VERSION} && \
- K_DEBLOB_AVAILABLE=1
- if [[ ${K_DEBLOB_AVAILABLE} == "1" ]] ; then
- IUSE="${IUSE} deblob"
-
- # Reflect that kernels contain firmware blobs unless otherwise
- # stripped
- LICENSE="${LICENSE} !deblob? ( freedist )"
-
- DEPEND+=" deblob? ( ${PYTHON_DEPS} )"
-
- if [[ -n KV_MINOR ]]; then
- DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
- else
- DEBLOB_PV="${KV_MAJOR}.${KV_PATCH}"
- fi
-
- if [[ ${KV_MAJOR} -ge 3 ]]; then
- DEBLOB_PV="${KV_MAJOR}.${KV_MINOR}"
- fi
-
- DEBLOB_A="deblob-${DEBLOB_PV}"
- DEBLOB_CHECK_A="deblob-check-${DEBLOB_PV}"
- DEBLOB_HOMEPAGE="http://www.fsfla.org/svnwiki/selibre/linux-libre/"
- DEBLOB_URI_PATH="download/releases/LATEST-${DEBLOB_PV}.N"
- if ! has "${EAPI:-0}" 0 1 ; then
- DEBLOB_CHECK_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/deblob-check -> ${DEBLOB_CHECK_A}"
- else
- DEBLOB_CHECK_URI="mirror://gentoo/${DEBLOB_CHECK_A}"
- fi
- DEBLOB_URI="${DEBLOB_HOMEPAGE}/${DEBLOB_URI_PATH}/${DEBLOB_A}"
- HOMEPAGE="${HOMEPAGE} ${DEBLOB_HOMEPAGE}"
-
- KERNEL_URI="${KERNEL_URI}
- deblob? (
- ${DEBLOB_URI}
- ${DEBLOB_CHECK_URI}
- )"
- else
- # We have no way to deblob older kernels, so just mark them as
- # tainted with non-libre materials.
- LICENSE="${LICENSE} freedist"
- fi
- fi
-
-elif [[ ${ETYPE} == headers ]]; then
- DESCRIPTION="Linux system headers"
-
- # Since we should NOT honour KBUILD_OUTPUT in headers
- # lets unset it here.
- unset KBUILD_OUTPUT
-
- SLOT="0"
-else
- eerror "Unknown ETYPE=\"${ETYPE}\", must be \"sources\" or \"headers\""
- die "Unknown ETYPE=\"${ETYPE}\", must be \"sources\" or \"headers\""
-fi
-
-# Cross-compile support functions
-#==============================================================
-kernel_header_destdir() {
- [[ ${CTARGET} == ${CHOST} ]] \
- && echo "${EPREFIX}"/usr/include \
- || echo "${EPREFIX}"/usr/${CTARGET}/usr/include
-}
-
-cross_pre_c_headers() {
- use crosscompile_opts_headers-only && [[ ${CHOST} != ${CTARGET} ]]
-}
-
-env_setup_xmakeopts() {
- # Kernel ARCH != portage ARCH
- export KARCH=$(tc-arch-kernel)
-
- # When cross-compiling, we need to set the ARCH/CROSS_COMPILE
- # variables properly or bad things happen !
- xmakeopts="ARCH=${KARCH}"
- if [[ ${CTARGET} != ${CHOST} ]] && ! cross_pre_c_headers ; then
- xmakeopts="${xmakeopts} CROSS_COMPILE=${CTARGET}-"
- elif type -p ${CHOST}-ar > /dev/null ; then
- xmakeopts="${xmakeopts} CROSS_COMPILE=${CHOST}-"
- fi
- export xmakeopts
-}
-
-# Unpack functions
-#==============================================================
-unpack_2_4() {
- # this file is required for other things to build properly,
- # so we autogenerate it
- make -s mrproper ${xmakeopts} || die "make mrproper failed"
- make -s symlinks ${xmakeopts} || die "make symlinks failed"
- make -s include/linux/version.h ${xmakeopts} || die "make include/linux/version.h failed"
- echo ">>> version.h compiled successfully."
-}
-
-unpack_2_6() {
- # this file is required for other things to build properly, so we
- # autogenerate it ... generate a .config to keep version.h build from
- # spitting out an annoying warning
- make -s mrproper ${xmakeopts} 2>/dev/null \
- || die "make mrproper failed"
-
- # quick fix for bug #132152 which triggers when it cannot include linux
- # headers (ie, we have not installed it yet)
- if ! make -s defconfig ${xmakeopts} &>/dev/null 2>&1 ; then
- touch .config
- eerror "make defconfig failed."
- eerror "assuming you dont have any headers installed yet and continuing"
- epause 5
- fi
-
- make -s include/linux/version.h ${xmakeopts} 2>/dev/null \
- || die "make include/linux/version.h failed"
- rm -f .config >/dev/null
-}
-
-universal_unpack() {
- debug-print "Inside universal_unpack"
-
- local OKV_ARRAY
- IFS="." read -r -a OKV_ARRAY <<<"${OKV}"
-
- cd "${WORKDIR}"
- if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then
- unpack linux-${KV_MAJOR}.${KV_MINOR}.tar.xz
- else
- unpack linux-${OKV}.tar.xz
- fi
-
- if [[ -d "linux" ]]; then
- debug-print "Moving linux to linux-${KV_FULL}"
- mv linux linux-${KV_FULL} \
- || die "Unable to move source tree to ${KV_FULL}."
- elif [[ "${OKV}" != "${KV_FULL}" ]]; then
- if [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]] &&
- [[ "${ETYPE}" = "sources" ]]; then
- debug-print "moving linux-${KV_MAJOR}.${KV_MINOR} to linux-${KV_FULL} "
- mv linux-${KV_MAJOR}.${KV_MINOR} linux-${KV_FULL} \
- || die "Unable to move source tree to ${KV_FULL}."
- else
- debug-print "moving linux-${OKV} to linux-${KV_FULL} "
- mv linux-${OKV} linux-${KV_FULL} \
- || die "Unable to move source tree to ${KV_FULL}."
- fi
- elif [[ ${#OKV_ARRAY[@]} -ge 3 ]] && [[ ${KV_MAJOR} -ge 3 ]]; then
- mv linux-${KV_MAJOR}.${KV_MINOR} linux-${KV_FULL} \
- || die "Unable to move source tree to ${KV_FULL}."
- fi
- cd "${S}"
-
- # remove all backup files
- find . -iname "*~" -exec rm {} \; 2> /dev/null
-
-}
-
-unpack_set_extraversion() {
- cd "${S}"
- sed -i -e "s:^\(EXTRAVERSION =\).*:\1 ${EXTRAVERSION}:" Makefile
- cd "${OLDPWD}"
-}
-
-# Should be done after patches have been applied
-# Otherwise patches that modify the same area of Makefile will fail
-unpack_fix_install_path() {
- cd "${S}"
- sed -i -e 's:#export\tINSTALL_PATH:export\tINSTALL_PATH:' Makefile
-}
-
-# Compile Functions
-#==============================================================
-compile_headers() {
- env_setup_xmakeopts
-
- # if we couldnt obtain HOSTCFLAGS from the Makefile,
- # then set it to something sane
- local HOSTCFLAGS=$(getfilevar HOSTCFLAGS "${S}"/Makefile)
- HOSTCFLAGS=${HOSTCFLAGS:--Wall -Wstrict-prototypes -O2 -fomit-frame-pointer}
-
- if kernel_is 2 4; then
- yes "" | make oldconfig ${xmakeopts}
- echo ">>> make oldconfig complete"
- make dep ${xmakeopts}
- elif kernel_is 2 6; then
- # 2.6.18 introduces headers_install which means we dont need any
- # of this crap anymore :D
- kernel_is ge 2 6 18 && return 0
-
- # autoconf.h isnt generated unless it already exists. plus, we have
- # no guarantee that any headers are installed on the system...
- [[ -f ${EROOT}/usr/include/linux/autoconf.h ]] \
- || touch include/linux/autoconf.h
-
- # if K_DEFCONFIG isn't set, force to "defconfig"
- # needed by mips
- if [[ -z ${K_DEFCONFIG} ]]; then
- if [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.16) ]]; then
- case ${CTARGET} in
- powerpc64*) K_DEFCONFIG="ppc64_defconfig";;
- powerpc*) K_DEFCONFIG="pmac32_defconfig";;
- *) K_DEFCONFIG="defconfig";;
- esac
- else
- K_DEFCONFIG="defconfig"
- fi
- fi
-
- # if there arent any installed headers, then there also isnt an asm
- # symlink in /usr/include/, and make defconfig will fail, so we have
- # to force an include path with $S.
- HOSTCFLAGS="${HOSTCFLAGS} -I${S}/include/"
- ln -sf asm-${KARCH} "${S}"/include/asm
- cross_pre_c_headers && return 0
-
- make ${K_DEFCONFIG} HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "defconfig failed (${K_DEFCONFIG})"
- if compile_headers_tweak_config ; then
- yes "" | make oldconfig HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "2nd oldconfig failed"
- fi
- make prepare HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "prepare failed"
- make prepare-all HOSTCFLAGS="${HOSTCFLAGS}" ${xmakeopts} || die "prepare failed"
- fi
-}
-
-compile_headers_tweak_config() {
- # some targets can be very very picky, so let's finesse the
- # .config based upon any info we may have
- case ${CTARGET} in
- sh*)
- sed -i '/CONFIG_CPU_SH/d' .config
- echo "CONFIG_CPU_SH${CTARGET:2:1}=y" >> .config
- return 0;;
- esac
-
- # no changes, so lets do nothing
- return 1
-}
-
-# install functions
-#==============================================================
-install_universal() {
- # Fix silly permissions in tarball
- cd "${WORKDIR}"
- chown -R 0:0 * >& /dev/null
- chmod -R a+r-w+X,u+w *
- cd ${OLDPWD}
-}
-
-install_headers() {
- local ddir=$(kernel_header_destdir)
-
- # 2.6.18 introduces headers_install which means we dont need any
- # of this crap anymore :D
- if kernel_is ge 2 6 18 ; then
- env_setup_xmakeopts
- emake headers_install INSTALL_HDR_PATH="${D}"/${ddir}/.. ${xmakeopts} || die
-
- # let other packages install some of these headers
- rm -rf "${D}"/${ddir}/scsi #glibc/uclibc/etc...
- return 0
- fi
-
- # Do not use "linux/*" as that can cause problems with very long
- # $S values where the cmdline to cp is too long
- pushd "${S}" >/dev/null
- dodir ${ddir#${EPREFIX}}/linux
- cp -pPR "${S}"/include/linux "${D}"/${ddir}/ || die
- rm -rf "${D}"/${ddir}/linux/modules
-
- dodir ${ddir#${EPREFIX}}/asm
- cp -pPR "${S}"/include/asm/* "${ED}"/${ddir}/asm
-
- if kernel_is 2 6 ; then
- dodir ${ddir#${EPREFIX}}/asm-generic
- cp -pPR "${S}"/include/asm-generic/* "${D}"/${ddir}/asm-generic
- fi
-
- # clean up
- find "${D}" -name '*.orig' -exec rm -f {} \;
-
- popd >/dev/null
-}
-
-install_sources() {
- local file
-
- cd "${S}"
- dodir /usr/src
- echo ">>> Copying sources ..."
-
- file="$(find ${WORKDIR} -iname "docs" -type d)"
- if [[ -n ${file} ]]; then
- for file in $(find ${file} -type f); do
- echo "${file//*docs\/}" >> "${S}"/patches.txt
- echo "===================================================" >> "${S}"/patches.txt
- cat ${file} >> "${S}"/patches.txt
- echo "===================================================" >> "${S}"/patches.txt
- echo "" >> "${S}"/patches.txt
- done
- fi
-
- if [[ ! -f ${S}/patches.txt ]]; then
- # patches.txt is empty so lets use our ChangeLog
- [[ -f ${FILESDIR}/../ChangeLog ]] && \
- echo "Please check the ebuild ChangeLog for more details." \
- > "${S}"/patches.txt
- fi
-
- mv ${WORKDIR}/linux* "${ED}"/usr/src
-
- if [[ -n "${UNIPATCH_DOCS}" ]] ; then
- for i in ${UNIPATCH_DOCS}; do
- dodoc "${T}"/${i}
- done
- fi
-}
-
-# pkg_preinst functions
-#==============================================================
-preinst_headers() {
- local ddir=$(kernel_header_destdir)
- [[ -L ${ddir}/linux ]] && rm ${ddir}/linux
- [[ -L ${ddir}/asm ]] && rm ${ddir}/asm
-}
-
-# pkg_postinst functions
-#==============================================================
-postinst_sources() {
- local MAKELINK=0
-
- # if we have USE=symlink, then force K_SYMLINK=1
- use symlink && K_SYMLINK=1
-
- # if we're using a deblobbed kernel, it's not supported
- [[ $K_DEBLOB_AVAILABLE == 1 ]] && \
- use deblob && \
- K_SECURITY_UNSUPPORTED=deblob
-
- # if we are to forcably symlink, delete it if it already exists first.
- if [[ ${K_SYMLINK} > 0 ]]; then
- [[ -h ${EROOT}usr/src/linux ]] && rm ${EROOT}usr/src/linux
- MAKELINK=1
- fi
-
- # if the link doesnt exist, lets create it
- [[ ! -h ${EROOT}usr/src/linux ]] && MAKELINK=1
-
- if [[ ${MAKELINK} == 1 ]]; then
- cd "${EROOT}"usr/src
- ln -sf linux-${KV_FULL} linux
- cd ${OLDPWD}
- fi
-
- # Don't forget to make directory for sysfs
- [[ ! -d ${EROOT}sys ]] && kernel_is 2 6 && mkdir ${EROOT}sys
-
- echo
- elog "If you are upgrading from a previous kernel, you may be interested"
- elog "in the following document:"
- elog " - General upgrade guide: http://www.gentoo.org/doc/en/kernel-upgrade.xml"
- echo
-
- # if K_EXTRAEINFO is set then lets display it now
- if [[ -n ${K_EXTRAEINFO} ]]; then
- echo ${K_EXTRAEINFO} | fmt |
- while read -s ELINE; do einfo "${ELINE}"; done
- fi
-
- # if K_EXTRAELOG is set then lets display it now
- if [[ -n ${K_EXTRAELOG} ]]; then
- echo ${K_EXTRAELOG} | fmt |
- while read -s ELINE; do elog "${ELINE}"; done
- fi
-
- # if K_EXTRAEWARN is set then lets display it now
- if [[ -n ${K_EXTRAEWARN} ]]; then
- echo ${K_EXTRAEWARN} | fmt |
- while read -s ELINE; do ewarn "${ELINE}"; done
- fi
-
- # optionally display security unsupported message
- # Start with why
- if [[ ${K_SECURITY_UNSUPPORTED} = deblob ]]; then
- ewarn "Deblobbed kernels may not be up-to-date security-wise"
- ewarn "as they depend on external scripts."
- elif [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then
- ewarn "${PN} is UNSUPPORTED by Gentoo Security."
- fi
- # And now the general message.
- if [[ -n ${K_SECURITY_UNSUPPORTED} ]]; then
- ewarn "This means that it is likely to be vulnerable to recent security issues."
- ewarn "For specific information on why this kernel is unsupported, please read:"
- ewarn "http://www.gentoo.org/proj/en/security/kernel.xml"
- fi
-
- # warn sparc users that they need to do cross-compiling with >= 2.6.25(bug #214765)
- KV_MAJOR=$(get_version_component_range 1 ${OKV})
- KV_MINOR=$(get_version_component_range 2 ${OKV})
- KV_PATCH=$(get_version_component_range 3 ${OKV})
- if [[ "$(tc-arch)" = "sparc" ]]; then
- if [[ $(gcc-major-version) -lt 4 && $(gcc-minor-version) -lt 4 ]]; then
- if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.24 ]] ; then
- echo
- elog "NOTE: Since 2.6.25 the kernel Makefile has changed in a way that"
- elog "you now need to do"
- elog " make CROSS_COMPILE=sparc64-unknown-linux-gnu-"
- elog "instead of just"
- elog " make"
- elog "to compile the kernel. For more information please browse to"
- elog "https://bugs.gentoo.org/show_bug.cgi?id=214765"
- echo
- fi
- fi
- fi
-}
-
-# pkg_setup functions
-#==============================================================
-setup_headers() {
- [[ -z ${H_SUPPORTEDARCH} ]] && H_SUPPORTEDARCH=${PN/-*/}
- for i in ${H_SUPPORTEDARCH}; do
- [[ $(tc-arch) == "${i}" ]] && H_ACCEPT_ARCH="yes"
- done
-
- if [[ ${H_ACCEPT_ARCH} != "yes" ]]; then
- echo
- eerror "This version of ${PN} does not support $(tc-arch)."
- eerror "Please merge the appropriate sources, in most cases"
- eerror "(but not all) this will be called $(tc-arch)-headers."
- die "Package unsupported for $(tc-arch)"
- fi
-}
-
-# unipatch
-#==============================================================
-unipatch() {
- local i x y z extention PIPE_CMD UNIPATCH_DROP KPATCH_DIR PATCH_DEPTH ELINE
- local STRICT_COUNT PATCH_LEVEL myLC_ALL myLANG
-
- # set to a standard locale to ensure sorts are ordered properly.
- myLC_ALL="${LC_ALL}"
- myLANG="${LANG}"
- LC_ALL="C"
- LANG=""
-
- [ -z "${KPATCH_DIR}" ] && KPATCH_DIR="${WORKDIR}/patches/"
- [ ! -d ${KPATCH_DIR} ] && mkdir -p ${KPATCH_DIR}
-
- # We're gonna need it when doing patches with a predefined patchlevel
- eshopts_push -s extglob
-
- # This function will unpack all passed tarballs, add any passed patches, and remove any passed patchnumbers
- # usage can be either via an env var or by params
- # although due to the nature we pass this within this eclass
- # it shall be by param only.
- # -z "${UNIPATCH_LIST}" ] && UNIPATCH_LIST="${@}"
- UNIPATCH_LIST="${@}"
-
- #unpack any passed tarballs
- for i in ${UNIPATCH_LIST}; do
- if echo ${i} | grep -qs -e "\.tar" -e "\.tbz" -e "\.tgz" ; then
- if [ -n "${UNIPATCH_STRICTORDER}" ]; then
- unset z
- STRICT_COUNT=$((10#${STRICT_COUNT} + 1))
- for((y=0; y<$((6 - ${#STRICT_COUNT})); y++));
- do z="${z}0";
- done
- PATCH_ORDER="${z}${STRICT_COUNT}"
-
- mkdir -p "${KPATCH_DIR}/${PATCH_ORDER}"
- pushd "${KPATCH_DIR}/${PATCH_ORDER}" >/dev/null
- unpack ${i##*/}
- popd >/dev/null
- else
- pushd "${KPATCH_DIR}" >/dev/null
- unpack ${i##*/}
- popd >/dev/null
- fi
-
- [[ ${i} == *:* ]] && echo ">>> Strict patch levels not currently supported for tarballed patchsets"
- else
- extention=${i/*./}
- extention=${extention/:*/}
- PIPE_CMD=""
- case ${extention} in
- xz) PIPE_CMD="xz -dc";;
- lzma) PIPE_CMD="lzma -dc";;
- bz2) PIPE_CMD="bzip2 -dc";;
- patch*) PIPE_CMD="cat";;
- diff) PIPE_CMD="cat";;
- gz|Z|z) PIPE_CMD="gzip -dc";;
- ZIP|zip) PIPE_CMD="unzip -p";;
- *) UNIPATCH_DROP="${UNIPATCH_DROP} ${i/:*/}";;
- esac
-
- PATCH_LEVEL=${i/*([^:])?(:)}
- i=${i/:*/}
- x=${i/*\//}
- x=${x/\.${extention}/}
-
- if [ -n "${PIPE_CMD}" ]; then
- if [ ! -r "${i}" ]; then
- echo
- eerror "FATAL: unable to locate:"
- eerror "${i}"
- eerror "for read-only. The file either has incorrect permissions"
- eerror "or does not exist."
- die Unable to locate ${i}
- fi
-
- if [ -n "${UNIPATCH_STRICTORDER}" ]; then
- unset z
- STRICT_COUNT=$((10#${STRICT_COUNT} + 1))
- for((y=0; y<$((6 - ${#STRICT_COUNT})); y++));
- do z="${z}0";
- done
- PATCH_ORDER="${z}${STRICT_COUNT}"
-
- mkdir -p ${KPATCH_DIR}/${PATCH_ORDER}/
- $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${PATCH_ORDER}/${x}.patch${PATCH_LEVEL}) || die "uncompressing patch failed"
- else
- $(${PIPE_CMD} ${i} > ${KPATCH_DIR}/${x}.patch${PATCH_LEVEL}) || die "uncompressing patch failed"
- fi
- fi
- fi
-
- # If experimental was not chosen by the user, drop experimental patches not in K_EXP_GENPATCHES_LIST.
- if [[ "${i}" == *"genpatches-"*".experimental."* && -n ${K_EXP_GENPATCHES_PULL} ]] ; then
- if [[ -z ${K_EXP_GENPATCHES_NOUSE} ]] && use experimental; then
- continue
- fi
-
- local j
- for j in ${KPATCH_DIR}/*/50*_*.patch*; do
- for k in ${K_EXP_GENPATCHES_LIST} ; do
- [[ "$(basename ${j})" == ${k}* ]] && continue 2
- done
- UNIPATCH_DROP+=" $(basename ${j})"
- done
- fi
- done
-
- #populate KPATCH_DIRS so we know where to look to remove the excludes
- x=${KPATCH_DIR}
- KPATCH_DIR=""
- for i in $(find ${x} -type d | sort -n); do
- KPATCH_DIR="${KPATCH_DIR} ${i}"
- done
-
- # do not apply fbcondecor patch to sparc/sparc64 as it breaks boot
- # bug #272676
- if [[ "$(tc-arch)" = "sparc" || "$(tc-arch)" = "sparc64" ]]; then
- if [[ ${KV_MAJOR} -ge 3 || ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} > 2.6.28 ]]; then
- UNIPATCH_DROP="${UNIPATCH_DROP} *_fbcondecor-0.9.6.patch"
- echo
- ewarn "fbcondecor currently prevents sparc/sparc64 from booting"
- ewarn "for kernel versions >= 2.6.29. Removing fbcondecor patch."
- ewarn "See https://bugs.gentoo.org/show_bug.cgi?id=272676 for details"
- echo
- fi
- fi
-
- #so now lets get rid of the patchno's we want to exclude
- UNIPATCH_DROP="${UNIPATCH_EXCLUDE} ${UNIPATCH_DROP}"
- for i in ${UNIPATCH_DROP}; do
- ebegin "Excluding Patch #${i}"
- for x in ${KPATCH_DIR}; do rm -f ${x}/${i}* 2>/dev/null; done
- eend $?
- done
-
- # and now, finally, we patch it :)
- for x in ${KPATCH_DIR}; do
- for i in $(find ${x} -maxdepth 1 -iname "*.patch*" -or -iname "*.diff*" | sort -n); do
- STDERR_T="${T}/${i/*\//}"
- STDERR_T="${STDERR_T/.patch*/.err}"
-
- [ -z ${i/*.patch*/} ] && PATCH_DEPTH=${i/*.patch/}
- #[ -z ${i/*.diff*/} ] && PATCH_DEPTH=${i/*.diff/}
-
- if [ -z "${PATCH_DEPTH}" ]; then PATCH_DEPTH=0; fi
-
- ####################################################################
- # IMPORTANT: This is temporary code to support Linux git 3.15_rc1! #
- # #
- # The patch contains a removal of a symlink, followed by addition #
- # of a file with the same name as the symlink in the same #
- # location; this causes the dry-run to fail, filed bug #507656. #
- # #
- # https://bugs.gentoo.org/show_bug.cgi?id=507656 #
- ####################################################################
- if [[ ${PN} == "git-sources" ]] ; then
- if [[ ${KV_MAJOR}${KV_PATCH} -ge 315 && ${RELEASETYPE} == -rc ]] ; then
- ebegin "Applying ${i/*\//} (-p1)"
- if [ $(patch -p1 --no-backup-if-mismatch -f < ${i} >> ${STDERR_T}) "$?" -eq 0 ]; then
- eend 0
- rm ${STDERR_T}
- break
- else
- eend 1
- eerror "Failed to apply patch ${i/*\//}"
- eerror "Please attach ${STDERR_T} to any bug you may post."
- eshopts_pop
- die "Failed to apply ${i/*\//} on patch depth 1."
- fi
- fi
- fi
- ####################################################################
-
- while [ ${PATCH_DEPTH} -lt 5 ]; do
- echo "Attempting Dry-run:" >> ${STDERR_T}
- echo "cmd: patch -p${PATCH_DEPTH} --no-backup-if-mismatch --dry-run -f < ${i}" >> ${STDERR_T}
- echo "=======================================================" >> ${STDERR_T}
- if [ $(patch -p${PATCH_DEPTH} --no-backup-if-mismatch --dry-run -f < ${i} >> ${STDERR_T}) $? -eq 0 ]; then
- ebegin "Applying ${i/*\//} (-p${PATCH_DEPTH})"
- echo "Attempting patch:" > ${STDERR_T}
- echo "cmd: patch -p${PATCH_DEPTH} --no-backup-if-mismatch -f < ${i}" >> ${STDERR_T}
- echo "=======================================================" >> ${STDERR_T}
- if [ $(patch -p${PATCH_DEPTH} --no-backup-if-mismatch -f < ${i} >> ${STDERR_T}) "$?" -eq 0 ]; then
- eend 0
- rm ${STDERR_T}
- break
- else
- eend 1
- eerror "Failed to apply patch ${i/*\//}"
- eerror "Please attach ${STDERR_T} to any bug you may post."
- eshopts_pop
- die "Failed to apply ${i/*\//} on patch depth ${PATCH_DEPTH}."
- fi
- else
- PATCH_DEPTH=$((${PATCH_DEPTH} + 1))
- fi
- done
- if [ ${PATCH_DEPTH} -eq 5 ]; then
- eerror "Failed to dry-run patch ${i/*\//}"
- eerror "Please attach ${STDERR_T} to any bug you may post."
- eshopts_pop
- die "Unable to dry-run patch on any patch depth lower than 5."
- fi
- done
- done
-
- # When genpatches is used, we want to install 0000_README which documents
- # the patches that were used; such that the user can see them, bug #301478.
- if [[ ! -z ${K_WANT_GENPATCHES} ]] ; then
- UNIPATCH_DOCS="${UNIPATCH_DOCS} 0000_README"
- fi
-
- # When files listed in UNIPATCH_DOCS are found in KPATCH_DIR's, we copy it
- # to the temporary directory and remember them in UNIPATCH_DOCS to install
- # them during the install phase.
- local tmp
- for x in ${KPATCH_DIR}; do
- for i in ${UNIPATCH_DOCS}; do
- if [[ -f "${x}/${i}" ]] ; then
- tmp="${tmp} ${i}"
- cp -f "${x}/${i}" "${T}"/
- fi
- done
- done
- UNIPATCH_DOCS="${tmp}"
-
- # clean up KPATCH_DIR's - fixes bug #53610
- for x in ${KPATCH_DIR}; do rm -Rf ${x}; done
-
- LC_ALL="${myLC_ALL}"
- LANG="${myLANG}"
- eshopts_pop
-}
-
-# getfilevar accepts 2 vars as follows:
-# getfilevar <VARIABLE> <CONFIGFILE>
-# pulled from linux-info
-
-getfilevar() {
- local workingdir basefname basedname xarch=$(tc-arch-kernel)
-
- if [[ -z ${1} ]] && [[ ! -f ${2} ]]; then
- echo -e "\n"
- eerror "getfilevar requires 2 variables, with the second a valid file."
- eerror " getfilevar <VARIABLE> <CONFIGFILE>"
- else
- workingdir=${PWD}
- basefname=$(basename ${2})
- basedname=$(dirname ${2})
- unset ARCH
-
- cd ${basedname}
- echo -e "include ${basefname}\ne:\n\t@echo \$(${1})" | \
- make ${BUILD_FIXES} -s -f - e 2>/dev/null
- cd ${workingdir}
-
- ARCH=${xarch}
- fi
-}
-
-detect_arch() {
- # This function sets ARCH_URI and ARCH_PATCH
- # with the neccessary info for the arch sepecific compatibility
- # patchsets.
-
- local ALL_ARCH LOOP_ARCH COMPAT_URI i
-
- # COMPAT_URI is the contents of ${ARCH}_URI
- # ARCH_URI is the URI for all the ${ARCH}_URI patches
- # ARCH_PATCH is ARCH_URI broken into files for UNIPATCH
-
- ARCH_URI=""
- ARCH_PATCH=""
- ALL_ARCH="ALPHA AMD64 ARM HPPA IA64 M68K MIPS PPC PPC64 S390 SH SPARC X86"
-
- for LOOP_ARCH in ${ALL_ARCH}; do
- COMPAT_URI="${LOOP_ARCH}_URI"
- COMPAT_URI="${!COMPAT_URI}"
-
- [[ -n ${COMPAT_URI} ]] && \
- ARCH_URI="${ARCH_URI} $(echo ${LOOP_ARCH} | tr '[:upper:]' '[:lower:]')? ( ${COMPAT_URI} )"
-
- if [[ ${LOOP_ARCH} == "$(echo $(tc-arch-kernel) | tr '[:lower:]' '[:upper:]')" ]]; then
- for i in ${COMPAT_URI}; do
- ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}"
- done
- fi
- done
-}
-
-headers___fix() {
- # Voodoo to partially fix broken upstream headers.
- # note: do not put inline/asm/volatile together (breaks "inline asm volatile")
- sed -i \
- -e '/^\#define.*_TYPES_H/{:loop n; bloop}' \
- -e 's:\<\([us]\(8\|16\|32\|64\)\)\>:__\1:g' \
- -e "s/\([[:space:]]\)inline\([[:space:](]\)/\1__inline__\2/g" \
- -e "s/\([[:space:]]\)asm\([[:space:](]\)/\1__asm__\2/g" \
- -e "s/\([[:space:]]\)volatile\([[:space:](]\)/\1__volatile__\2/g" \
- "$@"
-}
-
-# common functions
-#==============================================================
-kernel-2_src_unpack() {
- universal_unpack
- debug-print "Doing unipatch"
-
- [[ -n ${UNIPATCH_LIST} || -n ${UNIPATCH_LIST_DEFAULT} || -n ${UNIPATCH_LIST_GENPATCHES} ]] && \
- unipatch "${UNIPATCH_LIST_DEFAULT} ${UNIPATCH_LIST_GENPATCHES} ${UNIPATCH_LIST}"
-
- debug-print "Doing premake"
-
- # allow ebuilds to massage the source tree after patching but before
- # we run misc `make` functions below
- [[ $(type -t kernel-2_hook_premake) == "function" ]] && kernel-2_hook_premake
-
- debug-print "Doing epatch_user"
- epatch_user
-
- debug-print "Doing unpack_set_extraversion"
-
- [[ -z ${K_NOSETEXTRAVERSION} ]] && unpack_set_extraversion
- unpack_fix_install_path
-
- # Setup xmakeopts and cd into sourcetree.
- env_setup_xmakeopts
- cd "${S}"
-
- # We dont need a version.h for anything other than headers
- # at least, I should hope we dont. If this causes problems
- # take out the if/fi block and inform me please.
- # unpack_2_6 should now be 2.6.17 safe anyways
- if [[ ${ETYPE} == headers ]]; then
- kernel_is 2 4 && unpack_2_4
- kernel_is 2 6 && unpack_2_6
- fi
-
- if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then
- cp "${DISTDIR}/${DEBLOB_A}" "${T}" || die "cp ${DEBLOB_A} failed"
- cp "${DISTDIR}/${DEBLOB_CHECK_A}" "${T}/deblob-check" || die "cp ${DEBLOB_CHECK_A} failed"
- chmod +x "${T}/${DEBLOB_A}" "${T}/deblob-check" || die "chmod deblob scripts failed"
- fi
-
- # fix a problem on ppc where TOUT writes to /usr/src/linux breaking sandbox
- # only do this for kernel < 2.6.27 since this file does not exist in later
- # kernels
- if [[ -n ${KV_MINOR} && ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH} < 2.6.27 ]] ; then
- sed -i \
- -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
- "${S}"/arch/ppc/Makefile
- else
- sed -i \
- -e 's|TOUT := .tmp_gas_check|TOUT := $(T).tmp_gas_check|' \
- "${S}"/arch/powerpc/Makefile
- fi
-}
-
-kernel-2_src_compile() {
- cd "${S}"
- [[ ${ETYPE} == headers ]] && compile_headers
-
- if [[ $K_DEBLOB_AVAILABLE == 1 ]] && use deblob ; then
- echo ">>> Running deblob script ..."
- python_setup
- sh "${T}/${DEBLOB_A}" --force || die "Deblob script failed to run!!!"
- fi
-}
-
-# if you leave it to the default src_test, it will run make to
-# find whether test/check targets are present; since "make test"
-# actually produces a few support files, they are installed even
-# though the package is binchecks-restricted.
-#
-# Avoid this altogether by making the function moot.
-kernel-2_src_test() { :; }
-
-kernel-2_pkg_preinst() {
- [[ ${ETYPE} == headers ]] && preinst_headers
-}
-
-kernel-2_src_install() {
- install_universal
- [[ ${ETYPE} == headers ]] && install_headers
- [[ ${ETYPE} == sources ]] && install_sources
-}
-
-kernel-2_pkg_postinst() {
- [[ ${ETYPE} == sources ]] && postinst_sources
-}
-
-kernel-2_pkg_setup() {
- if kernel_is 2 4; then
- if [[ $(gcc-major-version) -ge 4 ]] ; then
- echo
- ewarn "Be warned !! >=sys-devel/gcc-4.0.0 isn't supported with linux-2.4!"
- ewarn "Either switch to another gcc-version (via gcc-config) or use a"
- ewarn "newer kernel that supports gcc-4."
- echo
- ewarn "Also be aware that bugreports about gcc-4 not working"
- ewarn "with linux-2.4 based ebuilds will be closed as INVALID!"
- echo
- epause 10
- fi
- fi
-
- ABI="${KERNEL_ABI}"
- [[ ${ETYPE} == headers ]] && setup_headers
- [[ ${ETYPE} == sources ]] && echo ">>> Preparing to unpack ..."
-}
-
-kernel-2_pkg_postrm() {
- # This warning only makes sense for kernel sources.
- [[ ${ETYPE} == headers ]] && return 0
-
- # If there isn't anything left behind, then don't complain.
- [[ -e ${EROOT}usr/src/linux-${KV_FULL} ]] || return 0
- echo
- ewarn "Note: Even though you have successfully unmerged "
- ewarn "your kernel package, directories in kernel source location: "
- ewarn "${EROOT}usr/src/linux-${KV_FULL}"
- ewarn "with modified files will remain behind. By design, package managers"
- ewarn "will not remove these modified files and the directories they reside in."
- echo
-}
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2016-07-08 11:17 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2016-07-08 11:17 UTC (permalink / raw
To: gentoo-commits
commit: bfd6b1346c60047b04563a61dd6cedec361e2d59
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 8 11:17:19 2016 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Jul 8 11:17:19 2016 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=bfd6b134
eclass/toolchain-funcs: sync with gx86
eclass/toolchain-funcs.eclass | 124 +++++++++++++++++++++++++++++++++---------
1 file changed, 99 insertions(+), 25 deletions(-)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 4a5c5e1..b2eeb69 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -22,7 +22,7 @@ inherit multilib prefix
_tc-getPROG() {
local tuple=$1
local v var vars=$2
- local prog=$3
+ local prog=( $3 )
var=${vars%% *}
for v in ${vars} ; do
@@ -34,11 +34,11 @@ _tc-getPROG() {
done
local search=
- [[ -n $4 ]] && search=$(type -p "$4-${prog}")
- [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p "${!tuple}-${prog}")
- [[ -n ${search} ]] && prog=${search##*/}
+ [[ -n $4 ]] && search=$(type -p $4-${prog[0]})
+ [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p ${!tuple}-${prog[0]})
+ [[ -n ${search} ]] && prog[0]=${search##*/}
- export ${var}=${prog}
+ export ${var}="${prog[*]}"
echo "${!var}"
}
tc-getBUILD_PROG() { _tc-getPROG CBUILD "BUILD_$1 $1_FOR_BUILD HOST$1" "${@:2}"; }
@@ -59,7 +59,7 @@ tc-getCC() { tc-getPROG CC gcc "$@"; }
# @FUNCTION: tc-getCPP
# @USAGE: [toolchain prefix]
# @RETURN: name of the C preprocessor
-tc-getCPP() { tc-getPROG CPP cpp "$@"; }
+tc-getCPP() { tc-getPROG CPP "${CC:-gcc} -E" "$@"; }
# @FUNCTION: tc-getCXX
# @USAGE: [toolchain prefix]
# @RETURN: name of the C++ compiler
@@ -132,7 +132,7 @@ tc-getBUILD_CC() { tc-getBUILD_PROG CC gcc "$@"; }
# @FUNCTION: tc-getBUILD_CPP
# @USAGE: [toolchain prefix]
# @RETURN: name of the C preprocessor for building binaries to run on the build machine
-tc-getBUILD_CPP() { tc-getBUILD_PROG CPP cpp "$@"; }
+tc-getBUILD_CPP() { tc-getBUILD_PROG CPP "$(tc-getBUILD_CC) -E" "$@"; }
# @FUNCTION: tc-getBUILD_CXX
# @USAGE: [toolchain prefix]
# @RETURN: name of the C++ compiler for building binaries to run on the build machine
@@ -221,6 +221,21 @@ tc-is-static-only() {
[[ ${host} == *-mint* ]]
}
+# @FUNCTION: tc-stack-grows-down
+# @DESCRIPTION:
+# Return shell true if the stack grows down. This is the default behavior
+# for the vast majority of systems out there and usually projects shouldn't
+# care about such internal details.
+tc-stack-grows-down() {
+ # List the few that grow up.
+ case ${ARCH} in
+ hppa|metag) return 1 ;;
+ esac
+
+ # Assume all others grow down.
+ return 0
+}
+
# @FUNCTION: tc-export_build_env
# @USAGE: [compiler variables]
# @DESCRIPTION:
@@ -445,11 +460,6 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
local host=$2
[[ -z ${host} ]] && host=${CTARGET:-${CHOST}}
- local KV=${KV:-${KV_FULL}}
- use kernel_linux &&
- [[ ${type} == "kern" ]] && [[ -z ${KV} ]] && \
- ewarn "QA: Kernel version could not be determined, please inherit kernel-2 or linux-info"
-
case ${host} in
powerpc-apple-darwin*) echo ppc-macos;;
powerpc64-apple-darwin*) echo ppc64-macos;;
@@ -488,7 +498,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
# Starting with linux-2.6.24, the 'x86_64' and 'i386'
# trees have been unified into 'x86'.
# FreeBSD still uses i386
- if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -lt $(KV_to_int 2.6.24) || ${host} == *freebsd* ]] ; then
+ if [[ ${type} == "kern" && ${host} == *freebsd* ]] ; then
echo i386
else
echo x86
@@ -506,18 +516,10 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
# Starting with linux-2.6.15, the 'ppc' and 'ppc64' trees
# have been unified into simply 'powerpc', but until 2.6.16,
# ppc32 is still using ARCH="ppc" as default
- if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.16) ]] ; then
+ if [[ ${type} == "kern" ]] ; then
echo powerpc
- elif [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -eq $(KV_to_int 2.6.15) ]] ; then
- if [[ ${host} == powerpc64* ]] || [[ ${PROFILE_ARCH} == "ppc64" ]] ; then
- echo powerpc
- else
- echo ppc
- fi
elif [[ ${host} == powerpc64* ]] ; then
echo ppc64
- elif [[ ${PROFILE_ARCH} == "ppc64" ]] ; then
- ninj ppc64 ppc
else
echo ppc
fi
@@ -538,10 +540,10 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
x86_64*)
# Starting with linux-2.6.24, the 'x86_64' and 'i386'
# trees have been unified into 'x86'.
- if [[ ${type} == "kern" ]] && [[ $(KV_to_int ${KV}) -ge $(KV_to_int 2.6.24) ]] ; then
+ if [[ ${type} == "kern" ]] ; then
echo x86
else
- ninj x86_64 amd64
+ echo amd64
fi
;;
xtensa*) echo xtensa;;
@@ -594,12 +596,46 @@ tc-endian() {
esac
}
+# @FUNCTION: tc-get-compiler-type
+# @RETURN: keyword identifying the compiler: gcc, clang, pathcc, unknown
+tc-get-compiler-type() {
+ local code='
+#if defined(__PATHSCALE__)
+ HAVE_PATHCC
+#elif defined(__clang__)
+ HAVE_CLANG
+#elif defined(__GNUC__)
+ HAVE_GCC
+#endif
+'
+ local res=$($(tc-getCPP "$@") -E -P - <<<"${code}")
+
+ case ${res} in
+ *HAVE_PATHCC*) echo pathcc;;
+ *HAVE_CLANG*) echo clang;;
+ *HAVE_GCC*) echo gcc;;
+ *) echo unknown;;
+ esac
+}
+
+# @FUNCTION: tc-is-gcc
+# @RETURN: Shell true if the current compiler is GCC, false otherwise.
+tc-is-gcc() {
+ [[ $(tc-get-compiler-type) == gcc ]]
+}
+
+# @FUNCTION: tc-is-clang
+# @RETURN: Shell true if the current compiler is clang, false otherwise.
+tc-is-clang() {
+ [[ $(tc-get-compiler-type) == clang ]]
+}
+
# Internal func. The first argument is the version info to expand.
# Query the preprocessor to improve compatibility across different
# compilers rather than maintaining a --version flag matrix. #335943
_gcc_fullversion() {
local ver="$1"; shift
- set -- `$(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"`
+ set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__")
eval echo "$ver"
}
@@ -629,6 +665,39 @@ gcc-micro-version() {
_gcc_fullversion '$3' "$@"
}
+# Internal func. Based on _gcc_fullversion() above.
+_clang_fullversion() {
+ local ver="$1"; shift
+ set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__")
+ eval echo "$ver"
+}
+
+# @FUNCTION: clang-fullversion
+# @RETURN: compiler version (major.minor.micro: [3.4.6])
+clang-fullversion() {
+ _clang_fullversion '$1.$2.$3' "$@"
+}
+# @FUNCTION: clang-version
+# @RETURN: compiler version (major.minor: [3.4].6)
+clang-version() {
+ _clang_fullversion '$1.$2' "$@"
+}
+# @FUNCTION: clang-major-version
+# @RETURN: major compiler version (major: [3].4.6)
+clang-major-version() {
+ _clang_fullversion '$1' "$@"
+}
+# @FUNCTION: clang-minor-version
+# @RETURN: minor compiler version (minor: 3.[4].6)
+clang-minor-version() {
+ _clang_fullversion '$2' "$@"
+}
+# @FUNCTION: clang-micro-version
+# @RETURN: micro compiler version (micro: 3.4.[6])
+clang-micro-version() {
+ _clang_fullversion '$3' "$@"
+}
+
# Returns the installation directory - internal toolchain
# function for use by _gcc-specs-exists (for flag-o-matic).
_gcc-install-dir() {
@@ -754,6 +823,11 @@ gen_usr_ldscript() {
# we keep on using gen_usr_ldscript.
[[ -n ${PREFIX_DISABLE_GEN_USR_LDSCRIPT} ]] && return
+ # We only care about stuffing / for the native ABI. #479448
+ if [[ $(type -t multilib_is_native_abi) == "function" ]] ; then
+ multilib_is_native_abi || return 0
+ fi
+
# Eventually we'd like to get rid of this func completely #417451
case ${CTARGET:-${CHOST}} in
*-darwin*) type -P scanmacho > /dev/null || return ;; # excluded for now due to known breakage
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2017-10-03 7:38 Michael Haubenwallner
0 siblings, 0 replies; 89+ messages in thread
From: Michael Haubenwallner @ 2017-10-03 7:38 UTC (permalink / raw
To: gentoo-commits
commit: 454ac483ada6005cd1285afc1f152a2512f46634
Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 3 07:36:18 2017 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Tue Oct 3 07:36:18 2017 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=454ac483
libtool.eclass: drop, app-portage/elt-patches has prefix support
eclass/libtool.eclass | 519 --------------------------------------------------
1 file changed, 519 deletions(-)
diff --git a/eclass/libtool.eclass b/eclass/libtool.eclass
deleted file mode 100644
index 7f09f3760c..0000000000
--- a/eclass/libtool.eclass
+++ /dev/null
@@ -1,519 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: libtool.eclass
-# @MAINTAINER:
-# base-system@gentoo.org
-# @BLURB: quickly update bundled libtool code
-# @DESCRIPTION:
-# This eclass patches ltmain.sh distributed with libtoolized packages with the
-# relink and portage patch among others
-#
-# Note, this eclass does not require libtool as it only applies patches to
-# generated libtool files. We do not run the libtoolize program because that
-# requires a regeneration of the main autotool files in order to work properly.
-
-if [[ -z ${_LIBTOOL_ECLASS} ]]; then
-_LIBTOOL_ECLASS=1
-
-DEPEND=">=app-portage/elt-patches-20170317"
-
-libtool_elt_patch_dir() {
- if use prefix-chain; then
- local parent parents
- IFS=: eval 'parents=(${PORTAGE_READONLY_EPREFIXES})'
- for parent in "${parents[@]}"; do
- if [[ -d ${parent}/usr/share/elt-patches ]]; then
- echo "${parent}/usr/share/elt-patches"
- return 0
- fi
- done
- fi
- echo "${EPREFIX}/usr/share/elt-patches"
-}
-
-inherit multilib toolchain-funcs
-
-#
-# See if we can apply $2 on $1, and if so, do it
-#
-ELT_try_and_apply_patch() {
- local ret=0
- local file=$1
- local patch=$2
- local src=$3
- local disp="${src} patch"
- local log="${T}/elibtool.log"
-
- if [[ -z ${_ELT_NOTED_TMP} ]] ; then
- _ELT_NOTED_TMP=true
- printf 'temp patch: %s\n' "${patch}" > "${log}"
- fi
- printf '\nTrying %s\n' "${disp}" >> "${log}"
-
- if [[ ! -e ${file} ]] ; then
- echo "File not found: ${file}" >> "${log}"
- return 1
- fi
-
- # Save file for permission restoration. `patch` sometimes resets things.
- # Ideally we'd want 'stat -c %a', but stat is highly non portable and we are
- # guaranted to have GNU find, so use that instead.
- local perms="$(find ${file} -maxdepth 0 -printf '%m')"
- # We only support patchlevel of 0 - why worry if its static patches?
- if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then
- einfo " Applying ${disp} ..."
- patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1
- ret=$?
- export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${src}"
- else
- ret=1
- fi
- chmod "${perms}" "${file}"
-
- return "${ret}"
-}
-
-#
-# Get string version of ltmain.sh or ltconfig (passed as $1)
-#
-ELT_libtool_version() {
- (
- unset VERSION
- eval $(grep -e '^[[:space:]]*VERSION=' "$1")
- echo "${VERSION:-0}"
- )
-}
-
-#
-# Run through the patches in $2 and see if any
-# apply to $1 ...
-#
-ELT_walk_patches() {
- local patch tmp
- local ret=1
- local file=$1
- local patch_set=$2
- local patch_dir="$(libtool_elt_patch_dir)/${patch_set}"
- local rem_int_dep=$3
-
- [[ -z ${patch_set} ]] && return 1
- [[ ! -d ${patch_dir} ]] && return 1
-
- # Allow patches to use @GENTOO_LIBDIR@ replacements
- local sed_args=( -e "s:@GENTOO_LIBDIR@:$(get_libdir):g" )
- if [[ -n ${rem_int_dep} ]] ; then
- # replace @REM_INT_DEP@ with what was passed
- # to --remove-internal-dep
- sed_args+=( -e "s|@REM_INT_DEP@|${rem_int_dep}|g" )
- fi
-
- pushd "$(libtool_elt_patch_dir)" >/dev/null || die
-
- # Go through the patches in reverse order (newer version to older)
- for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do
- tmp="${T}/libtool-elt.patch"
- sed "${sed_args[@]}" "${patch}" > "${tmp}" || die
- if ELT_try_and_apply_patch "${file}" "${tmp}" "${patch}" ; then
- # Break to unwind w/popd rather than return directly
- ret=0
- break
- fi
- done
-
- popd >/dev/null
- return ${ret}
-}
-
-# @FUNCTION: elibtoolize
-# @USAGE: [dirs] [--portage] [--reverse-deps] [--patch-only] [--remove-internal-dep=xxx] [--shallow] [--no-uclibc]
-# @DESCRIPTION:
-# Apply a smorgasbord of patches to bundled libtool files. This function
-# should always be safe to run. If no directories are specified, then
-# ${S} will be searched for appropriate files.
-#
-# If the --shallow option is used, then only ${S}/ltmain.sh will be patched.
-#
-# The other options should be avoided in general unless you know what's going on.
-elibtoolize() {
- local x
- local dirs=()
- local do_portage="no"
- local do_reversedeps="yes"
- local do_only_patches="no"
- local do_uclibc="yes"
- local deptoremove=
- local do_shallow="no"
- local force="false"
- local elt_patches="install-sh ltmain portage relink max_cmd_len sed test tmp cross as-needed target-nm ppc64le"
-
- for x in "$@" ; do
- case ${x} in
- --portage)
- # Only apply portage patch, and don't
- # 'libtoolize --copy --force' if all patches fail.
- do_portage="yes"
- ;;
- --reverse-deps)
- # Apply the reverse-deps patch
- # http://bugzilla.gnome.org/show_bug.cgi?id=75635
- do_reversedeps="yes"
- elt_patches+=" fix-relink"
- ;;
- --patch-only)
- # Do not run libtoolize if none of the patches apply ..
- do_only_patches="yes"
- ;;
- --remove-internal-dep=*)
- # We will replace @REM_INT_DEP@ with what is needed
- # in ELT_walk_patches() ...
- deptoremove=${x#--remove-internal-dep=}
-
- # Add the patch for this ...
- [[ -n ${deptoremove} ]] && elt_patches+=" rem-int-dep"
- ;;
- --shallow)
- # Only patch the ltmain.sh in ${S}
- do_shallow="yes"
- ;;
- --no-uclibc)
- do_uclibc="no"
- ;;
- --force)
- force="true"
- ;;
- -*)
- eerror "Invalid elibtoolize option: ${x}"
- die "elibtoolize called with ${x} ??"
- ;;
- *) dirs+=( "${x}" )
- esac
- done
-
- [[ ${do_uclibc} == "yes" ]] && elt_patches+=" uclibc-conf uclibc-ltconf"
-
- case ${CHOST} in
- *-aix*) elt_patches+=" hardcode aixrtl" ;; #213277
- *-darwin*) elt_patches+=" darwin-ltconf darwin-ltmain darwin-conf" ;;
- *-solaris*) elt_patches+=" sol2-conf sol2-ltmain" ;;
- *-freebsd*) elt_patches+=" fbsd-conf fbsd-ltconf" ;;
- *-hpux*) elt_patches+=" hpux-conf deplibs hc-flag-ld hardcode hardcode-relink relink-prog no-lc" ;;
- *-irix*) elt_patches+=" irix-ltmain" ;;
- *-mint*) elt_patches+=" mint-conf" ;;
- esac
-
- if $(tc-getLD) --version 2>&1 | grep -qs 'GNU gold'; then
- elt_patches+=" gold-conf"
- fi
-
- # Find out what dirs to scan.
- if [[ ${do_shallow} == "yes" ]] ; then
- [[ ${#dirs[@]} -ne 0 ]] && die "Using --shallow with explicit dirs doesn't make sense"
- [[ -f ${S}/ltmain.sh || -f ${S}/configure ]] && dirs+=( "${S}" )
- else
- [[ ${#dirs[@]} -eq 0 ]] && dirs+=( "${S}" )
- dirs=( $(find "${dirs[@]}" '(' -name ltmain.sh -o -name configure ')' -printf '%h\n' | sort -u) )
- fi
-
- local d p ret
- for d in "${dirs[@]}" ; do
- export ELT_APPLIED_PATCHES=
-
- if [[ -f ${d}/.elibtoolized ]] ; then
- ${force} || continue
- fi
-
- local outfunc="einfo"
- [[ -f ${d}/.elibtoolized ]] && outfunc="ewarn"
- ${outfunc} "Running elibtoolize in: ${d#${WORKDIR}/}/"
- if [[ ${outfunc} == "ewarn" ]] ; then
- ewarn " We've already been run in this tree; you should"
- ewarn " avoid this if possible (perhaps by filing a bug)"
- fi
-
- # patching ltmain.sh
- [[ -f ${d}/ltmain.sh ]] &&
- for p in ${elt_patches} ; do
- ret=0
-
- case ${p} in
- portage)
- # Stupid test to see if its already applied ...
- if ! grep -qs 'We do not want portage' "${d}/ltmain.sh" ; then
- ELT_walk_patches "${d}/ltmain.sh" "${p}"
- ret=$?
- fi
- ;;
- rem-int-dep)
- ELT_walk_patches "${d}/ltmain.sh" "${p}" "${deptoremove}"
- ret=$?
- ;;
- fix-relink)
- # Do not apply if we do not have the relink patch applied ...
- if grep -qs 'inst_prefix_dir' "${d}/ltmain.sh" ; then
- ELT_walk_patches "${d}/ltmain.sh" "${p}"
- ret=$?
- fi
- ;;
- max_cmd_len)
- # Do not apply if $max_cmd_len is not used ...
- if grep -qs 'max_cmd_len' "${d}/ltmain.sh" ; then
- ELT_walk_patches "${d}/ltmain.sh" "${p}"
- ret=$?
- fi
- ;;
- as-needed)
- ELT_walk_patches "${d}/ltmain.sh" "${p}"
- ret=$?
- ;;
- uclibc-ltconf)
- # Newer libtoolize clears ltconfig, as not used anymore
- if [[ -s ${d}/ltconfig ]] ; then
- ELT_walk_patches "${d}/ltconfig" "${p}"
- ret=$?
- fi
- ;;
- fbsd-ltconf)
- if [[ -s ${d}/ltconfig ]] ; then
- ELT_walk_patches "${d}/ltconfig" "${p}"
- ret=$?
- fi
- ;;
- darwin-ltconf)
- # Newer libtoolize clears ltconfig, as not used anymore
- if [[ -s ${d}/ltconfig ]] ; then
- ELT_walk_patches "${d}/ltconfig" "${p}"
- ret=$?
- fi
- ;;
- darwin-ltmain)
- # special case to avoid false positives (failing to apply
- # ltmain.sh path message), newer libtools have this patch
- # built in, so not much to patch around then
- if [[ -e ${d}/ltmain.sh ]] && \
- ! grep -qs 'verstring="-compatibility_version' "${d}/ltmain.sh" ; then
- ELT_walk_patches "${d}/ltmain.sh" "${p}"
- ret=$?
- fi
- ;;
- install-sh)
- ELT_walk_patches "${d}/install-sh" "${p}"
- ret=$?
- ;;
- cross)
- if tc-is-cross-compiler ; then
- ELT_walk_patches "${d}/ltmain.sh" "${p}"
- ret=$?
- fi
- ;;
- *)
- ELT_walk_patches "${d}/ltmain.sh" "${p}"
- ret=$?
- ;;
- esac
-
- if [[ ${ret} -ne 0 ]] ; then
- case ${p} in
- relink)
- local version=$(ELT_libtool_version "${d}/ltmain.sh")
- # Critical patch, but could be applied ...
- # FIXME: Still need a patch for ltmain.sh > 1.4.0
- if ! grep -qs 'inst_prefix_dir' "${d}/ltmain.sh" && \
- [[ $(VER_to_int "${version}") -ge $(VER_to_int "1.4.0") ]] ; then
- ewarn " Could not apply relink.patch!"
- fi
- ;;
- portage)
- # Critical patch - for this one we abort, as it can really
- # cause breakage without it applied!
- if [[ ${do_portage} == "yes" ]] ; then
- # Stupid test to see if its already applied ...
- if ! grep -qs 'We do not want portage' "${d}/ltmain.sh" ; then
- echo
- eerror "Portage patch requested, but failed to apply!"
- eerror "Please file a bug report to add a proper patch."
- die "Portage patch requested, but failed to apply!"
- fi
- else
- if grep -qs 'We do not want portage' "${d}/ltmain.sh" ; then
- # ewarn " Portage patch seems to be already applied."
- # ewarn " Please verify that it is not needed."
- :
- else
- local version=$(ELT_libtool_version "${d}"/ltmain.sh)
- echo
- eerror "Portage patch failed to apply (ltmain.sh version ${version})!"
- eerror "Please file a bug report to add a proper patch."
- die "Portage patch failed to apply!"
- fi
- # We do not want to run libtoolize ...
- ELT_APPLIED_PATCHES="portage"
- fi
- ;;
- darwin-*)
- [[ ${CHOST} == *"-darwin"* ]] && ewarn " Darwin patch set '${p}' failed to apply!"
- ;;
- esac
- fi
- done
-
- # makes sense for ltmain.sh patches only
- [[ -f ${d}/ltmain.sh ]] &&
- if [[ -z ${ELT_APPLIED_PATCHES} ]] ; then
- if [[ ${do_portage} == "no" && \
- ${do_reversedeps} == "no" && \
- ${do_only_patches} == "no" && \
- ${deptoremove} == "" ]]
- then
- ewarn "Cannot apply any patches, please file a bug about this"
- die
- fi
- fi
-
- # patching configure
- [[ -f ${d}/configure ]] &&
- for p in ${elt_patches} ; do
- ret=0
-
- case ${p} in
- uclibc-conf)
- if grep -qs 'Transform linux' "${d}/configure" ; then
- ELT_walk_patches "${d}/configure" "${p}"
- ret=$?
- fi
- ;;
- fbsd-conf)
- if grep -qs 'version_type=freebsd-' "${d}/configure" ; then
- ELT_walk_patches "${d}/configure" "${p}"
- ret=$?
- fi
- ;;
- darwin-conf)
- if grep -qs '&& echo \.so ||' "${d}/configure" ; then
- ELT_walk_patches "${d}/configure" "${p}"
- ret=$?
- fi
- ;;
- aixrtl|hpux-conf)
- ret=1
- local subret=0
- # apply multiple patches as often as they match
- while [[ $subret -eq 0 ]]; do
- subret=1
- if [[ -e ${d}/configure ]]; then
- ELT_walk_patches "${d}/configure" "${p}"
- subret=$?
- fi
- if [[ $subret -eq 0 ]]; then
- # have at least one patch succeeded.
- ret=0
- fi
- done
- ;;
- mint-conf|gold-conf|sol2-conf)
- ELT_walk_patches "${d}/configure" "${p}"
- ret=$?
- ;;
- target-nm)
- ELT_walk_patches "${d}/configure" "${p}"
- ret=$?
- ;;
- ppc64le)
- ELT_walk_patches "${d}/configure" "${p}"
- ret=$?
- ;;
- *)
- # ltmain.sh patches are applied above
- ;;
- esac
-
- if [[ ${ret} -ne 0 ]] ; then
- case ${p} in
- uclibc-*)
- [[ ${CHOST} == *-uclibc ]] && ewarn " uClibc patch set '${p}' failed to apply!"
- ;;
- fbsd-*)
- if [[ ${CHOST} == *-freebsd* ]] ; then
- if [[ -z $(grep 'Handle Gentoo/FreeBSD as it was Linux' \
- "${d}/configure" 2>/dev/null) ]]; then
- eerror " FreeBSD patch set '${p}' failed to apply!"
- die "FreeBSD patch set '${p}' failed to apply!"
- fi
- fi
- ;;
- darwin-*)
- [[ ${CHOST} == *"-darwin"* ]] && ewarn " Darwin patch set '${p}' failed to apply!"
- ;;
- esac
- fi
- done
-
- rm -f "${d}/libtool"
-
- > "${d}/.elibtoolized"
- done
-}
-
-uclibctoolize() { die "Use elibtoolize"; }
-darwintoolize() { die "Use elibtoolize"; }
-
-# char *VER_major(string)
-#
-# Return the Major (X of X.Y.Z) version
-#
-VER_major() {
- [[ -z $1 ]] && return 1
-
- local VER=$@
- echo "${VER%%[^[:digit:]]*}"
-}
-
-# char *VER_minor(string)
-#
-# Return the Minor (Y of X.Y.Z) version
-#
-VER_minor() {
- [[ -z $1 ]] && return 1
-
- local VER=$@
- VER=${VER#*.}
- echo "${VER%%[^[:digit:]]*}"
-}
-
-# char *VER_micro(string)
-#
-# Return the Micro (Z of X.Y.Z) version.
-#
-VER_micro() {
- [[ -z $1 ]] && return 1
-
- local VER=$@
- VER=${VER#*.*.}
- echo "${VER%%[^[:digit:]]*}"
-}
-
-# int VER_to_int(string)
-#
-# Convert a string type version (2.4.0) to an int (132096)
-# for easy compairing or versions ...
-#
-VER_to_int() {
- [[ -z $1 ]] && return 1
-
- local VER_MAJOR=$(VER_major "$1")
- local VER_MINOR=$(VER_minor "$1")
- local VER_MICRO=$(VER_micro "$1")
- local VER_int=$(( VER_MAJOR * 65536 + VER_MINOR * 256 + VER_MICRO ))
-
- # We make version 1.0.0 the minimum version we will handle as
- # a sanity check ... if its less, we fail ...
- if [[ ${VER_int} -ge 65536 ]] ; then
- echo "${VER_int}"
- return 0
- fi
-
- echo 1
- return 1
-}
-
-fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2017-10-16 13:54 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2017-10-16 13:54 UTC (permalink / raw
To: gentoo-commits
commit: d014d46e64b29ad5c8caf7461b78f8221b18a963
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Oct 16 13:54:15 2017 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Oct 16 13:54:15 2017 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=d014d46e
eclass: sync java eclasses
eclass/java-ant-2.eclass | 524 ---------------------------------------
eclass/java-utils-2.eclass | 597 +++++++++++++++++++++++++++++----------------
2 files changed, 380 insertions(+), 741 deletions(-)
diff --git a/eclass/java-ant-2.eclass b/eclass/java-ant-2.eclass
deleted file mode 100644
index ddfbc3a29e..0000000000
--- a/eclass/java-ant-2.eclass
+++ /dev/null
@@ -1,524 +0,0 @@
-# eclass for ant based Java packages
-#
-# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
-# Copyright (c) 2004-2011, Gentoo Foundation
-# Changes:
-# May 2007:
-# Made bsfix make one pass for all things and add some glocal targets for
-# setting up the whole thing. Contributed by kiorky
-# (kiorky@cryptelium.net).
-# December 2006:
-# I pretty much rewrote the logic of the bsfix functions
-# and xml-rewrite.py because they were so slow
-# Petteri Räty (betelgeuse@gentoo.org)
-#
-# Licensed under the GNU General Public License, v2
-#
-# $Header: /var/cvsroot/gentoo-x86/eclass/java-ant-2.eclass,v 1.58 2014/03/31 16:48:51 mgorny Exp $
-
-# @ECLASS: java-ant-2.eclass
-# @MAINTAINER:
-# java@gentoo.org
-# @AUTHOR:
-# kiorky (kiorky@cryptelium.net), Petteri Räty (betelgeuse@gentoo.org)
-# @BLURB: eclass for ant based Java packages
-# @DESCRIPTION:
-# Eclass for Ant-based Java packages. Provides support for both automatic and
-# manual manipulation of build.xml files. Should be inherited after java-pkg-2
-# or java-pkg-opt-2 eclass.
-
-inherit java-utils-2 multilib
-
-# This eclass provides functionality for Java packages which use
-# ant to build. In particular, it will attempt to fix build.xml files, so that
-# they use the appropriate 'target' and 'source' attributes.
-
-# @ECLASS-VARIABLE: WANT_ANT_TASKS
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# An $IFS separated list of ant tasks.
-# Ebuild can specify this variable before inheriting java-ant-2 eclass to
-# determine ANT_TASKS it needs. They will be automatically translated to
-# DEPEND variable and ANT_TASKS variable. JAVA_PKG_FORCE_ANT_TASKS can override
-# ANT_TASKS set by WANT_ANT_TASKS, but not the DEPEND due to caching.
-# Ebuilds that need to depend conditionally on certain tasks and specify them
-# differently for different eant calls can't use this simplified approach.
-# You also cannot specify version or anything else than ant-*.
-#
-# @CODE
-# WANT_ANT_TASKS="ant-junit ant-trax"
-# @CODE
-
-#The implementation of dependencies is handled by java-utils-2.eclass
-#WANT_ANT_TASKS
-
-# @ECLASS-VARIABLE: JAVA_ANT_DISABLE_ANT_CORE_DEP
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Setting this variable non-empty before inheriting java-ant-2 disables adding
-# dev-java/ant-core into DEPEND.
-if [[ -z "${JAVA_ANT_DISABLE_ANT_CORE_DEP}" ]]; then
- JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND} >=dev-java/ant-core-1.8.2"
-fi
-
-# add ant tasks specified in WANT_ANT_TASKS to DEPEND
-local ANT_TASKS_DEPEND;
-ANT_TASKS_DEPEND="$(java-pkg_ant-tasks-depend)"
-# check that java-pkg_ant-tasks-depend didn't fail
-if [[ $? != 0 ]]; then
- eerror "${ANT_TASKS_DEPEND}"
- die "java-pkg_ant-tasks-depend() failed"
-fi
-
-# We need some tools from javatoolkit. We also need portage 2.1 for phase hooks
-# and ant dependencies constructed above. Python is there for
-# java-ant_remove-taskdefs
-JAVA_ANT_E_DEPEND="${JAVA_ANT_E_DEPEND}
- ${ANT_TASKS_DEPEND}
- ${JAVA_PKG_PORTAGE_DEP}
- >=dev-java/javatoolkit-0.3.0-r2"
-
-# this eclass must be inherited after java-pkg-2 or java-pkg-opt-2
-# if it's java-pkg-opt-2, ant dependencies are pulled based on USE flag
-if has java-pkg-opt-2 ${INHERITED}; then
- JAVA_ANT_E_DEPEND="${JAVA_PKG_OPT_USE}? ( ${JAVA_ANT_E_DEPEND} )"
-elif ! has java-pkg-2 ${INHERITED}; then
- eerror "java-ant-2 eclass can only be inherited AFTER java-pkg-2 or java-pkg-opt-2"
-fi
-
-DEPEND="${JAVA_ANT_E_DEPEND}"
-
-# @ECLASS-VARIABLE: JAVA_PKG_BSFIX
-# @DESCRIPTION:
-# Should we attempt to 'fix' ant build files to include the source/target
-# attributes when calling javac?
-JAVA_PKG_BSFIX=${JAVA_PKG_BSFIX:-"on"}
-
-# @ECLASS-VARIABLE: JAVA_PKG_BSFIX_ALL
-# @DESCRIPTION:
-# If we're fixing build files, should we try to fix all the ones we can find?
-JAVA_PKG_BSFIX_ALL=${JAVA_PKG_BSFIX_ALL:-"yes"}
-
-# @ECLASS-VARIABLE: JAVA_PKG_BSFIX_NAME
-# @DESCRIPTION:
-# Filename of build files to fix/search for
-JAVA_PKG_BSFIX_NAME=${JAVA_PKG_BSFIX_NAME:-"build.xml"}
-
-# @ECLASS-VARIABLE: JAVA_PKG_BSFIX_TARGET_TAGS
-# @DESCRIPTION:
-# Targets to fix the 'source' attribute in
-JAVA_PKG_BSFIX_TARGET_TAGS=${JAVA_PKG_BSFIX_TARGET_TAGS:-"javac xjavac javac.preset"}
-
-# @ECLASS-VARIABLE: JAVA_PKG_BSFIX_SOURCE_TAGS
-# @DESCRIPTION:
-# Targets to fix the 'target' attribute in
-JAVA_PKG_BSFIX_SOURCE_TAGS=${JAVA_PKG_BSFIX_SOURCE_TAGS:-"javadoc javac xjavac javac.preset"}
-
-# @ECLASS-VARIABLE: JAVA_ANT_CLASSPATH_TAGS
-# @DESCRIPTION:
-# Targets to add the classpath attribute to
-JAVA_ANT_CLASSPATH_TAGS="javac xjavac"
-
-# @ECLASS-VARIABLE: JAVA_ANT_IGNORE_SYSTEM_CLASSES
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# When set, <available> Ant tasks are rewritten to ignore Ant's runtime classpath.
-
-case "${EAPI:-0}" in
- 0|1) : ;;
- *) EXPORT_FUNCTIONS src_configure ;;
-esac
-
-# @FUNCTION: java-ant-2_src_configure
-# @DESCRIPTION:
-# src_configure rewrites the build.xml files automatically, unless EAPI is undefined, 0 or 1.
-java-ant-2_src_configure() {
- # if java support is optional, don't perform this when the USE flag is off
- if has java-pkg-opt-2 ${INHERITED}; then
- use ${JAVA_PKG_OPT_USE} || return
- fi
-
- # eant will call us unless called by Portage
- [[ -e "${T}/java-ant-2_src_configure-run" ]] && return
-
- [[ "${JAVA_ANT_IGNORE_SYSTEM_CLASSES}" ]] \
- && java-ant_ignore-system-classes "${S}/build.xml"
-
- java-ant_bsfix
- touch "${T}/java-ant-2_src_configure-run"
-}
-
-# @FUNCTION: java-ant_bsfix
-# @INTERNAL
-# @DESCRIPTION:
-# Attempts to fix build files.
-#
-# @CODE
-# Affected by variables:
-# JAVA_PKG_BSFIX
-# JAVA_PKG_BSFIX_ALL
-# JAVA_PKG_BSFIX_NAME,
-# @CODE
-java-ant_bsfix() {
- debug-print-function ${FUNCNAME} $*
-
- [[ "${JAVA_PKG_BSFIX}" != "on" ]] && return
- if ! java-pkg_needs-vm; then
- echo "QA Notice: Package is using java-ant, but doesn't depend on a Java VM"
- fi
-
- pushd "${S}" >/dev/null
-
- local find_args=""
- [[ "${JAVA_PKG_BSFIX_ALL}" == "yes" ]] || find_args="-maxdepth 1"
-
- find_args="${find_args} -type f -name ${JAVA_PKG_BSFIX_NAME// / -o -name } "
-
- # This voodoo is done for paths with spaces
- local bsfix_these
- while read line; do
- [[ -z ${line} ]] && continue
- bsfix_these="${bsfix_these} '${line}'"
- done <<-EOF
- $(find . ${find_args})
- EOF
-
- [[ "${bsfix_these// /}" ]] && eval java-ant_bsfix_files ${bsfix_these}
-
- popd > /dev/null
-}
-
-_bsfix_die() {
- if has_version dev-python/pyxml; then
- eerror "If the output above contains:"
- eerror "ImportError:"
- eerror "/usr/lib/python2.4/site-packages/_xmlplus/parsers/pyexpat.so:"
- eerror "undefined symbol: PyUnicodeUCS2_DecodeUTF8"
- eerror "Try re-emerging dev-python/pyxml"
- die ${1} " Look at the eerror message above"
- else
- die ${1}
- fi
-}
-
-# @FUNCTION: java-ant_bsfix_files
-# @USAGE: <path/to/first/build.xml> [path/to/second.build.xml ...]
-# @DESCRIPTION:
-# Attempts to fix named build files.
-#
-# @CODE
-# Affected by variables:
-# JAVA_PKG_BSFIX_SOURCE_TAGS
-# JAVA_PKG_BSFIX_TARGET_TAGS
-# JAVA_ANT_REWRITE_CLASSPATH
-# JAVA_ANT_JAVADOC_INPUT_DIRS: Where we can find java sources for javadoc
-# input. Can be a space separated list of
-# directories
-# JAVA_ANT_BSFIX_EXTRA_ARGS: You can use this to pass extra variables to the
-# rewriter if you know what you are doing.
-# @CODE
-#
-# If JAVA_ANT_JAVADOC_INPUT_DIRS is set, we will turn on the adding of a basic
-# javadoc target to the ant's build.xml with the javadoc xml-rewriter feature.
-# Then we will set EANT DOC TARGET to the added javadoc target
-# NOTE: the variable JAVA_ANT_JAVADOC_OUTPUT_DIR points where we will
-# generate the javadocs. This is a read-only variable, dont change it.
-
-# When changing this function, make sure that it works with paths with spaces in
-# them.
-java-ant_bsfix_files() {
- debug-print-function ${FUNCNAME} $*
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
-
- [[ ${#} = 0 ]] && die "${FUNCNAME} called without arguments"
-
- local want_source="$(java-pkg_get-source)"
- local want_target="$(java-pkg_get-target)"
-
- debug-print "${FUNCNAME}: target: ${want_target} source: ${want_source}"
-
- if [ -z "${want_source}" -o -z "${want_target}" ]; then
- eerror "Could not find valid -source/-target values"
- eerror "Please file a bug about this on bugs.gentoo.org"
- die "Could not find valid -source/-target values"
- else
- local files
-
- for file in "${@}"; do
- debug-print "${FUNCNAME}: ${file}"
-
- if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
- cp "${file}" "${file}.orig" || die "failed to copy ${file}"
- fi
-
- if [[ ! -w "${file}" ]]; then
- chmod u+w "${file}" || die "chmod u+w ${file} failed"
- fi
-
- files="${files} -f '${file}'"
- done
-
- # for javadoc target and all in one pass, we need the new rewriter.
- local rewriter3="${EPREFIX}/usr/share/javatoolkit/xml-rewrite-3.py"
- if [[ ! -f ${rewriter3} ]]; then
- rewriter3="${EPREFIX}/usr/$(get_libdir)/javatoolkit/bin/xml-rewrite-3.py"
- fi
-
- local rewriter4="${EPREFIX}/usr/$(get_libdir)/javatoolkit/bin/build-xml-rewrite"
-
- if [[ -x ${rewriter4} && ${JAVA_ANT_ENCODING} ]]; then
- [[ ${JAVA_ANT_REWRITE_CLASSPATH} ]] && local gcp="-g"
- [[ ${JAVA_ANT_ENCODING} ]] && local enc="-e ${JAVA_ANT_ENCODING}"
- eval echo "cElementTree rewriter"
- debug-print "${rewriter4} extra args: ${gcp} ${enc}"
- ${rewriter4} ${gcp} ${enc} \
- -c "${JAVA_PKG_BSFIX_SOURCE_TAGS}" source ${want_source} \
- -c "${JAVA_PKG_BSFIX_TARGET_TAGS}" target ${want_target} \
- "${@}" || die "build-xml-rewrite failed"
- elif [[ ! -f ${rewriter3} ]]; then
- debug-print "Using second generation rewriter"
- eval echo "Rewriting source attributes"
- eval xml-rewrite-2.py ${files} \
- -c -e ${JAVA_PKG_BSFIX_SOURCE_TAGS// / -e } \
- -a source -v ${want_source} || _bsfix_die "xml-rewrite2 failed: ${file}"
-
- eval echo "Rewriting target attributes"
- eval xml-rewrite-2.py ${files} \
- -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
- -a target -v ${want_target} || _bsfix_die "xml-rewrite2 failed: ${file}"
-
- eval echo "Rewriting nowarn attributes"
- eval xml-rewrite-2.py ${files} \
- -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
- -a nowarn -v yes || _bsfix_die "xml-rewrite2 failed: ${file}"
-
- if [[ ${JAVA_ANT_REWRITE_CLASSPATH} ]]; then
- eval echo "Adding gentoo.classpath to javac tasks"
- eval xml-rewrite-2.py ${files} \
- -c -e javac -e xjavac -a classpath -v \
- '\${gentoo.classpath}' \
- || _bsfix_die "xml-rewrite2 failed"
- fi
- else
- debug-print "Using third generation rewriter"
- eval echo "Rewriting attributes"
- local bsfix_extra_args=""
- # WARNING KEEP THE ORDER, ESPECIALLY FOR CHANGED ATTRIBUTES!
- if [[ -n ${JAVA_ANT_REWRITE_CLASSPATH} ]]; then
- local cp_tags="${JAVA_ANT_CLASSPATH_TAGS// / -e }"
- bsfix_extra_args="${bsfix_extra_args} -g -e ${cp_tags}"
- bsfix_extra_args="${bsfix_extra_args} -a classpath -v '\${gentoo.classpath}'"
- fi
- if [[ -n ${JAVA_ANT_JAVADOC_INPUT_DIRS} ]]; then
- if [[ -n ${JAVA_ANT_JAVADOC_OUTPUT_DIR} ]]; then
- die "Do not define JAVA_ANT_JAVADOC_OUTPUT_DIR!"
- fi
- # Where will our generated javadoc go.
- readonly JAVA_ANT_JAVADOC_OUTPUT_DIR="${WORKDIR}/gentoo_javadoc"
- mkdir -p "${JAVA_ANT_JAVADOC_OUTPUT_DIR}" || die
-
- if has doc ${IUSE}; then
- if use doc; then
- if [[ -z ${EANT_DOC_TARGET} ]]; then
- EANT_DOC_TARGET="gentoojavadoc"
- else
- die "You can't use javadoc adding and set EANT_DOC_TARGET too."
- fi
-
- for dir in ${JAVA_ANT_JAVADOC_INPUT_DIRS};do
- if [[ ! -d ${dir} ]]; then
- eerror "This dir: ${dir} doesnt' exists"
- die "You must specify directories for javadoc input/output dirs."
- fi
- done
- bsfix_extra_args="${bsfix_extra_args} --javadoc --source-directory "
- # filter third/double spaces
- JAVA_ANT_JAVADOC_INPUT_DIRS=${JAVA_ANT_JAVADOC_INPUT_DIRS// /}
- JAVA_ANT_JAVADOC_INPUT_DIRS=${JAVA_ANT_JAVADOC_INPUT_DIRS// /}
- bsfix_extra_args="${bsfix_extra_args} ${JAVA_ANT_JAVADOC_INPUT_DIRS// / --source-directory }"
- bsfix_extra_args="${bsfix_extra_args} --output-directory ${JAVA_ANT_JAVADOC_OUTPUT_DIR}"
- fi
- else
- die "You need to have doc in IUSE when using JAVA_ANT_JAVADOC_INPUT_DIRS"
- fi
- fi
-
- [[ -n ${JAVA_ANT_BSFIX_EXTRA_ARGS} ]] \
- && bsfix_extra_args="${bsfix_extra_args} ${JAVA_ANT_BSFIX_EXTRA_ARGS}"
-
- debug-print "bsfix_extra_args: ${bsfix_extra_args}"
-
- eval ${rewriter3} ${files} \
- -c --source-element ${JAVA_PKG_BSFIX_SOURCE_TAGS// / --source-element } \
- --source-attribute source --source-value ${want_source} \
- --target-element ${JAVA_PKG_BSFIX_TARGET_TAGS// / --target-element } \
- --target-attribute target --target-value ${want_target} \
- --target-attribute nowarn --target-value yes \
- ${bsfix_extra_args} \
- || _bsfix_die "xml-rewrite2 failed: ${file}"
- fi
-
- if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
- for file in "${@}"; do
- diff -NurbB "${file}.orig" "${file}"
- done
- fi
- fi
- return 0 # so that the 1 for diff doesn't get reported
-}
-
-
-# @FUNCTION: java-ant_bsfix_one
-# @USAGE: <path/to/build.xml>
-# @DESCRIPTION:
-# Attempts to fix named build file.
-#
-# @CODE
-# Affected by variables:
-# JAVA_PKG_BSFIX_SOURCE_TAGS
-# JAVA_PKG_BSFIX_TARGET_TAGS
-# @CODE
-java-ant_bsfix_one() {
- debug-print-function ${FUNCNAME} $*
-
- if [ -z "${1}" ]; then
- eerror "${FUNCNAME} needs one argument"
- die "${FUNCNAME} needs one argument"
- fi
-
- java-ant_bsfix_files "${1}"
-}
-
-# @FUNCTION: java-ant_rewrite-classpath
-# @USAGE: [path/to/build.xml]
-# @DESCRIPTION:
-# Adds 'classpath="${gentoo.classpath}"' to specified build file.
-#
-# Affected by:
-# JAVA_ANT_CLASSPATH_TAGS
-#
-# Parameter defaults to build.xml when not specified
-java-ant_rewrite-classpath() {
- debug-print-function ${FUNCNAME} $*
-
- local file="${1}"
- [[ -z "${1}" ]] && file=build.xml
- [[ ${#} -gt 1 ]] && die "${FUNCNAME} currently can only rewrite one file."
-
- echo "Adding gentoo.classpath to ${file}"
- debug-print "java-ant_rewrite-classpath: ${file}"
-
- cp "${file}" "${file}.orig" || die "failed to copy ${file}"
-
- chmod u+w "${file}"
-
- java-ant_xml-rewrite -f "${file}" --change \
- -e ${JAVA_ANT_CLASSPATH_TAGS// / -e } -a classpath -v '${gentoo.classpath}'
-
- if [[ -n "${JAVA_PKG_DEBUG}" ]]; then
- diff -NurbB "${file}.orig" "${file}"
- fi
-}
-
-# @FUNCTION: java-ant_remove-taskdefs
-# @USAGE: [--name NAME] [path/to/build.xml]
-# @DESCRIPTION:
-# Removes (named) taskdef elements from the build.xml file.
-# When --name NAME is specified, only remove taskdef with name NAME. Otherwise,
-# all taskdefs are removed.
-# The file to rewrite defaults to build.xml when not specified.
-java-ant_remove-taskdefs() {
- debug-print-function ${FUNCNAME} $*
-
- die "${FUNCNAME} has been banned, see bug #479838."
-
- local task_name
- if [[ "${1}" == --name ]]; then
- task_name="${2}"
- shift 2
- fi
- local file="${1:-build.xml}"
- echo "Removing taskdefs from ${file}"
- python <<EOF
-import sys
-from xml.dom.minidom import parse
-dom = parse("${file}")
-for elem in dom.getElementsByTagName('taskdef'):
- if (len("${task_name}") == 0 or elem.getAttribute("name") == "${task_name}"):
- elem.parentNode.removeChild(elem)
- elem.unlink()
-f = open("${file}", "w")
-dom.writexml(f)
-f.close()
-EOF
- [[ $? != 0 ]] && die "Removing taskdefs failed"
-}
-
-# @FUNCTION: java-ant_ignore-system-classes
-# @USAGE: [path/to/build.xml]
-# @DESCRIPTION:
-# Makes the available task ignore classes in the system classpath
-# Parameter defaults to build.xml when not specified
-java-ant_ignore-system-classes() {
- debug-print-function ${FUNCNAME} $*
- local file=${1:-build.xml}
- echo "Changing ignoresystemclasses to true for available tasks in ${file}"
- java-ant_xml-rewrite -f "${file}" --change \
- -e available -a ignoresystemclasses -v "true"
-}
-
-# @FUNCTION: java-ant_xml-rewrite
-# @USAGE: <xml rewriter arguments>
-# @DESCRIPTION:
-# Run the right xml-rewrite binary with the given arguments
-java-ant_xml-rewrite() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
- local gen2="${EPREFIX}/usr/bin/xml-rewrite-2.py"
- local gen2_1="${EPREFIX}/usr/$(get_libdir)/javatoolkit/bin/xml-rewrite-2.py"
- # gen1 is deprecated
- if [[ -x "${gen2}" ]]; then
- ${gen2} "${@}" || die "${gen2} failed"
- elif [[ -x "${gen2_1}" ]]; then
- ${gen2_1} "${@}" || die "${gen2_1} failed"
- else
- eerror "No binary for rewriting found."
- eerror "Do you have dev-java/javatoolkit installed?"
- die "xml-rewrite not found"
- fi
-}
-
-# @FUNCTION: java-ant_rewrite-bootclasspath
-# @USAGE: <version> [path/to/build.xml] [prepend] [append]
-# @DESCRIPTION:
-# Adds bootclasspath to javac-like tasks in build.xml filled with jars of a
-# bootclasspath package of given version.
-#
-# @CODE
-# Affected by:
-# JAVA_PKG_BSFIX_TARGET_TAGS - the tags of javac tasks
-#
-# Parameters:
-# $1 - the version of bootclasspath (e.g. 1.5), 'auto' for bootclasspath
-# of the current JDK
-# $2 - path to desired build.xml file, defaults to 'build.xml'
-# $3 - (optional) what to prepend the bootclasspath with (to override)
-# $4 - (optional) what to append to the bootclasspath
-# @CODE
-java-ant_rewrite-bootclasspath() {
- local version="${1}"
- local file="${2-build.xml}"
- local extra_before="${3}"
- local extra_after="${4}"
-
- local bcp="$(java-pkg_get-bootclasspath "${version}")"
-
- if [[ -n "${extra_before}" ]]; then
- bcp="${extra_before}:${bcp}"
- fi
- if [[ -n "${extra_after}" ]]; then
- bcp="${bcp}:${extra_after}"
- fi
-
- java-ant_xml-rewrite -f "${file}" -c -e ${JAVA_PKG_BSFIX_TARGET_TAGS// / -e } \
- -a bootclasspath -v "${bcp}"
-}
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 55d7fa5849..1ec878b96c 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1,12 +1,5 @@
-# Base eclass for Java packages
-#
-# Copyright (c) 2004-2005, Thomas Matthijs <axxo@gentoo.org>
-# Copyright (c) 2004, Karl Trygve Kalleberg <karltk@gentoo.org>
-# Copyright (c) 2004-2011, Gentoo Foundation
-#
-# Licensed under the GNU General Public License, v2
-#
-# $Header: /var/cvsroot/gentoo-x86/eclass/java-utils-2.eclass,v 1.156 2014/04/09 21:55:12 radhermit Exp $
+# Copyright 2004-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-utils-2.eclass
# @MAINTAINER:
@@ -21,7 +14,7 @@
# This eclass should not be inherited this directly from an ebuild. Instead,
# you should inherit java-pkg-2 for Java packages or java-pkg-opt-2 for packages
# that have optional Java support. In addition you can inherit java-ant-2 for
-# Ant-based packages.
+# Ant-based packages.
inherit eutils versionator multilib
IUSE="elibc_FreeBSD"
@@ -29,6 +22,9 @@ IUSE="elibc_FreeBSD"
# Make sure we use java-config-2
export WANT_JAVA_CONFIG="2"
+# Prefix variables are only available for EAPI>=3
+has "${EAPI:-0}" 0 1 2 && ED="${D}" EPREFIX= EROOT="${ROOT}"
+
# @VARIABLE: JAVA_PKG_PORTAGE_DEP
# @INTERNAL
# @DESCRIPTION:
@@ -43,7 +39,7 @@ has "${EAPI}" 0 1 && JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1.2.7"
# This is a convience variable to be used from the other java eclasses. This is
# the version of java-config we want to use. Usually the latest stable version
# so that ebuilds can use new features without depending on specific versions.
-JAVA_PKG_E_DEPEND="!x86-winnt? ( >=dev-java/java-config-2.1.9-r1 ${JAVA_PKG_PORTAGE_DEP} )"
+JAVA_PKG_E_DEPEND="!x86-winnt? ( >=dev-java/java-config-2.2.0-r3 ${JAVA_PKG_PORTAGE_DEP} )"
has source ${JAVA_PKG_IUSE} && JAVA_PKG_E_DEPEND="${JAVA_PKG_E_DEPEND} source? ( app-arch/zip )"
# @ECLASS-VARIABLE: JAVA_PKG_WANT_BOOTCLASSPATH
@@ -126,20 +122,43 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
# JAVA_PKG_WANT_TARGET=1.3 emerge bar
# @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
+# zero. When set, verbosity across java eclasses is increased and extra
+# logging is displayed.
+# @CODE
+# JAVA_PKG_DEBUG="yes"
+# @CODE
+
+# @ECLASS-VARIABLE: JAVA_RM_FILES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# An array containing a list of files to remove. If defined, this array will be
+# automatically handed over to java-pkg_rm_files for processing during the
+# src_prepare phase.
+#
+# @CODE
+# JAVA_RM_FILES=(
+# path/to/File1.java
+# DELETEME.txt
+# )
+# @CODE
+
# @VARIABLE: JAVA_PKG_COMPILER_DIR
# @INTERNAL
# @DESCRIPTION:
# Directory where compiler settings are saved, without trailing slash.
# You probably shouldn't touch this variable except local testing.
-JAVA_PKG_COMPILER_DIR=${JAVA_PKG_COMPILER_DIR:="${EPREFIX}"/usr/share/java-config-2/compiler}
-
+JAVA_PKG_COMPILER_DIR=${JAVA_PKG_COMPILER_DIR:="${EPREFIX}/usr/share/java-config-2/compiler"}
# @VARIABLE: JAVA_PKG_COMPILERS_CONF
# @INTERNAL
# @DESCRIPTION:
# Path to file containing information about which compiler to use.
# 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}
+JAVA_PKG_COMPILERS_CONF=${JAVA_PKG_COMPILERS_CONF:="${EPREFIX}/etc/java-config-2/build/compilers.conf"}
# @ECLASS-VARIABLE: JAVA_PKG_FORCE_COMPILER
# @INTERNAL
@@ -218,6 +237,73 @@ java-pkg_doexamples() {
dosym "${dest}" "${JAVA_PKG_SHAREPATH}/examples" || die
}
+# @FUNCTION: java-pkg_addres
+# @USAGE: <jar> <dir> [<find arguments> ...]
+# @DESCRIPTION:
+# Adds resource files to an existing jar.
+# It is important that the directory given is actually the root of the
+# corresponding resource tree. The target directory as well as
+# sources.lst, MANIFEST.MF, *.class, *.jar, and *.java files are
+# automatically excluded. Symlinks are always followed. Additional
+# arguments are passed through to find.
+#
+# @CODE
+# java-pkg_addres ${PN}.jar resources ! -name "*.html"
+# @CODE
+#
+# @param $1 - jar file
+# @param $2 - resource tree directory
+# @param $* - arguments to pass to find
+java-pkg_addres() {
+ debug-print-function ${FUNCNAME} $*
+
+ [[ ${#} -lt 2 ]] && die "at least two arguments needed"
+
+ local jar=$(realpath "$1" || die "realpath $1 failed")
+ local dir="$2"
+ shift 2
+
+ pushd "${dir}" > /dev/null || die "pushd ${dir} failed"
+ find -L -type f ! -path "./target/*" ! -path "./sources.lst" ! -name "MANIFEST.MF" ! -regex ".*\.\(class\|jar\|java\)" "${@}" -print0 | xargs -r0 jar uf "${jar}" || die "jar failed"
+ popd > /dev/null || die "popd failed"
+}
+
+# @FUNCTION: java-pkg_rm_files
+# @USAGE: java-pkg_rm_files File1.java File2.java ...
+# @DESCRIPTION:
+# Remove unneeded files in ${S}.
+#
+# Every now and then, you'll run into situations whereby a file needs removing,
+# be it a unit test or a regular java class.
+#
+# You can use this function by either:
+# - calling it yourself in src_prepare() and feeding java-pkg_rm_files with
+# the list of files you wish to remove.
+# - defining an array in the ebuild named JAVA_RM_FILES with the list of files
+# you wish to remove.
+#
+# Both way work and it is left to the developer's preferences. If the
+# JAVA_RM_FILES array is defined, it will be automatically handed over to
+# java-pkg_rm_files during the src_prepare phase.
+#
+# See java-utils-2_src_prepare.
+#
+# @CODE
+# java-pkg_rm_files File1.java File2.java
+# @CODE
+#
+# @param $* - list of files to remove.
+java-pkg_rm_files() {
+ debug-print-function ${FUNCNAME} $*
+ local IFS="\n"
+ for filename in "$@"; do
+ [[ ! -f "${filename}" ]] && die "${filename} is not a regular file. Aborting."
+ einfo "Removing unneeded file ${filename}"
+ rm -f "${S}/${filename}" || die "cannot remove ${filename}"
+ eend $?
+ done
+}
+
# @FUNCTION: java-pkg_dojar
# @USAGE: <jar1> [<jar2> ...]
# @DESCRIPTION:
@@ -264,8 +350,10 @@ java-pkg_dojar() {
#but first check class version when in strict mode.
is-java-strict && java-pkg_verify-classes "${jar}"
- INSDESTTREE="${JAVA_PKG_JARDEST}" \
- doins "${jar}" || die "failed to install ${jar}"
+ (
+ insinto "${JAVA_PKG_JARDEST}"
+ doins "${jar}"
+ ) || die "failed to install ${jar}"
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
@@ -280,19 +368,16 @@ java-pkg_dojar() {
fi
done
- java-pkg_do_write_
-}
+ # Extra logging if enabled.
+ if [[ -n ${JAVA_PKG_DEBUG} ]]; then
+ einfo "Verbose logging for \"${FUNCNAME}\" function"
+ einfo "Jar file(s) destination: ${JAVA_PKG_JARDEST}"
+ einfo "Jar file(s) created: ${@}"
+ einfo "Complete command:"
+ einfo "${FUNCNAME} ${@}"
+ fi
-# @FUNCTION: depend-java-query
-# @INTERNAL
-# @DESCRIPTION:
-# Wrapper for the depend-java-query binary to enable passing USE in env.
-# Using env variables keeps this eclass working with java-config versions that
-# do not handle use flags.
-depend-java-query() {
- # Used to have a which call here but it caused endless loops for some people
- # that had some weird bashrc voodoo for which.
- USE="${USE}" "${EPREFIX}"/usr/bin/depend-java-query "${@}"
+ java-pkg_do_write_
}
# @FUNCTION: java-pkg_regjar
@@ -412,9 +497,11 @@ java-pkg_doso() {
if [[ -e "${lib}" ]] ; then
# install if it isn't a symlink
if [[ ! -L "${lib}" ]] ; then
- INSDESTTREE="${JAVA_PKG_LIBDEST}" \
- INSOPTIONS="${LIBOPTIONS}" \
- doins "${lib}" || die "failed to install ${lib}"
+ (
+ insinto "${JAVA_PKG_LIBDEST}"
+ insopts -m0755
+ doins "${lib}"
+ ) || die "failed to install ${lib}"
java-pkg_append_ JAVA_PKG_LIBRARY "${JAVA_PKG_LIBDEST}"
debug-print "Installing ${lib} to ${JAVA_PKG_LIBDEST}"
# otherwise make a symlink to the symlink's origin
@@ -502,13 +589,13 @@ java-pkg_sointo() {
java-pkg_dohtml() {
debug-print-function ${FUNCNAME} $*
- [[ ${#} -lt 1 ]] && die "At least one argument required for ${FUNCNAME}"
+ [[ ${#} -lt 1 ]] && die "At least one argument required for ${FUNCNAME}"
- # from /usr/lib/portage/bin/dohtml -h
- # -f Set list of allowed extensionless file names.
- dohtml -f package-list "$@"
+ # Do away with dohtml and rely on dodoc instead to do the deed.
+ docinto html
+ dodoc "$@"
- # this probably shouldn't be here but it provides
+ # This probably shouldn't be here but it provides
# a reasonable way to catch # docs for all of the
# old ebuilds.
java-pkg_recordjavadoc
@@ -570,7 +657,6 @@ java-pkg_dojavadoc() {
fi
# Actual installation
-
java-pkg_dohtml -r "${dir_to_install}"
# Let's make a symlink to the directory we have everything else under
@@ -580,6 +666,15 @@ java-pkg_dojavadoc() {
debug-print "symlinking ${dest}/{api,${symlink}}"
dosym ${dest}/{api,${symlink}} || die
fi
+
+ # Extra logging if enabled.
+ if [[ -n ${JAVA_PKG_DEBUG} ]]; then
+ einfo "Verbose logging for \"${FUNCNAME}\" function"
+ einfo "Documentation destination: ${dest}"
+ einfo "Directory to install: ${dir_to_install}"
+ einfo "Complete command:"
+ einfo "${FUNCNAME} ${@}"
+ fi
}
# @FUNCTION: java-pkg_dosrc
@@ -631,14 +726,27 @@ java-pkg_dosrc() {
if [[ ${result} != 12 && ${result} != 0 ]]; then
die "failed to zip ${dir_name}"
fi
- popd >/dev/null
+ popd >/dev/null || die
done
# Install the zip
- INSDESTTREE=${JAVA_PKG_SOURCESPATH} \
- doins ${zip_path} || die "Failed to install source"
+ (
+ insinto "${JAVA_PKG_SOURCESPATH}"
+ doins ${zip_path}
+ ) || die "Failed to install source"
JAVA_SOURCES="${JAVA_PKG_SOURCESPATH}/${zip_name}"
+
+ # Extra logging if enabled.
+ if [[ -n ${JAVA_PKG_DEBUG} ]]; then
+ einfo "Verbose logging for \"${FUNCNAME}\" function"
+ einfo "Zip filename created: ${zip_name}"
+ einfo "Zip file destination: ${JAVA_PKG_SOURCESPATH}"
+ einfo "Directories zipped: ${@}"
+ einfo "Complete command:"
+ einfo "${FUNCNAME} ${@}"
+ fi
+
java-pkg_do_write_
}
@@ -725,7 +833,10 @@ java-pkg_dolauncher() {
echo "source ${EPREFIX}/usr/share/java-config-2/launcher/launcher.bash" >> "${target}"
if [[ -n "${target_dir}" ]]; then
- DESTTREE="${target_dir}" dobin "${target}"
+ (
+ into "${target_dir}"
+ dobin "${target}"
+ )
local ret=$?
return ${ret}
else
@@ -764,9 +875,11 @@ java-pkg_dowar() {
fi
# Install those files like you mean it
- INSOPTIONS="-m 0644" \
- INSDESTTREE=${JAVA_PKG_WARDEST} \
+ (
+ insopts -m0644
+ insinto "${JAVA_PKG_WARDEST}"
doins ${warpath}
+ )
done
}
@@ -921,7 +1034,7 @@ java-pkg_jar-from() {
java-pkg_record-jar_ --build-only "${target_pkg}" "${jar}"
fi
fi
- # otherwise, if the current jar is the target jar, link it
+ # otherwise, if the current jar is the target jar, link it
elif [[ "${jar_name}" == "${target_jar}" ]] ; then
[[ -f "${destjar}" ]] && rm "${destjar}"
ln -snf "${jar}" "${destjar}" \
@@ -930,14 +1043,14 @@ java-pkg_jar-from() {
if [[ -z "${build_only}" ]]; then
java-pkg_record-jar_ "${target_pkg}" "${jar}"
else
- java-pkg_record-jar_ --build-only "${target_jar}" "${jar}"
+ java-pkg_record-jar_ --build-only "${target_pkg}" "${jar}"
fi
fi
- popd > /dev/null
+ popd > /dev/null || die
return 0
fi
done
- popd > /dev/null
+ popd > /dev/null || die
# if no target was specified, we're ok
if [[ -z "${target_jar}" ]] ; then
return 0
@@ -1515,7 +1628,7 @@ java-pkg_get-target() {
java-pkg_get-javac() {
debug-print-function ${FUNCNAME} $*
-
+ java-pkg_init-compiler_
local compiler="${GENTOO_COMPILER}"
local compiler_executable
@@ -1534,18 +1647,15 @@ java-pkg_get-javac() {
export JAVAC=${old_javac}
if [[ -z ${compiler_executable} ]]; then
- echo "JAVAC is empty or undefined in ${compiler_env}"
- return 1
+ die "JAVAC is empty or undefined in ${compiler_env}"
fi
# check that it's executable
if [[ ! -x ${compiler_executable} ]]; then
- echo "${compiler_executable} doesn't exist, or isn't executable"
- return 1
+ die "${compiler_executable} doesn't exist, or isn't executable"
fi
else
- echo "Could not find environment file for ${compiler}"
- return 1
+ die "Could not find environment file for ${compiler}"
fi
fi
echo ${compiler_executable}
@@ -1570,15 +1680,9 @@ java-pkg_javac-args() {
debug-print "want target: ${want_target}"
if [[ -z "${want_source}" || -z "${want_target}" ]]; then
- debug-print "could not find valid -source/-target values for javac"
- echo "Could not find valid -source/-target values for javac"
- return 1
+ die "Could not find valid -source/-target values for javac"
else
- if java-pkg_is-vm-version-ge "1.4"; then
- echo "${source_str} ${target_str}"
- else
- echo "${target_str}"
- fi
+ echo "${source_str} ${target_str}"
fi
}
@@ -1715,8 +1819,8 @@ ejunit_() {
if [[ "${junit}" == "junit-4" ]] ; then
runner=org.junit.runner.JUnitCore
fi
- debug-print "Calling: java -cp \"${cp}\" -Djava.awt.headless=true ${runner} ${@}"
- java -cp "${cp}" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed"
+ debug-print "Calling: java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true ${runner} ${@}"
+ java -cp "${cp}" -Djava.io.tmpdir="${T}/" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed"
}
# @FUNCTION: ejunit
@@ -1769,18 +1873,28 @@ ejunit4() {
# src_prepare Searches for bundled jars
# Don't call directly, but via java-pkg-2_src_prepare!
java-utils-2_src_prepare() {
- [[ ${EBUILD_PHASE} == prepare ]] &&
- java-pkg_func-exists java_prepare && java_prepare
+ case ${EAPI:-0} in
+ [0-5])
+ java-pkg_func-exists java_prepare && java_prepare ;;
+ *)
+ java-pkg_func-exists java_prepare &&
+ eqawarn "java_prepare is no longer called, define src_prepare instead."
+ eapply_user ;;
+ esac
+
+ # Check for files in JAVA_RM_FILES array.
+ if [[ ${JAVA_RM_FILES[@]} ]]; then
+ debug-print "$FUNCNAME: removing unneeded files"
+ java-pkg_rm_files "${JAVA_RM_FILES[@]}"
+ fi
- # Remember that eant will call this unless called via Portage
- if [[ ! -e "${T}/java-utils-2_src_prepare-run" ]] && is-java-strict; then
+ if is-java-strict; then
echo "Searching for bundled jars:"
java-pkg_find-normal-jars || echo "None found."
echo "Searching for bundled classes (no output if none found):"
find "${WORKDIR}" -name "*.class"
echo "Search done."
fi
- touch "${T}/java-utils-2_src_prepare-run"
}
# @FUNCTION: java-utils-2_pkg_preinst
@@ -1789,18 +1903,13 @@ java-utils-2_src_prepare() {
# Don't call directly, but via java-pkg-2_pkg_preinst!
java-utils-2_pkg_preinst() {
if is-java-strict; then
+ if [[ ! -e "${JAVA_PKG_ENV}" ]] || has ant-tasks ${INHERITED}; then
+ return
+ fi
+
if has_version dev-java/java-dep-check; then
- [[ -e "${JAVA_PKG_ENV}" ]] || return
- local output=$(GENTOO_VM= java-dep-check --image "${ED}" "${JAVA_PKG_ENV}")
- if [[ ${output} && has_version <=dev-java/java-dep-check-0.2 ]]; then
- ewarn "Possibly unneeded dependencies found in package.env:"
- for dep in ${output}; do
- ewarn "\t${dep}"
- done
- fi
- if [[ ${output} && has_version >dev-java/java-dep-check-0.2 ]]; then
- ewarn "${output}"
- fi
+ local output=$(GENTOO_VM= java-dep-check --image "${D}" "${JAVA_PKG_ENV}")
+ [[ ${output} ]] && ewarn "${output}"
else
eerror "Install dev-java/java-dep-check for dependency checking"
fi
@@ -1813,7 +1922,7 @@ java-utils-2_pkg_preinst() {
# Ant wrapper function. Will use the appropriate compiler, based on user-defined
# compiler. Will also set proper ANT_TASKS from the variable ANT_TASKS,
# variables:
-#
+#
# @CODE
# Variables:
# EANT_GENTOO_CLASSPATH - calls java-pkg_getjars for the value and adds to the
@@ -1828,7 +1937,6 @@ eant() {
if [[ ${EBUILD_PHASE} = compile ]]; then
java-ant-2_src_configure
- java-utils-2_src_prepare
fi
if ! has java-ant-2 ${INHERITED}; then
@@ -1914,8 +2022,10 @@ eant() {
if [[ ${EBUILD_PHASE} = "test" ]]; then
antflags="${antflags} -DJunit.present=true"
- [[ ${ANT_TASKS} = *ant-junit* ]] && gcp="${gcp} junit"
getjarsarg="--with-dependencies"
+
+ local re="\bant-junit4?([-:]\S+)?\b"
+ [[ ${ANT_TASKS} =~ ${re} ]] && gcp+=" ${BASH_REMATCH[0]}"
else
antflags="${antflags} -Dmaven.test.skip=true"
fi
@@ -1923,17 +2033,15 @@ eant() {
local cp
for atom in ${gcp}; do
- cp="${cp}:$(java-pkg_getjars ${getjarsarg} ${atom})"
+ cp+=":$(java-pkg_getjars ${getjarsarg} ${atom})"
done
- [[ -n "${EANT_NEEDS_TOOLS}" ]] && cp="${cp}:$(java-config --tools)"
+ [[ ${EANT_NEEDS_TOOLS} ]] && cp+=":$(java-config --tools)"
+ [[ ${EANT_GENTOO_CLASSPATH_EXTRA} ]] && cp+=":${EANT_GENTOO_CLASSPATH_EXTRA}"
- if [[ ${cp} ]]; then
+ if [[ ${cp#:} ]]; then
# It seems ant does not like single quotes around ${cp}
- cp=${cp#:}
- [[ ${EANT_GENTOO_CLASSPATH_EXTRA} ]] && \
- cp="${cp}:${EANT_GENTOO_CLASSPATH_EXTRA}"
- antflags="${antflags} -Dgentoo.classpath=\"${cp}\""
+ antflags="${antflags} -Dgentoo.classpath=\"${cp#:}\""
fi
[[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}"
@@ -1949,26 +2057,50 @@ eant() {
ejavac() {
debug-print-function ${FUNCNAME} $*
- java-pkg_init-compiler_
-
local compiler_executable
compiler_executable=$(java-pkg_get-javac)
- if [[ ${?} != 0 ]]; then
- eerror "There was a problem determining compiler: ${compiler_executable}"
- die "get-javac failed"
- fi
local javac_args
javac_args="$(java-pkg_javac-args)"
- if [[ ${?} != 0 ]]; then
- eerror "There was a problem determining JAVACFLAGS: ${javac_args}"
- die "java-pkg_javac-args failed"
+
+ if [[ -n ${JAVA_PKG_DEBUG} ]]; then
+ einfo "Verbose logging for \"${FUNCNAME}\" function"
+ einfo "Compiler executable: ${compiler_executable}"
+ einfo "Extra arguments: ${javac_args}"
+ einfo "Complete command:"
+ einfo "${compiler_executable} ${javac_args} ${@}"
fi
- [[ -n ${JAVA_PKG_DEBUG} ]] && echo ${compiler_executable} ${javac_args} "${@}"
+ ebegin "Compiling"
${compiler_executable} ${javac_args} "${@}" || die "ejavac failed"
}
+# @FUNCTION: ejavadoc
+# @USAGE: <javadoc_arguments>
+# @DESCRIPTION:
+# javadoc wrapper function. Will set some flags based on the VM version
+# due to strict javadoc rules in 1.8.
+ejavadoc() {
+ debug-print-function ${FUNCNAME} $*
+
+ local javadoc_args=""
+
+ if java-pkg_is-vm-version-ge "1.8" ; then
+ javadoc_args="-Xdoclint:none"
+ fi
+
+ if [[ -n ${JAVA_PKG_DEBUG} ]]; then
+ einfo "Verbose logging for \"${FUNCNAME}\" function"
+ einfo "Javadoc executable: javadoc"
+ einfo "Extra arguments: ${javadoc_args}"
+ einfo "Complete command:"
+ einfo "javadoc ${javadoc_args} ${@}"
+ fi
+
+ ebegin "Generating JavaDoc"
+ javadoc ${javadoc_args} "${@}" || die "ejavadoc failed"
+}
+
# @FUNCTION: java-pkg_filter-compiler
# @USAGE: <compiler(s)_to_filter>
# @DESCRIPTION:
@@ -2045,7 +2177,7 @@ java-pkg_init() {
}
# People do all kinds of weird things.
- # http://forums.gentoo.org/viewtopic-p-3943166.html
+ # https://forums.gentoo.org/viewtopic-p-3943166.html
local silence="${SILENCE_JAVA_OPTIONS_WARNING}"
local accept="${I_WANT_GLOBAL_JAVA_OPTIONS}"
if [[ -n ${_JAVA_OPTIONS} && -z ${accept} && -z ${silence} ]]; then
@@ -2065,10 +2197,6 @@ java-pkg_init() {
I_WANT_GLOBAL_JAVA_OPTIONS="true"
fi
- if java-pkg_func-exists ant_src_unpack; then
- java-pkg_announce-qa-violation "Using old ant_src_unpack. Should be src_unpack"
- fi
-
java-pkg_switch-vm
# DON'T just prepend /bin to PATH ever in Prefix, it breaks more than can
# imagine
@@ -2148,7 +2276,7 @@ java-pkg_init-compiler_() {
if has ${compiler} ${JAVA_PKG_FILTER_COMPILER}; then
if [[ -z ${JAVA_PKG_FORCE_COMPILER} ]]; then
- einfo "Filtering ${compiler}"
+ einfo "Filtering ${compiler}" >&2
continue
fi
fi
@@ -2168,14 +2296,11 @@ java-pkg_init-compiler_() {
continue
fi
- # -source was introduced in 1.3, so only check 1.3 and on
- if version_is_at_least "${desired_soure}" "1.3"; then
- # Verify that the compiler supports source
- local supported_source=$(source ${compiler_env} 1>/dev/null 2>&1; echo ${SUPPORTED_SOURCE})
- if ! has ${desired_source} ${supported_source}; then
- ewarn "${compiler} does not support -source ${desired_source}, skipping"
- continue
- fi
+ # Verify that the compiler supports source
+ local supported_source=$(source ${compiler_env} 1>/dev/null 2>&1; echo ${SUPPORTED_SOURCE})
+ if ! has ${desired_source} ${supported_source}; then
+ ewarn "${compiler} does not support -source ${desired_source}, skipping"
+ continue
fi
# if you get here, then the compiler should be good to go
@@ -2191,10 +2316,10 @@ java-pkg_init-compiler_() {
# If it hasn't been defined already, default to javac
if [[ -z ${GENTOO_COMPILER} ]]; then
if [[ -n ${compilers} ]]; then
- einfo "No suitable compiler found: defaulting to JDK default for compilation"
+ einfo "No suitable compiler found: defaulting to JDK default for compilation" >&2
else
# probably don't need to notify users about the default.
- :;#einfo "Defaulting to javac for compilation"
+ :;#einfo "Defaulting to javac for compilation" >&2
fi
if java-config -g GENTOO_COMPILER 2> /dev/null; then
export GENTOO_COMPILER=$(java-config -g GENTOO_COMPILER)
@@ -2202,7 +2327,7 @@ java-pkg_init-compiler_() {
export GENTOO_COMPILER=javac
fi
else
- einfo "Using ${GENTOO_COMPILER} for compilation"
+ einfo "Using ${GENTOO_COMPILER} for compilation" >&2
fi
}
@@ -2222,14 +2347,14 @@ java-pkg_init_paths_() {
JAVA_PKG_NAME="${PN}-${SLOT%/*}"
fi
- JAVA_PKG_SHAREPATH="${DESTTREE}/share/${JAVA_PKG_NAME}"
+ JAVA_PKG_SHAREPATH="/usr/share/${JAVA_PKG_NAME}"
JAVA_PKG_SOURCESPATH="${JAVA_PKG_SHAREPATH}/sources/"
JAVA_PKG_ENV="${ED}${JAVA_PKG_SHAREPATH}/package.env"
- JAVA_PKG_VIRTUALS_PATH="${DESTTREE}/share/java-config-2/virtuals"
- JAVA_PKG_VIRTUAL_PROVIDER="${ED}/${JAVA_PKG_VIRTUALS_PATH}/${JAVA_PKG_NAME}"
+ JAVA_PKG_VIRTUALS_PATH="/usr/share/java-config-2/virtuals"
+ JAVA_PKG_VIRTUAL_PROVIDER="${ED}${JAVA_PKG_VIRTUALS_PATH}/${JAVA_PKG_NAME}"
[[ -z "${JAVA_PKG_JARDEST}" ]] && JAVA_PKG_JARDEST="${JAVA_PKG_SHAREPATH}/lib"
- [[ -z "${JAVA_PKG_LIBDEST}" ]] && JAVA_PKG_LIBDEST="${DESTTREE}/$(get_libdir)/${JAVA_PKG_NAME}"
+ [[ -z "${JAVA_PKG_LIBDEST}" ]] && JAVA_PKG_LIBDEST="/usr/$(get_libdir)/${JAVA_PKG_NAME}"
[[ -z "${JAVA_PKG_WARDEST}" ]] && JAVA_PKG_WARDEST="${JAVA_PKG_SHAREPATH}/webapps"
# TODO maybe only print once?
@@ -2251,62 +2376,54 @@ java-pkg_do_write_() {
java-pkg_init_paths_
# Create directory for package.env
dodir "${JAVA_PKG_SHAREPATH}"
- if [[ -n "${JAVA_PKG_CLASSPATH}" || -n "${JAVA_PKG_LIBRARY}" || -f \
- "${JAVA_PKG_DEPEND_FILE}" || -f \
- "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]]; then
- # Create package.env
- (
- echo "DESCRIPTION=\"${DESCRIPTION}\""
- echo "GENERATION=\"2\""
- echo "SLOT=\"${SLOT}\""
- echo "CATEGORY=\"${CATEGORY}\""
- echo "PVR=\"${PVR}\""
-
- [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\""
- [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\""
- [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\""
- [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \
- && echo "DEPEND=\"$(sort -u "${JAVA_PKG_DEPEND_FILE}" | tr '\n' ':')\""
- [[ -f "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]] \
- && echo "OPTIONAL_DEPEND=\"$(sort -u "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" | tr '\n' ':')\""
- echo "VM=\"$(echo ${RDEPEND} ${DEPEND} | sed -e 's/ /\n/g' | sed -n -e '/virtual\/\(jre\|jdk\)/ { p;q }')\"" # TODO cleanup !
- [[ -f "${JAVA_PKG_BUILD_DEPEND_FILE}" ]] \
- && echo "BUILD_DEPEND=\"$(sort -u "${JAVA_PKG_BUILD_DEPEND_FILE}" | tr '\n' ':')\""
- ) > "${JAVA_PKG_ENV}"
-
- # register target/source
- local target="$(java-pkg_get-target)"
- local source="$(java-pkg_get-source)"
- [[ -n ${target} ]] && echo "TARGET=\"${target}\"" >> "${JAVA_PKG_ENV}"
- [[ -n ${source} ]] && echo "SOURCE=\"${source}\"" >> "${JAVA_PKG_ENV}"
-
- # register javadoc info
- [[ -n ${JAVADOC_PATH} ]] && echo "JAVADOC_PATH=\"${JAVADOC_PATH}\"" \
- >> ${JAVA_PKG_ENV}
- # register source archives
- [[ -n ${JAVA_SOURCES} ]] && echo "JAVA_SOURCES=\"${JAVA_SOURCES}\"" \
- >> ${JAVA_PKG_ENV}
-
-
- echo "MERGE_VM=\"${GENTOO_VM}\"" >> "${JAVA_PKG_ENV}"
- [[ -n ${GENTOO_COMPILER} ]] && echo "MERGE_COMPILER=\"${GENTOO_COMPILER}\"" >> "${JAVA_PKG_ENV}"
-
- # extra env variables
- if [[ -n "${JAVA_PKG_EXTRA_ENV_VARS}" ]]; then
- cat "${JAVA_PKG_EXTRA_ENV}" >> "${JAVA_PKG_ENV}" || die
- # nested echo to remove leading/trailing spaces
- echo "ENV_VARS=\"$(echo ${JAVA_PKG_EXTRA_ENV_VARS})\"" \
- >> "${JAVA_PKG_ENV}" || die
- fi
- # Strip unnecessary leading and trailing colons
- # TODO try to cleanup if possible
- sed -e "s/=\":/=\"/" -e "s/:\"$/\"/" -i "${JAVA_PKG_ENV}" || die "Did you forget to call java_init ?"
- else
- debug-print "JAVA_PKG_CLASSPATH, JAVA_PKG_LIBRARY, JAVA_PKG_DEPEND_FILE"
- debug-print "or JAVA_PKG_OPTIONAL_DEPEND_FILE not defined so can't"
- debug-print "write package.env."
- fi
+ # Create package.env
+ (
+ echo "DESCRIPTION=\"${DESCRIPTION}\""
+ echo "GENERATION=\"2\""
+ echo "SLOT=\"${SLOT}\""
+ echo "CATEGORY=\"${CATEGORY}\""
+ echo "PVR=\"${PVR}\""
+
+ [[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\""
+ [[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\""
+ [[ -n "${JAVA_PROVIDE}" ]] && echo "PROVIDES=\"${JAVA_PROVIDE}\""
+ [[ -f "${JAVA_PKG_DEPEND_FILE}" ]] \
+ && echo "DEPEND=\"$(sort -u "${JAVA_PKG_DEPEND_FILE}" | tr '\n' ':')\""
+ [[ -f "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" ]] \
+ && echo "OPTIONAL_DEPEND=\"$(sort -u "${JAVA_PKG_OPTIONAL_DEPEND_FILE}" | tr '\n' ':')\""
+ echo "VM=\"$(echo ${RDEPEND} ${DEPEND} | sed -e 's/ /\n/g' | sed -n -e '/virtual\/\(jre\|jdk\)/ { p;q }')\"" # TODO cleanup !
+ [[ -f "${JAVA_PKG_BUILD_DEPEND_FILE}" ]] \
+ && echo "BUILD_DEPEND=\"$(sort -u "${JAVA_PKG_BUILD_DEPEND_FILE}" | tr '\n' ':')\""
+ ) > "${JAVA_PKG_ENV}"
+
+ # register target/source
+ local target="$(java-pkg_get-target)"
+ local source="$(java-pkg_get-source)"
+ [[ -n ${target} ]] && echo "TARGET=\"${target}\"" >> "${JAVA_PKG_ENV}"
+ [[ -n ${source} ]] && echo "SOURCE=\"${source}\"" >> "${JAVA_PKG_ENV}"
+
+ # register javadoc info
+ [[ -n ${JAVADOC_PATH} ]] && echo "JAVADOC_PATH=\"${JAVADOC_PATH}\"" \
+ >> ${JAVA_PKG_ENV}
+ # register source archives
+ [[ -n ${JAVA_SOURCES} ]] && echo "JAVA_SOURCES=\"${JAVA_SOURCES}\"" \
+ >> ${JAVA_PKG_ENV}
+
+ echo "MERGE_VM=\"${GENTOO_VM}\"" >> "${JAVA_PKG_ENV}"
+ [[ -n ${GENTOO_COMPILER} ]] && echo "MERGE_COMPILER=\"${GENTOO_COMPILER}\"" >> "${JAVA_PKG_ENV}"
+
+ # extra env variables
+ if [[ -n "${JAVA_PKG_EXTRA_ENV_VARS}" ]]; then
+ cat "${JAVA_PKG_EXTRA_ENV}" >> "${JAVA_PKG_ENV}" || die
+ # nested echo to remove leading/trailing spaces
+ echo "ENV_VARS=\"$(echo ${JAVA_PKG_EXTRA_ENV_VARS})\"" \
+ >> "${JAVA_PKG_ENV}" || die
+ fi
+
+ # Strip unnecessary leading and trailing colons
+ # TODO try to cleanup if possible
+ sed -e "s/=\":/=\"/" -e "s/:\"$/\"/" -i "${JAVA_PKG_ENV}" || die "Did you forget to call java_init ?"
}
# @FUNCTION: java-pkg_record-jar_
@@ -2386,9 +2503,9 @@ java-pkg_append_() {
# @CODE
# @RETURN: path to $1's parent directory
java-pkg_expand_dir_() {
- pushd "$(dirname "${1}")" >/dev/null 2>&1
+ pushd "$(dirname "${1}")" >/dev/null 2>&1 || die
pwd
- popd >/dev/null 2>&1
+ popd >/dev/null 2>&1 || die
}
# @FUNCTION: java-pkg_func-exists
@@ -2559,10 +2676,6 @@ java-pkg_switch-vm() {
export JAVA=$(java-config --java)
export JAVAC=$(java-config --javac)
JAVACFLAGS="$(java-pkg_javac-args)"
- if [[ ${?} != 0 ]]; then
- eerror "There was a problem determining JAVACFLAGS: ${JAVACFLAGS}"
- die "java-pkg_javac-args failed"
- fi
[[ -n ${JAVACFLAGS_EXTRA} ]] && JAVACFLAGS="${JAVACFLAGS_EXTRA} ${JAVACFLAGS}"
export JAVACFLAGS
@@ -2665,7 +2778,8 @@ java-pkg_verify-classes() {
# @INTERNAL
# @DESCRIPTION:
# Check that a package being used in jarfrom, getjars and getjar is contained
-# within DEPEND or RDEPEND.
+# within DEPEND or RDEPEND with the correct SLOT. See this mail for details:
+# https://archives.gentoo.org/gentoo-dev/message/dcb644f89520f4bbb61cc7bbe45fdf6e
# @CODE
# Parameters:
# $1 - empty - check both vars; "runtime" or "build" - check only
@@ -2679,43 +2793,56 @@ java-pkg_ensure-dep() {
local target_pkg="${2}"
local dev_error=""
- # remove the version specification, which may include globbing (* and [123])
- local stripped_pkg=$(echo "${target_pkg}" | sed \
- 's/-\([0-9*]*\(\[[0-9]*\]\)*\)*\(\.\([0-9*]*\(\[[0-9]*\]\)*\)*\)*$//')
+ # Transform into a regular expression to look for a matching package
+ # and SLOT. SLOTs don't have to be numeric so foo-bar could either
+ # mean foo-bar:0 or foo:bar. So you want to get your head around the
+ # line below?
+ #
+ # * The target package first has any dots escaped, e.g. foo-1.2
+ # becomes foo-1\.2.
+ #
+ # * sed then looks at the component following the last - or :
+ # character, or the whole string if there is no - or :
+ # character. It uses this to build a new regexp with two
+ # significant branches.
+ #
+ # * The first checks for the whole target package string, optionally
+ # followed by a version number, and then :0.
+ #
+ # * The second checks for the first part of the target package
+ # string, optionally followed by a version number, followed by the
+ # aforementioned component, treating that as a SLOT.
+ #
+ local stripped_pkg=/$(sed -r 's/[-:]?([^-:]+)$/(\0(-[^:]+)?:0|(-[^:]+)?:\1)/' <<< "${target_pkg//./\\.}")\\b
debug-print "Matching against: ${stripped_pkg}"
- if [[ ${limit_to} != runtime && ! ( "${DEPEND}" =~ "$stripped_pkg" ) ]]; then
- dev_error="The ebuild is attempting to use ${target_pkg} that is not"
- dev_error="${dev_error} declared in DEPEND."
- if is-java-strict; then
- eerror "${dev_error}"
- die "${dev_error}"
- elif [[ ${BASH_SUBSHELL} = 0 ]]; then
- eerror "${dev_error}"
- elog "Because you have this package installed the package will"
- elog "build without problems, but please report this to"
- elog "http://bugs.gentoo.org"
- fi
- fi
-
- if [[ ${limit_to} != build ]]; then
- if [[ ! ( ${RDEPEND} =~ "${stripped_pkg}" ) ]]; then
- if [[ ! ( ${PDEPEND} =~ "${stripped_pkg}" ) ]]; then
- dev_error="The ebuild is attempting to use ${target_pkg},"
- dev_error="${dev_error} without specifying --build-only, that is not declared in RDEPEND"
- dev_error="${dev_error} or PDEPEND."
- if is-java-strict; then
- eerror "${dev_error}"
- die "${dev_error}"
- elif [[ ${BASH_SUBSHELL} = 0 ]]; then
- eerror "${dev_error}"
- elog "The package will build without problems, but may fail to run"
- elog "if you don't have ${target_pkg} installed, so please report"
- elog "this to http://bugs.gentoo.org"
- fi
- fi
- fi
+ # Uncomment the lines below once we've dealt with more of these
+ # otherwise we'll be tempted to turn JAVA_PKG_STRICT off while
+ # getting hit with a wave of bug reports. :(
+
+ if [[ ${limit_to} != runtime && ! ( "${DEPEND}" =~ $stripped_pkg ) ]]; then
+ dev_error="The ebuild is attempting to use ${target_pkg}, which is not "
+ dev_error+="declared with a SLOT in DEPEND."
+# if is-java-strict; then
+# die "${dev_error}"
+# else
+ eqawarn "java-pkg_ensure-dep: ${dev_error}"
+# eerror "Because you have ${target_pkg} installed,"
+# eerror "the package will build without problems, but please"
+# eerror "report this to https://bugs.gentoo.org."
+# fi
+ elif [[ ${limit_to} != build && ! ( "${RDEPEND}${PDEPEND}" =~ ${stripped_pkg} ) ]]; then
+ dev_error="The ebuild is attempting to use ${target_pkg}, which is not "
+ dev_error+="declared with a SLOT in [RP]DEPEND and --build-only wasn't given."
+# if is-java-strict; then
+# die "${dev_error}"
+# else
+ eqawarn "java-pkg_ensure-dep: ${dev_error}"
+# eerror "The package will build without problems, but may fail to run"
+# eerror "if you don't have ${target_pkg} installed,"
+# eerror "so please report this to https://bugs.gentoo.org."
+# fi
fi
}
@@ -2762,3 +2889,39 @@ is-java-strict() {
[[ -n ${JAVA_PKG_STRICT} ]]
return $?
}
+
+# @FUNCTION: java-pkg_clean
+# @DESCRIPTION:
+# Java package cleaner function. This will remove all *.class and *.jar
+# files, removing any bundled dependencies.
+java-pkg_clean() {
+ if [[ -z "${JAVA_PKG_NO_CLEAN}" ]]; then
+ find "${@}" '(' -name '*.class' -o -name '*.jar' ')' -type f -delete -print || die
+ fi
+}
+
+# @FUNCTION: java-pkg_gen-cp
+# @INTERNAL
+# @DESCRIPTION:
+# Java package generate classpath will create a classpath based on
+# special variable CP_DEPEND in the ebuild.
+#
+# @CODE
+# Parameters:
+# $1 - classpath variable either EANT_GENTOO_CLASSPATH or JAVA_GENTOO_CLASSPATH
+# @CODE
+java-pkg_gen-cp() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local atom
+ for atom in ${CP_DEPEND}; do
+ if [[ ${atom} =~ /(([[:alnum:]+_-]+)-[0-9]+(\.[0-9]+)*[a-z]?(_[[:alnum:]]+)?(-r[0-9]*)?|[[:alnum:]+_-]+):([[:alnum:]+_.-]+) ]]; then
+ atom=${BASH_REMATCH[2]:-${BASH_REMATCH[1]}}
+ [[ ${BASH_REMATCH[6]} != 0 ]] && atom+=-${BASH_REMATCH[6]}
+ local regex="(^|\s|,)${atom}($|\s|,)"
+ [[ ${!1} =~ ${regex} ]] || declare -g ${1}+=${!1:+,}${atom}
+ else
+ die "Invalid CP_DEPEND atom ${atom}, ensure a SLOT is included"
+ fi
+ done
+}
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2017-10-17 8:39 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2017-10-17 8:39 UTC (permalink / raw
To: gentoo-commits
commit: f5d555884c130733f2deb74a6bd3afda5ac99f83
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 17 08:39:42 2017 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Oct 17 08:39:42 2017 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f5d55588
eclass/java-utils-2: ensure EPREFIX is set for depend-java-query
eclass/java-utils-2.eclass | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 1ec878b96c..31ba721003 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -23,7 +23,8 @@ IUSE="elibc_FreeBSD"
export WANT_JAVA_CONFIG="2"
# Prefix variables are only available for EAPI>=3
-has "${EAPI:-0}" 0 1 2 && ED="${D}" EPREFIX= EROOT="${ROOT}"
+# PREFIX: we always need EPREFIX, as there's still old ebuilds
+#has "${EAPI:-0}" 0 1 2 && ED="${D}" EPREFIX= EROOT="${ROOT}"
# @VARIABLE: JAVA_PKG_PORTAGE_DEP
# @INTERNAL
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2017-12-12 18:53 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2017-12-12 18:53 UTC (permalink / raw
To: gentoo-commits
commit: 890fb26a2be03155a494ee32d5ad10642f478864
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 12 18:43:30 2017 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Dec 12 18:43:30 2017 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=890fb26a
eclass: sync toolchain.eclass by hsk17, bug #639882
eclass/toolchain.eclass | 67 ++++++++++++++++++++++++++++++++++++++-----------
1 file changed, 53 insertions(+), 14 deletions(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 130feea359..9dcfcf1d88 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1,6 +1,5 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Id$
# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
@@ -94,8 +93,6 @@ if [[ ${SNAPSHOT} == [56789].0-* ]] ; then
SNAPSHOT=${SNAPSHOT/.0}
fi
-export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}}
-
PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr}
if tc_version_is_at_least 3.4.0 ; then
@@ -145,6 +142,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
[[ -n ${D_VER} ]] && IUSE+=" d"
[[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
tc_version_is_at_least 3 && IUSE+=" doc gcj awt hardened multilib objc"
+ tc_version_is_at_least 3.3 && IUSE+=" pgo"
tc_version_is_at_least 4.0 && IUSE+=" objc-gc"
tc_version_is_between 4.0 4.9 && IUSE+=" mudflap"
tc_version_is_at_least 4.1 && IUSE+=" libssp objc++"
@@ -157,7 +155,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
tc_version_is_at_least 4.8 && IUSE+=" graphite" IUSE_DEF+=( sanitize )
tc_version_is_at_least 4.9 && IUSE+=" cilk +vtv"
tc_version_is_at_least 5.0 && IUSE+=" jit mpx"
- tc_version_is_at_least 6.0 && IUSE+=" pie ssp +pch"
+ tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch"
fi
IUSE+=" ${IUSE_DEF[*]/#/+}"
@@ -182,6 +180,12 @@ fi
tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0"
+if in_iuse objc-gc ; then
+ if tc_version_is_at_least 7 ; then
+ RDEPEND+=" objc-gc? ( >=dev-libs/boehm-gc-7.4.2 )"
+ fi
+fi
+
if in_iuse graphite ; then
if tc_version_is_at_least 5.0 ; then
RDEPEND+=" graphite? ( >=dev-libs/isl-0.14 )"
@@ -237,7 +241,8 @@ S=$(
gentoo_urls() {
local devspace="HTTP~vapier/dist/URI HTTP~rhill/dist/URI
- HTTP~zorry/patches/gcc/URI HTTP~blueness/dist/URI"
+ HTTP~zorry/patches/gcc/URI HTTP~blueness/dist/URI
+ HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
devspace=${devspace//HTTP/https:\/\/dev.gentoo.org\/}
echo mirror://gentoo/$1 ${devspace//URI/$1}
}
@@ -317,7 +322,11 @@ get_gcc_src_uri() {
elif [[ -n ${SNAPSHOT} ]] ; then
GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.bz2"
else
- GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2"
+ if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
+ GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz"
+ else
+ GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2"
+ fi
# we want all branch updates to be against the main release
[[ -n ${BRANCH_UPDATE} ]] && \
GCC_SRC_URI+=" $(gentoo_urls gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2)"
@@ -434,7 +443,11 @@ gcc_quick_unpack() {
elif [[ -n ${SNAPSHOT} ]] ; then
unpack gcc-${SNAPSHOT}.tar.bz2
elif [[ ${PV} != *9999* ]] ; then
- unpack gcc-${GCC_RELEASE_VER}.tar.bz2
+ if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
+ unpack gcc-${GCC_RELEASE_VER}.tar.xz
+ else
+ unpack gcc-${GCC_RELEASE_VER}.tar.bz2
+ fi
# We want branch updates to be against a release tarball
if [[ -n ${BRANCH_UPDATE} ]] ; then
pushd "${S}" > /dev/null
@@ -594,14 +607,14 @@ toolchain_src_prepare() {
einfo "Fixing misc issues in configure files"
for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
ebegin " Updating ${f/${S}\/} [LANG]"
- patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
+ patch "${f}" "${FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
|| eerror "Please file a bug about this"
eend $?
done
sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
# Prevent new texinfo from breaking old versions (see #198182, #464008)
- tc_version_is_at_least 4.1 && epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
+ tc_version_is_at_least 4.1 && epatch "${FILESDIR}"/gcc-configure-texinfo.patch
if [[ -x contrib/gcc_update ]] ; then
einfo "Touching generated files"
@@ -668,6 +681,14 @@ do_gcc_CYGWINPORTS_patches() {
make_gcc_hard() {
local gcc_hard_flags=""
+
+ # If we use gcc-6 or newer with pie enable to compile older gcc we need to pass -no-pie
+ # to stage1; bug 618908
+ if ! tc_version_is_at_least 6.0 && [[ $(gcc-major-version) -ge 6 ]] ; then
+ einfo "Disabling PIE in stage1 (only) ..."
+ sed -i -e "/^STAGE1_LDFLAGS/ s/$/ -no-pie/" "${S}"/Makefile.in || die
+ fi
+
# Gcc >= 6.X we can use configurations options to turn pie/ssp on as default
if tc_version_is_at_least 6.0 ; then
if use pie ; then
@@ -1524,7 +1545,8 @@ gcc_do_filter_flags() {
FFLAGS=${CFLAGS}
FCFLAGS=${CFLAGS}
- local VAR="CFLAGS_"${CTARGET//-/_}
+ # "hppa2.0-unknown-linux-gnu" -> hppa2_0_unknown_linux_gnu
+ local VAR="CFLAGS_"${CTARGET//[-.]/_}
CXXFLAGS=${!VAR}
fi
@@ -1616,7 +1638,11 @@ gcc_do_make() {
# resulting binaries natively ^^;
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
else
- GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
+ if tc_version_is_at_least 3.3 && use pgo; then
+ GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap}
+ else
+ GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
+ fi
fi
# Older versions of GCC could not do profiledbootstrap in parallel due to
@@ -1826,10 +1852,10 @@ toolchain_src_install() {
# between binary and source package borks things ....
if ! is_crosscompile ; then
insinto "${DATAPATH#${EPREFIX}}"
- newins "$(prefixify_ro "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la)" fixlafiles.awk || die
+ newins "$(prefixify_ro "${FILESDIR}"/awk/fixlafiles.awk-no_gcc_la)" fixlafiles.awk || die
exeinto "${DATAPATH#${EPREFIX}}"
- doexe "$(prefixify_ro "${GCC_FILESDIR}"/fix_libtool_files.sh)" || die
- doexe "${GCC_FILESDIR}"/c{89,99} || die
+ doexe "$(prefixify_ro "${FILESDIR}"/fix_libtool_files.sh)" || die
+ doexe "${FILESDIR}"/c{89,99} || die
fi
# libstdc++.la: Delete as it doesn't add anything useful: g++ itself
@@ -1896,6 +1922,12 @@ toolchain_src_install() {
pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
fi
+
+ # Disable MPROTECT so java works. #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"
+ fi
}
# Move around the libs to the right location. For some reason,
@@ -2108,6 +2140,9 @@ 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
if ! is_crosscompile ; then
echo
@@ -2146,6 +2181,10 @@ toolchain_pkg_postinst() {
}
toolchain_pkg_postrm() {
+ if [[ ${ROOT} == / && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
+ eselect compiler-shadow clean all
+ fi
+
# to make our lives easier (and saner), we do the fix_libtool stuff here.
# rather than checking SLOT's and trying in upgrade paths, we just see if
# the common libstdc++.la exists in the ${LIBPATH} of the gcc that we are
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2017-12-12 18:53 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2017-12-12 18:53 UTC (permalink / raw
To: gentoo-commits
commit: 64e9b736c728fc62da48ea290441e0048f515dad
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 12 18:44:27 2017 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Dec 12 18:44:27 2017 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=64e9b736
eclass: sync toolchain-funcs.eclass by hsk17, bug #639882
eclass/toolchain-funcs.eclass | 69 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 68 insertions(+), 1 deletion(-)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index bf70ab979e..d9450c3584 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -602,7 +602,7 @@ tc-endian() {
case ${host} in
aarch64*be) echo big;;
aarch64) echo little;;
- alpha*) echo big;;
+ alpha*) echo little;;
arm*b*) echo big;;
arm*) echo little;;
cris*) echo little;;
@@ -822,6 +822,73 @@ gcc-specs-stack-check() {
}
+# @FUNCTION: tc-enables-pie
+# @RETURN: Truth if the current compiler generates position-independent code (PIC) which can be linked into executables
+# @DESCRIPTION:
+# Return truth if the current compiler generates position-independent code (PIC)
+# which can be linked into executables.
+tc-enables-pie() {
+ local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
+ #if defined(__PIE__)
+ true
+ #endif
+ EOF
+ )"
+ [[ ${ret} == true ]]
+}
+
+# @FUNCTION: tc-enables-ssp
+# @RETURN: Truth if the current compiler enables stack smashing protection (SSP) on at least minimal level
+# @DESCRIPTION:
+# Return truth if the current compiler enables stack smashing protection (SSP)
+# on level corresponding to any of the following options:
+# -fstack-protector
+# -fstack-protector-strong
+# -fstack-protector-all
+tc-enables-ssp() {
+ local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
+ #if defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)
+ true
+ #endif
+ EOF
+ )"
+ [[ ${ret} == true ]]
+}
+
+# @FUNCTION: tc-enables-ssp-strong
+# @RETURN: Truth if the current compiler enables stack smashing protection (SSP) on at least middle level
+# @DESCRIPTION:
+# Return truth if the current compiler enables stack smashing protection (SSP)
+# on level corresponding to any of the following options:
+# -fstack-protector-strong
+# -fstack-protector-all
+tc-enables-ssp-strong() {
+ local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
+ #if defined(__SSP_STRONG__) || defined(__SSP_ALL__)
+ true
+ #endif
+ EOF
+ )"
+ [[ ${ret} == true ]]
+}
+
+# @FUNCTION: tc-enables-ssp-all
+# @RETURN: Truth if the current compiler enables stack smashing protection (SSP) on maximal level
+# @DESCRIPTION:
+# Return truth if the current compiler enables stack smashing protection (SSP)
+# on level corresponding to any of the following options:
+# -fstack-protector-all
+tc-enables-ssp-all() {
+ local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
+ #if defined(__SSP_ALL__)
+ true
+ #endif
+ EOF
+ )"
+ [[ ${ret} == true ]]
+}
+
+
# @FUNCTION: gen_usr_ldscript
# @USAGE: [-a] <list of libs to create linker scripts for>
# @DESCRIPTION:
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2018-06-06 12:48 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2018-06-06 12:48 UTC (permalink / raw
To: gentoo-commits
commit: a0a7ca1dc65b9d19def3e3c5f7010540449c9dd5
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 6 12:48:14 2018 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Jun 6 12:48:14 2018 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=a0a7ca1d
eclass: sync with gx86
eclass/autotools.eclass | 34 +++++---
eclass/db.eclass | 29 +++----
eclass/flag-o-matic.eclass | 83 ++++++++++---------
eclass/gnuconfig.eclass | 1 -
eclass/python-utils-r1.eclass | 49 +++++++----
eclass/toolchain-binutils.eclass | 12 +--
eclass/toolchain-funcs.eclass | 62 ++++++++++----
eclass/toolchain.eclass | 174 ++++++++++++++++++++++++---------------
eclass/user.eclass | 31 ++-----
9 files changed, 279 insertions(+), 196 deletions(-)
diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index b6efa541de..f30ac7414f 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: autotools.eclass
@@ -46,16 +46,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 )
+_LATEST_AUTOMAKE=( 1.16.1:1.16 1.15.1:1.15 )
_automake_atom="sys-devel/automake"
_autoconf_atom="sys-devel/autoconf"
@@ -110,7 +114,7 @@ RDEPEND=""
# @ECLASS-VARIABLE: AUTOTOOLS_AUTO_DEPEND
# @DESCRIPTION:
# Set to 'no' to disable automatically adding to DEPEND. This lets
-# ebuilds former conditional depends by using ${AUTOTOOLS_DEPEND} in
+# ebuilds form conditional depends by using ${AUTOTOOLS_DEPEND} in
# their own DEPEND string.
: ${AUTOTOOLS_AUTO_DEPEND:=yes}
if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then
@@ -433,7 +437,7 @@ config_rpath_update() {
# @DESCRIPTION:
# Process the WANT_AUTO{CONF,MAKE} flags.
autotools_env_setup() {
- # We do the "latest" â version switch here because it solves
+ # We do the "latest" → version switch here because it solves
# possible order problems, see bug #270010 as an example.
# During bootstrap in prefix there might be no automake merged yet
# due to --nodeps, but still available somewhere in PATH.
@@ -442,9 +446,17 @@ autotools_env_setup() {
ROOT=/ has_version "sys-devel/automake"; 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[*]}"
diff --git a/eclass/db.eclass b/eclass/db.eclass
index 8973031ba9..7f80f13823 100644
--- a/eclass/db.eclass
+++ b/eclass/db.eclass
@@ -1,11 +1,12 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/db.eclass,v 1.49 2013/07/21 09:23:45 pacho Exp $
-# This is a common location for functions used in the sys-libs/db ebuilds
-#
-# Bugs: maintainer-needed@gentoo.org
-inherit eutils multilib
+# @ECLASS: db.eclass
+# @MAINTAINER:
+# base-system@gentoo.org
+# @BLURB: Internal eclass used by sys-libs/db ebuilds
+
+inherit eutils multilib multiprocessing
IUSE="doc test examples"
@@ -22,11 +23,9 @@ db_fix_so() {
cd "${LIB}"
# first clean up old symlinks
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1_-]*'"$(get_libname)" -delete
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1_-]*'"$(get_libname "[23]")" -delete
- find "${LIB}" -maxdepth 1 -type l -name "libdb$(get_libname)" -delete #519364
- find "${LIB}" -maxdepth 1 -type l -name "libdb$(get_libname "[23]")" -delete #519364
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -delete
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname)" -exec rm \{} \;
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname "[23]")" -exec rm \{} \;
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
# now rebuild all the correct ones
for ext in so a dylib sl; do
@@ -152,12 +151,10 @@ db_src_install_usrlibcleanup() {
mv "${LIB}/libdb_cxx.a" "${LIB}/libdb_cxx-${SLOT}.a"
fi
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1_-]*'"$(get_libname)" -delete
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1_-]*'"$(get_libname "[23]")" -delete
- find "${LIB}" -maxdepth 1 -type l -name "libdb$(get_libname)" -delete #519364
- find "${LIB}" -maxdepth 1 -type l -name "libdb$(get_libname "[23]")" -delete #519364
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname)" -exec rm \{} \;
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname "[23]")" -exec rm \{} \;
einfo "removing unversioned static archives"
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -delete
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
rm -f \
"${ED}"/usr/include/{db,db_185}.h \
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 14922d1f58..3f9fd205c4 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -1,6 +1,5 @@
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Id$
# @ECLASS: flag-o-matic.eclass
# @MAINTAINER:
@@ -17,7 +16,7 @@ inherit eutils toolchain-funcs multilib
# Return all the flag variables that our high level funcs operate on.
all-flag-vars() {
- echo {C,CPP,CXX,CCAS,F,FC,LD}FLAGS
+ echo {ADA,C,CPP,CXX,CCAS,F,FC,LD}FLAGS
}
# {C,CPP,CXX,CCAS,F,FC,LD}FLAGS that we allow in strip-flags
@@ -25,10 +24,10 @@ all-flag-vars() {
setup-allowed-flags() {
ALLOWED_FLAGS=(
-pipe -O '-O[12sg]' -mcpu -march -mtune
- '-fstack-protector*' '-fsanitize*'
+ '-fstack-protector*' '-fsanitize*' '-fstack-check*' -fno-stack-check
-fbounds-check -fbounds-checking -fno-strict-overflow
-fno-PIE -fno-pie -nopie -no-pie -fno-unit-at-a-time
- -g '-g[0-9]' -ggdb '-ggdb[0-9]' '-gdwarf-*' gstabs -gstabs+
+ -g '-g[0-9]' -ggdb '-ggdb[0-9]' '-gdwarf-*' gstabs -gstabs+ -gz
-fno-ident -fpermissive -frecord-gcc-switches
'-fdiagnostics*' '-fplugin*'
'-W*' -w
@@ -117,7 +116,7 @@ _filter-var() {
done
new+=( "${f}" )
done
- eval export ${var}=\""${new[*]}"\"
+ export ${var}="${new[*]}"
}
# @FUNCTION: filter-flags
@@ -274,7 +273,7 @@ replace-flags() {
[[ ${f} == ${1} ]] && f=${2}
new+=( "${f}" )
done
- eval export ${var}=\""${new[*]}"\"
+ export ${var}="${new[*]}"
done
return 0
@@ -299,9 +298,8 @@ replace-cpu-flags() {
}
_is_flagq() {
- local x var
- eval var=\""\${$1[*]}"\"
- for x in ${var} ; do
+ local x var="$1[*]"
+ for x in ${!var} ; do
[[ ${x} == $2 ]] && return 0
done
return 1
@@ -415,7 +413,7 @@ strip-flags() {
if [[ ${!var} != "${new[*]}" ]] ; then
einfo "strip-flags: ${var}: changed '${!var}' to '${new[*]}'"
fi
- eval export ${var}=\""${new[*]}"\"
+ export ${var}="${new[*]}"
done
set +f # re-enable pathname expansion
@@ -426,9 +424,9 @@ strip-flags() {
test-flag-PROG() {
local comp=$1
local lang=$2
- local flag=$3
+ shift 2
- [[ -z ${comp} || -z ${flag} ]] && return 1
+ [[ -z ${comp} || -z $1 ]] && return 1
local src=${T}/tf-${comp}-${SECONDS}.${lang}
local cmdline=(
@@ -440,12 +438,21 @@ test-flag-PROG() {
# don't use -o /dev/null: /usr/ccs/bin/as: File exists (Sun LD)
-c -o "${src}.o"
)
- if "${cmdline[@]}" -x${lang} - </dev/null >/dev/null 2>&1 ; then
- "${cmdline[@]}" "${flag}" -x${lang} - </dev/null >/dev/null 2>&1
+ if "${cmdline[@]}" -x${lang} - </dev/null &>/dev/null ; then
+ cmdline+=( "$@" -x${lang} - )
else
# don't use /dev/null as input: -xc flag needs not to exist #254120
echo "int main() { return 0; }" > "${src}"
- "${cmdline[@]}" "${flag}" -c -o "${src}.o" "${src}" >/dev/null 2>&1
+ cmdline+=( "$@" -c -o "${src}.o" "${src}" )
+ fi
+
+ if ! "${cmdline[@]}" </dev/null &>/dev/null; then
+ # -Werror makes clang bail out on unused arguments as well;
+ # try to add -Qunused-arguments to work-around that
+ # other compilers don't support it but then, it's failure like
+ # any other
+ cmdline+=( -Qunused-arguments )
+ "${cmdline[@]}" </dev/null &>/dev/null
fi
local ret=$?
rm -f "${src}"{,.o}
@@ -456,25 +463,25 @@ test-flag-PROG() {
# @USAGE: <flag>
# @DESCRIPTION:
# Returns shell true if <flag> is supported by the C compiler, else returns shell false.
-test-flag-CC() { test-flag-PROG "CC" c "$1"; }
+test-flag-CC() { test-flag-PROG "CC" c "$@"; }
# @FUNCTION: test-flag-CXX
# @USAGE: <flag>
# @DESCRIPTION:
# Returns shell true if <flag> is supported by the C++ compiler, else returns shell false.
-test-flag-CXX() { test-flag-PROG "CXX" c++ "$1"; }
+test-flag-CXX() { test-flag-PROG "CXX" c++ "$@"; }
# @FUNCTION: test-flag-F77
# @USAGE: <flag>
# @DESCRIPTION:
# Returns shell true if <flag> is supported by the Fortran 77 compiler, else returns shell false.
-test-flag-F77() { test-flag-PROG "F77" f77 "$1"; }
+test-flag-F77() { test-flag-PROG "F77" f77 "$@"; }
# @FUNCTION: test-flag-FC
# @USAGE: <flag>
# @DESCRIPTION:
# Returns shell true if <flag> is supported by the Fortran 90 compiler, else returns shell false.
-test-flag-FC() { test-flag-PROG "FC" f95 "$1"; }
+test-flag-FC() { test-flag-PROG "FC" f95 "$@"; }
test-flags-PROG() {
local comp=$1
@@ -485,8 +492,21 @@ test-flags-PROG() {
[[ -z ${comp} ]] && return 1
- for x ; do
- test-flag-${comp} "${x}" && flags+=( "${x}" )
+ while (( $# )); do
+ case "$1" in
+ --param)
+ if test-flag-${comp} "$1" "$2"; then
+ flags+=( "$1" "$2" )
+ fi
+ shift 2
+ ;;
+ *)
+ if test-flag-${comp} "$1"; then
+ flags+=( "$1" )
+ fi
+ shift 1
+ ;;
+ esac
done
echo "${flags[*]}"
@@ -547,6 +567,9 @@ strip-unsupported-flags() {
export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS})
export FFLAGS=$(test-flags-F77 ${FFLAGS})
export FCFLAGS=$(test-flags-FC ${FCFLAGS})
+ # note: this does not verify the linker flags but it is enough
+ # to strip invalid C flags which are much more likely, #621274
+ export LDFLAGS=$(test-flags-CC ${LDFLAGS})
}
# @FUNCTION: get-flag
@@ -578,21 +601,7 @@ get-flag() {
# WORKS. Non-multilib gcc will take both -m32 and -m64. If the flag works
# return code is 0, else the return code is 1.
has_m64() {
- eqawarn "${FUNCNAME}: don't use this anymore"
-
- # this doesnt test if the flag is accepted, it tests if the flag
- # actually -WORKS-. non-multilib gcc will take both -m32 and -m64!
- # please dont replace this function with test_flag in some future
- # clean-up!
-
- local temp="$(emktemp)"
- echo "int main() { return(0); }" > "${temp}".c
- MY_CC=$(tc-getCC)
- ${MY_CC/ .*/} -m64 -o "$(emktemp)" "${temp}".c > /dev/null 2>&1
- local ret=$?
- rm -f "${temp}".c
- [[ ${ret} != 1 ]] && return 0
- return 1
+ die "${FUNCNAME}: don't use this anymore"
}
has_m32() {
diff --git a/eclass/gnuconfig.eclass b/eclass/gnuconfig.eclass
index 7cfb7d38ea..3c8d98d6a9 100644
--- a/eclass/gnuconfig.eclass
+++ b/eclass/gnuconfig.eclass
@@ -1,6 +1,5 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/gnuconfig.eclass,v 1.36 2014/11/15 06:20:07 vapier Exp $
#
# THIS ECLASS IS DEAD: It has been integrated into portage
#
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 422a8223be..ed84c2680c 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: python-utils-r1.eclass
@@ -19,7 +19,7 @@
# https://wiki.gentoo.org/wiki/Project:Python/python-utils-r1
case "${EAPI:-0}" in
- 0|1|2|3|4|5|6)
+ 0|1|2|3|4|5|6|7)
;;
*)
die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
@@ -169,7 +169,8 @@ _python_set_impls() {
# Check whether the specified <impl> matches at least one
# of the patterns following it. Return 0 if it does, 1 otherwise.
#
-# <impl> should be in PYTHON_COMPAT form. The patterns can be either:
+# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns can be
+# either:
# a) fnmatch-style patterns, e.g. 'python2*', 'pypy'...
# b) '-2' to indicate all Python 2 variants (= !python_is_python3)
# c) '-3' to indicate all Python 3 variants (= python_is_python3)
@@ -186,7 +187,8 @@ _python_impl_matches() {
elif [[ ${pattern} == -3 ]]; then
python_is_python3 "${impl}"
return
- elif [[ ${impl} == ${pattern} ]]; then
+ # unify value style to allow lax matching
+ elif [[ ${impl/./_} == ${pattern/./_} ]]; then
return 0
fi
done
@@ -732,8 +734,8 @@ python_optimize() {
# 2) skip paths which do not exist
# (python2.6 complains about them verbosely)
- if [[ ${f} == /* && -d ${D}${f} ]]; then
- set -- "${D}${f}" "${@}"
+ if [[ ${f} == /* && -d ${D%/}${f} ]]; then
+ set -- "${D%/}${f}" "${@}"
fi
done < <("${PYTHON}" -c 'import sys; print("\0".join(sys.path))' || die)
@@ -743,7 +745,7 @@ python_optimize() {
local d
for d; do
# make sure to get a nice path without //
- local instpath=${d#${D}}
+ local instpath=${d#${D%/}}
instpath=/${instpath##/}
case "${EPYTHON}" in
@@ -968,7 +970,7 @@ python_domodule() {
doins -r "${@}" || return ${?}
)
- python_optimize "${ED}/${d}"
+ python_optimize "${ED%/}/${d}"
}
# @FUNCTION: python_doheader
@@ -1130,9 +1132,20 @@ python_is_python3() {
python_is_installed() {
local impl=${1:-${EPYTHON}}
[[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON"
+ local hasv_args=()
+
+ case ${EAPI:-0} in
+ 0|1|2|3|4)
+ local -x ROOT=/
+ ;;
+ 5|6)
+ hasv_args+=( --host-root )
+ ;;
+ *)
+ hasv_args+=( -b )
+ ;;
+ esac
- # for has_version
- local -x ROOT=/
case "${impl}" in
pypy|pypy3)
local append=
@@ -1141,13 +1154,13 @@ python_is_installed() {
fi
# be happy with just the interpeter, no need for the virtual
- has_version "dev-python/${impl}${append}" \
- || has_version "dev-python/${impl}-bin${append}"
+ has_version "${hasv_args[@]}" "dev-python/${impl}${append}" \
+ || has_version "${hasv_args[@]}" "dev-python/${impl}-bin${append}"
;;
*)
local PYTHON_PKG_DEP
python_export "${impl}" PYTHON_PKG_DEP
- has_version "${PYTHON_PKG_DEP}"
+ has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
;;
esac
}
@@ -1211,7 +1224,7 @@ python_fix_shebang() {
for i in "${split_shebang[@]}"; do
case "${i}" in
*"${EPYTHON}")
- debug-print "${FUNCNAME}: in file ${f#${D}}"
+ debug-print "${FUNCNAME}: in file ${f#${D%/}}"
debug-print "${FUNCNAME}: shebang matches EPYTHON: ${shebang}"
# Nothing to do, move along.
@@ -1220,7 +1233,7 @@ python_fix_shebang() {
break
;;
*python|*python[23])
- debug-print "${FUNCNAME}: in file ${f#${D}}"
+ debug-print "${FUNCNAME}: in file ${f#${D%/}}"
debug-print "${FUNCNAME}: rewriting shebang: ${shebang}"
if [[ ${i} == *python2 ]]; then
@@ -1270,7 +1283,7 @@ python_fix_shebang() {
fi
if [[ ! ${quiet} ]]; then
- einfo "Fixing shebang in ${f#${D}}."
+ einfo "Fixing shebang in ${f#${D%/}}."
fi
if [[ ! ${error} ]]; then
@@ -1284,7 +1297,7 @@ python_fix_shebang() {
any_fixed=1
else
eerror "The file has incompatible shebang:"
- eerror " file: ${f#${D}}"
+ eerror " file: ${f#${D%/}}"
eerror " current shebang: ${shebang}"
eerror " requested impl: ${EPYTHON}"
die "${FUNCNAME}: conversion of incompatible shebang requested"
@@ -1295,7 +1308,7 @@ python_fix_shebang() {
local cmd=eerror
[[ ${EAPI:-0} == [012345] ]] && cmd=eqawarn
- "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D}} did not match any fixable files."
+ "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files."
if [[ ${any_correct} ]]; then
"${cmd}" "All files have ${EPYTHON} shebang already."
else
diff --git a/eclass/toolchain-binutils.eclass b/eclass/toolchain-binutils.eclass
index 89c00e6228..095e5d196a 100644
--- a/eclass/toolchain-binutils.eclass
+++ b/eclass/toolchain-binutils.eclass
@@ -1,6 +1,5 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Id$
#
# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
#
@@ -76,11 +75,12 @@ add_src_uri() {
else
a+=".bz2"
fi
- set -- mirror://gentoo https://dev.gentoo.org/~vapier/dist
+ set -- mirror://gentoo https://dev.gentoo.org/~vapier/dist https://dev.gentoo.org/~tamiko/distfiles https://dev.gentoo.org/~dilfridge/distfiles
SRC_URI="${SRC_URI} ${@/%//${a}}"
}
-add_src_uri binutils-${BVER}-patches-${PATCHVER}.tar ${PATCHVER}
-add_src_uri binutils-${BVER}-uclibc-patches-${UCLIBC_PATCHVER}.tar ${UCLIBC_PATCHVER}
+PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${BVER}}
+add_src_uri binutils-${PATCH_BINUTILS_VER}-patches-${PATCHVER}.tar ${PATCHVER}
+add_src_uri binutils-${PATCH_BINUTILS_VER}-uclibc-patches-${UCLIBC_PATCHVER}.tar ${UCLIBC_PATCHVER}
add_src_uri elf2flt-${ELF2FLT_VER}.tar ${ELF2FLT_VER}
if version_is_at_least 2.18 ; then
@@ -218,7 +218,7 @@ toolchain-binutils_src_prepare() {
}
_eprefix_init() {
- has "${EAPI:-0}" 0 1 2 && : ${ED:=${D}} ${EPREFIX:=} ${EROOT:=${ROOT}}
+ has "${EAPI:-0}" 0 1 2 && ED=${D} EPREFIX= EROOT=${ROOT}
}
# Intended for ebuilds to override to set their own versioning information.
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index d9450c3584..14d7aea8b4 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: toolchain-funcs.eclass
@@ -40,7 +40,13 @@ _tc-getPROG() {
export ${var}="${prog[*]}"
echo "${!var}"
}
-tc-getBUILD_PROG() { _tc-getPROG CBUILD "BUILD_$1 $1_FOR_BUILD HOST$1" "${@:2}"; }
+tc-getBUILD_PROG() {
+ local vars="BUILD_$1 $1_FOR_BUILD HOST$1"
+ # respect host vars if not cross-compiling
+ # https://bugs.gentoo.org/630282
+ tc-is-cross-compiler || vars+=" $1"
+ _tc-getPROG CBUILD "${vars}" "${@:2}"
+}
tc-getPROG() { _tc-getPROG CHOST "$@"; }
# @FUNCTION: tc-getAR
@@ -241,13 +247,21 @@ tc-stack-grows-down() {
# Export common build related compiler settings.
tc-export_build_env() {
tc-export "$@"
- # Some build envs will initialize vars like:
- # : ${BUILD_LDFLAGS:-${LDFLAGS}}
- # So make sure all variables are non-empty. #526734
- : ${BUILD_CFLAGS:=-O1 -pipe}
- : ${BUILD_CXXFLAGS:=-O1 -pipe}
- : ${BUILD_CPPFLAGS:= }
- : ${BUILD_LDFLAGS:= }
+ if tc-is-cross-compiler; then
+ # Some build envs will initialize vars like:
+ # : ${BUILD_LDFLAGS:-${LDFLAGS}}
+ # So make sure all variables are non-empty. #526734
+ : ${BUILD_CFLAGS:=-O1 -pipe}
+ : ${BUILD_CXXFLAGS:=-O1 -pipe}
+ : ${BUILD_CPPFLAGS:= }
+ : ${BUILD_LDFLAGS:= }
+ else
+ # https://bugs.gentoo.org/654424
+ : ${BUILD_CFLAGS:=${CFLAGS}}
+ : ${BUILD_CXXFLAGS:=${CXXFLAGS}}
+ : ${BUILD_CPPFLAGS:=${CPPFLAGS}}
+ : ${BUILD_LDFLAGS:=${LDFLAGS}}
+ fi
export BUILD_{C,CXX,CPP,LD}FLAGS
# Some packages use XXX_FOR_BUILD.
@@ -377,11 +391,28 @@ tc-ld-disable-gold() {
local path_ld=$(which "${bfd_ld}" 2>/dev/null)
[[ -e ${path_ld} ]] && export LD=${bfd_ld}
- # Set up LDFLAGS to select gold based on the gcc version.
- local major=$(gcc-major-version "$@")
- local minor=$(gcc-minor-version "$@")
- if [[ ${major} -lt 4 ]] || [[ ${major} -eq 4 && ${minor} -lt 8 ]] ; then
- # <=gcc-4.7 requires some coercion. Only works if bfd exists.
+ # Set up LDFLAGS to select gold based on the gcc / clang version.
+ local fallback="true"
+ if tc-is-gcc; then
+ local major=$(gcc-major-version "$@")
+ local minor=$(gcc-minor-version "$@")
+ if [[ ${major} -gt 4 ]] || [[ ${major} -eq 4 && ${minor} -ge 8 ]]; then
+ # gcc-4.8+ supports -fuse-ld directly.
+ export LDFLAGS="${LDFLAGS} -fuse-ld=bfd"
+ fallback="false"
+ fi
+ elif tc-is-clang; then
+ local major=$(clang-major-version "$@")
+ local minor=$(clang-minor-version "$@")
+ if [[ ${major} -gt 3 ]] || [[ ${major} -eq 3 && ${minor} -ge 5 ]]; then
+ # clang-3.5+ supports -fuse-ld directly.
+ export LDFLAGS="${LDFLAGS} -fuse-ld=bfd"
+ fallback="false"
+ fi
+ fi
+ if [[ ${fallback} == "true" ]] ; then
+ # <=gcc-4.7 and <=clang-3.4 require some coercion.
+ # Only works if bfd exists.
if [[ -e ${path_ld} ]] ; then
local d="${T}/bfd-linker"
mkdir -p "${d}"
@@ -390,9 +421,6 @@ tc-ld-disable-gold() {
else
die "unable to locate a BFD linker to bypass gold"
fi
- else
- # gcc-4.8+ supports -fuse-ld directly.
- export LDFLAGS="${LDFLAGS} -fuse-ld=bfd"
fi
}
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 9dcfcf1d88..4235583495 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
@@ -23,14 +23,13 @@ fi
FEATURES=${FEATURES/multilib-strict/}
-EXPORTED_FUNCTIONS="pkg_setup src_unpack src_compile src_test src_install pkg_postinst pkg_postrm"
case ${EAPI:-0} in
- 0|1) die "Need to upgrade to at least EAPI=2";;
- 2|3) EXPORTED_FUNCTIONS+=" src_prepare src_configure" ;;
- 4*|5*) EXPORTED_FUNCTIONS+=" pkg_pretend src_prepare src_configure" ;;
- *) die "I don't speak EAPI ${EAPI}."
+ 0|1|2|3|4*) die "Need to upgrade to at least EAPI=5" ;;
+ 5*) ;;
+ *) die "I don't speak EAPI ${EAPI}." ;;
esac
-EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
+EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \
+ src_compile src_test src_install pkg_postinst pkg_postrm
#---->> globals <<----
@@ -141,7 +140,8 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
[[ -n ${HTB_VER} ]] && IUSE+=" boundschecking"
[[ -n ${D_VER} ]] && IUSE+=" d"
[[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
- tc_version_is_at_least 3 && IUSE+=" doc gcj awt hardened multilib objc"
+ tc_version_is_at_least 3 && IUSE+=" doc hardened multilib objc"
+ tc_version_is_between 3 7 && IUSE+=" awt gcj"
tc_version_is_at_least 3.3 && IUSE+=" pgo"
tc_version_is_at_least 4.0 && IUSE+=" objc-gc"
tc_version_is_between 4.0 4.9 && IUSE+=" mudflap"
@@ -153,9 +153,12 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
# versions which we dropped. Since graphite was also experimental in
# the older versions, we don't want to bother supporting it. #448024
tc_version_is_at_least 4.8 && IUSE+=" graphite" IUSE_DEF+=( sanitize )
- tc_version_is_at_least 4.9 && IUSE+=" cilk +vtv"
+ tc_version_is_between 4.9 8 && IUSE+=" cilk"
+ tc_version_is_at_least 4.9 && IUSE+=" +vtv"
tc_version_is_at_least 5.0 && IUSE+=" jit mpx"
tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch"
+ # systemtap is a gentoo-specific switch: bug #654748
+ tc_version_is_at_least 8.0 && IUSE+=" systemtap"
fi
IUSE+=" ${IUSE_DEF[*]/#/+}"
@@ -170,7 +173,7 @@ RDEPEND="sys-libs/zlib
tc_version_is_at_least 3 && RDEPEND+=" virtual/libiconv"
if tc_version_is_at_least 4 ; then
- GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2:0 >=dev-libs/mpfr-2.4.2:0"
+ GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2:0= >=dev-libs/mpfr-2.4.2:0="
if tc_version_is_at_least 4.3 ; then
RDEPEND+=" ${GMP_MPFR_DEPS}"
elif in_iuse fortran ; then
@@ -178,7 +181,7 @@ if tc_version_is_at_least 4 ; then
fi
fi
-tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0"
+tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0="
if in_iuse objc-gc ; then
if tc_version_is_at_least 7 ; then
@@ -188,12 +191,12 @@ fi
if in_iuse graphite ; then
if tc_version_is_at_least 5.0 ; then
- RDEPEND+=" graphite? ( >=dev-libs/isl-0.14 )"
+ RDEPEND+=" graphite? ( >=dev-libs/isl-0.14:0= )"
elif tc_version_is_at_least 4.8 ; then
RDEPEND+="
graphite? (
- >=dev-libs/cloog-0.18.0
- >=dev-libs/isl-0.11.1
+ >=dev-libs/cloog-0.18.0:0=
+ >=dev-libs/isl-0.11.1:0=
)"
fi
fi
@@ -210,11 +213,10 @@ DEPEND="${RDEPEND}
if in_iuse gcj ; then
GCJ_DEPS=">=media-libs/libart_lgpl-2.1"
GCJ_GTK_DEPS="
+ x11-base/xorg-proto
x11-libs/libXt
x11-libs/libX11
x11-libs/libXtst
- x11-proto/xproto
- x11-proto/xextproto
=x11-libs/gtk+-2*
virtual/pkgconfig
"
@@ -223,6 +225,11 @@ if in_iuse gcj ; then
DEPEND+=" gcj? ( awt? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )"
fi
+if in_iuse systemtap ; then
+ # gcc needs sys/sdt.h headers on target
+ DEPEND+=" systemtap? ( dev-util/systemtap )"
+fi
+
PDEPEND=">=sys-devel/gcc-config-1.7"
#---->> S + SRC_URI essentials <<----
@@ -320,7 +327,11 @@ get_gcc_src_uri() {
elif [[ -n ${PRERELEASE} ]] ; then
GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/prerelease-${PRERELEASE}/gcc-${PRERELEASE}.tar.bz2"
elif [[ -n ${SNAPSHOT} ]] ; then
- GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.bz2"
+ if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
+ GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz"
+ else
+ GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.bz2"
+ fi
else
if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz"
@@ -385,9 +396,6 @@ toolchain_pkg_pretend() {
"in your make.conf if you want to use this version."
fi
- [[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && \
- die "Sorry, this version does not support uClibc"
-
if ! use_if_iuse cxx ; then
use_if_iuse go && ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"'
use_if_iuse objc++ && ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"'
@@ -400,10 +408,6 @@ toolchain_pkg_pretend() {
#---->> pkg_setup <<----
toolchain_pkg_setup() {
- case ${EAPI} in
- 2|3) toolchain_pkg_pretend ;;
- esac
-
# we dont want to use the installed compiler's specs to build gcc
unset GCC_SPECS
unset LANGUAGES #265283
@@ -441,7 +445,11 @@ gcc_quick_unpack() {
elif [[ -n ${PRERELEASE} ]] ; then
unpack gcc-${PRERELEASE}.tar.bz2
elif [[ -n ${SNAPSHOT} ]] ; then
- unpack gcc-${SNAPSHOT}.tar.bz2
+ if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
+ unpack gcc-${SNAPSHOT}.tar.xz
+ else
+ unpack gcc-${SNAPSHOT}.tar.bz2
+ fi
elif [[ ${PV} != *9999* ]] ; then
if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
unpack gcc-${GCC_RELEASE_VER}.tar.xz
@@ -518,7 +526,7 @@ toolchain_src_prepare() {
do_gcc_CYGWINPORTS_patches
epatch_user
- if ( tc_version_is_at_least 4.8.2 || use hardened ) && ! use vanilla ; then
+ if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) && ! use vanilla ; then
make_gcc_hard
fi
@@ -568,7 +576,7 @@ toolchain_src_prepare() {
fi
# >= gcc-4.3 doesn't bundle ecj.jar, so copy it
- if tc_version_is_at_least 4.3 && use gcj ; then
+ if tc_version_is_at_least 4.3 && use_if_iuse gcj ; then
if tc_version_is_at_least 4.5 ; then
einfo "Copying ecj-4.5.jar"
cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
@@ -691,20 +699,20 @@ make_gcc_hard() {
# Gcc >= 6.X we can use configurations options to turn pie/ssp on as default
if tc_version_is_at_least 6.0 ; then
- if use pie ; then
+ if use_if_iuse pie ; then
einfo "Updating gcc to use automatic PIE building ..."
fi
- if use ssp ; then
+ if use_if_iuse ssp ; then
einfo "Updating gcc to use automatic SSP building ..."
fi
- if use hardened ; then
+ if use_if_iuse hardened ; then
# Will add some optimatizion as default.
gcc_hard_flags+=" -DEXTRA_OPTIONS"
# rebrand to make bug reports easier
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
fi
else
- if use hardened ; then
+ if use_if_iuse hardened ; then
# rebrand to make bug reports easier
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
if hardened_gcc_works ; then
@@ -952,7 +960,7 @@ toolchain_src_configure() {
# Use the default ("release") checking because upstream usually neglects
# to test "disabled" so it has a history of breaking. #317217
- if tc_version_is_at_least 3.4 ; then
+ if tc_version_is_at_least 3.4 && in_iuse debug ; then
# The "release" keyword is new to 4.0. #551636
local off=$(tc_version_is_at_least 4.0 && echo release || echo no)
confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes ${off})}" )
@@ -965,7 +973,7 @@ toolchain_src_configure() {
)
# If we want hardened support with the newer piepatchset for >=gcc 4.4
- if tc_version_is_at_least 4.4 && want_minispecs ; then
+ if tc_version_is_at_least 4.4 && want_minispecs && in_iuse hardened ; then
confgcc+=( $(use_enable hardened esp) )
fi
@@ -977,7 +985,7 @@ toolchain_src_configure() {
fi
# Support to disable pch when building libstdcxx
- if tc_version_is_at_least 6.0 && ! use pch ; then
+ if tc_version_is_at_least 6.0 && ! use_if_iuse pch ; then
confgcc+=( --disable-libstdcxx-pch )
fi
@@ -1012,7 +1020,14 @@ toolchain_src_configure() {
case ${CTARGET} in
*-linux) needed_libc=no-fucking-clue;;
*-dietlibc) needed_libc=dietlibc;;
- *-elf|*-eabi) needed_libc=newlib;;
+ *-elf|*-eabi)
+ needed_libc=newlib
+ # Bare-metal targets don't have access to clock_gettime()
+ # arm-none-eabi example: bug #589672
+ # But we explicitly do --enable-libstdcxx-time above.
+ # Undoing it here.
+ confgcc+=( --disable-libstdcxx-time )
+ ;;
*-gentoo-freebsd*) needed_libc=freebsd-lib;;
*-gnu*) needed_libc=glibc;;
*-klibc) needed_libc=klibc;;
@@ -1046,7 +1061,7 @@ toolchain_src_configure() {
--disable-threads
--without-headers
)
- elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then
+ elif has_version "${CATEGORY}/${needed_libc}[headers-only(-)]" ; then
confgcc+=(
"${confgcc_no_libc[@]}"
--with-sysroot="${PREFIX}"/${CTARGET}
@@ -1116,12 +1131,12 @@ toolchain_src_configure() {
gcc-multilib-configure
# ppc altivec support
- confgcc+=( $(use_enable altivec) )
+ in_iuse altivec && confgcc+=( $(use_enable altivec) )
# gcc has fixed-point arithmetic support in 4.3 for mips targets that can
# significantly increase compile time by several hours. This will allow
# users to control this feature in the event they need the support.
- tc_version_is_at_least 4.3 && confgcc+=( $(use_enable fixed-point) )
+ tc_version_is_at_least 4.3 && in_iuse fixed-point && confgcc+=( $(use_enable fixed-point) )
case $(tc-is-softfloat) in
yes) confgcc+=( --with-float=soft ) ;;
@@ -1259,7 +1274,17 @@ toolchain_src_configure() {
if hardened_gcc_is_stable ssp; then
export gcc_cv_libc_provides_ssp=yes
fi
- confgcc+=( --disable-libssp )
+ if use_if_iuse ssp; then
+ # On some targets USE="ssp -libssp" is an invalid
+ # configuration as target libc does not provide
+ # stack_chk_* functions. Do not disable libssp there.
+ case ${CTARGET} in
+ mingw*|*-mingw*) ewarn "Not disabling libssp" ;;
+ *) confgcc+=( --disable-libssp ) ;;
+ esac
+ else
+ confgcc+=( --disable-libssp )
+ fi
fi
fi
@@ -1271,6 +1296,10 @@ toolchain_src_configure() {
confgcc+=( $(use_enable mpx libmpx) )
fi
+ if in_iuse systemtap ; then
+ confgcc+=( $(use_enable systemtap) )
+ fi
+
if in_iuse vtv ; then
confgcc+=(
$(use_enable vtv vtable-verify)
@@ -1292,23 +1321,26 @@ toolchain_src_configure() {
# graphite was added in 4.4 but we only support it in 4.8+ due to external
# library issues. #448024
- if tc_version_is_at_least 5.0 ; then
+ if tc_version_is_at_least 5.0 && in_iuse graphite ; then
confgcc+=( $(use_with graphite isl) )
use graphite && confgcc+=( --disable-isl-version-check )
- elif tc_version_is_at_least 4.8 ; then
+ elif tc_version_is_at_least 4.8 && in_iuse graphite ; then
confgcc+=( $(use_with graphite cloog) )
use graphite && confgcc+=( --disable-isl-version-check )
elif tc_version_is_at_least 4.4 ; then
confgcc+=( --without-{cloog,ppl} )
fi
- if tc_version_is_at_least 4.8 ; then
+ if tc_version_is_at_least 4.8 && in_iuse sanitize ; then
confgcc+=( $(use_enable sanitize libsanitizer) )
fi
- if tc_version_is_at_least 6.0 ; then
+ if tc_version_is_at_least 6.0 && in_iuse pie ; then
+ confgcc+=( $(use_enable pie default-pie) )
+ fi
+
+ if tc_version_is_at_least 6.0 && in_iuse ssp ; then
confgcc+=(
- $(use_enable pie default-pie)
# This defaults to -fstack-protector-strong.
$(use_enable ssp default-ssp)
)
@@ -1547,7 +1579,7 @@ gcc_do_filter_flags() {
# "hppa2.0-unknown-linux-gnu" -> hppa2_0_unknown_linux_gnu
local VAR="CFLAGS_"${CTARGET//[-.]/_}
- CXXFLAGS=${!VAR}
+ CXXFLAGS=${!VAR-${CFLAGS}}
fi
export GCJFLAGS=${GCJFLAGS:-${CFLAGS}}
@@ -1638,7 +1670,7 @@ gcc_do_make() {
# resulting binaries natively ^^;
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
else
- if tc_version_is_at_least 3.3 && use pgo; then
+ if tc_version_is_at_least 3.3 && use_if_iuse pgo; then
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap}
else
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
@@ -1685,7 +1717,7 @@ gcc_do_make() {
${GCC_MAKE_TARGET} \
|| die "emake failed with ${GCC_MAKE_TARGET}"
- if ! is_crosscompile && use cxx && use_if_iuse doc ; then
+ if ! is_crosscompile && use_if_iuse cxx && use_if_iuse doc ; then
if type -p doxygen > /dev/null ; then
if tc_version_is_at_least 4.3 ; then
cd "${CTARGET}"/libstdc++-v3/doc
@@ -1738,8 +1770,12 @@ toolchain_src_install() {
fi
done
- # Remove generated headers, as they can cause things to break
- # (ncurses, openssl, etc), unless when in a prefix.
+ # We remove the generated fixincludes, as they can cause things to break
+ # (ncurses, openssl, etc). We do not prevent them from being built, as
+ # in the following commit which we revert:
+ # https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/toolchain.eclass?r1=1.647&r2=1.648
+ # This is because bsd userland needs fixedincludes to build gcc, while
+ # linux does not. Both can dispose of them afterwards.
while read x ; do
grep -q 'It has been auto-edited by fixincludes from' "${x}" \
&& use !prefix && rm -f "${x}"
@@ -1850,7 +1886,7 @@ toolchain_src_install() {
# Rather install the script, else portage with changing $FILESDIR
# between binary and source package borks things ....
- if ! is_crosscompile ; then
+ if ! is_crosscompile && [[ ${PN} != "kgcc64" ]] ; then
insinto "${DATAPATH#${EPREFIX}}"
newins "$(prefixify_ro "${FILESDIR}"/awk/fixlafiles.awk-no_gcc_la)" fixlafiles.awk || die
exeinto "${DATAPATH#${EPREFIX}}"
@@ -1866,6 +1902,7 @@ toolchain_src_install() {
# libsupc++.la: This has no dependencies.
# libcc1.la: There is no static library, only dynamic.
# libcc1plugin.la: Same as above, and it's loaded via dlopen.
+ # libcp1plugin.la: Same as above, and it's loaded via dlopen.
# libgomp.la: gcc itself handles linkage (libgomp.spec).
# libgomp-plugin-*.la: Same as above, and it's an internal plugin only
# loaded via dlopen.
@@ -1885,6 +1922,7 @@ toolchain_src_install() {
-name libsupc++.la -o \
-name libcc1.la -o \
-name libcc1plugin.la -o \
+ -name libcp1plugin.la -o \
-name 'libgomp.la' -o \
-name 'libgomp-plugin-*.la' -o \
-name libgfortran.la -o \
@@ -2144,7 +2182,7 @@ toolchain_pkg_postinst() {
eselect compiler-shadow update all
fi
- if ! is_crosscompile ; then
+ if ! is_crosscompile && [[ ${PN} != "kgcc64" ]] ; then
echo
ewarn "If you have issues with packages unable to locate libstdc++.la,"
ewarn "then try running 'fix_libtool_files.sh' on the old gcc versions."
@@ -2160,12 +2198,12 @@ toolchain_pkg_postinst() {
mkdir -p "${EROOT}"usr/{share/gcc-data,sbin,bin}
# DATAPATH has EPREFIX already, use ROOT with it
- cp "${ROOT%/}${DATAPATH}"/fixlafiles.awk "${EROOT}"usr/share/gcc-data/ || die
- cp "${ROOT%/}${DATAPATH}"/fix_libtool_files.sh "${EROOT}"usr/sbin/ || die
+ cp "${ROOT}${DATAPATH}"/fixlafiles.awk "${EROOT}"usr/share/gcc-data/ || die
+ cp "${ROOT}${DATAPATH}"/fix_libtool_files.sh "${EROOT}"usr/sbin/ || die
# Since these aren't critical files and portage sucks with
# handling of binpkgs, don't require these to be found
- cp "${ROOT%/}${DATAPATH}"/c{89,99} "${EROOT}"usr/bin/ 2>/dev/null
+ cp "${ROOT}${DATAPATH}"/c{89,99} "${EROOT}"usr/bin/ 2>/dev/null
fi
if use regression-test ; then
@@ -2234,7 +2272,7 @@ do_gcc_config() {
[[ -n ${current_specs} ]] && use_specs=-${current_specs}
if [[ -n ${use_specs} ]] && \
- [[ ! -e ${ROOT}etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
+ [[ ! -e ${ROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
then
ewarn "The currently selected specs-specific gcc config,"
ewarn "${current_specs}, doesn't exist anymore. This is usually"
@@ -2309,13 +2347,13 @@ gcc-lang-supported() {
is_ada() {
gcc-lang-supported ada || return 1
- use ada
+ use_if_iuse ada
}
is_cxx() {
gcc-lang-supported 'c++' || return 1
! is_crosscompile && tc_version_is_at_least 4.8 && return 0
- use cxx
+ use_if_iuse cxx
}
is_d() {
@@ -2325,27 +2363,27 @@ is_d() {
is_f77() {
gcc-lang-supported f77 || return 1
- use fortran
+ use_if_iuse fortran
}
is_f95() {
gcc-lang-supported f95 || return 1
- use fortran
+ use_if_iuse fortran
}
is_fortran() {
gcc-lang-supported fortran || return 1
- use fortran
+ use_if_iuse fortran
}
is_gcj() {
gcc-lang-supported java || return 1
- use cxx && use_if_iuse gcj
+ use_if_iuse cxx && use_if_iuse gcj
}
is_go() {
gcc-lang-supported go || return 1
- use cxx && use_if_iuse go
+ use_if_iuse cxx && use_if_iuse go
}
is_jit() {
@@ -2355,7 +2393,7 @@ is_jit() {
is_multilib() {
tc_version_is_at_least 3 || return 1
- use multilib
+ use_if_iuse multilib
}
is_objc() {
@@ -2365,7 +2403,7 @@ is_objc() {
is_objcxx() {
gcc-lang-supported 'obj-c++' || return 1
- use cxx && use_if_iuse objc++
+ use_if_iuse cxx && use_if_iuse objc++
}
# Grab a variable from the build system (taken from linux-info.eclass)
@@ -2433,12 +2471,12 @@ want_minispecs() {
if tc_version_is_at_least 6.0 ; then
return 0
fi
- if tc_version_is_at_least 4.3.2 && use hardened ; then
+ if tc_version_is_at_least 4.3.2 && use_if_iuse hardened ; then
if ! want_pie ; then
ewarn "PIE_VER or SPECS_VER is not defined in the GCC ebuild."
elif use vanilla ; then
ewarn "You will not get hardened features if you have the vanilla USE-flag."
- elif use nopie && use nossp ; then
+ elif use_if_iuse nopie && use_if_iuse nossp ; then
ewarn "You will not get hardened features if you have the nopie and nossp USE-flag."
elif ! hardened_gcc_works ; then
ewarn "Your $(tc-arch) arch is not supported."
@@ -2452,11 +2490,11 @@ want_minispecs() {
}
want_pie() {
- ! use hardened && [[ -n ${PIE_VER} ]] && use nopie && return 1
+ ! use_if_iuse hardened && [[ -n ${PIE_VER} ]] && use_if_iuse nopie && return 1
[[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0
tc_version_is_at_least 4.3.2 && return 1
[[ -z ${PIE_VER} ]] && return 1
- use !nopie && return 0
+ use_if_iuse nopie || return 0
return 1
}
diff --git a/eclass/user.eclass b/eclass/user.eclass
index 847fc1a0fa..83f13f25f4 100644
--- a/eclass/user.eclass
+++ b/eclass/user.eclass
@@ -1,13 +1,9 @@
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/user.eclass,v 1.24 2014/07/11 08:21:58 ulm Exp $
# @ECLASS: user.eclass
# @MAINTAINER:
# base-system@gentoo.org (Linux)
-# Joe Jezak <josejx@gmail.com> (OS X)
-# usata@gentoo.org (OS X)
-# Aaron Walker <ka0ttic@gentoo.org> (FreeBSD)
# @BLURB: user management in ebuilds
# @DESCRIPTION:
# The user eclass contains a suite of functions that allow ebuilds
@@ -107,6 +103,10 @@ egetent() {
# Default uid is (pass -1 for this) next available, default shell is
# /bin/false, default homedir is /dev/null, and there are no default groups.
enewuser() {
+ if [[ ${EUID} != 0 ]] ; then
+ einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
+ return 0
+ fi
_assert_pkg_ebuild_phase ${FUNCNAME}
# get the username
@@ -116,14 +116,6 @@ enewuser() {
die "Cannot call enewuser without a username"
fi
- # in Gentoo Prefix, we may be unprivileged, such that we can't handle this
- rootuid=$(python -c 'from portage.const import rootuid; print(rootuid)')
- if [[ ${rootuid} != 0 ]] ; then
- ewarn "'enewuser()' disabled in Gentoo Prefix with non-root user (by design)"
- ewarn " User: '$euser' not created"
- return 0
- fi
-
# lets see if the username already exists
if [[ -n $(egetent passwd "${euser}") ]] ; then
return 0
@@ -196,7 +188,6 @@ enewuser() {
local egroups=$1; shift
local g egroups_arr
IFS="," read -r -a egroups_arr <<<"${egroups}"
- shift
if [[ ${#egroups_arr[@]} -gt 0 ]] ; then
local defgroup exgroups
for g in "${egroups_arr[@]}" ; do
@@ -275,6 +266,10 @@ enewuser() {
# do the rest. You may specify the gid for the group or allow the group to
# allocate the next available one.
enewgroup() {
+ if [[ ${EUID} != 0 ]] ; then
+ einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
+ return 0
+ fi
_assert_pkg_ebuild_phase ${FUNCNAME}
# get the group
@@ -284,14 +279,6 @@ enewgroup() {
die "Cannot call enewgroup without a group"
fi
- # in Gentoo Prefix, we may be unprivileged, such that we can't handle this
- rootuid=$(python -c 'from portage.const import rootuid; print(rootuid)')
- if [[ ${rootuid} != 0 ]] ; then
- ewarn "'enewgroup()' disabled in Gentoo Prefix with non-root user (by design)"
- ewarn " Group: '$egroup' not created"
- return 0
- fi
-
# see if group already exists
if [[ -n $(egetent group "${egroup}") ]] ; then
return 0
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2018-06-20 7:32 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2018-06-20 7:32 UTC (permalink / raw
To: gentoo-commits
commit: d3e19786b5813d6ce3d3ee80ca4a8163054d97af
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 20 07:30:33 2018 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Jun 20 07:30:33 2018 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=d3e19786
eclass/toolchain: stop adding EPREFIX/Frameworks to searchpath on Darwin
The path isn't used at all, and compilation with gcc-7 yields lots of
warnings by default about the dir not existing. In combination with
-Werror (like gcc build process does) this results in a failure.
eclass/toolchain.eclass | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 4235583495..097cf772ed 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -543,8 +543,14 @@ toolchain_src_prepare() {
"${S}"/gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
# add prefixed Frameworks to default search paths (may want to
# change this in a cross-compile)
- sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
- "${S}"/gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
+ # 2018-06-20 (grobian): disabled this because
+ # 1. no packages seem to use this
+ # 2. absence of this dir causes
+ # warnings->errors with gcc-7
+ # 3. after 2. would need to create the dir
+ # somewhere, but 1. still applies
+ #sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
+ # "${S}"/gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
# make sure the pkg config files install into multilib dirs.
# since we configure with just one --libdir, we can't use that
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2018-06-22 13:16 Michael Haubenwallner
0 siblings, 0 replies; 89+ messages in thread
From: Michael Haubenwallner @ 2018-06-22 13:16 UTC (permalink / raw
To: gentoo-commits
commit: 6f2711db74877064b9be3c3ef6b5555515f720c2
Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Fri Jun 22 13:14:01 2018 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Fri Jun 22 13:14:01 2018 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=6f2711db
toolchain.eclass: support EAPI 7 paths, update cygwin patching
eclass/toolchain.eclass | 58 ++++++++++++++++++++++++++++---------------------
1 file changed, 33 insertions(+), 25 deletions(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 097cf772ed..560fe96139 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -312,6 +312,14 @@ gentoo_urls() {
# ten Brugge's bounds-checking patches. If you want to use a patch
# for an older gcc version with a new gcc, make sure you set
# HTB_GCC_VER to that version of gcc.
+#
+# CYGWINPORTS_GITREV
+# If set, this variable signals that we should apply additional patches
+# maintained by upstream Cygwin developers at github/cygwinports/gcc,
+# using the specified git commit id there. The list of patches to
+# apply is extracted from gcc.cygport, maintained there as well.
+# This is done for compilers running on Cygwin, not for cross compilers
+# with a Cygwin target.
get_gcc_src_uri() {
export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
@@ -380,7 +388,8 @@ get_gcc_src_uri() {
# Cygwin patches from https://github.com/cygwinports/gcc
[[ -n ${CYGWINPORTS_GITREV} ]] && \
- GCC_SRC_URI+=" elibc_Cygwin? ( https://github.com/cygwinports/gcc/archive/${CYGWINPORTS_GITREV}.zip )"
+ GCC_SRC_URI+=" elibc_Cygwin? ( https://github.com/cygwinports/gcc/archive/${CYGWINPORTS_GITREV}.tar.gz
+ -> gcc-cygwinports-${CYGWINPORTS_GITREV}.tar.gz )"
echo "${GCC_SRC_URI}"
}
@@ -497,7 +506,7 @@ gcc_quick_unpack() {
use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
- [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin && unpack "${CYGWINPORTS_GITREV}.zip"
+ [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin && unpack "gcc-cygwinports-${CYGWINPORTS_GITREV}.tar.gz"
popd > /dev/null
}
@@ -682,11 +691,10 @@ do_gcc_CYGWINPORTS_patches() {
[[ -n ${CYGWINPORTS_GITREV} ]] || return 0
use elibc_Cygwin || return 0
+ local -a patches
local p d="${WORKDIR}/gcc-${CYGWINPORTS_GITREV}"
- for p in $(
- eval "$(sed -ne '/PATCH_URI="/,/"/p' < "${d}"/gcc.cygport)"
- echo ${PATCH_URI}
- ); do
+ readarray -t patches < <(sed -e '1,/PATCH_URI="/d;/"/,$d' < "${d}"/gcc.cygport)
+ for p in ${patches[*]}; do
epatch "${d}/${p}"
done
}
@@ -1864,13 +1872,13 @@ toolchain_src_install() {
cd "${S}"
if is_crosscompile; then
- rm -rf "${ED}"usr/share/{man,info}
+ rm -rf "${ED}"/usr/share/{man,info}
rm -rf "${D}"${DATAPATH}/{man,info}
else
if tc_version_is_at_least 3.0 ; then
local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
if [[ -d ${cxx_mandir} ]] ; then
- cp -r "${cxx_mandir}"/man? "${D}/${DATAPATH}"/man/
+ cp -r "${cxx_mandir}"/man? "${D}${DATAPATH}"/man/
fi
fi
has noinfo ${FEATURES} \
@@ -1921,7 +1929,7 @@ toolchain_src_install() {
# libvtv.la: gcc itself handles linkage correctly.
# lib*san.la: Sanitizer linkage is handled internally by gcc, and they
# do not support static linking. #487550 #546700
- find "${D}/${LIBPATH}" \
+ find "${D}${LIBPATH}" \
'(' \
-name libstdc++.la -o \
-name libstdc++fs.la -o \
@@ -1943,7 +1951,7 @@ toolchain_src_install() {
# Use gid of 0 because some stupid ports don't have
# the group 'root' set to gid 0. Send to /dev/null
# for people who are testing as non-root.
- chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${ED}"${LIBPATH} 2>/dev/null
+ chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${D}${LIBPATH}" 2>/dev/null
# Move pretty-printers to gdb datadir to shut ldconfig up
local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
@@ -1987,7 +1995,7 @@ gcc_movelibs() {
# code to run on the target.
if tc_version_is_at_least 5 && is_crosscompile ; then
dodir "${HOSTLIBPATH#${EPREFIX}}"
- mv "${ED}"usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die
+ mv "${ED}"/usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die
fi
# For all the libs that are built for CTARGET, move them into the
@@ -2184,7 +2192,7 @@ gcc_slot_java() {
toolchain_pkg_postinst() {
do_gcc_config
- if [[ ${ROOT} == / && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
+ if [[ ! ${ROOT%/} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
eselect compiler-shadow update all
fi
@@ -2199,17 +2207,17 @@ toolchain_pkg_postinst() {
echo
# Clean up old paths
- rm -f "${EROOT}"*/rcscripts/awk/fixlafiles.awk "${EROOT}"sbin/fix_libtool_files.sh
- rmdir "${EROOT}"*/rcscripts{/awk,} 2>/dev/null
+ rm -f "${EROOT%/}"/*/rcscripts/awk/fixlafiles.awk "${EROOT%/}"/sbin/fix_libtool_files.sh
+ rmdir "${EROOT%/}"/*/rcscripts{/awk,} 2>/dev/null
- mkdir -p "${EROOT}"usr/{share/gcc-data,sbin,bin}
+ mkdir -p "${EROOT%/}"/usr/{share/gcc-data,sbin,bin}
# DATAPATH has EPREFIX already, use ROOT with it
- cp "${ROOT}${DATAPATH}"/fixlafiles.awk "${EROOT}"usr/share/gcc-data/ || die
- cp "${ROOT}${DATAPATH}"/fix_libtool_files.sh "${EROOT}"usr/sbin/ || die
+ cp "${ROOT%/}${DATAPATH}"/fixlafiles.awk "${EROOT%/}"/usr/share/gcc-data/ || die
+ cp "${ROOT%/}${DATAPATH}"/fix_libtool_files.sh "${EROOT%/}"/usr/sbin/ || die
# Since these aren't critical files and portage sucks with
# handling of binpkgs, don't require these to be found
- cp "${ROOT}${DATAPATH}"/c{89,99} "${EROOT}"usr/bin/ 2>/dev/null
+ cp "${ROOT%/}${DATAPATH}"/c{89,99} "${EROOT%/}"/usr/bin/ 2>/dev/null
fi
if use regression-test ; then
@@ -2225,7 +2233,7 @@ toolchain_pkg_postinst() {
}
toolchain_pkg_postrm() {
- if [[ ${ROOT} == / && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
+ if [[ ! ${ROOT%/} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
eselect compiler-shadow clean all
fi
@@ -2236,16 +2244,16 @@ toolchain_pkg_postrm() {
# clean up the cruft left behind by cross-compilers
if is_crosscompile ; then
- if [[ -z $(ls "${EROOT}"etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
- rm -f "${EROOT}"etc/env.d/gcc/config-${CTARGET}
- rm -f "${EROOT}"etc/env.d/??gcc-${CTARGET}
- rm -f "${EROOT}"usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
+ if [[ -z $(ls "${EROOT%/}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
+ rm -f "${EROOT%/}"/etc/env.d/gcc/config-${CTARGET}
+ rm -f "${EROOT%/}"/etc/env.d/??gcc-${CTARGET}
+ rm -f "${EROOT%/}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
fi
return 0
fi
# ROOT isnt handled by the script
- [[ ${ROOT} != "/" ]] && return 0
+ [[ ${ROOT%/} ]] && return 0
if [[ ! -e ${LIBPATH}/libstdc++.so ]] ; then
# make sure the profile is sane during same-slot upgrade #289403
@@ -2278,7 +2286,7 @@ do_gcc_config() {
[[ -n ${current_specs} ]] && use_specs=-${current_specs}
if [[ -n ${use_specs} ]] && \
- [[ ! -e ${ROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
+ [[ ! -e ${EROOT%/}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
then
ewarn "The currently selected specs-specific gcc config,"
ewarn "${current_specs}, doesn't exist anymore. This is usually"
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2018-07-03 8:52 Michael Haubenwallner
0 siblings, 0 replies; 89+ messages in thread
From: Michael Haubenwallner @ 2018-07-03 8:52 UTC (permalink / raw
To: gentoo-commits
commit: 96b0650dfe6ec38d1c02541d20b0adaf492032d9
Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 3 08:49:01 2018 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Tue Jul 3 08:49:01 2018 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=96b0650d
python-utils-r1.eclass: switch to stacked-prefix feature
USE=prefix-chain now is FEATURES=stacked-prefix
Bug: https://bugs.gentoo.org/658572
eclass/python-utils-r1.eclass | 54 +++++++++++++++----------------------------
1 file changed, 18 insertions(+), 36 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index ed84c2680c..6a70453cbe 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -388,36 +388,24 @@ python_export() {
PYTHON)
export PYTHON=${EPREFIX}/usr/bin/${impl}
if [[ " python jython pypy pypy3 " != *" ${PN} "* ]] \
- && [[ ! -x ${PYTHON} ]] \
- && use prefix-chain; then
- # Need to search in parent prefixes
- local parent
- local parents=()
- IFS=: eval 'parents=(${PORTAGE_READONLY_EPREFIXES})'
- for parent in "${parents[@]}"; do
- if [[ -x ${parent}/usr/bin/${impl} ]]; then
- PYTHON=${parent}/usr/bin/${impl}
- break
- fi
- done
+ && [[ ! -x ${EPREFIX}/usr/bin/${impl} ]] \
+ && has stacked-prefix ${FEATURES}; then
+ # Need to look in build prefix
+ if [[ -x ${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}/usr/bin/${impl} ]]; then
+ PYTHON=${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}/usr/bin/${impl}
+ fi
fi
debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
;;
PYTHON_EPREFIX)
export PYTHON_EPREFIX=${EPREFIX}
if [[ " python jython pypy pypy3 " != *" ${PN} "* ]] \
- && [[ ! -x ${PYTHON_EPREFIX}/usr/bin/${impl} ]] \
- && use prefix-chain; then
- # Need to search in parent prefixes
- local parent
- local parents=()
- IFS=: eval 'parents=(${PORTAGE_READONLY_EPREFIXES})'
- for parent in "${parents[@]}"; do
- if [[ -x ${parent}/usr/bin/${impl} ]]; then
- PYTHON_EPREFIX=${parent}
- break
- fi
- done
+ && [[ ! -x ${EPREFIX}/usr/bin/${impl} ]] \
+ && 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}"
;;
@@ -531,18 +519,12 @@ python_export() {
local dir
export PYTHON_SCRIPTDIR=${EPREFIX}/usr/lib/python-exec/${impl}
if [[ " python jython pypy pypy3 " != *" ${PN} "* ]] \
- && [[ ! -d ${PYTHON_SCRIPTDIR} ]] \
- && use prefix-chain; then
- # Need to search in parent prefixes
- local parent
- local parents=()
- IFS=: eval 'parents=(${PORTAGE_READONLY_EPREFIXES})'
- for parent in "${parents[@]}"; do
- if [[ -e ${parent}/usr/lib/python-exec/${impl} ]]; then
- PYTHON_SCRIPTDIR=${parent}/usr/lib/python-exec/${impl}
- break
- fi
- done
+ && [[ ! -x ${EPREFIX}/usr/bin/${impl} ]] \
+ && has stacked-prefix ${FEATURES}; then
+ # Need to look in build prefix
+ if [[ -x ${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}/usr/bin/${impl} ]]; then
+ PYTHON_SCRIPTDIR=${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}/usr/lib/python-exec/${impl}
+ fi
fi
debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}"
;;
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2018-07-17 8:45 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2018-07-17 8:45 UTC (permalink / raw
To: gentoo-commits
commit: d0a61b2661153267fb43637a745f1ba0a104cb60
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 17 08:45:27 2018 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Jul 17 08:45:27 2018 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=d0a61b26
eclass/python-utils-r1: sync for PYTHON_TARGETS=python3_7
eclass/python-utils-r1.eclass | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 6a70453cbe..ebcced39bf 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -43,7 +43,7 @@ _PYTHON_ALL_IMPLS=(
jython2_7
pypy pypy3
python2_7
- python3_4 python3_5 python3_6
+ python3_4 python3_5 python3_6 python3_7
)
readonly _PYTHON_ALL_IMPLS
@@ -79,7 +79,7 @@ _python_impl_supported() {
# keep in sync with _PYTHON_ALL_IMPLS!
# (not using that list because inline patterns shall be faster)
case "${impl}" in
- python2_7|python3_[456]|jython2_7)
+ python2_7|python3_[4567]|jython2_7)
return 0
;;
pypy1_[89]|pypy2_0|python2_[56]|python3_[123])
@@ -817,6 +817,7 @@ python_newexe() {
(
dodir "${wrapd}"
+ exeopts -m 0755
exeinto "${d}"
newexe "${f}" "${newfn}" || return ${?}
)
@@ -948,6 +949,7 @@ python_domodule() {
fi
(
+ insopts -m 0644
insinto "${d}"
doins -r "${@}" || return ${?}
)
@@ -982,6 +984,7 @@ python_doheader() {
d=${PYTHON_INCLUDEDIR#${PYTHON_EPREFIX:-${EPREFIX}}}
(
+ insopts -m 0644
insinto "${d}"
doins -r "${@}" || return ${?}
)
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2018-12-17 9:55 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2018-12-17 9:55 UTC (permalink / raw
To: gentoo-commits
commit: d6ffd48fbde60f371dd8b763b9ab9a4beecf282a
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 17 09:55:25 2018 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Dec 17 09:55:25 2018 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=d6ffd48f
eclass: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/autotools.eclass | 11 +-
eclass/flag-o-matic.eclass | 8 +-
eclass/gnuconfig.eclass | 99 ---------
eclass/java-utils-2.eclass | 23 +-
eclass/python-utils-r1.eclass | 1 +
eclass/toolchain-binutils.eclass | 19 +-
eclass/toolchain-funcs.eclass | 145 ++++++++----
eclass/user.eclass | 469 ---------------------------------------
8 files changed, 127 insertions(+), 648 deletions(-)
diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index f30ac7414f..5a59c8d2d5 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -4,6 +4,7 @@
# @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
@@ -118,7 +124,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
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 3f9fd205c4..cdd63219de 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -34,6 +34,9 @@ setup-allowed-flags() {
# CPPFLAGS and LDFLAGS
'-[DUILR]*' '-Wl,*'
+
+ # Linker choice flag
+ '-fuse-ld'
)
# allow a bunch of flags that negate features / control ABI
@@ -595,11 +598,6 @@ get-flag() {
return 1
}
-# @FUNCTION: has_m64
-# @DESCRIPTION:
-# This doesn't test if the flag is accepted, it tests if the flag actually
-# WORKS. Non-multilib gcc will take both -m32 and -m64. If the flag works
-# return code is 0, else the return code is 1.
has_m64() {
die "${FUNCNAME}: don't use this anymore"
}
diff --git a/eclass/gnuconfig.eclass b/eclass/gnuconfig.eclass
deleted file mode 100644
index 3c8d98d6a9..0000000000
--- a/eclass/gnuconfig.eclass
+++ /dev/null
@@ -1,99 +0,0 @@
-# Copyright 1999-2012 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-#
-# THIS ECLASS IS DEAD: It has been integrated into portage
-#
-# Author: Will Woods <wwoods@gentoo.org>
-#
-# This eclass is used to automatically update files that typically come with
-# automake to the newest version available on the system. The most common use
-# of this is to update config.guess and config.sub when configure dies from
-# misguessing your canonical system name (CHOST). It can also be used to update
-# other files that come with automake, e.g. depcomp, mkinstalldirs, etc.
-#
-# usage: gnuconfig_update [file1 file2 ...]
-# if called without arguments, config.guess and config.sub will be updated.
-# All files in the source tree ($S) with the given name(s) will be replaced
-# with the newest available versions chosen from the list of locations in
-# gnuconfig_findnewest(), below.
-#
-# gnuconfig_update should generally be called from src_unpack()
-
-
-DEPEND="sys-devel/gnuconfig"
-
-# Wrapper function for gnuconfig_do_update. If no arguments are given, update
-# config.sub and config.guess (old default behavior), otherwise update the
-# named files.
-gnuconfig_update() {
-
-# hmm some packages (like binutils gcc glibc) still use this ...
-# echo
-# ewarn "QA Notice: Please stop using me, portage updates files for you."
-# echo
-
- local startdir # declared here ... used in gnuconfig_do_update
-
- if [[ $1 == /* ]] ; then
- startdir=$1
- shift
- else
- startdir=${S}
- fi
-
- if [[ $# -gt 0 ]] ; then
- gnuconfig_do_update "$@"
- else
- gnuconfig_do_update config.sub config.guess
- fi
-
- return $?
-}
-
-# Copy the newest available version of specified files over any old ones in the
-# source dir. This function shouldn't be called directly - use gnuconfig_update
-#
-# Note that since bash using dynamic scoping, startdir is available here from
-# the gnuconfig_update function
-gnuconfig_do_update() {
- local configsubs_dir target targetlist file
-
- [[ $# -eq 0 ]] && die "do not call gnuconfig_do_update; use gnuconfig_update"
-
- configsubs_dir=$(gnuconfig_findnewest)
- einfo "Using GNU config files from ${configsubs_dir}"
- for file in "$@" ; do
- if [[ ! -r ${configsubs_dir}/${file} ]] ; then
- eerror "Can't read ${configsubs_dir}/${file}, skipping.."
- continue
- fi
- targetlist=$(find "${startdir}" -name "${file}")
- if [[ -n ${targetlist} ]] ; then
- for target in ${targetlist} ; do
- [[ -L ${target} ]] && rm -f "${target}"
- einfo " Updating ${target/$startdir\//}"
- cp -f "${configsubs_dir}/${file}" "${target}"
- eend $?
- done
- else
- ewarn " No ${file} found in ${startdir}, skipping ..."
- fi
- done
-
- return 0
-}
-
-# this searches the standard locations for the newest config.{sub|guess}, and
-# returns the directory where they can be found.
-gnuconfig_findnewest() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
- local locations=(
- "${EPREFIX}"/usr/share/misc/config.sub
- "${EPREFIX}"/usr/share/gnuconfig/config.sub
- "${EPREFIX}"/usr/share/automake*/config.sub
- "${EPREFIX}"/usr/share/libtool/config.sub
- )
- grep -s '^timestamp' "${locations[@]}" | \
- sort -r -n -t\' -k2 | \
- sed -n '1{s,/config.sub:.*$,,;p;q}'
-}
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 31ba721003..da96e04c14 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 2004-2017 Gentoo Foundation
+# Copyright 2004-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-utils-2.eclass
@@ -23,16 +23,7 @@ IUSE="elibc_FreeBSD"
export WANT_JAVA_CONFIG="2"
# Prefix variables are only available for EAPI>=3
-# PREFIX: we always need EPREFIX, as there's still old ebuilds
-#has "${EAPI:-0}" 0 1 2 && ED="${D}" EPREFIX= EROOT="${ROOT}"
-
-# @VARIABLE: JAVA_PKG_PORTAGE_DEP
-# @INTERNAL
-# @DESCRIPTION:
-# The version of portage we need to function properly. Previously it was
-# portage with phase hooks support but now we use a version with proper env
-# saving. For EAPI 2 we have new enough stuff so let's have cleaner deps.
-has "${EAPI}" 0 1 && JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1.2.7"
+has "${EAPI:-0}" 0 1 2 && ED="${D}" EPREFIX= EROOT="${ROOT}"
# @VARIABLE: JAVA_PKG_E_DEPEND
# @INTERNAL
@@ -40,7 +31,7 @@ has "${EAPI}" 0 1 && JAVA_PKG_PORTAGE_DEP=">=sys-apps/portage-2.1.2.7"
# This is a convience variable to be used from the other java eclasses. This is
# the version of java-config we want to use. Usually the latest stable version
# so that ebuilds can use new features without depending on specific versions.
-JAVA_PKG_E_DEPEND="!x86-winnt? ( >=dev-java/java-config-2.2.0-r3 ${JAVA_PKG_PORTAGE_DEP} )"
+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
@@ -1481,7 +1472,7 @@ java-pkg_ensure-vm-version-sufficient() {
if ! java-pkg_is-vm-version-sufficient; then
debug-print "VM is not suffient"
eerror "Current Java VM cannot build this package"
- einfo "Please use java-config -S to set the correct one"
+ einfo "Please use \"eselect java-vm set system\" to set the correct one"
die "Active Java VM cannot build this package"
fi
}
@@ -1509,7 +1500,7 @@ java-pkg_ensure-vm-version-eq() {
if ! java-pkg_is-vm-version-eq $@ ; then
debug-print "VM is not suffient"
eerror "This package requires a Java VM version = $@"
- einfo "Please use java-config -S to set the correct one"
+ einfo "Please use \"eselect java-vm set system\" to set the correct one"
die "Active Java VM too old"
fi
}
@@ -1556,7 +1547,7 @@ java-pkg_ensure-vm-version-ge() {
if ! java-pkg_is-vm-version-ge "$@" ; then
debug-print "vm is not suffient"
eerror "This package requires a Java VM version >= $@"
- einfo "Please use java-config -S to set the correct one"
+ einfo "Please use \"eselect java-vm set system\" to set the correct one"
die "Active Java VM too old"
fi
}
@@ -2916,7 +2907,7 @@ java-pkg_gen-cp() {
local atom
for atom in ${CP_DEPEND}; do
- if [[ ${atom} =~ /(([[:alnum:]+_-]+)-[0-9]+(\.[0-9]+)*[a-z]?(_[[:alnum:]]+)?(-r[0-9]*)?|[[:alnum:]+_-]+):([[:alnum:]+_.-]+) ]]; then
+ if [[ ${atom} =~ /(([[:alnum:]+_-]+)-[0-9]+(\.[0-9]+)*[a-z]?(_[[:alnum:]]+)*(-r[0-9]*)?|[[:alnum:]+_-]+):([[:alnum:]+_.-]+) ]]; then
atom=${BASH_REMATCH[2]:-${BASH_REMATCH[1]}}
[[ ${BASH_REMATCH[6]} != 0 ]] && atom+=-${BASH_REMATCH[6]}
local regex="(^|\s|,)${atom}($|\s|,)"
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index ebcced39bf..d72329b30a 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -7,6 +7,7 @@
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
# Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
+# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
# @BLURB: Utility functions for packages with Python parts.
# @DESCRIPTION:
# A utility eclass providing functions to query Python implementations,
diff --git a/eclass/toolchain-binutils.eclass b/eclass/toolchain-binutils.eclass
index 095e5d196a..6e3a60f357 100644
--- a/eclass/toolchain-binutils.eclass
+++ b/eclass/toolchain-binutils.eclass
@@ -2,6 +2,7 @@
# Distributed under the terms of the GNU General Public License v2
#
# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
+# @SUPPORTED_EAPIS: 0 1 2 3 4 5
#
# We install binutils into CTARGET-VERSION specific directories. This lets
# us easily merge multiple versions for multiple targets (if we wish) and
@@ -15,7 +16,6 @@ if [[ -n ${BINUTILS_TYPE} ]] ; then
BTYPE=${BINUTILS_TYPE}
else
case ${PV} in
- 9999) BTYPE="git";;
9999_pre*) BTYPE="snap";;
*.*.90) BTYPE="snap";;
*.*.*.*.*) BTYPE="hjlu";;
@@ -24,11 +24,6 @@ else
fi
case ${BTYPE} in
-git)
- BVER="git"
- EGIT_REPO_URI="git://sourceware.org/git/binutils-gdb.git"
- inherit git-2
- ;;
snap)
BVER=${PV/9999_pre}
;;
@@ -58,7 +53,6 @@ DESCRIPTION="Tools necessary to build programs"
HOMEPAGE="https://sourceware.org/binutils/"
case ${BTYPE} in
- git) SRC_URI="" ;;
snap)
SRC_URI="ftp://gcc.gnu.org/pub/binutils/snapshots/binutils-${BVER}.tar.bz2
ftp://sourceware.org/pub/binutils/snapshots/binutils-${BVER}.tar.bz2" ;;
@@ -112,11 +106,7 @@ if is_cross ; then
DEPEND+=" >=sys-libs/binutils-libs-${PV}"
fi
-S=${WORKDIR}/binutils
-case ${BVER} in
-git) ;;
-*) S=${S}-${BVER} ;;
-esac
+S=${WORKDIR}/binutils-${BVER}
LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${BVER}
INCPATH=${LIBPATH}/include
@@ -129,10 +119,7 @@ else
fi
tc-binutils_unpack() {
- case ${BTYPE} in
- git) git-2_src_unpack ;;
- *) unpacker ${A} ;;
- esac
+ unpacker ${A}
mkdir -p "${MY_BUILDDIR}"
[[ -d ${WORKDIR}/patch ]] && mkdir "${WORKDIR}"/patch/skip
}
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 14d7aea8b4..7b82db8e40 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -167,6 +167,17 @@ tc-getBUILD_OBJCOPY() { tc-getBUILD_PROG OBJCOPY objcopy "$@"; }
# @RETURN: name of the pkg-config tool for building binaries to run on the build machine
tc-getBUILD_PKG_CONFIG() { tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"; }
+# @FUNCTION: tc-getTARGET_CPP
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the C preprocessor for the toolchain being built (or used)
+tc-getTARGET_CPP() {
+ if [[ -n ${CTARGET} ]]; then
+ _tc-getPROG CTARGET TARGET_CPP "gcc -E" "$@"
+ else
+ tc-getCPP "$@"
+ fi
+}
+
# @FUNCTION: tc-export
# @USAGE: <list of toolchain variables>
# @DESCRIPTION:
@@ -185,6 +196,93 @@ tc-is-cross-compiler() {
[[ ${CBUILD:-${CHOST}} != ${CHOST} ]]
}
+# @FUNCTION: tc-cpp-is-true
+# @USAGE: <condition> [cpp flags]
+# @RETURN: Shell true if the condition is true, shell false otherwise.
+# @DESCRIPTION:
+# Evaluate the given condition using the C preprocessor for CTARGET, if
+# defined, or CHOST. Additional arguments are passed through to the cpp
+# command. A typical condition would be in the form defined(__FOO__).
+tc-cpp-is-true() {
+ local CONDITION=${1}
+ shift
+
+ local RESULT=$($(tc-getTARGET_CPP) "${@}" -P - <<-EOF 2>/dev/null
+ #if ${CONDITION}
+ true
+ #endif
+ EOF
+ )
+
+ [[ ${RESULT} == true ]]
+}
+
+# @FUNCTION: tc-detect-is-softfloat
+# @RETURN:
+# Shell true if (positive or negative) detection was possible, shell
+# false otherwise. Also outputs a string when detection succeeds, see
+# tc-is-softfloat for the possible values.
+# @DESCRIPTION:
+# Detect whether the CTARGET (or CHOST) toolchain is a softfloat based
+# one by examining the toolchain's output, if possible.
+tc-detect-is-softfloat() {
+ # If fetching CPP falls back to the default (gcc -E) then fail
+ # detection as this may not be the correct toolchain.
+ [[ $(tc-getTARGET_CPP) == "gcc -E" ]] && return 1
+
+ case ${CTARGET:-${CHOST}} in
+ # Avoid autodetection for bare-metal targets. bug #666896
+ *-newlib|*-elf|*-eabi)
+ return 1 ;;
+
+ # arm-unknown-linux-gnueabi is ambiguous. We used to treat it as
+ # hardfloat but we now treat it as softfloat like most everyone
+ # else. Check existing toolchains to respect existing systems.
+ arm*)
+ if tc-cpp-is-true "defined(__ARM_PCS_VFP)"; then
+ echo "no"
+ else
+ # Confusingly __SOFTFP__ is defined only when
+ # -mfloat-abi is soft, not softfp.
+ if tc-cpp-is-true "defined(__SOFTFP__)"; then
+ echo "yes"
+ else
+ echo "softfp"
+ fi
+ fi
+
+ return 0 ;;
+ *)
+ return 1 ;;
+ esac
+}
+
+# @FUNCTION: tc-tuple-is-softfloat
+# @RETURN: See tc-is-softfloat for the possible values.
+# @DESCRIPTION:
+# Determine whether the CTARGET (or CHOST) toolchain is a softfloat
+# based one solely from the tuple.
+tc-tuple-is-softfloat() {
+ local CTARGET=${CTARGET:-${CHOST}}
+ case ${CTARGET//_/-} in
+ bfin*|h8300*)
+ echo "only" ;;
+ *-softfloat-*)
+ echo "yes" ;;
+ *-softfp-*)
+ echo "softfp" ;;
+ arm*-hardfloat-*|arm*eabihf)
+ echo "no" ;;
+ # bare-metal targets have their defaults. bug #666896
+ *-newlib|*-elf|*-eabi)
+ echo "no" ;;
+ arm*)
+ echo "yes" ;;
+ *)
+ echo "no" ;;
+ esac
+}
+
# @FUNCTION: tc-is-softfloat
# @DESCRIPTION:
# See if this toolchain is a softfloat based one.
@@ -199,20 +297,7 @@ tc-is-cross-compiler() {
# softfloat flags in the case where support is optional, but
# rejects softfloat flags where the target always lacks an fpu.
tc-is-softfloat() {
- local CTARGET=${CTARGET:-${CHOST}}
- case ${CTARGET} in
- bfin*|h8300*)
- echo "only" ;;
- *)
- if [[ ${CTARGET//_/-} == *-softfloat-* ]] ; then
- echo "yes"
- elif [[ ${CTARGET//_/-} == *-softfp-* ]] ; then
- echo "softfp"
- else
- echo "no"
- fi
- ;;
- esac
+ tc-detect-is-softfloat || tc-tuple-is-softfloat
}
# @FUNCTION: tc-is-static-only
@@ -856,13 +941,7 @@ gcc-specs-stack-check() {
# Return truth if the current compiler generates position-independent code (PIC)
# which can be linked into executables.
tc-enables-pie() {
- local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
- #if defined(__PIE__)
- true
- #endif
- EOF
- )"
- [[ ${ret} == true ]]
+ tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS}
}
# @FUNCTION: tc-enables-ssp
@@ -874,13 +953,7 @@ tc-enables-pie() {
# -fstack-protector-strong
# -fstack-protector-all
tc-enables-ssp() {
- local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
- #if defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)
- true
- #endif
- EOF
- )"
- [[ ${ret} == true ]]
+ tc-cpp-is-true "defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
}
# @FUNCTION: tc-enables-ssp-strong
@@ -891,13 +964,7 @@ tc-enables-ssp() {
# -fstack-protector-strong
# -fstack-protector-all
tc-enables-ssp-strong() {
- local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
- #if defined(__SSP_STRONG__) || defined(__SSP_ALL__)
- true
- #endif
- EOF
- )"
- [[ ${ret} == true ]]
+ tc-cpp-is-true "defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
}
# @FUNCTION: tc-enables-ssp-all
@@ -907,13 +974,7 @@ tc-enables-ssp-strong() {
# on level corresponding to any of the following options:
# -fstack-protector-all
tc-enables-ssp-all() {
- local ret="$($(tc-getCC) ${CPPFLAGS} ${CFLAGS} -E -P - <<-EOF 2> /dev/null | grep '^true$'
- #if defined(__SSP_ALL__)
- true
- #endif
- EOF
- )"
- [[ ${ret} == true ]]
+ tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
}
diff --git a/eclass/user.eclass b/eclass/user.eclass
deleted file mode 100644
index 83f13f25f4..0000000000
--- a/eclass/user.eclass
+++ /dev/null
@@ -1,469 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: user.eclass
-# @MAINTAINER:
-# base-system@gentoo.org (Linux)
-# @BLURB: user management in ebuilds
-# @DESCRIPTION:
-# The user eclass contains a suite of functions that allow ebuilds
-# to quickly make sure users in the installed system are sane.
-
-if [[ -z ${_USER_ECLASS} ]]; then
-_USER_ECLASS=1
-
-# @FUNCTION: _assert_pkg_ebuild_phase
-# @INTERNAL
-# @USAGE: <calling func name>
-_assert_pkg_ebuild_phase() {
- case ${EBUILD_PHASE} in
- setup|preinst|postinst) ;;
- *)
- eerror "'$1()' called from '${EBUILD_PHASE}' phase which is not OK:"
- eerror "You may only call from pkg_{setup,preinst,postinst} functions."
- eerror "Package fails at QA and at life. Please file a bug."
- die "Bad package! $1 is only for use in some pkg_* functions!"
- esac
-}
-
-# @FUNCTION: egetent
-# @USAGE: <database> <key>
-# @DESCRIPTION:
-# Small wrapper for getent (Linux), nidump (< Mac OS X 10.5),
-# dscl (Mac OS X 10.5), and pw (FreeBSD) used in enewuser()/enewgroup().
-#
-# Supported databases: group passwd
-egetent() {
- local db=$1 key=$2
-
- [[ $# -ge 3 ]] && die "usage: egetent <database> <key>"
-
- case ${db} in
- passwd|group) ;;
- *) die "sorry, database '${db}' not yet supported; file a bug" ;;
- esac
-
- case ${CHOST} in
- *-darwin[678])
- case ${key} in
- *[!0-9]*) # Non numeric
- nidump ${db} . | awk -F: "(\$1 ~ /^${key}\$/) {print;exit;}"
- ;;
- *) # Numeric
- nidump ${db} . | awk -F: "(\$3 == ${key}) {print;exit;}"
- ;;
- esac
- ;;
- *-darwin*)
- local mykey
- case ${db} in
- passwd) db="Users" mykey="UniqueID" ;;
- group) db="Groups" mykey="PrimaryGroupID" ;;
- esac
-
- case ${key} in
- *[!0-9]*) # Non numeric
- dscl . -read /${db}/${key} 2>/dev/null |grep RecordName
- ;;
- *) # Numeric
- dscl . -search /${db} ${mykey} ${key} 2>/dev/null
- ;;
- esac
- ;;
- *-freebsd*|*-dragonfly*)
- case ${db} in
- passwd) db="user" ;;
- *) ;;
- esac
-
- # lookup by uid/gid
- local opts
- if [[ ${key} == [[:digit:]]* ]] ; then
- [[ ${db} == "user" ]] && opts="-u" || opts="-g"
- fi
-
- pw show ${db} ${opts} "${key}" -q
- ;;
- *-netbsd*|*-openbsd*)
- grep "${key}:\*:" /etc/${db}
- ;;
- *)
- # ignore output if nscd doesn't exist, or we're not running as root
- nscd -i "${db}" 2>/dev/null
- getent "${db}" "${key}"
- ;;
- esac
-}
-
-# @FUNCTION: enewuser
-# @USAGE: <user> [uid] [shell] [homedir] [groups]
-# @DESCRIPTION:
-# Same as enewgroup, you are not required to understand how to properly add
-# a user to the system. The only required parameter is the username.
-# Default uid is (pass -1 for this) next available, default shell is
-# /bin/false, default homedir is /dev/null, and there are no default groups.
-enewuser() {
- if [[ ${EUID} != 0 ]] ; then
- einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
- return 0
- fi
- _assert_pkg_ebuild_phase ${FUNCNAME}
-
- # get the username
- local euser=$1; shift
- if [[ -z ${euser} ]] ; then
- eerror "No username specified !"
- die "Cannot call enewuser without a username"
- fi
-
- # lets see if the username already exists
- if [[ -n $(egetent passwd "${euser}") ]] ; then
- return 0
- fi
- einfo "Adding user '${euser}' to your system ..."
-
- # options to pass to useradd
- local opts=()
-
- # handle uid
- local euid=$1; shift
- if [[ -n ${euid} && ${euid} != -1 ]] ; then
- if [[ ${euid} -gt 0 ]] ; then
- if [[ -n $(egetent passwd ${euid}) ]] ; then
- euid="next"
- fi
- else
- eerror "Userid given but is not greater than 0 !"
- die "${euid} is not a valid UID"
- fi
- else
- euid="next"
- fi
- if [[ ${euid} == "next" ]] ; then
- for ((euid = 101; euid <= 999; euid++)); do
- [[ -z $(egetent passwd ${euid}) ]] && break
- done
- fi
- opts+=( -u ${euid} )
- einfo " - Userid: ${euid}"
-
- # handle shell
- local eshell=$1; shift
- if [[ ! -z ${eshell} ]] && [[ ${eshell} != "-1" ]] ; then
- if [[ ! -e ${EROOT}${eshell} ]] ; then
- eerror "A shell was specified but it does not exist !"
- die "${eshell} does not exist in ${EROOT}"
- fi
- if [[ ${eshell} == */false || ${eshell} == */nologin ]] ; then
- eerror "Do not specify ${eshell} yourself, use -1"
- die "Pass '-1' as the shell parameter"
- fi
- else
- for eshell in /sbin/nologin /usr/sbin/nologin /bin/false /usr/bin/false /dev/null ; do
- [[ -x ${ROOT}${eshell} ]] && break
- done
-
- if [[ ${eshell} == "/dev/null" ]] ; then
- eerror "Unable to identify the shell to use, proceeding with userland default."
- case ${USERLAND} in
- GNU) eshell="/bin/false" ;;
- BSD) eshell="/sbin/nologin" ;;
- Darwin) eshell="/usr/sbin/nologin" ;;
- *) die "Unable to identify the default shell for userland ${USERLAND}"
- esac
- fi
- fi
- einfo " - Shell: ${eshell}"
- opts+=( -s "${eshell}" )
-
- # handle homedir
- local ehome=$1; shift
- if [[ -z ${ehome} ]] || [[ ${ehome} == "-1" ]] ; then
- ehome="/dev/null"
- fi
- einfo " - Home: ${ehome}"
- opts+=( -d "${ehome}" )
-
- # handle groups
- local egroups=$1; shift
- local g egroups_arr
- IFS="," read -r -a egroups_arr <<<"${egroups}"
- if [[ ${#egroups_arr[@]} -gt 0 ]] ; then
- local defgroup exgroups
- for g in "${egroups_arr[@]}" ; do
- if [[ -z $(egetent group "${g}") ]] ; then
- eerror "You must add group ${g} to the system first"
- die "${g} is not a valid GID"
- fi
- if [[ -z ${defgroup} ]] ; then
- defgroup=${g}
- else
- exgroups+=",${g}"
- fi
- done
- opts+=( -g "${defgroup}" )
- if [[ ! -z ${exgroups} ]] ; then
- opts+=( -G "${exgroups:1}" )
- fi
- fi
- einfo " - Groups: ${egroups:-(none)}"
-
- # handle extra args
- if [[ $# -gt 0 ]] ; then
- die "extra arguments no longer supported; please file a bug"
- else
- local comment="added by portage for ${PN}"
- opts+=( -c "${comment}" )
- einfo " - GECOS: ${comment}"
- fi
-
- # add the user
- case ${CHOST} in
- *-darwin*)
- ### Make the user
- dscl . create "/users/${euser}" uid ${euid}
- dscl . create "/users/${euser}" shell "${eshell}"
- dscl . create "/users/${euser}" home "${ehome}"
- dscl . create "/users/${euser}" realname "added by portage for ${PN}"
- ### Add the user to the groups specified
- for g in "${egroups_arr[@]}" ; do
- dscl . merge "/groups/${g}" users "${euser}"
- done
- ;;
-
- *-freebsd*|*-dragonfly*)
- pw useradd "${euser}" "${opts[@]}" || die
- ;;
-
- *-netbsd*)
- useradd "${opts[@]}" "${euser}" || die
- ;;
-
- *-openbsd*)
- # all ops the same, except the -g vs -g/-G ...
- useradd -u ${euid} -s "${eshell}" \
- -d "${ehome}" -g "${egroups}" "${euser}" || die
- ;;
-
- *)
- useradd -r "${opts[@]}" "${euser}" || die
- ;;
- esac
-
- if [[ ! -e ${EROOT}/${ehome} ]] ; then
- einfo " - Creating ${ehome} in ${EROOT}"
- mkdir -p "${EROOT}/${ehome}"
- chown "${euser}" "${EROOT}/${ehome}"
- chmod 755 "${EROOT}/${ehome}"
- fi
-}
-
-# @FUNCTION: enewgroup
-# @USAGE: <group> [gid]
-# @DESCRIPTION:
-# This function does not require you to understand how to properly add a
-# group to the system. Just give it a group name to add and enewgroup will
-# do the rest. You may specify the gid for the group or allow the group to
-# allocate the next available one.
-enewgroup() {
- if [[ ${EUID} != 0 ]] ; then
- einfo "Insufficient privileges to execute ${FUNCNAME[0]}"
- return 0
- fi
- _assert_pkg_ebuild_phase ${FUNCNAME}
-
- # get the group
- local egroup=$1; shift
- if [[ -z ${egroup} ]] ; then
- eerror "No group specified !"
- die "Cannot call enewgroup without a group"
- fi
-
- # see if group already exists
- if [[ -n $(egetent group "${egroup}") ]] ; then
- return 0
- fi
- einfo "Adding group '${egroup}' to your system ..."
-
- # handle gid
- local egid=$1; shift
- if [[ ! -z ${egid} ]] ; then
- if [[ ${egid} -gt 0 ]] ; then
- if [[ -n $(egetent group ${egid}) ]] ; then
- egid="next available; requested gid taken"
- fi
- else
- eerror "Groupid given but is not greater than 0 !"
- die "${egid} is not a valid GID"
- fi
- else
- egid="next available"
- fi
- einfo " - Groupid: ${egid}"
-
- # handle extra
- if [[ $# -gt 0 ]] ; then
- die "extra arguments no longer supported; please file a bug"
- fi
-
- # Some targets need to find the next available GID manually
- _enewgroup_next_gid() {
- if [[ ${egid} == *[!0-9]* ]] ; then
- # Non numeric
- for ((egid = 101; egid <= 999; egid++)) ; do
- [[ -z $(egetent group ${egid}) ]] && break
- done
- fi
- }
-
- # add the group
- case ${CHOST} in
- *-darwin*)
- _enewgroup_next_gid
- dscl . create "/groups/${egroup}" gid ${egid}
- dscl . create "/groups/${egroup}" passwd '*'
- ;;
-
- *-freebsd*|*-dragonfly*)
- _enewgroup_next_gid
- pw groupadd "${egroup}" -g ${egid} || die
- ;;
-
- *-netbsd*)
- _enewgroup_next_gid
- groupadd -g ${egid} "${egroup}" || die
- ;;
-
- *)
- local opts
- if [[ ${egid} == *[!0-9]* ]] ; then
- # Non numeric; let groupadd figure out a GID for us
- opts=""
- else
- opts="-g ${egid}"
- fi
- # We specify -r so that we get a GID in the system range from login.defs
- groupadd -r ${opts} "${egroup}" || die
- ;;
- esac
-}
-
-# @FUNCTION: egethome
-# @USAGE: <user>
-# @DESCRIPTION:
-# Gets the home directory for the specified user.
-egethome() {
- local pos
-
- [[ $# -eq 1 ]] || die "usage: egethome <user>"
-
- case ${CHOST} in
- *-darwin*|*-freebsd*|*-dragonfly*)
- pos=9
- ;;
- *) # Linux, NetBSD, OpenBSD, etc...
- pos=6
- ;;
- esac
-
- egetent passwd "$1" | cut -d: -f${pos}
-}
-
-# @FUNCTION: egetshell
-# @USAGE: <user>
-# @DESCRIPTION:
-# Gets the shell for the specified user.
-egetshell() {
- local pos
-
- [[ $# -eq 1 ]] || die "usage: egetshell <user>"
-
- case ${CHOST} in
- *-darwin*|*-freebsd*|*-dragonfly*)
- pos=10
- ;;
- *) # Linux, NetBSD, OpenBSD, etc...
- pos=7
- ;;
- esac
-
- egetent passwd "$1" | cut -d: -f${pos}
-}
-
-# @FUNCTION: esethome
-# @USAGE: <user> <homedir>
-# @DESCRIPTION:
-# Update the home directory in a platform-agnostic way.
-# Required parameters is the username and the new home directory.
-# Specify -1 if you want to set home to the enewuser default
-# of /dev/null.
-# If the new home directory does not exist, it is created.
-# Any previously existing home directory is NOT moved.
-esethome() {
- _assert_pkg_ebuild_phase ${FUNCNAME}
-
- # get the username
- local euser=$1; shift
- if [[ -z ${euser} ]] ; then
- eerror "No username specified !"
- die "Cannot call esethome without a username"
- fi
-
- # lets see if the username already exists
- if [[ -z $(egetent passwd "${euser}") ]] ; then
- ewarn "User does not exist, cannot set home dir -- skipping."
- return 1
- fi
-
- # handle homedir
- local ehome=$1; shift
- if [[ -z ${ehome} ]] ; then
- eerror "No home directory specified !"
- die "Cannot call esethome without a home directory or '-1'"
- fi
-
- if [[ ${ehome} == "-1" ]] ; then
- ehome="/dev/null"
- fi
-
- # exit with no message if home dir is up to date
- if [[ $(egethome "${euser}") == ${ehome} ]]; then
- return 0
- fi
-
- einfo "Updating home for user '${euser}' ..."
- einfo " - Home: ${ehome}"
-
- # ensure home directory exists, otherwise update will fail
- if [[ ! -e ${EROOT}/${ehome} ]] ; then
- einfo " - Creating ${ehome} in ${EROOT}"
- mkdir -p "${EROOT}/${ehome}"
- chown "${euser}" "${EROOT}/${ehome}"
- chmod 755 "${EROOT}/${ehome}"
- fi
-
- # update the home directory
- case ${CHOST} in
- *-darwin*)
- dscl . change "/users/${euser}" home "${ehome}"
- ;;
-
- *-freebsd*|*-dragonfly*)
- pw usermod "${euser}" -d "${ehome}" && return 0
- [[ $? == 8 ]] && eerror "${euser} is in use, cannot update home"
- eerror "There was an error when attempting to update the home directory for ${euser}"
- eerror "Please update it manually on your system:"
- eerror "\t pw usermod \"${euser}\" -d \"${ehome}\""
- ;;
-
- *)
- usermod -d "${ehome}" "${euser}" && return 0
- [[ $? == 8 ]] && eerror "${euser} is in use, cannot update home"
- eerror "There was an error when attempting to update the home directory for ${euser}"
- eerror "Please update it manually on your system (as root):"
- eerror "\t usermod -d \"${ehome}\" \"${euser}\""
- ;;
- esac
-}
-
-fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2019-03-25 14:20 Michael Haubenwallner
0 siblings, 0 replies; 89+ messages in thread
From: Michael Haubenwallner @ 2019-03-25 14:20 UTC (permalink / raw
To: gentoo-commits
commit: 954efef84a53cdbd10393fd71a37bd9cc3286ac9
Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 25 11:36:26 2019 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 25 12:01:32 2019 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=954efef8
python-utils-r1.eclass: support USE=prefix-stack
Need to support FEATURES=stacked-prefix for some transition period.
Better not test with 'use prefix-stack' but 'has prefix-stack ${USE}',
for when the user's profile does not set IUSE_IMPLICIT=prefix-stack yet.
Bug: https://bugs.gentoo.org/658572
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>
eclass/python-utils-r1.eclass | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index d72329b30a..6e9cab5360 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -390,7 +390,7 @@ python_export() {
export PYTHON=${EPREFIX}/usr/bin/${impl}
if [[ " python jython pypy pypy3 " != *" ${PN} "* ]] \
&& [[ ! -x ${EPREFIX}/usr/bin/${impl} ]] \
- && has stacked-prefix ${FEATURES}; then
+ && { 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=${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}/usr/bin/${impl}
@@ -402,7 +402,7 @@ python_export() {
export PYTHON_EPREFIX=${EPREFIX}
if [[ " python jython pypy pypy3 " != *" ${PN} "* ]] \
&& [[ ! -x ${EPREFIX}/usr/bin/${impl} ]] \
- && has stacked-prefix ${FEATURES}; then
+ && { 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}}
@@ -521,7 +521,7 @@ python_export() {
export PYTHON_SCRIPTDIR=${EPREFIX}/usr/lib/python-exec/${impl}
if [[ " python jython pypy pypy3 " != *" ${PN} "* ]] \
&& [[ ! -x ${EPREFIX}/usr/bin/${impl} ]] \
- && has stacked-prefix ${FEATURES}; then
+ && { 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_SCRIPTDIR=${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}/usr/lib/python-exec/${impl}
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2019-05-30 8:25 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2019-05-30 8:25 UTC (permalink / raw
To: gentoo-commits
commit: f5b4e670e0d7a5686f67b5bcfe4c323d6f4fe050
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu May 30 08:24:51 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu May 30 08:24:51 2019 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f5b4e670
eclass: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/flag-o-matic.eclass | 7 ++
eclass/java-utils-2.eclass | 17 ++--
eclass/python-utils-r1.eclass | 6 +-
eclass/toolchain-funcs.eclass | 11 +--
eclass/toolchain.eclass | 211 +++++++++++++++++++++++++++++-------------
5 files changed, 172 insertions(+), 80 deletions(-)
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index cdd63219de..1a5d1e8099 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -69,6 +69,13 @@ setup-allowed-flags() {
# gcc 4.9
-mno-avx512cd -mno-avx512er -mno-avx512f -mno-avx512pf -mno-sha
)
+
+ # Allow some safe individual flags. Should come along with the bug reference.
+ ALLOWED_FLAGS+=(
+ # Allow explicit stack realignment to run non-conformant
+ # binaries: bug #677852
+ -mstackrealign
+ )
}
# inverted filters for hardened compiler. This is trying to unpick
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index da96e04c14..e8e8575eda 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 2004-2018 Gentoo Foundation
+# Copyright 2004-2018 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-utils-2.eclass
@@ -15,7 +15,10 @@
# you should inherit java-pkg-2 for Java packages or java-pkg-opt-2 for packages
# that have optional Java support. In addition you can inherit java-ant-2 for
# Ant-based packages.
-inherit eutils versionator multilib
+
+# EAPI 7 has version functions built-in. Use eapi7-ver for all earlier eclasses.
+# Keep versionator inheritance in case consumers are using it implicitly.
+[[ ${EAPI} == [0123456] ]] && inherit eapi7-ver eutils multilib versionator
IUSE="elibc_FreeBSD"
@@ -1518,8 +1521,8 @@ java-pkg_is-vm-version-eq() {
local vm_version="$(java-pkg_get-vm-version)"
- vm_version="$(get_version_component_range 1-2 "${vm_version}")"
- needed_version="$(get_version_component_range 1-2 "${needed_version}")"
+ vm_version="$(ver_cut 1-2 "${vm_version}")"
+ needed_version="$(ver_cut 1-2 "${needed_version}")"
if [[ -z "${vm_version}" ]]; then
debug-print "Could not get JDK version from DEPEND"
@@ -1570,7 +1573,7 @@ java-pkg_is-vm-version-ge() {
debug-print "Could not get JDK version from DEPEND"
return 1
else
- if version_is_at_least "${needed_version}" "${vm_version}"; then
+ if ver_test "${vm_version}" -ge "${needed_version}"; then
debug-print "Detected a JDK(${vm_version}) >= ${needed_version}"
return 0
else
@@ -2033,7 +2036,9 @@ eant() {
if [[ ${cp#:} ]]; then
# It seems ant does not like single quotes around ${cp}
- antflags="${antflags} -Dgentoo.classpath=\"${cp#:}\""
+ # And ant 1.9.13+ also does not like double quotes around ${cp}
+ # https://bz.apache.org/bugzilla/show_bug.cgi?id=58898
+ antflags="${antflags} -Dgentoo.classpath=${cp#:}"
fi
[[ -n ${JAVA_PKG_DEBUG} ]] && echo ant ${antflags} "${@}"
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 6e9cab5360..859f4daf4a 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -44,7 +44,7 @@ _PYTHON_ALL_IMPLS=(
jython2_7
pypy pypy3
python2_7
- python3_4 python3_5 python3_6 python3_7
+ python3_5 python3_6 python3_7
)
readonly _PYTHON_ALL_IMPLS
@@ -80,10 +80,10 @@ _python_impl_supported() {
# keep in sync with _PYTHON_ALL_IMPLS!
# (not using that list because inline patterns shall be faster)
case "${impl}" in
- python2_7|python3_[4567]|jython2_7)
+ python2_7|python3_[567]|jython2_7)
return 0
;;
- pypy1_[89]|pypy2_0|python2_[56]|python3_[123])
+ pypy1_[89]|pypy2_0|python2_[56]|python3_[1234])
return 1
;;
pypy|pypy3)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 392cf02e27..99aac55dea 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 2002-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: toolchain-funcs.eclass
@@ -218,13 +218,11 @@ tc-cpp-is-true() {
}
# @FUNCTION: tc-detect-is-softfloat
-# @RETURN:
-# Shell true if (positive or negative) detection was possible, shell
-# false otherwise. Also outputs a string when detection succeeds, see
-# tc-is-softfloat for the possible values.
+# @RETURN: Shell true if detection was possible, shell false otherwise
# @DESCRIPTION:
# Detect whether the CTARGET (or CHOST) toolchain is a softfloat based
-# one by examining the toolchain's output, if possible.
+# one by examining the toolchain's output, if possible. Outputs a value
+# alike tc-is-softfloat if detection was possible.
tc-detect-is-softfloat() {
# If fetching CPP falls back to the default (gcc -E) then fail
# detection as this may not be the correct toolchain.
@@ -727,6 +725,7 @@ tc-endian() {
mips*) echo big;;
powerpc*le) echo little;;
powerpc*) echo big;;
+ riscv*) echo little;;
s390*) echo big;;
sh*b*) echo big;;
sh*) echo little;;
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 560fe96139..99b8c08d9c 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -2,12 +2,13 @@
# Distributed under the terms of the GNU General Public License v2
# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
+# @SUPPORTED_EAPIS: 5 6
DESCRIPTION="The GNU Compiler Collection"
HOMEPAGE="https://gcc.gnu.org/"
RESTRICT="strip" # cross-compilers need controlled stripping
-inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs versionator prefix
+inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
if [[ ${PV} == *_pre9999* ]] ; then
EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
@@ -25,8 +26,8 @@ FEATURES=${FEATURES/multilib-strict/}
case ${EAPI:-0} in
0|1|2|3|4*) die "Need to upgrade to at least EAPI=5" ;;
- 5*) ;;
- *) die "I don't speak EAPI ${EAPI}." ;;
+ 5*|6) inherit eapi7-ver ;;
+ *) die "I don't speak EAPI ${EAPI}." ;;
esac
EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \
src_compile src_test src_install pkg_postinst pkg_postrm
@@ -52,7 +53,7 @@ is_crosscompile() {
# General purpose version check. Without a second arg matches up to minor version (x.x.x)
tc_version_is_at_least() {
- version_is_at_least "$1" "${2:-${GCC_RELEASE_VER}}"
+ ver_test "${2:-${GCC_RELEASE_VER}}" -ge "$1"
}
# General purpose version range check
@@ -64,17 +65,17 @@ tc_version_is_between() {
GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}}
GCC_PVR=${GCC_PV}
[[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR}
-GCC_RELEASE_VER=$(get_version_component_range 1-3 ${GCC_PV})
-GCC_BRANCH_VER=$(get_version_component_range 1-2 ${GCC_PV})
-GCCMAJOR=$(get_version_component_range 1 ${GCC_PV})
-GCCMINOR=$(get_version_component_range 2 ${GCC_PV})
-GCCMICRO=$(get_version_component_range 3 ${GCC_PV})
+GCC_RELEASE_VER=$(ver_cut 1-3 ${GCC_PV})
+GCC_BRANCH_VER=$(ver_cut 1-2 ${GCC_PV})
+GCCMAJOR=$(ver_cut 1 ${GCC_PV})
+GCCMINOR=$(ver_cut 2 ${GCC_PV})
+GCCMICRO=$(ver_cut 3 ${GCC_PV})
[[ ${BRANCH_UPDATE-notset} == "notset" ]] && \
- BRANCH_UPDATE=$(get_version_component_range 4 ${GCC_PV})
+ BRANCH_UPDATE=$(ver_cut 4 ${GCC_PV})
# According to gcc/c-cppbuiltin.c, GCC_CONFIG_VER MUST match this regex.
# ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)?
-GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(replace_version_separator 3 '-' ${GCC_PV})}
+GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(ver_rs 3 '-' ${GCC_PV})}
# Pre-release support
if [[ ${GCC_PV} == *_pre* ]] ; then
@@ -130,39 +131,55 @@ else
LICENSE="GPL-2+ LGPL-2.1+ FDL-1.1+"
fi
-IUSE="regression-test vanilla"
-IUSE_DEF=( nls nptl )
+if tc_version_is_at_least 8.3; then
+ GCC_EBUILD_TEST_FLAG='test'
+else
+ # Don't force USE regression-test->test change on every
+ # gcc ebuild just yet. Let's do the change when >=gcc-8.3
+ # is commonly used as a main compiler.
+ GCC_EBUILD_TEST_FLAG='regression-test'
+fi
+IUSE="${GCC_EBUILD_TEST_FLAG} vanilla +nls +nptl"
+
+TC_FEATURES=()
+
+tc_has_feature() {
+ has "$1" "${TC_FEATURES[@]}"
+}
if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
- IUSE+=" altivec debug"
- IUSE_DEF+=( cxx fortran )
+ IUSE+=" altivec debug +cxx +fortran" TC_FEATURES+=(fortran)
[[ -n ${PIE_VER} ]] && IUSE+=" nopie"
[[ -n ${HTB_VER} ]] && IUSE+=" boundschecking"
[[ -n ${D_VER} ]] && IUSE+=" d"
[[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
tc_version_is_at_least 3 && IUSE+=" doc hardened multilib objc"
- tc_version_is_between 3 7 && IUSE+=" awt gcj"
+ tc_version_is_between 3 7 && IUSE+=" awt gcj" TC_FEATURES+=(gcj)
tc_version_is_at_least 3.3 && IUSE+=" pgo"
- tc_version_is_at_least 4.0 && IUSE+=" objc-gc"
+ tc_version_is_at_least 4.0 &&
+ IUSE+=" objc-gc" TC_FEATURES+=(objc-gc)
tc_version_is_between 4.0 4.9 && IUSE+=" mudflap"
tc_version_is_at_least 4.1 && IUSE+=" libssp objc++"
- tc_version_is_at_least 4.2 && IUSE_DEF+=( openmp )
+ tc_version_is_at_least 4.2 && IUSE+=" +openmp"
tc_version_is_at_least 4.3 && IUSE+=" fixed-point"
tc_version_is_at_least 4.7 && IUSE+=" go"
# Note: while <=gcc-4.7 also supported graphite, it required forked ppl
# versions which we dropped. Since graphite was also experimental in
# the older versions, we don't want to bother supporting it. #448024
- tc_version_is_at_least 4.8 && IUSE+=" graphite" IUSE_DEF+=( sanitize )
+ tc_version_is_at_least 4.8 &&
+ IUSE+=" graphite +sanitize" TC_FEATURES+=(graphite)
tc_version_is_between 4.9 8 && IUSE+=" cilk"
tc_version_is_at_least 4.9 && IUSE+=" +vtv"
- tc_version_is_at_least 5.0 && IUSE+=" jit mpx"
+ tc_version_is_at_least 5.0 && IUSE+=" jit"
+ tc_version_is_between 5.0 9 && IUSE+=" mpx"
tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch"
# systemtap is a gentoo-specific switch: bug #654748
- tc_version_is_at_least 8.0 && IUSE+=" systemtap"
+ tc_version_is_at_least 8.0 &&
+ IUSE+=" systemtap" TC_FEATURES+=(systemtap)
+ tc_version_is_at_least 9.0 && IUSE+=" d"
+ tc_version_is_at_least 9.1 && IUSE+=" lto"
fi
-IUSE+=" ${IUSE_DEF[*]/#/+}"
-
SLOT="${GCC_CONFIG_VER}"
#---->> DEPEND <<----
@@ -176,20 +193,20 @@ if tc_version_is_at_least 4 ; then
GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2:0= >=dev-libs/mpfr-2.4.2:0="
if tc_version_is_at_least 4.3 ; then
RDEPEND+=" ${GMP_MPFR_DEPS}"
- elif in_iuse fortran ; then
+ elif tc_has_feature fortran ; then
RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
fi
fi
tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0="
-if in_iuse objc-gc ; then
+if tc_has_feature objc-gc ; then
if tc_version_is_at_least 7 ; then
RDEPEND+=" objc-gc? ( >=dev-libs/boehm-gc-7.4.2 )"
fi
fi
-if in_iuse graphite ; then
+if tc_has_feature graphite ; then
if tc_version_is_at_least 5.0 ; then
RDEPEND+=" graphite? ( >=dev-libs/isl-0.14:0= )"
elif tc_version_is_at_least 4.8 ; then
@@ -205,12 +222,12 @@ DEPEND="${RDEPEND}
>=sys-devel/bison-1.875
>=sys-devel/flex-2.5.4
nls? ( sys-devel/gettext )
- regression-test? (
+ ${GCC_EBUILD_TEST_FLAG}? (
>=dev-util/dejagnu-1.4.4
>=sys-devel/autogen-5.5.4
)"
-if in_iuse gcj ; then
+if tc_has_feature gcj ; then
GCJ_DEPS=">=media-libs/libart_lgpl-2.1"
GCJ_GTK_DEPS="
x11-base/xorg-proto
@@ -225,7 +242,7 @@ if in_iuse gcj ; then
DEPEND+=" gcj? ( awt? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )"
fi
-if in_iuse systemtap ; then
+if tc_has_feature systemtap ; then
# gcc needs sys/sdt.h headers on target
DEPEND+=" systemtap? ( dev-util/systemtap )"
fi
@@ -378,7 +395,7 @@ get_gcc_src_uri() {
[[ -n ${D_VER} ]] && \
GCC_SRC_URI+=" d? ( mirror://sourceforge/dgcc/gdc-${D_VER}-src.tar.bz2 )"
- if in_iuse gcj ; then
+ if tc_has_feature gcj ; then
if tc_version_is_at_least 4.5 ; then
GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )"
elif tc_version_is_at_least 4.3 ; then
@@ -533,7 +550,12 @@ toolchain_src_prepare() {
do_gcc_HTB_patches
do_gcc_PIE_patches
do_gcc_CYGWINPORTS_patches
- epatch_user
+
+ case ${EAPI:-0} in
+ 5*) epatch_user;;
+ 6) eapply_user ;;
+ *) die "Update toolchain_src_prepare() for ${EAPI}." ;;
+ esac
if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) && ! use vanilla ; then
make_gcc_hard
@@ -998,6 +1020,11 @@ toolchain_src_configure() {
confgcc+=( --enable-libstdcxx-time )
fi
+ # Build compiler using LTO
+ if tc_version_is_at_least 9.1 && use_if_iuse lto ; then
+ confgcc+=( --with-build-config=bootstrap-lto )
+ fi
+
# Support to disable pch when building libstdcxx
if tc_version_is_at_least 6.0 && ! use_if_iuse pch ; then
confgcc+=( --disable-libstdcxx-pch )
@@ -1042,7 +1069,7 @@ toolchain_src_configure() {
# Undoing it here.
confgcc+=( --disable-libstdcxx-time )
;;
- *-gentoo-freebsd*) needed_libc=freebsd-lib;;
+ *-gentoo-freebsd*) needed_libc=freebsd-lib;;
*-gnu*) needed_libc=glibc;;
*-klibc) needed_libc=klibc;;
*-musl*) needed_libc=musl;;
@@ -1053,7 +1080,7 @@ toolchain_src_configure() {
then #291870
confgcc+=( --disable-shared )
fi
- needed_libc=uclibc
+ needed_libc=uclibc-ng
;;
*-cygwin) needed_libc=cygwin;;
x86_64-*-mingw*|\
@@ -1123,6 +1150,9 @@ toolchain_src_configure() {
*-elf|*-eabi)
confgcc+=( --with-newlib )
;;
+ *-musl*)
+ confgcc+=( --enable-__cxa_atexit )
+ ;;
*-gnu*)
confgcc+=(
--enable-__cxa_atexit
@@ -1224,6 +1254,10 @@ toolchain_src_configure() {
is-flagq -mfloat-gprs=double && confgcc+=( --enable-e500-double )
[[ ${CTARGET//_/-} == *-e500v2-* ]] && confgcc+=( --enable-e500-double )
;;
+ riscv)
+ # Add --with-abi flags to set default ABI
+ confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
+ ;;
esac
# if the target can do biarch (-m32/-m64), enable it. overhead should
@@ -1246,10 +1280,12 @@ toolchain_src_configure() {
### library options
- if ! is_gcj ; then
- confgcc+=( --disable-libgcj )
- elif use awt ; then
- confgcc+=( --enable-java-awt=gtk )
+ if tc_version_is_between 3.0 7.0 ; then
+ if ! is_gcj ; then
+ confgcc+=( --disable-libgcj )
+ elif use awt ; then
+ confgcc+=( --enable-java-awt=gtk )
+ fi
fi
if tc_version_is_at_least 4.2 ; then
@@ -1317,7 +1353,8 @@ toolchain_src_configure() {
if in_iuse vtv ; then
confgcc+=(
$(use_enable vtv vtable-verify)
- $(use_enable vtv libvtv)
+ # See Note [implicitly enabled flags]
+ $(usex vtv '' --disable-libvtv)
)
fi
@@ -1346,7 +1383,8 @@ toolchain_src_configure() {
fi
if tc_version_is_at_least 4.8 && in_iuse sanitize ; then
- confgcc+=( $(use_enable sanitize libsanitizer) )
+ # See Note [implicitly enabled flags]
+ confgcc+=( $(usex sanitize '' --disable-libsanitizer) )
fi
if tc_version_is_at_least 6.0 && in_iuse pie ; then
@@ -1393,7 +1431,7 @@ toolchain_src_configure() {
addwrite /dev/zero
echo "${S}"/configure "${confgcc[@]}"
# 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 harmeful.
+ # use of bash. Newer ones will auto-detect, but this is not harmful.
CONFIG_SHELL="${EPREFIX}/bin/bash" \
bash "${S}"/configure "${confgcc[@]}" || die "failed to run configure"
@@ -1550,6 +1588,12 @@ gcc_do_filter_flags() {
filter-flags -f{no-,}unit-at-a-time -f{no-,}web -mno-tls-direct-seg-refs
filter-flags -f{no-,}stack-protector{,-all}
filter-flags -fvisibility-inlines-hidden -fvisibility=hidden
+ # and warning options
+ filter-flags -Wextra -Wstack-protector
+ fi
+ if ! tc_version_is_at_least 4.1 ; then
+ filter-flags -fdiagnostics-show-option
+ filter-flags -Wstack-protector
fi
if tc_version_is_at_least 3.4 ; then
@@ -1646,6 +1690,7 @@ gcc-abi-map() {
local map=()
case ${CTARGET} in
mips*) map=("o32 32" "n32 n32" "n64 64") ;;
+ riscv*) map=("lp64d lp64d" "lp64 lp64") ;;
x86_64*) map=("amd64 m64" "x86 m32" "x32 mx32") ;;
esac
@@ -1665,6 +1710,11 @@ toolchain_src_compile() {
[[ ! -x /usr/bin/perl ]] \
&& find "${WORKDIR}"/build -name '*.[17]' -exec touch {} +
+ # 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.
+ # 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): #664486
+ CONFIG_SHELL="${EPREFIX}/bin/bash" \
gcc_do_make ${GCC_MAKE_TARGET}
}
@@ -1758,9 +1808,10 @@ gcc_do_make() {
#---->> src_test <<----
toolchain_src_test() {
- if use regression-test ; then
+ if use ${GCC_EBUILD_TEST_FLAG} ; then
cd "${WORKDIR}"/build
- emake -k check
+ # enable verbose test run and result logging
+ emake -k check RUNTESTFLAGS='-a -v'
fi
}
@@ -1853,22 +1904,28 @@ toolchain_src_install() {
ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_CONFIG_VER}
fi
done
- # Rename the main go binaries as we don't want to clobber dev-lang/go
- # when gcc-config runs. #567806
- if tc_version_is_at_least 5 && is_go ; then
- for x in go gofmt; do
- mv ${x} ${x}-${GCCMAJOR} || die
- done
+
+ # When gcc builds a crosscompiler it does not install unprefixed tools.
+ # When cross-building gcc does install native tools.
+ if ! is_crosscompile; then
+ # Rename the main go binaries as we don't want to clobber dev-lang/go
+ # when gcc-config runs. #567806
+ if tc_version_is_at_least 5 && is_go ; then
+ for x in go gofmt; do
+ mv ${x} ${x}-${GCCMAJOR} || die
+ done
+ fi
fi
- # Now do the fun stripping stuff
- env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
- is_crosscompile && \
- env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${HOSTLIBPATH}"
- env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
- # gcc used to install helper binaries in lib/ but then moved to libexec/
- [[ -d ${D}${PREFIX}/libexec/gcc ]] && \
- env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
+ # TODO: implement stripping (we use RESTRICT=strip)
+ # As gcc installs object files both build against ${CHOST} and ${CTARGET}
+ # we will ned to run stripping using different tools:
+ # Using ${CHOST} tools:
+ # - "${D}${BINPATH}"
+ # - (for is_crosscompile) "${D}${HOSTLIBPATH}"
+ # - "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
+ # Using ${CTARGET} tools:
+ # - "${D}${LIBPATH}"
cd "${S}"
if is_crosscompile; then
@@ -1881,18 +1938,20 @@ toolchain_src_install() {
cp -r "${cxx_mandir}"/man? "${D}${DATAPATH}"/man/
fi
fi
- has noinfo ${FEATURES} \
- && rm -r "${D}${DATAPATH}"/info \
- || prepinfo "${DATAPATH#${EPREFIX}}"
- has noman ${FEATURES} \
- && rm -r "${D}${DATAPATH}"/man \
- || prepman "${DATAPATH#${EPREFIX}}"
fi
+
+ # portage regenerates 'dir' files on it's own: bug #672408
+ # Drop 'dir' files to avoid collisions.
+ if [[ -f "${D}${DATAPATH}"/info/dir ]]; then
+ einfo "Deleting '${D}${DATAPATH}/info/dir'"
+ rm "${D}${DATAPATH}"/info/dir || die
+ fi
+
# prune empty dirs left behind
find "${ED}" -depth -type d -delete 2>/dev/null
# install testsuite results
- if use regression-test; then
+ if use ${GCC_EBUILD_TEST_FLAG}; then
docinto testsuite
find "${WORKDIR}"/build -type f -name "*.sum" -exec dodoc {} +
find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -exec dodoc {} +
@@ -2220,7 +2279,7 @@ toolchain_pkg_postinst() {
cp "${ROOT%/}${DATAPATH}"/c{89,99} "${EROOT%/}"/usr/bin/ 2>/dev/null
fi
- if use regression-test ; then
+ if use ${GCC_EBUILD_TEST_FLAG} ; then
elog "Testsuite results have been installed into /usr/share/doc/${PF}/testsuite"
echo
fi
@@ -2319,7 +2378,7 @@ should_we_gcc_config() {
# for being in the same SLOT, make sure we run gcc-config.
local curr_config_ver=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -S ${curr_config} | awk '{print $2}')
- local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver})
+ local curr_branch_ver=$(ver_cut 1-2 ${curr_config_ver})
if [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then
return 0
@@ -2402,6 +2461,10 @@ is_go() {
is_jit() {
gcc-lang-supported jit || return 1
+ # cross-compiler does not really support jit as it has
+ # to generate code for a target. On target like avr
+ # libgcclit.so can't link at all: bug #594572
+ is_crosscompile && return 1
use_if_iuse jit
}
@@ -2527,3 +2590,21 @@ toolchain_death_notice() {
popd >/dev/null
fi
}
+
+# Note [implicitly enabled flags]
+# -------------------------------
+# Usually configure-based packages handle explicit feature requests
+# like
+# ./configure --enable-foo
+# as explicit request to check for support of 'foo' and bail out at
+# configure time.
+#
+# GCC does not follow this pattern and instead overrides autodetection
+# of the feature and enables it unconditionally.
+# See bugs:
+# https://gcc.gnu.org/PR85663 (libsanitizer on mips)
+# https://bugs.gentoo.org/661252 (libvtv on powerpc64)
+#
+# Thus safer way to enable/disable the feature is to rely on implicit
+# enabled-by-default state:
+# econf $(usex foo '' --disable-foo)
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2019-11-14 6:36 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2019-11-14 6:36 UTC (permalink / raw
To: gentoo-commits
commit: c9047396875b04faa35fc808554535b48c0cd482
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Nov 14 06:35:51 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Nov 14 06:35:51 2019 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=c9047396
eclass/python-utils-r1: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 859f4daf4a..2ea5bab356 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -44,7 +44,7 @@ _PYTHON_ALL_IMPLS=(
jython2_7
pypy pypy3
python2_7
- python3_5 python3_6 python3_7
+ python3_5 python3_6 python3_7 python3_8
)
readonly _PYTHON_ALL_IMPLS
@@ -80,7 +80,7 @@ _python_impl_supported() {
# keep in sync with _PYTHON_ALL_IMPLS!
# (not using that list because inline patterns shall be faster)
case "${impl}" in
- python2_7|python3_[567]|jython2_7)
+ python2_7|python3_[5678]|jython2_7)
return 0
;;
pypy1_[89]|pypy2_0|python2_[56]|python3_[1234])
@@ -720,7 +720,7 @@ python_optimize() {
if [[ ${f} == /* && -d ${D%/}${f} ]]; then
set -- "${D%/}${f}" "${@}"
fi
- done < <("${PYTHON}" -c 'import sys; print("\0".join(sys.path))' || die)
+ done < <("${PYTHON}" -c 'import sys; print("".join(x + "\0" for x in sys.path))' || die)
debug-print "${FUNCNAME}: using sys.path: ${*/%/;}"
fi
@@ -1024,7 +1024,7 @@ python_wrapper_setup() {
rm -f "${workdir}"/bin/2to3 || die
rm -f "${workdir}"/pkgconfig/python{,2,3}.pc || die
- local EPYTHON PYTHON PYTHON_CONFIG
+ local EPYTHON PYTHON
python_export "${impl}" EPYTHON PYTHON
local pyver pyother
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2019-12-11 9:47 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2019-12-11 9:47 UTC (permalink / raw
To: gentoo-commits
commit: 8ae66dc29cd269a487cd96e293a6ed1315fa6f7a
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Dec 11 09:47:15 2019 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Dec 11 09:47:15 2019 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=8ae66dc2
eclass/python-utils-r1: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 36 +++++++++++++++++++++++++++++++-----
1 file changed, 31 insertions(+), 5 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 2ea5bab356..7d1f577534 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -164,11 +164,12 @@ _python_set_impls() {
}
# @FUNCTION: _python_impl_matches
-# @USAGE: <impl> <pattern>...
+# @USAGE: <impl> [<pattern>...]
# @INTERNAL
# @DESCRIPTION:
# Check whether the specified <impl> matches at least one
# of the patterns following it. Return 0 if it does, 1 otherwise.
+# Matches if no patterns are provided.
#
# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns can be
# either:
@@ -176,17 +177,17 @@ _python_set_impls() {
# b) '-2' to indicate all Python 2 variants (= !python_is_python3)
# c) '-3' to indicate all Python 3 variants (= python_is_python3)
_python_impl_matches() {
- [[ ${#} -ge 2 ]] || die "${FUNCNAME}: takes at least 2 parameters"
+ [[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter"
+ [[ ${#} -eq 1 ]] && return 0
local impl=${1} pattern
shift
for pattern; do
if [[ ${pattern} == -2 ]]; then
- ! python_is_python3 "${impl}"
- return
+ python_is_python3 "${impl}" || return 0
elif [[ ${pattern} == -3 ]]; then
- python_is_python3 "${impl}"
+ python_is_python3 "${impl}" && return 0
return
# unify value style to allow lax matching
elif [[ ${impl/./_} == ${pattern/./_} ]]; then
@@ -1372,6 +1373,31 @@ python_export_utf8_locale() {
return 0
}
+# @FUNCTION: build_sphinx
+# @USAGE: <directory>
+# @DESCRIPTION:
+# Build HTML documentation using dev-python/sphinx in the specified
+# <directory>. Takes care of disabling Intersphinx and appending
+# to HTML_DOCS.
+#
+# If <directory> is relative to the current directory, care needs
+# to be taken to run einstalldocs from the same directory
+# (usually ${S}).
+build_sphinx() {
+ debug-print-function ${FUNCNAME} "${@}"
+ [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes 1 arg: <directory>"
+
+ local dir=${1}
+
+ sed -i -e 's:^intersphinx_mapping:disabled_&:' \
+ "${dir}"/conf.py || die
+ # not all packages include the Makefile in pypi tarball
+ sphinx-build -b html -d "${dir}"/_build/doctrees "${dir}" \
+ "${dir}"/_build/html || die
+
+ HTML_DOCS+=( "${dir}/_build/html/." )
+}
+
# -- python.eclass functions --
_python_check_dead_variables() {
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2020-03-13 7:51 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2020-03-13 7:51 UTC (permalink / raw
To: gentoo-commits
commit: 5b99beb42d0df33eda54d61e712f310311b730dc
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Mar 13 07:51:01 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Mar 13 07:51:01 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=5b99beb4
eclass/toolchain-*: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain-binutils.eclass | 504 -------------------------------------
eclass/toolchain-funcs.eclass | 60 +++--
eclass/toolchain.eclass | 522 +++++++++++++++++++--------------------
3 files changed, 292 insertions(+), 794 deletions(-)
diff --git a/eclass/toolchain-binutils.eclass b/eclass/toolchain-binutils.eclass
deleted file mode 100644
index 6e3a60f357..0000000000
--- a/eclass/toolchain-binutils.eclass
+++ /dev/null
@@ -1,504 +0,0 @@
-# Copyright 1999-2015 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-#
-# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5
-#
-# We install binutils into CTARGET-VERSION specific directories. This lets
-# us easily merge multiple versions for multiple targets (if we wish) and
-# then switch the versions on the fly (with `binutils-config`).
-#
-# binutils-9999 -> live git
-# binutils-9999_preYYMMDD -> nightly snapshot date YYMMDD
-# binutils-# -> normal release
-
-if [[ -n ${BINUTILS_TYPE} ]] ; then
- BTYPE=${BINUTILS_TYPE}
-else
- case ${PV} in
- 9999_pre*) BTYPE="snap";;
- *.*.90) BTYPE="snap";;
- *.*.*.*.*) BTYPE="hjlu";;
- *) BTYPE="rel";;
- esac
-fi
-
-case ${BTYPE} in
-snap)
- BVER=${PV/9999_pre}
- ;;
-*)
- BVER=${BINUTILS_VER:-${PV}}
- ;;
-esac
-
-inherit eutils libtool flag-o-matic gnuconfig multilib versionator unpacker
-case ${EAPI:-0} in
-0|1)
- EXPORT_FUNCTIONS src_unpack src_compile src_test src_install pkg_postinst pkg_postrm ;;
-2|3|4|5)
- EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm ;;
-*) die "unsupported EAPI ${EAPI}" ;;
-esac
-
-export CTARGET=${CTARGET:-${CHOST}}
-if [[ ${CTARGET} == ${CHOST} ]] ; then
- if [[ ${CATEGORY} == cross-* ]] ; then
- export CTARGET=${CATEGORY#cross-}
- fi
-fi
-is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
-
-DESCRIPTION="Tools necessary to build programs"
-HOMEPAGE="https://sourceware.org/binutils/"
-
-case ${BTYPE} in
- snap)
- SRC_URI="ftp://gcc.gnu.org/pub/binutils/snapshots/binutils-${BVER}.tar.bz2
- ftp://sourceware.org/pub/binutils/snapshots/binutils-${BVER}.tar.bz2" ;;
- hjlu)
- SRC_URI="mirror://kernel/linux/devel/binutils/binutils-${BVER}.tar."
- version_is_at_least 2.21.51.0.5 && SRC_URI+="xz" || SRC_URI+="bz2" ;;
- rel) SRC_URI="mirror://gnu/binutils/binutils-${BVER}.tar.bz2" ;;
-esac
-add_src_uri() {
- [[ -z $2 ]] && return
- local a=$1
- if version_is_at_least 2.22.52.0.2 ; then
- a+=".xz"
- else
- a+=".bz2"
- fi
- set -- mirror://gentoo https://dev.gentoo.org/~vapier/dist https://dev.gentoo.org/~tamiko/distfiles https://dev.gentoo.org/~dilfridge/distfiles
- SRC_URI="${SRC_URI} ${@/%//${a}}"
-}
-PATCH_BINUTILS_VER=${PATCH_BINUTILS_VER:-${BVER}}
-add_src_uri binutils-${PATCH_BINUTILS_VER}-patches-${PATCHVER}.tar ${PATCHVER}
-add_src_uri binutils-${PATCH_BINUTILS_VER}-uclibc-patches-${UCLIBC_PATCHVER}.tar ${UCLIBC_PATCHVER}
-add_src_uri elf2flt-${ELF2FLT_VER}.tar ${ELF2FLT_VER}
-
-if version_is_at_least 2.18 ; then
- LICENSE="|| ( GPL-3 LGPL-3 )"
-else
- LICENSE="|| ( GPL-2 LGPL-2 )"
-fi
-IUSE="cxx multitarget nls static-libs test vanilla"
-if version_is_at_least 2.19 && ! version_is_at_least 2.26 ; then
- IUSE+=" zlib"
-fi
-SLOT="${BVER}"
-
-RDEPEND=">=sys-devel/binutils-config-3"
-if in_iuse zlib ; then
- RDEPEND+=" zlib? ( sys-libs/zlib )"
-elif version_is_at_least 2.26 ; then
- RDEPEND+=" sys-libs/zlib"
-fi
-DEPEND="${RDEPEND}
- test? ( dev-util/dejagnu )
- nls? ( sys-devel/gettext )
- sys-devel/flex
- virtual/yacc"
-if is_cross ; then
- # The build assumes the host has libiberty and such when cross-compiling
- # its build tools. We should probably make binutils itself build a local
- # copy to use, but until then, be lazy.
- DEPEND+=" >=sys-libs/binutils-libs-${PV}"
-fi
-
-S=${WORKDIR}/binutils-${BVER}
-
-LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${BVER}
-INCPATH=${LIBPATH}/include
-DATAPATH=/usr/share/binutils-data/${CTARGET}/${BVER}
-MY_BUILDDIR=${WORKDIR}/build
-if is_cross ; then
- BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${BVER}
-else
- BINPATH=/usr/${CTARGET}/binutils-bin/${BVER}
-fi
-
-tc-binutils_unpack() {
- unpacker ${A}
- mkdir -p "${MY_BUILDDIR}"
- [[ -d ${WORKDIR}/patch ]] && mkdir "${WORKDIR}"/patch/skip
-}
-
-# In case the ebuild wants to add a few of their own.
-PATCHES=()
-
-tc-binutils_apply_patches() {
- cd "${S}"
-
- if ! use vanilla ; then
- if [[ -n ${PATCHVER} ]] ; then
- EPATCH_SOURCE=${WORKDIR}/patch
- if [[ ${CTARGET} == mips* ]] ; then
- # remove gnu-hash for mips (bug #233233)
- EPATCH_EXCLUDE+=" 77_all_generate-gnu-hash.patch"
- fi
- [[ -n $(ls "${EPATCH_SOURCE}"/*.bz2 2>/dev/null) ]] \
- && EPATCH_SUFFIX="patch.bz2" \
- || EPATCH_SUFFIX="patch"
- epatch
- fi
- if [[ -n ${UCLIBC_PATCHVER} ]] ; then
- EPATCH_SOURCE=${WORKDIR}/uclibc-patches
- [[ -n $(ls "${EPATCH_SOURCE}"/*.bz2 2>/dev/null) ]] \
- && EPATCH_SUFFIX="patch.bz2" \
- || EPATCH_SUFFIX="patch"
- EPATCH_MULTI_MSG="Applying uClibc fixes ..." \
- epatch
- elif [[ ${CTARGET} == *-uclibc* ]] ; then
- # starting with binutils-2.17.50.0.17, we no longer need
- # uClibc patchsets :D
- if grep -qs 'linux-gnu' "${S}"/ltconfig ; then
- die "sorry, but this binutils doesn't yet support uClibc :("
- fi
- fi
- [[ ${#PATCHES[@]} -gt 0 ]] && epatch "${PATCHES[@]}"
-
- # Make sure our explicit libdir paths don't get clobbered. #562460
- sed -i \
- -e 's:@bfdlibdir@:@libdir@:g' \
- -e 's:@bfdincludedir@:@includedir@:g' \
- {bfd,opcodes}/Makefile.in || die
-
- epatch_user
- fi
-
- # fix locale issues if possible #122216
- if [[ -e ${FILESDIR}/binutils-configure-LANG.patch ]] ; then
- einfo "Fixing misc issues in configure files"
- for f in $(find "${S}" -name configure -exec grep -l 'autoconf version 2.13' {} +) ; do
- ebegin " Updating ${f/${S}\/}"
- patch "${f}" "${FILESDIR}"/binutils-configure-LANG.patch >& "${T}"/configure-patch.log \
- || eerror "Please file a bug about this"
- eend $?
- done
- fi
- # fix conflicts with newer glibc #272594
- if [[ -e libiberty/testsuite/test-demangle.c ]] ; then
- sed -i 's:\<getline\>:get_line:g' libiberty/testsuite/test-demangle.c
- fi
-
- # Fix po Makefile generators
- sed -i \
- -e '/^datadir = /s:$(prefix)/@DATADIRNAME@:@datadir@:' \
- -e '/^gnulocaledir = /s:$(prefix)/share:$(datadir):' \
- */po/Make-in || die "sed po's failed"
-
- # Run misc portage update scripts
- gnuconfig_update
- elibtoolize --portage --no-uclibc
-}
-
-toolchain-binutils_src_unpack() {
- tc-binutils_unpack
- case ${EAPI:-0} in
- 0|1) toolchain-binutils_src_prepare ;;
- esac
-}
-
-toolchain-binutils_src_prepare() {
- tc-binutils_apply_patches
-}
-
-_eprefix_init() {
- has "${EAPI:-0}" 0 1 2 && ED=${D} EPREFIX= EROOT=${ROOT}
-}
-
-# Intended for ebuilds to override to set their own versioning information.
-toolchain-binutils_bugurl() {
- printf "https://bugs.gentoo.org/"
-}
-toolchain-binutils_pkgversion() {
- printf "Gentoo ${BVER}"
- [[ -n ${PATCHVER} ]] && printf " p${PATCHVER}"
-}
-
-toolchain-binutils_src_configure() {
- _eprefix_init
-
- # make sure we filter $LINGUAS so that only ones that
- # actually work make it through #42033
- strip-linguas -u */po
-
- # keep things sane
- strip-flags
-
- local x
- echo
- for x in CATEGORY CBUILD CHOST CTARGET CFLAGS LDFLAGS ; do
- einfo "$(printf '%10s' ${x}:) ${!x}"
- done
- echo
-
- cd "${MY_BUILDDIR}"
- local myconf=()
-
- # enable gold if available (installed as ld.gold)
- # PREFIX LOCAL: Linux only (fails to compile on Solaris, MiNT #353410)
- if [[ ${CHOST} == *-linux* ]] && use cxx ; then
- if grep -q 'enable-gold=default' "${S}"/configure ; then
- myconf+=( --enable-gold )
- # old ways - remove when 2.21 is stable
- elif grep -q 'enable-gold=both/ld' "${S}"/configure ; then
- myconf+=( --enable-gold=both/ld )
- elif grep -q 'enable-gold=both/bfd' "${S}"/configure ; then
- myconf+=( --enable-gold=both/bfd )
- fi
- if grep -q -e '--enable-plugins' "${S}"/ld/configure ; then
- myconf+=( --enable-plugins )
- fi
- fi
-
- use nls \
- && myconf+=( --without-included-gettext ) \
- || myconf+=( --disable-nls )
-
- if in_iuse zlib ; then
- # older versions did not have an explicit configure flag
- export ac_cv_search_zlibVersion=$(usex zlib -lz no)
- myconf+=( $(use_with zlib) )
- elif version_is_at_least 2.26 ; then
- myconf+=( --with-system-zlib )
- fi
-
- # For bi-arch systems, enable a 64bit bfd. This matches
- # the bi-arch logic in toolchain.eclass. #446946
- # We used to do it for everyone, but it's slow on 32bit arches. #438522
- case $(tc-arch) in
- ppc|sparc|x86) myconf+=( --enable-64-bit-bfd ) ;;
- esac
-
- [[ ${CHOST} == *"-solaris"* ]] && use nls && append-libs -lintl
- use multitarget && myconf+=( --enable-targets=all --enable-64-bit-bfd )
- [[ -n ${CBUILD} ]] && myconf+=( --build=${CBUILD} )
- is_cross && myconf+=(
- --with-sysroot="${EPREFIX}"/usr/${CTARGET}
- --enable-poison-system-directories
- )
-
- # glibc-2.3.6 lacks support for this ... so rather than force glibc-2.5+
- # on everyone in alpha (for now), we'll just enable it when possible
- has_version ">=${CATEGORY}/glibc-2.5" && myconf+=( --enable-secureplt )
- has_version ">=sys-libs/glibc-2.5" && myconf+=( --enable-secureplt )
-
- myconf+=(
- --prefix="${EPREFIX}"/usr
- --host=${CHOST}
- --target=${CTARGET}
- --datadir="${EPREFIX}"${DATAPATH}
- --infodir="${EPREFIX}"${DATAPATH}/info
- --mandir="${EPREFIX}"${DATAPATH}/man
- --bindir="${EPREFIX}"${BINPATH}
- --libdir="${EPREFIX}"${LIBPATH}
- --libexecdir="${EPREFIX}"${LIBPATH}
- --includedir="${EPREFIX}"${INCPATH}
- --enable-obsolete
- --enable-shared
- --enable-threads
- # Newer versions (>=2.27) offer a configure flag now.
- --enable-relro
- # Newer versions (>=2.24) make this an explicit option. #497268
- --enable-install-libiberty
- --disable-werror
- --with-bugurl="$(toolchain-binutils_bugurl)"
- --with-pkgversion="$(toolchain-binutils_pkgversion)"
- $(use_enable static-libs static)
- ${EXTRA_ECONF}
- # Disable modules that are in a combined binutils/gdb tree. #490566
- --disable-{gdb,libdecnumber,readline,sim}
- # Strip out broken static link flags.
- # https://gcc.gnu.org/PR56750
- --without-stage1-ldflags
- )
- echo ./configure "${myconf[@]}"
- "${S}"/configure "${myconf[@]}" || die
-
- # Prevent makeinfo from running in releases. It may not always be
- # installed, and older binutils may fail with newer texinfo.
- # Besides, we never patch the doc files anyways, so regenerating
- # in the first place is useless. #193364
- # For older versions, it means we don't get any info pages at all.
- # Oh well, tough luck. #294617
- if [[ -e ${S}/gas/doc/as.info ]] || ! version_is_at_least 2.24 ; then
- sed -i \
- -e '/^MAKEINFO/s:=.*:= true:' \
- Makefile || die
- fi
-}
-
-toolchain-binutils_src_compile() {
- _eprefix_init
- case ${EAPI:-0} in
- 0|1) toolchain-binutils_src_configure ;;
- esac
-
- cd "${MY_BUILDDIR}"
- emake all || die "emake failed"
-
- # only build info pages if we user wants them, and if
- # we have makeinfo (may not exist when we bootstrap)
- if type -p makeinfo > /dev/null ; then
- emake info || die "make info failed"
- fi
- # we nuke the manpages when we're left with junk
- # (like when we bootstrap, no perl -> no manpages)
- find . -name '*.1' -a -size 0 -delete
-
- # elf2flt only works on some arches / targets
- if [[ -n ${ELF2FLT_VER} ]] && [[ ${CTARGET} == *linux* || ${CTARGET} == *-elf* ]] ; then
- cd "${WORKDIR}"/elf2flt-${ELF2FLT_VER}
-
- local x supported_arches=$(sed -n '/defined(TARGET_/{s:^.*TARGET_::;s:)::;p}' elf2flt.c | sort -u)
- for x in ${supported_arches} UNSUPPORTED ; do
- [[ ${CTARGET} == ${x}* ]] && break
- done
-
- if [[ ${x} != "UNSUPPORTED" ]] ; then
- append-flags -I"${S}"/include
- myconf+=(
- --with-bfd-include-dir=${MY_BUILDDIR}/bfd
- --with-libbfd=${MY_BUILDDIR}/bfd/libbfd.a
- --with-libiberty=${MY_BUILDDIR}/libiberty/libiberty.a
- --with-binutils-ldscript-dir="${EPREFIX}"${LIBPATH}/ldscripts
- )
- echo ./configure "${myconf[@]}"
- ./configure "${myconf[@]}" || die
- emake || die "make elf2flt failed"
- fi
- fi
-}
-
-toolchain-binutils_src_test() {
- cd "${MY_BUILDDIR}"
- emake -k check || die "check failed :("
-}
-
-toolchain-binutils_src_install() {
- _eprefix_init
- local x d
-
- cd "${MY_BUILDDIR}"
- emake DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install || die
- rm -rf "${ED}"/${LIBPATH}/bin
- use static-libs || find "${ED}" -name '*.la' -delete
-
- # Newer versions of binutils get fancy with ${LIBPATH} #171905
- cd "${ED}"/${LIBPATH}
- for d in ../* ; do
- [[ ${d} == ../${BVER} ]] && continue
- mv ${d}/* . || die
- rmdir ${d} || die
- done
-
- # Now we collect everything intp the proper SLOT-ed dirs
- # When something is built to cross-compile, it installs into
- # /usr/$CHOST/ by default ... we have to 'fix' that :)
- if is_cross ; then
- cd "${ED}"/${BINPATH}
- for x in * ; do
- mv ${x} ${x/${CTARGET}-}
- done
-
- if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then
- mv "${ED}"/usr/${CHOST}/${CTARGET}/include "${ED}"/${INCPATH}
- mv "${ED}"/usr/${CHOST}/${CTARGET}/lib/* "${ED}"/${LIBPATH}/
- rm -r "${ED}"/usr/${CHOST}/{include,lib}
- fi
- fi
- insinto ${INCPATH}
- local libiberty_headers=(
- # Not all the libiberty headers. See libiberty/Makefile.in:install_to_libdir.
- demangle.h
- dyn-string.h
- fibheap.h
- hashtab.h
- libiberty.h
- objalloc.h
- splay-tree.h
- )
- doins "${libiberty_headers[@]/#/${S}/include/}" || die
- if [[ -d ${ED}/${LIBPATH}/lib ]] ; then
- mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/
- rm -r "${ED}"/${LIBPATH}/lib
- fi
-
- # Insert elf2flt where appropriate
- if [[ -x ${WORKDIR}/elf2flt-${ELF2FLT_VER}/elf2flt ]] ; then
- cd "${WORKDIR}"/elf2flt-${ELF2FLT_VER}
- insinto ${LIBPATH}/ldscripts
- doins elf2flt.ld || die "doins elf2flt.ld failed"
- exeinto ${BINPATH}
- doexe elf2flt flthdr || die "doexe elf2flt flthdr failed"
- mv "${ED}"/${BINPATH}/{ld,ld.real} || die
- newexe ld-elf2flt ld || die "doexe ld-elf2flt failed"
- newdoc README README.elf2flt
- fi
-
- # Generate an env.d entry for this binutils
- insinto /etc/env.d/binutils
- cat <<-EOF > "${T}"/env.d
- TARGET="${CTARGET}"
- VER="${BVER}"
- LIBPATH="${EPREFIX}${LIBPATH}"
- EOF
- newins "${T}"/env.d ${CTARGET}-${BVER}
-
- # Handle documentation
- if ! is_cross ; then
- cd "${S}"
- dodoc README
- docinto bfd
- dodoc bfd/ChangeLog* bfd/README bfd/PORTING bfd/TODO
- docinto binutils
- dodoc binutils/ChangeLog binutils/NEWS binutils/README
- docinto gas
- dodoc gas/ChangeLog* gas/CONTRIBUTORS gas/NEWS gas/README*
- docinto gprof
- dodoc gprof/ChangeLog* gprof/TEST gprof/TODO gprof/bbconv.pl
- docinto ld
- dodoc ld/ChangeLog* ld/README ld/NEWS ld/TODO
- docinto libiberty
- dodoc libiberty/ChangeLog* libiberty/README
- docinto opcodes
- dodoc opcodes/ChangeLog*
- fi
- # Remove shared info pages
- rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info}
- # Trim all empty dirs
- find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null
-}
-
-toolchain-binutils_pkg_postinst() {
- _eprefix_init
- # Make sure this ${CTARGET} has a binutils version selected
- [[ -e ${EROOT}/etc/env.d/binutils/config-${CTARGET} ]] && return 0
- binutils-config ${CTARGET}-${BVER}
-}
-
-toolchain-binutils_pkg_postrm() {
- _eprefix_init
- local current_profile=$(binutils-config -c ${CTARGET})
-
- # If no other versions exist, then uninstall for this
- # target ... otherwise, switch to the newest version
- # Note: only do this if this version is unmerged. We
- # rerun binutils-config if this is a remerge, as
- # we want the mtimes on the symlinks updated (if
- # it is the same as the current selected profile)
- if [[ ! -e ${EPREFIX}${BINPATH}/ld ]] && [[ ${current_profile} == ${CTARGET}-${BVER} ]] ; then
- local choice=$(binutils-config -l | grep ${CTARGET} | awk '{print $2}')
- choice=${choice//$'\n'/ }
- choice=${choice/* }
- if [[ -z ${choice} ]] ; then
- env -i ROOT="${ROOT}" binutils-config -u ${CTARGET}
- else
- binutils-config ${choice}
- fi
- elif [[ $(CHOST=${CTARGET} binutils-config -c) == ${CTARGET}-${BVER} ]] ; then
- binutils-config ${CTARGET}-${BVER}
- fi
-}
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 99aac55dea..a491b75522 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -207,14 +207,13 @@ tc-cpp-is-true() {
local CONDITION=${1}
shift
- local RESULT=$($(tc-getTARGET_CPP) "${@}" -P - <<-EOF 2>/dev/null
- #if ${CONDITION}
- true
- #endif
- EOF
- )
-
- [[ ${RESULT} == true ]]
+ $(tc-getTARGET_CPP) "${@}" -P - <<-EOF >/dev/null 2>&1
+ #if ${CONDITION}
+ true
+ #else
+ #error false
+ #endif
+ EOF
}
# @FUNCTION: tc-detect-is-softfloat
@@ -453,6 +452,36 @@ tc-ld-is-gold() {
return 1
}
+# @FUNCTION: tc-ld-is-lld
+# @USAGE: [toolchain prefix]
+# @DESCRIPTION:
+# Return true if the current linker is set to lld.
+tc-ld-is-lld() {
+ local out
+
+ # First check the linker directly.
+ out=$($(tc-getLD "$@") --version 2>&1)
+ if [[ ${out} == *"LLD"* ]] ; then
+ return 0
+ fi
+
+ # Then see if they're selecting lld via compiler flags.
+ # Note: We're assuming they're using LDFLAGS to hold the
+ # options and not CFLAGS/CXXFLAGS.
+ local base="${T}/test-tc-lld"
+ cat <<-EOF > "${base}.c"
+ int main() { return 0; }
+ EOF
+ out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1)
+ rm -f "${base}"*
+ if [[ ${out} == *"LLD"* ]] ; then
+ return 0
+ fi
+
+ # No lld here!
+ return 1
+}
+
# @FUNCTION: tc-ld-disable-gold
# @USAGE: [toolchain prefix]
# @DESCRIPTION:
@@ -980,18 +1009,11 @@ tc-enables-ssp-all() {
# @FUNCTION: gen_usr_ldscript
# @USAGE: [-a] <list of libs to create linker scripts for>
# @DESCRIPTION:
-# This function generate linker scripts in /usr/lib for dynamic
-# libs in /lib. This is to fix linking problems when you have
-# the .so in /lib, and the .a in /usr/lib. What happens is that
-# in some cases when linking dynamic, the .a in /usr/lib is used
-# instead of the .so in /lib due to gcc/libtool tweaking ld's
-# library search path. This causes many builds to fail.
-# See bug #4411 for more info.
-#
-# Note that you should in general use the unversioned name of
-# the library (libfoo.so), as ldconfig should usually update it
-# correctly to point to the latest version of the library present.
+# This function is deprecated. Use the version from
+# usr-ldscript.eclass instead.
gen_usr_ldscript() {
+ ewarn "${FUNCNAME}: Please migrate to usr-ldscript.eclass"
+
local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname)
[[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 99b8c08d9c..89a522f9cf 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1,25 +1,28 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6
+# @SUPPORTED_EAPIS: 5 6 7
DESCRIPTION="The GNU Compiler Collection"
HOMEPAGE="https://gcc.gnu.org/"
-RESTRICT="strip" # cross-compilers need controlled stripping
inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
-if [[ ${PV} == *_pre9999* ]] ; then
+tc_is_live() {
+ [[ ${PV} == *9999* ]]
+}
+
+if tc_is_live ; then
EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
# naming style:
- # gcc-4.7.1_pre9999 -> gcc-4_7-branch
+ # gcc-10.1.0_pre9999 -> gcc-10-branch
# Note that the micro version is required or lots of stuff will break.
# To checkout master set gcc_LIVE_BRANCH="master" in the ebuild before
# inheriting this eclass.
- EGIT_BRANCH="${PN}-${PV%.?_pre9999}-branch"
+ EGIT_BRANCH="releases/${PN}-${PV%.?.?_pre9999}"
EGIT_BRANCH=${EGIT_BRANCH//./_}
- inherit git-2
+ inherit git-r3
fi
FEATURES=${FEATURES/multilib-strict/}
@@ -27,8 +30,10 @@ FEATURES=${FEATURES/multilib-strict/}
case ${EAPI:-0} in
0|1|2|3|4*) die "Need to upgrade to at least EAPI=5" ;;
5*|6) inherit eapi7-ver ;;
+ 7) ;;
*) die "I don't speak EAPI ${EAPI}." ;;
esac
+
EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \
src_compile src_test src_install pkg_postinst pkg_postrm
@@ -65,34 +70,36 @@ tc_version_is_between() {
GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}}
GCC_PVR=${GCC_PV}
[[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR}
+
+# GCC_RELEASE_VER must always match 'gcc/BASE-VER' value.
+# It's an internal representation of gcc version used for:
+# - versioned paths on disk
+# - 'gcc -dumpversion' output. Must always match <digit>.<digit>.<digit>.
GCC_RELEASE_VER=$(ver_cut 1-3 ${GCC_PV})
+
GCC_BRANCH_VER=$(ver_cut 1-2 ${GCC_PV})
GCCMAJOR=$(ver_cut 1 ${GCC_PV})
GCCMINOR=$(ver_cut 2 ${GCC_PV})
GCCMICRO=$(ver_cut 3 ${GCC_PV})
-[[ ${BRANCH_UPDATE-notset} == "notset" ]] && \
- BRANCH_UPDATE=$(ver_cut 4 ${GCC_PV})
-
-# According to gcc/c-cppbuiltin.c, GCC_CONFIG_VER MUST match this regex.
-# ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)?
-GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(ver_rs 3 '-' ${GCC_PV})}
-
-# Pre-release support
-if [[ ${GCC_PV} == *_pre* ]] ; then
- PRERELEASE=${GCC_PV/_pre/-}
-elif [[ ${GCC_PV} == *_alpha* ]] ; then
- SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_alpha}
-elif [[ ${GCC_PV} == *_beta* ]] ; then
- SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_beta}
+
+# Ideally this variable should allow for custom gentoo versioning
+# of binary and gcc-config names not directly tied to upstream
+# versioning. In practive it's hard to untangle from gcc/BASE-VER
+# (GCC_RELEASE_VER) value.
+GCC_CONFIG_VER=${GCC_RELEASE_VER}
+
+# Pre-release support. Versioning schema:
+# 1.0.0_pre9999: live ebuild
+# 1.2.3_alphaYYYYMMDD: weekly snapshots
+# 1.2.3_rcYYYYMMDD: release candidates
+if [[ ${GCC_PV} == *_alpha* ]] ; then
+ # weekly snapshots
+ SNAPSHOT=${GCCMAJOR}-${GCC_PV##*_alpha}
elif [[ ${GCC_PV} == *_rc* ]] ; then
+ # release candidates
SNAPSHOT=${GCC_PV%_rc*}-RC-${GCC_PV##*_rc}
fi
-if [[ ${SNAPSHOT} == [56789].0-* ]] ; then
- # The gcc-5+ releases have dropped the .0 for some reason.
- SNAPSHOT=${SNAPSHOT/.0}
-fi
-
PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr}
if tc_version_is_at_least 3.4.0 ; then
@@ -131,15 +138,18 @@ else
LICENSE="GPL-2+ LGPL-2.1+ FDL-1.1+"
fi
-if tc_version_is_at_least 8.3; then
- GCC_EBUILD_TEST_FLAG='test'
-else
- # Don't force USE regression-test->test change on every
- # gcc ebuild just yet. Let's do the change when >=gcc-8.3
- # is commonly used as a main compiler.
- GCC_EBUILD_TEST_FLAG='regression-test'
-fi
-IUSE="${GCC_EBUILD_TEST_FLAG} vanilla +nls +nptl"
+IUSE="test vanilla +nls"
+RESTRICT="!test? ( test )"
+
+tc_supports_dostrip() {
+ case ${EAPI:-0} in
+ 5*|6) return 1 ;;
+ 7) return 0 ;;
+ *) die "Update apply_patches() for ${EAPI}." ;;
+ esac
+}
+
+tc_supports_dostrip || RESTRICT+=" strip" # cross-compilers need controlled stripping
TC_FEATURES=()
@@ -148,11 +158,13 @@ tc_has_feature() {
}
if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
- IUSE+=" altivec debug +cxx +fortran" TC_FEATURES+=(fortran)
+ IUSE+=" altivec debug +cxx +nptl" TC_FEATURES+=(nptl)
[[ -n ${PIE_VER} ]] && IUSE+=" nopie"
[[ -n ${HTB_VER} ]] && IUSE+=" boundschecking"
[[ -n ${D_VER} ]] && IUSE+=" d"
[[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
+ # fortran support appeared in 4.1, but 4.1 needs outdated mpfr
+ tc_version_is_at_least 4.2 && IUSE+=" +fortran" TC_FEATURES+=(fortran)
tc_version_is_at_least 3 && IUSE+=" doc hardened multilib objc"
tc_version_is_between 3 7 && IUSE+=" awt gcj" TC_FEATURES+=(gcj)
tc_version_is_at_least 3.3 && IUSE+=" pgo"
@@ -163,11 +175,16 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
tc_version_is_at_least 4.2 && IUSE+=" +openmp"
tc_version_is_at_least 4.3 && IUSE+=" fixed-point"
tc_version_is_at_least 4.7 && IUSE+=" go"
- # Note: while <=gcc-4.7 also supported graphite, it required forked ppl
- # versions which we dropped. Since graphite was also experimental in
- # the older versions, we don't want to bother supporting it. #448024
tc_version_is_at_least 4.8 &&
- IUSE+=" graphite +sanitize" TC_FEATURES+=(graphite)
+ IUSE+=" +sanitize"
+ # Note:
+ # <gcc-4.8 supported graphite, it required forked ppl
+ # versions which we dropped. Since graphite was also experimental in
+ # the older versions, we don't want to bother supporting it. #448024
+ # <gcc-5 supported graphite, it required cloog
+ # <gcc-6.5 supported graphite, it required old incompatible isl
+ tc_version_is_at_least 6.5 &&
+ IUSE+=" graphite" TC_FEATURES+=(graphite)
tc_version_is_between 4.9 8 && IUSE+=" cilk"
tc_version_is_at_least 4.9 && IUSE+=" +vtv"
tc_version_is_at_least 5.0 && IUSE+=" jit"
@@ -178,9 +195,16 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
IUSE+=" systemtap" TC_FEATURES+=(systemtap)
tc_version_is_at_least 9.0 && IUSE+=" d"
tc_version_is_at_least 9.1 && IUSE+=" lto"
+ tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=(zstd)
fi
-SLOT="${GCC_CONFIG_VER}"
+if tc_version_is_at_least 10; then
+ # Note: currently we pull in releases, snapshots and
+ # git versions into the same SLOT.
+ SLOT="${GCCMAJOR}"
+else
+ SLOT="${GCC_CONFIG_VER}"
+fi
#---->> DEPEND <<----
@@ -207,25 +231,18 @@ if tc_has_feature objc-gc ; then
fi
if tc_has_feature graphite ; then
- if tc_version_is_at_least 5.0 ; then
- RDEPEND+=" graphite? ( >=dev-libs/isl-0.14:0= )"
- elif tc_version_is_at_least 4.8 ; then
- RDEPEND+="
- graphite? (
- >=dev-libs/cloog-0.18.0:0=
- >=dev-libs/isl-0.11.1:0=
- )"
- fi
+ RDEPEND+=" graphite? ( >=dev-libs/isl-0.14:0= )"
fi
-DEPEND="${RDEPEND}
+BDEPEND="
>=sys-devel/bison-1.875
>=sys-devel/flex-2.5.4
nls? ( sys-devel/gettext )
- ${GCC_EBUILD_TEST_FLAG}? (
+ test? (
>=dev-util/dejagnu-1.4.4
>=sys-devel/autogen-5.5.4
)"
+DEPEND="${RDEPEND}"
if tc_has_feature gcj ; then
GCJ_DEPS=">=media-libs/libart_lgpl-2.1"
@@ -247,15 +264,23 @@ if tc_has_feature systemtap ; then
DEPEND+=" systemtap? ( dev-util/systemtap )"
fi
+if tc_has_feature zstd ; then
+ DEPEND+=" zstd? ( app-arch/zstd )"
+fi
+
+case ${EAPI:-0} in
+ 5*|6) DEPEND+=" ${BDEPEND}" ;;
+esac
+
PDEPEND=">=sys-devel/gcc-config-1.7"
#---->> S + SRC_URI essentials <<----
# Set the source directory depending on whether we're using
-# a prerelease, snapshot, or release tarball.
+# a live git tree, snapshot, or release tarball.
S=$(
- if [[ -n ${PRERELEASE} ]] ; then
- echo ${WORKDIR}/gcc-${PRERELEASE}
+ if tc_is_live ; then
+ echo ${EGIT_CHECKOUT_DIR}
elif [[ -n ${SNAPSHOT} ]] ; then
echo ${WORKDIR}/gcc-${SNAPSHOT}
else
@@ -279,20 +304,16 @@ gentoo_urls() {
# Other than the variables normally set by portage, this function's behavior
# can be altered by setting the following:
#
+# GCC_TARBALL_SRC_URI
+# Override link to main tarball into SRC_URI. Used by dev-lang/gnat-gpl
+# to provide gcc tarball snapshots. Patches are usually reused as-is.
+#
# SNAPSHOT
# If set, this variable signals that we should be using a snapshot of
# gcc. It is expected to be in the format "YYYY-MM-DD". Note that if
# the ebuild has a _pre suffix, this variable is ignored and the
# prerelease tarball is used instead.
#
-# BRANCH_UPDATE
-# If set, this variable signals that we should be using the main
-# release tarball (determined by ebuild version) and applying a
-# CVS branch update patch against it. The location of this branch
-# update patch is assumed to be in ${GENTOO_TOOLCHAIN_BASE_URI}.
-# Just like with SNAPSHOT, this variable is ignored if the ebuild
-# has a _pre suffix.
-#
# PATCH_VER
# PATCH_GCC_VER
# This should be set to the version of the gentoo patch tarball.
@@ -345,27 +366,20 @@ get_gcc_src_uri() {
export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}}
# Set where to download gcc itself depending on whether we're using a
- # prerelease, snapshot, or release tarball.
- if [[ ${PV} == *9999* ]] ; then
- # Nothing to do w/git snapshots.
- :
- elif [[ -n ${PRERELEASE} ]] ; then
- GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/prerelease-${PRERELEASE}/gcc-${PRERELEASE}.tar.bz2"
+ # live git tree, snapshot, or release tarball.
+ if tc_is_live ; then
+ : # Nothing to do w/git snapshots.
+ elif [[ -n ${GCC_TARBALL_SRC_URI} ]] ; then
+ # pull gcc tarball from another location. Frequently used by gnat-gpl.
+ GCC_SRC_URI="${GCC_TARBALL_SRC_URI}"
elif [[ -n ${SNAPSHOT} ]] ; then
- if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
- GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz"
- else
- GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.bz2"
- fi
+ GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz"
else
if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz"
else
GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2"
fi
- # we want all branch updates to be against the main release
- [[ -n ${BRANCH_UPDATE} ]] && \
- GCC_SRC_URI+=" $(gentoo_urls gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2)"
fi
[[ -n ${UCLIBC_VER} ]] && \
@@ -373,7 +387,6 @@ get_gcc_src_uri() {
[[ -n ${PATCH_VER} ]] && \
GCC_SRC_URI+=" $(gentoo_urls gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2)"
- # strawberry pie, Cappuccino and a Gauloises (it's a good thing)
[[ -n ${PIE_VER} ]] && \
PIE_CORE=${PIE_CORE:-gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2} && \
GCC_SRC_URI+=" $(gentoo_urls ${PIE_CORE})"
@@ -415,8 +428,12 @@ SRC_URI=$(get_gcc_src_uri)
#---->> pkg_pretend <<----
+toolchain_is_unsupported() {
+ [[ -n ${SNAPSHOT} ]] || tc_is_live
+}
+
toolchain_pkg_pretend() {
- if [[ -n ${PRERELEASE}${SNAPSHOT} || ${PV} == *9999* ]] &&
+ if toolchain_is_unsupported &&
[[ -z ${I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS} ]] ; then
die "Please \`export I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS=1\` or define it" \
"in your make.conf if you want to use this version."
@@ -451,49 +468,37 @@ toolchain_pkg_setup() {
#---->> src_unpack <<----
toolchain_src_unpack() {
- if [[ ${PV} == *9999* ]]; then
- git-2_src_unpack
- else
- gcc_quick_unpack
+ if tc_is_live ; then
+ git-r3_src_unpack
fi
+
+ default_src_unpack
}
-gcc_quick_unpack() {
- pushd "${WORKDIR}" > /dev/null
- export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
- export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
- export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}}
- export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}}
- export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}}
+#---->> src_prepare <<----
- if [[ -n ${GCC_A_FAKEIT} ]] ; then
- unpack ${GCC_A_FAKEIT}
- elif [[ -n ${PRERELEASE} ]] ; then
- unpack gcc-${PRERELEASE}.tar.bz2
- elif [[ -n ${SNAPSHOT} ]] ; then
- if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
- unpack gcc-${SNAPSHOT}.tar.xz
- else
- unpack gcc-${SNAPSHOT}.tar.bz2
- fi
- elif [[ ${PV} != *9999* ]] ; then
- if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
- unpack gcc-${GCC_RELEASE_VER}.tar.xz
- else
- unpack gcc-${GCC_RELEASE_VER}.tar.bz2
- fi
- # We want branch updates to be against a release tarball
- if [[ -n ${BRANCH_UPDATE} ]] ; then
- pushd "${S}" > /dev/null
- epatch "${DISTDIR}"/gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
- popd > /dev/null
- fi
- fi
+# 'epatch' is not available in EAPI=7. Abstract away patchset application
+# until we eventually get all gcc ebuilds on EAPI=7 or later.
+tc_apply_patches() {
+ [[ ${#@} -lt 2 ]] && die "usage: tc_apply_patches <message> <patches...>"
+
+ einfo "$1"; shift
+
+ case ${EAPI:-0} in
+ # Note: even for EAPI=6 we used 'epatch' semantics. To avoid
+ # breaking existing ebuilds use 'eapply' only in EAPI=7 or later.
+ 5*|6) epatch "$@" ;;
+ 7) eapply "$@" ;;
+ *) die "Update apply_patches() for ${EAPI}." ;;
+ esac
+}
+
+toolchain_src_prepare() {
+ export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}"
+ cd "${S}"
if [[ -n ${D_VER} ]] && use d ; then
- pushd "${S}"/gcc > /dev/null
- unpack gdc-${D_VER}-src.tar.bz2
- cd ..
+ mv "${WORKDIR}"/d gcc/d || die
ebegin "Adding support for the D language"
./gcc/d/setup-gcc.sh >& "${T}"/dgcc.log
if ! eend $? ; then
@@ -502,58 +507,20 @@ gcc_quick_unpack() {
eerror " ${T}/dgcc.log"
die "failed to include the D language"
fi
- popd > /dev/null
fi
- [[ -n ${PATCH_VER} ]] && \
- unpack gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2
-
- [[ -n ${UCLIBC_VER} ]] && \
- unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2
-
- if want_pie ; then
- if [[ -n ${PIE_CORE} ]] ; then
- unpack ${PIE_CORE}
- else
- unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2
- fi
- [[ -n ${SPECS_VER} ]] && \
- unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2
- fi
-
- use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
-
- [[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin && unpack "gcc-cygwinports-${CYGWINPORTS_GITREV}.tar.gz"
-
- popd > /dev/null
-}
-
-#---->> src_prepare <<----
-
-toolchain_src_prepare() {
- export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}"
- cd "${S}"
-
- if ! use vanilla ; then
- if [[ -n ${PATCH_VER} ]] ; then
- guess_patch_type_in_dir "${WORKDIR}"/patch
- EPATCH_MULTI_MSG="Applying Gentoo patches ..." \
- epatch "${WORKDIR}"/patch
- BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}"
- fi
- if [[ -n ${UCLIBC_VER} ]] ; then
- guess_patch_type_in_dir "${WORKDIR}"/uclibc
- EPATCH_MULTI_MSG="Applying uClibc patches ..." \
- epatch "${WORKDIR}"/uclibc
- fi
- fi
+ do_gcc_gentoo_patches
do_gcc_HTB_patches
do_gcc_PIE_patches
do_gcc_CYGWINPORTS_patches
+ if tc_is_live ; then
+ BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, commit ${EGIT_VERSION}"
+ fi
+
case ${EAPI:-0} in
5*) epatch_user;;
- 6) eapply_user ;;
+ 6|7) eapply_user ;;
*) die "Update toolchain_src_prepare() for ${EAPI}." ;;
esac
@@ -574,14 +541,8 @@ toolchain_src_prepare() {
"${S}"/gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
# add prefixed Frameworks to default search paths (may want to
# change this in a cross-compile)
- # 2018-06-20 (grobian): disabled this because
- # 1. no packages seem to use this
- # 2. absence of this dir causes
- # warnings->errors with gcc-7
- # 3. after 2. would need to create the dir
- # somewhere, but 1. still applies
- #sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
- # "${S}"/gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
+ sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
+ "${S}"/gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
# make sure the pkg config files install into multilib dirs.
# since we configure with just one --libdir, we can't use that
@@ -602,13 +563,10 @@ toolchain_src_prepare() {
gcc_version_patch
if tc_version_is_at_least 4.1 ; then
- if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then
- # BASE-VER must be a three-digit version number
- # followed by an optional -pre string
- # eg. 4.5.1, 4.6.2-pre20120213, 4.7.0-pre9999
- # If BASE-VER differs from ${PV/_/-} then libraries get installed in
- # the wrong directory.
- echo ${PV/_/-} > "${S}"/gcc/BASE-VER
+ local actual_version=$(< "${S}"/gcc/BASE-VER)
+ if [[ "${GCC_RELEASE_VER}" != "${actual_version}" ]] ; then
+ eerror "'${S}/gcc/BASE-VER' contains '${actual_version}', expected '${GCC_RELEASE_VER}'"
+ die "Please set 'TOOLCHAIN_GCC_PV' to '${actual_version}'"
fi
fi
@@ -659,8 +617,11 @@ toolchain_src_prepare() {
sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
# Prevent new texinfo from breaking old versions (see #198182, #464008)
- tc_version_is_at_least 4.1 && epatch "${FILESDIR}"/gcc-configure-texinfo.patch
+ if tc_version_is_at_least 4.1; then
+ tc_apply_patches "Remove texinfo (bug #198182, bug #464008)" "${FILESDIR}"/gcc-configure-texinfo.patch
+ fi
+ # >=gcc-4
if [[ -x contrib/gcc_update ]] ; then
einfo "Touching generated files"
./contrib/gcc_update --touch | \
@@ -670,17 +631,23 @@ toolchain_src_prepare() {
fi
}
-guess_patch_type_in_dir() {
- [[ -n $(ls "$1"/*.bz2 2>/dev/null) ]] \
- && EPATCH_SUFFIX="patch.bz2" \
- || EPATCH_SUFFIX="patch"
+do_gcc_gentoo_patches() {
+ if ! use vanilla ; then
+ if [[ -n ${PATCH_VER} ]] ; then
+ tc_apply_patches "Applying Gentoo patches ..." "${WORKDIR}"/patch/*.patch
+ BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}"
+ fi
+ if [[ -n ${UCLIBC_VER} ]] ; then
+ tc_apply_patches "Applying uClibc patches ..." "${WORKDIR}"/uclibc/*.patch
+ fi
+ fi
}
do_gcc_HTB_patches() {
use_if_iuse boundschecking || return 0
# modify the bounds checking patch with a regression patch
- epatch "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch"
+ tc_apply_patches "Bounds checking patch" "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch"
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${HTB_VER}"
}
@@ -688,23 +655,7 @@ do_gcc_PIE_patches() {
want_pie || return 0
use vanilla && return 0
- if tc_version_is_at_least 4.3.2 ; then
- guess_patch_type_in_dir "${WORKDIR}"/piepatch/
- EPATCH_MULTI_MSG="Applying pie patches ..." \
- epatch "${WORKDIR}"/piepatch/
- else
- guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream
-
- # corrects startfile/endfile selection and shared/static/pie flag usage
- EPATCH_MULTI_MSG="Applying upstream pie patches ..." \
- epatch "${WORKDIR}"/piepatch/upstream
- # adds non-default pie support (rs6000)
- EPATCH_MULTI_MSG="Applying non-default pie patches ..." \
- epatch "${WORKDIR}"/piepatch/nondef
- # adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined
- EPATCH_MULTI_MSG="Applying default pie patches ..." \
- epatch "${WORKDIR}"/piepatch/def
- fi
+ tc_apply_patches "Applying pie patches ..." "${WORKDIR}"/piepatch/*.patch
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
}
@@ -713,21 +664,18 @@ do_gcc_CYGWINPORTS_patches() {
[[ -n ${CYGWINPORTS_GITREV} ]] || return 0
use elibc_Cygwin || return 0
- local -a patches
local p d="${WORKDIR}/gcc-${CYGWINPORTS_GITREV}"
- readarray -t patches < <(sed -e '1,/PATCH_URI="/d;/"/,$d' < "${d}"/gcc.cygport)
- for p in ${patches[*]}; do
- epatch "${d}/${p}"
- done
+ # readarray -t is available since bash-4.4 only, #690686
+ local patches=( $(sed -e '1,/PATCH_URI="/d;/"/,$d' < "${d}"/gcc.cygport) )
+ tc_apply_patches "Applying cygwin port patches ..." ${patches[*]}
}
# configure to build with the hardened GCC specs as the default
make_gcc_hard() {
-
local gcc_hard_flags=""
# If we use gcc-6 or newer with pie enable to compile older gcc we need to pass -no-pie
- # to stage1; bug 618908
+ # to stage1; bug #618908
if ! tc_version_is_at_least 6.0 && [[ $(gcc-major-version) -ge 6 ]] ; then
einfo "Disabling PIE in stage1 (only) ..."
sed -i -e "/^STAGE1_LDFLAGS/ s/$/ -no-pie/" "${S}"/Makefile.in || die
@@ -742,7 +690,10 @@ make_gcc_hard() {
einfo "Updating gcc to use automatic SSP building ..."
fi
if use_if_iuse hardened ; then
- # Will add some optimatizion as default.
+ # Will add some hardened options as default, like:
+ # -fstack-clash-protection
+ # -z now
+ # see *_all_extra-options.patch gcc patches.
gcc_hard_flags+=" -DEXTRA_OPTIONS"
# rebrand to make bug reports easier
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
@@ -845,8 +796,7 @@ gcc_version_patch() {
# gcc-4.3+ has configure flags (whoo!)
tc_version_is_at_least 4.3 && return 0
- local version_string=${GCC_CONFIG_VER}
- [[ -n ${BRANCH_UPDATE} ]] && version_string+=" ${BRANCH_UPDATE}"
+ local version_string=${GCC_RELEASE_VER}
einfo "patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})"
@@ -995,9 +945,9 @@ toolchain_src_configure() {
tc_version_is_at_least 3.4 || confgcc+=( --disable-libunwind-exceptions )
# Use the default ("release") checking because upstream usually neglects
- # to test "disabled" so it has a history of breaking. #317217
+ # to test "disabled" so it has a history of breaking. bug #317217
if tc_version_is_at_least 3.4 && in_iuse debug ; then
- # The "release" keyword is new to 4.0. #551636
+ # The "release" keyword is new to 4.0. bug #551636
local off=$(tc_version_is_at_least 4.0 && echo release || echo no)
confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes ${off})}" )
fi
@@ -1015,12 +965,12 @@ toolchain_src_configure() {
# allow gcc to search for clock funcs in the main C lib.
# if it can't find them, then tough cookies -- we aren't
- # going to link in -lrt to all C++ apps. #411681
+ # going to link in -lrt to all C++ apps. bug #411681
if tc_version_is_at_least 4.4 && is_cxx ; then
confgcc+=( --enable-libstdcxx-time )
fi
- # Build compiler using LTO
+ # Build compiler itself using LTO
if tc_version_is_at_least 9.1 && use_if_iuse lto ; then
confgcc+=( --with-build-config=bootstrap-lto )
fi
@@ -1033,7 +983,9 @@ toolchain_src_configure() {
# The jit language requires this.
is_jit && confgcc+=( --enable-host-shared )
- # # Turn on the -Wl,--build-id flag by default for ELF targets. #525942
+ # build-id was disabled for file collisions: bug #526144
+ #
+ # # Turn on the -Wl,--build-id flag by default for ELF targets. bug #525942
# # This helps with locating debug files.
# case ${CTARGET} in
# *-linux-*|*-elf|*-eabi)
@@ -1059,7 +1011,7 @@ toolchain_src_configure() {
# disable a bunch of features or gcc goes boom
local needed_libc=""
case ${CTARGET} in
- *-linux) needed_libc=no-fucking-clue;;
+ *-linux) needed_libc=error-unknown-libc;;
*-dietlibc) needed_libc=dietlibc;;
*-elf|*-eabi)
needed_libc=newlib
@@ -1074,10 +1026,12 @@ toolchain_src_configure() {
*-klibc) needed_libc=klibc;;
*-musl*) needed_libc=musl;;
*-uclibc*)
+ # Enable shared library support only on targets
+ # that support it: bug #291870
if ! echo '#include <features.h>' | \
$(tc-getCPP ${CTARGET}) -E -dD - 2>/dev/null | \
grep -q __HAVE_SHARED__
- then #291870
+ then
confgcc+=( --disable-shared )
fi
needed_libc=uclibc-ng
@@ -1138,10 +1092,12 @@ toolchain_src_configure() {
# destructors", but apparently requires glibc.
case ${CTARGET} in
*-uclibc*)
- confgcc+=(
- --disable-__cxa_atexit
- $(use_enable nptl tls)
- )
+ if tc_has_feature nptl ; then
+ confgcc+=(
+ --disable-__cxa_atexit
+ $(use_enable nptl tls)
+ )
+ fi
tc_version_is_between 3.3 3.4 && confgcc+=( --enable-sjlj-exceptions )
if tc_version_is_between 3.4 4.3 ; then
confgcc+=( --enable-clocale=uclibc )
@@ -1254,6 +1210,15 @@ toolchain_src_configure() {
is-flagq -mfloat-gprs=double && confgcc+=( --enable-e500-double )
[[ ${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
+ # https://bugs.gentoo.org/704784
+ # https://gcc.gnu.org/PR93157
+ [[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( --with-abi=elfv2 )
+ ;;
riscv)
# Add --with-abi flags to set default ABI
confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
@@ -1281,10 +1246,11 @@ toolchain_src_configure() {
### library options
if tc_version_is_between 3.0 7.0 ; then
- if ! is_gcj ; then
+ if is_gcj ; then
+ confgcc+=( --disable-gjdoc )
+ use awt && confgcc+=( --enable-java-awt=gtk )
+ else
confgcc+=( --disable-libgcj )
- elif use awt ; then
- confgcc+=( --enable-java-awt=gtk )
fi
fi
@@ -1358,6 +1324,10 @@ toolchain_src_configure() {
)
fi
+ if in_iuse zstd ; then
+ confgcc+=( $(use_with zstd) )
+ fi
+
# newer gcc's come with libquadmath, but only fortran uses
# it, so auto punt it when we don't care
if tc_version_is_at_least 4.6 && ! is_fortran ; then
@@ -1370,14 +1340,15 @@ toolchain_src_configure() {
confgcc+=( --disable-lto )
fi
- # graphite was added in 4.4 but we only support it in 4.8+ due to external
- # library issues. #448024
- if tc_version_is_at_least 5.0 && in_iuse graphite ; then
+ # graphite was added in 4.4 but we only support it in 6.5+ due to external
+ # library issues. #448024, #701270
+ if tc_version_is_at_least 6.5 && in_iuse graphite ; then
confgcc+=( $(use_with graphite isl) )
use graphite && confgcc+=( --disable-isl-version-check )
- elif tc_version_is_at_least 4.8 && in_iuse graphite ; then
- confgcc+=( $(use_with graphite cloog) )
- use graphite && confgcc+=( --disable-isl-version-check )
+ elif tc_version_is_at_least 5.0 ; then
+ confgcc+=( --without-isl )
+ elif tc_version_is_at_least 4.8 ; then
+ confgcc+=( --without-cloog )
elif tc_version_is_at_least 4.4 ; then
confgcc+=( --without-{cloog,ppl} )
fi
@@ -1445,7 +1416,8 @@ downgrade_arch_flags() {
local arch bver i isa myarch mytune rep ver
bver=${1:-${GCC_BRANCH_VER}}
- [[ $(gcc-version) < ${bver} ]] && return 0
+ # Don't perform downgrade if running gcc is older than ebuild's.
+ tc_version_is_at_least ${bver} $(gcc-version) || return 0
[[ $(tc-arch) != amd64 && $(tc-arch) != x86 ]] && return 0
myarch=$(get-flag march)
@@ -1453,7 +1425,7 @@ downgrade_arch_flags() {
# If -march=native isn't supported we have to tease out the actual arch
if [[ ${myarch} == native || ${mytune} == native ]] ; then
- if [[ ${bver} < 4.2 ]] ; then
+ if ! tc_version_is_at_least 4.2 ${bver}; then
arch=$($(tc-getCC) -march=native -v -E -P - </dev/null 2>&1 \
| sed -rn "/cc1.*-march/s:.*-march=([^ ']*).*:\1:p")
replace-cpu-flags native ${arch}
@@ -1461,10 +1433,10 @@ downgrade_arch_flags() {
fi
# Handle special -mtune flags
- [[ ${mytune} == intel && ${bver} < 4.9 ]] && replace-cpu-flags intel generic
- [[ ${mytune} == generic && ${bver} < 4.2 ]] && filter-flags '-mtune=*'
+ [[ ${mytune} == intel ]] && ! tc_version_is_at_least 4.9 ${bver} && replace-cpu-flags intel generic
+ [[ ${mytune} == generic ]] && ! tc_version_is_at_least 4.2 ${bver} && filter-flags '-mtune=*'
[[ ${mytune} == x86-64 ]] && filter-flags '-mtune=*'
- [[ ${bver} < 3.4 ]] && filter-flags '-mtune=*'
+ tc_version_is_at_least 3.4 ${bver} || filter-flags '-mtune=*'
# "added" "arch" "replacement"
local archlist=(
@@ -1514,8 +1486,8 @@ downgrade_arch_flags() {
[[ ${myarch} != ${arch} && ${mytune} != ${arch} ]] && continue
- if [[ ${ver} > ${bver} ]] ; then
- einfo "Replacing ${myarch} (added in gcc ${ver}) with ${rep}..."
+ if ! tc_version_is_at_least ${ver} ${bver}; then
+ einfo "Downgrading '${myarch}' (added in gcc ${ver}) with '${rep}'..."
[[ ${myarch} == ${arch} ]] && replace-cpu-flags ${myarch} ${rep}
[[ ${mytune} == ${arch} ]] && replace-cpu-flags ${mytune} ${rep}
continue
@@ -1563,13 +1535,17 @@ downgrade_arch_flags() {
for ((i = 0; i < ${#isalist[@]}; i += 2)) ; do
ver=${isalist[i]}
isa=${isalist[i + 1]}
- [[ ${ver} > ${bver} ]] && filter-flags ${isa} ${isa/-m/-mno-}
+ tc_version_is_at_least ${ver} ${bver} || filter-flags ${isa} ${isa/-m/-mno-}
done
}
gcc_do_filter_flags() {
+ # Be conservative here:
+ # - don't allow -O3 and like to over-optimize libgcc # 701786
+ # - don't allow -O0 to generate potentially invalid startup code
strip-flags
- replace-flags -O? -O2
+ filter-flags '-O?'
+ append-flags -O2
# dont want to funk ourselves
filter-flags '-mabi*' -m31 -m32 -m64
@@ -1596,6 +1572,13 @@ gcc_do_filter_flags() {
filter-flags -Wstack-protector
fi
+ if tc_version_is_between 6 8 ; then
+ # -mstackrealign triggers crashes in exception throwing
+ # at least on ada: bug #688580
+ # The reason is unknown. Drop the flag for now.
+ filter-flags -mstackrealign
+ fi
+
if tc_version_is_at_least 3.4 ; then
case $(tc-arch) in
amd64|x86)
@@ -1808,11 +1791,11 @@ gcc_do_make() {
#---->> src_test <<----
toolchain_src_test() {
- if use ${GCC_EBUILD_TEST_FLAG} ; then
- cd "${WORKDIR}"/build
- # enable verbose test run and result logging
- emake -k check RUNTESTFLAGS='-a -v'
- fi
+ cd "${WORKDIR}"/build
+ # '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
}
#---->> src_install <<----
@@ -1820,7 +1803,7 @@ toolchain_src_test() {
toolchain_src_install() {
cd "${WORKDIR}"/build
- # Do allow symlinks in private gcc include dir as this can break the build
+ # Don't allow symlinks in private gcc include dir as this can break the build
# Keep them in prefix for things like 'machine->ia64' #gcc PR26189
use prefix ||
find gcc/include*/ -type l -delete
@@ -1866,6 +1849,7 @@ toolchain_src_install() {
dodir /etc/env.d/gcc
create_gcc_env_entry
+ create_revdep_rebuild_entry
# Setup the gcc_env_entry for hardened gcc 4 with minispecs
want_minispecs && copy_minispecs_gcc_specs
@@ -1878,7 +1862,7 @@ toolchain_src_install() {
cd "${D}"${BINPATH}
# 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 ; do
+ for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo gnat* ; do
# For some reason, g77 gets made instead of ${CTARGET}-g77...
# this should take care of that
if [[ -f ${x} ]] ; then
@@ -1917,15 +1901,17 @@ toolchain_src_install() {
fi
fi
- # TODO: implement stripping (we use RESTRICT=strip)
- # As gcc installs object files both build against ${CHOST} and ${CTARGET}
- # we will ned to run stripping using different tools:
+ # As gcc installs object files built against bost ${CHOST} and ${CTARGET}
+ # ideally we will need to strip them using different tools:
# Using ${CHOST} tools:
# - "${D}${BINPATH}"
# - (for is_crosscompile) "${D}${HOSTLIBPATH}"
# - "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}"
# Using ${CTARGET} tools:
# - "${D}${LIBPATH}"
+ # As dostrip does not specify host to override ${CHOST} tools just skip
+ # non-native binary stripping.
+ is_crosscompile && tc_supports_dostrip && dostrip -x "${LIBPATH}"
cd "${S}"
if is_crosscompile; then
@@ -1950,13 +1936,6 @@ toolchain_src_install() {
# prune empty dirs left behind
find "${ED}" -depth -type d -delete 2>/dev/null
- # install testsuite results
- if use ${GCC_EBUILD_TEST_FLAG}; then
- docinto testsuite
- find "${WORKDIR}"/build -type f -name "*.sum" -exec dodoc {} +
- find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -exec dodoc {} +
- fi
-
# Rather install the script, else portage with changing $FILESDIR
# between binary and source package borks things ....
if ! is_crosscompile && [[ ${PN} != "kgcc64" ]] ; then
@@ -2012,7 +1991,7 @@ toolchain_src_install() {
# for people who are testing as non-root.
chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${D}${LIBPATH}" 2>/dev/null
- # Move pretty-printers to gdb datadir to shut ldconfig up
+ # Installing gdb pretty-printers into gdb-specific location.
local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
pushd "${D}${LIBPATH}" >/dev/null
for py in $(find . -name '*-gdb.py') ; do
@@ -2173,8 +2152,6 @@ create_gcc_env_entry() {
fi
cat <<-EOF > ${gcc_envd_file}
- PATH="${BINPATH}"
- ROOTPATH="${BINPATH}"
GCC_PATH="${BINPATH}"
LDPATH="${ldpaths}"
MANPATH="${DATAPATH}/man"
@@ -2186,6 +2163,20 @@ create_gcc_env_entry() {
EOF
}
+create_revdep_rebuild_entry() {
+ local revdep_rebuild_base="/etc/revdep-rebuild/05cross-${CTARGET}-${GCC_CONFIG_VER}"
+ local revdep_rebuild_file="${ED}${revdep_rebuild_base}"
+
+ is_crosscompile || return 0
+
+ dodir /etc/revdep-rebuild
+ cat <<-EOF > "${revdep_rebuild_file}"
+ # Generated by ${CATEGORY}/${PF}
+ # Ignore libraries built for ${CTARGET}, https://bugs.gentoo.org/692844.
+ SEARCH_DIRS_MASK="${LIBPATH}"
+ EOF
+}
+
copy_minispecs_gcc_specs() {
# on gcc 6 we don't need minispecs
if tc_version_is_at_least 6.0 ; then
@@ -2279,12 +2270,7 @@ toolchain_pkg_postinst() {
cp "${ROOT%/}${DATAPATH}"/c{89,99} "${EROOT%/}"/usr/bin/ 2>/dev/null
fi
- if use ${GCC_EBUILD_TEST_FLAG} ; then
- elog "Testsuite results have been installed into /usr/share/doc/${PF}/testsuite"
- echo
- fi
-
- if [[ -n ${PRERELEASE}${SNAPSHOT} ]] ; then
+ if toolchain_is_unsupported ; then
einfo "This GCC ebuild is provided for your convenience, and the use"
einfo "of this compiler is not supported by the Gentoo Developers."
einfo "Please report bugs to upstream at http://gcc.gnu.org/bugzilla/"
@@ -2292,6 +2278,7 @@ toolchain_pkg_postinst() {
}
toolchain_pkg_postrm() {
+ do_gcc_config
if [[ ! ${ROOT%/} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
eselect compiler-shadow clean all
fi
@@ -2304,6 +2291,7 @@ toolchain_pkg_postrm() {
# clean up the cruft left behind by cross-compilers
if is_crosscompile ; then
if [[ -z $(ls "${EROOT%/}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
+ einfo "Removing last cross-compiler instance. Deleting dangling symlinks."
rm -f "${EROOT%/}"/etc/env.d/gcc/config-${CTARGET}
rm -f "${EROOT%/}"/etc/env.d/??gcc-${CTARGET}
rm -f "${EROOT%/}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
@@ -2315,15 +2303,8 @@ toolchain_pkg_postrm() {
[[ ${ROOT%/} ]] && return 0
if [[ ! -e ${LIBPATH}/libstdc++.so ]] ; then
- # make sure the profile is sane during same-slot upgrade #289403
- do_gcc_config
-
einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
fix_libtool_files.sh ${GCC_RELEASE_VER}
- if [[ -n ${BRANCH_UPDATE} ]] ; then
- einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'"
- fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}
- fi
fi
return 0
@@ -2425,7 +2406,6 @@ is_ada() {
is_cxx() {
gcc-lang-supported 'c++' || return 1
- ! is_crosscompile && tc_version_is_at_least 4.8 && return 0
use_if_iuse cxx
}
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2020-03-16 17:23 Michael Haubenwallner
0 siblings, 0 replies; 89+ messages in thread
From: Michael Haubenwallner @ 2020-03-16 17:23 UTC (permalink / raw
To: gentoo-commits
commit: f3cec249275ed4e00f1a9b465f44012a90dc6aff
Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Mon Mar 16 17:20:03 2020 +0000
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Mon Mar 16 17:23:16 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f3cec249
toolchain.eclass: fix applying cygwinports patches
This commit in gentoo repo broke it (after sync into overlay):
commit bd758f25a82460f6e7011314f9fb7923864e9e1e
Author: Sergei Trofimovich <slyfox <AT> gentoo.org>
Date: Sat Oct 19 13:54:48 2019 +0100
toolchain.eclass: isolate 'epatch' into 'tc_apply_patches'
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>
eclass/toolchain.eclass | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 89a522f9cf..57c4177d70 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -666,7 +666,9 @@ do_gcc_CYGWINPORTS_patches() {
local p d="${WORKDIR}/gcc-${CYGWINPORTS_GITREV}"
# readarray -t is available since bash-4.4 only, #690686
- local patches=( $(sed -e '1,/PATCH_URI="/d;/"/,$d' < "${d}"/gcc.cygport) )
+ local patches=( $(for p in $(
+ sed -e '1,/PATCH_URI="/d;/"/,$d' < "${d}"/gcc.cygport
+ ); do echo "${d}/${p}"; done) )
tc_apply_patches "Applying cygwin port patches ..." ${patches[*]}
}
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2020-03-22 9:25 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2020-03-22 9:25 UTC (permalink / raw
To: gentoo-commits
commit: e8d7c88ec7af706a1b37c3c282cafd042b15aff3
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 22 09:25:06 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Mar 22 09:25:06 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=e8d7c88e
eclass/python-utils-r1: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 88 +++++++++++++++----------------------------
1 file changed, 30 insertions(+), 58 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 7d1f577534..294efe6f66 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: python-utils-r1.eclass
@@ -7,7 +7,7 @@
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
# Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7
# @BLURB: Utility functions for packages with Python parts.
# @DESCRIPTION:
# A utility eclass providing functions to query Python implementations,
@@ -16,15 +16,13 @@
# This eclass does not set any metadata variables nor export any phase
# functions. It can be inherited safely.
#
-# For more information, please see the wiki:
-# https://wiki.gentoo.org/wiki/Project:Python/python-utils-r1
+# For more information, please see the Python Guide:
+# https://dev.gentoo.org/~mgorny/python-guide/
case "${EAPI:-0}" in
- 0|1|2|3|4|5|6|7)
- ;;
- *)
- die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
- ;;
+ [0-4]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
+ [5-7]) ;;
+ *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
esac
if [[ ${_PYTHON_ECLASS_INHERITED} ]]; then
@@ -33,7 +31,7 @@ fi
if [[ ! ${_PYTHON_UTILS_R1} ]]; then
-[[ ${EAPI:-0} == [012345] ]] && inherit eutils multilib
+[[ ${EAPI} == 5 ]] && inherit eutils multilib
inherit toolchain-funcs
# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
@@ -41,10 +39,9 @@ inherit toolchain-funcs
# @DESCRIPTION:
# All supported Python implementations, most preferred last.
_PYTHON_ALL_IMPLS=(
- jython2_7
- pypy pypy3
+ pypy3
python2_7
- python3_5 python3_6 python3_7 python3_8
+ python3_6 python3_7 python3_8
)
readonly _PYTHON_ALL_IMPLS
@@ -80,17 +77,12 @@ _python_impl_supported() {
# keep in sync with _PYTHON_ALL_IMPLS!
# (not using that list because inline patterns shall be faster)
case "${impl}" in
- python2_7|python3_[5678]|jython2_7)
+ python2_7|python3_[678]|pypy3)
return 0
;;
- pypy1_[89]|pypy2_0|python2_[56]|python3_[1234])
+ jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[56]|python3_[12345])
return 1
;;
- pypy|pypy3)
- if [[ ${EAPI:-0} == [01234] ]]; then
- die "PyPy is supported in EAPI 5 and newer only."
- fi
- ;;
*)
[[ ${PYTHON_COMPAT_NO_STRICT} ]] && return 1
die "Invalid implementation in PYTHON_COMPAT: ${impl}"
@@ -206,7 +198,7 @@ _python_impl_matches() {
# This variable is set automatically in the following contexts:
#
# python-r1: Set in functions called by python_foreach_impl() or after
-# calling python_export_best().
+# calling python_setup().
#
# python-single-r1: Set after calling python-single-r1_pkg_setup().
#
@@ -225,7 +217,7 @@ _python_impl_matches() {
# This variable is set automatically in the following contexts:
#
# python-r1: Set in functions called by python_foreach_impl() or after
-# calling python_export_best().
+# calling python_setup().
#
# python-single-r1: Set after calling python-single-r1_pkg_setup().
#
@@ -500,9 +492,9 @@ python_export() {
python*)
PYTHON_PKG_DEP="dev-lang/python:${impl#python}";;
pypy)
- PYTHON_PKG_DEP='>=virtual/pypy-5:0=';;
+ PYTHON_PKG_DEP='>=dev-python/pypy-5:0=';;
pypy3)
- PYTHON_PKG_DEP='>=virtual/pypy3-5:0=';;
+ PYTHON_PKG_DEP='>=dev-python/pypy3-5:0=';;
jython2.7)
PYTHON_PKG_DEP='dev-java/jython:2.7';;
*)
@@ -804,9 +796,6 @@ python_newexe() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
[[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>"
- if [[ ${EAPI:-0} == [0123] ]]; then
- die "python_do* and python_new* helpers are banned in EAPIs older than 4."
- fi
local wrapd=${python_scriptroot:-/usr/bin}
@@ -934,9 +923,6 @@ python_domodule() {
debug-print-function ${FUNCNAME} "${@}"
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
- if [[ ${EAPI:-0} == [0123] ]]; then
- die "python_do* and python_new* helpers are banned in EAPIs older than 4."
- fi
local d
if [[ ${python_moduleroot} == /* ]]; then
@@ -976,9 +962,6 @@ python_doheader() {
debug-print-function ${FUNCNAME} "${@}"
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
- if [[ ${EAPI:-0} == [0123] ]]; then
- die "python_do* and python_new* helpers are banned in EAPIs older than 4."
- fi
local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR}
[[ ${PYTHON_INCLUDEDIR} ]] || python_export PYTHON_INCLUDEDIR PYTHON_EPREFIX
@@ -1023,7 +1006,7 @@ python_wrapper_setup() {
# Clean up, in case we were supposed to do a cheap update.
rm -f "${workdir}"/bin/python{,2,3}{,-config} || die
rm -f "${workdir}"/bin/2to3 || die
- rm -f "${workdir}"/pkgconfig/python{,2,3}.pc || die
+ rm -f "${workdir}"/pkgconfig/python{2,3}{,-embed}.pc || die
local EPYTHON PYTHON
python_export "${impl}" EPYTHON PYTHON
@@ -1066,8 +1049,13 @@ python_wrapper_setup() {
# Python 2.7+.
ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}.pc \
- "${workdir}"/pkgconfig/python.pc || die
- ln -s python.pc "${workdir}"/pkgconfig/python${pyver}.pc || die
+ "${workdir}"/pkgconfig/python${pyver}.pc || die
+
+ # Python 3.8+.
+ if [[ ${EPYTHON} != python[23].[67] ]]; then
+ ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}-embed.pc \
+ "${workdir}"/pkgconfig/python${pyver}-embed.pc || die
+ fi
else
nonsupp+=( 2to3 python-config "python${pyver}-config" )
fi
@@ -1121,10 +1109,7 @@ python_is_installed() {
[[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON"
local hasv_args=()
- case ${EAPI:-0} in
- 0|1|2|3|4)
- local -x ROOT=/
- ;;
+ case ${EAPI} in
5|6)
hasv_args+=( --host-root )
;;
@@ -1133,23 +1118,9 @@ python_is_installed() {
;;
esac
- case "${impl}" in
- pypy|pypy3)
- local append=
- if [[ ${PYTHON_REQ_USE} ]]; then
- append=[${PYTHON_REQ_USE}]
- fi
-
- # be happy with just the interpeter, no need for the virtual
- has_version "${hasv_args[@]}" "dev-python/${impl}${append}" \
- || has_version "${hasv_args[@]}" "dev-python/${impl}-bin${append}"
- ;;
- *)
- local PYTHON_PKG_DEP
- python_export "${impl}" PYTHON_PKG_DEP
- has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
- ;;
- esac
+ local PYTHON_PKG_DEP
+ python_export "${impl}" PYTHON_PKG_DEP
+ has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
}
# @FUNCTION: python_fix_shebang
@@ -1293,7 +1264,7 @@ python_fix_shebang() {
if [[ ! ${any_fixed} ]]; then
local cmd=eerror
- [[ ${EAPI:-0} == [012345] ]] && cmd=eqawarn
+ [[ ${EAPI} == 5 ]] && cmd=eqawarn
"${cmd}" "QA warning: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files."
if [[ ${any_correct} ]]; then
@@ -1309,6 +1280,7 @@ python_fix_shebang() {
# @FUNCTION: _python_check_locale_sanity
# @USAGE: <locale>
+# @INTERNAL
# @RETURN: 0 if sane, 1 otherwise
# @DESCRIPTION:
# Check whether the specified locale sanely maps between lowercase
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2020-03-26 7:56 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2020-03-26 7:56 UTC (permalink / raw
To: gentoo-commits
commit: f7c81bea327aa909e26cca3519c157a5e4cb92e7
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 26 07:55:34 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Mar 26 07:55:34 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f7c81bea
eclass/python-utils-r1: sync with x86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 173 +++++++++++-------------------------------
1 file changed, 45 insertions(+), 128 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 294efe6f66..87f0821b68 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -228,116 +228,24 @@ _python_impl_matches() {
# python2.7
# @CODE
-# @ECLASS-VARIABLE: PYTHON_SITEDIR
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The path to Python site-packages directory.
-#
-# Set and exported on request using python_export().
-# Requires a proper build-time dependency on the Python implementation.
-#
-# Example value:
-# @CODE
-# /usr/lib64/python2.7/site-packages
-# @CODE
-
-# @ECLASS-VARIABLE: PYTHON_INCLUDEDIR
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The path to Python include directory.
-#
-# Set and exported on request using python_export().
-# Requires a proper build-time dependency on the Python implementation.
-#
-# Example value:
-# @CODE
-# /usr/include/python2.7
-# @CODE
-
-# @ECLASS-VARIABLE: PYTHON_LIBPATH
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The path to Python library.
-#
-# Set and exported on request using python_export().
-# Valid only for CPython. Requires a proper build-time dependency
-# on the Python implementation.
-#
-# Example value:
-# @CODE
-# /usr/lib64/libpython2.7.so
-# @CODE
-
-# @ECLASS-VARIABLE: PYTHON_CFLAGS
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Proper C compiler flags for building against Python. Obtained from
-# pkg-config or python-config.
-#
-# Set and exported on request using python_export().
-# Valid only for CPython. Requires a proper build-time dependency
-# on the Python implementation and on pkg-config.
-#
-# Example value:
-# @CODE
-# -I/usr/include/python2.7
-# @CODE
-
-# @ECLASS-VARIABLE: PYTHON_LIBS
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Proper C compiler flags for linking against Python. Obtained from
-# pkg-config or python-config.
-#
-# Set and exported on request using python_export().
-# Valid only for CPython. Requires a proper build-time dependency
-# on the Python implementation and on pkg-config.
-#
-# Example value:
-# @CODE
-# -lpython2.7
-# @CODE
-
-# @ECLASS-VARIABLE: PYTHON_CONFIG
-# @DEFAULT_UNSET
+# @FUNCTION: python_export
+# @USAGE: [<impl>] <variables>...
+# @INTERNAL
# @DESCRIPTION:
-# Path to the python-config executable.
-#
-# Set and exported on request using python_export().
-# Valid only for CPython. Requires a proper build-time dependency
-# on the Python implementation and on pkg-config.
-#
-# Example value:
-# @CODE
-# /usr/bin/python2.7-config
-# @CODE
+# Backwards compatibility function. The relevant API is now considered
+# private, please use python_get* instead.
+python_export() {
+ debug-print-function ${FUNCNAME} "${@}"
-# @ECLASS-VARIABLE: PYTHON_PKG_DEP
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The complete dependency on a particular Python package as a string.
-#
-# Set and exported on request using python_export().
-#
-# Example value:
-# @CODE
-# dev-lang/python:2.7[xml]
-# @CODE
+ eqawarn "python_export() is part of private eclass API."
+ eqawarn "Please call python_get*() instead."
-# @ECLASS-VARIABLE: PYTHON_SCRIPTDIR
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The location where Python scripts must be installed for current impl.
-#
-# Set and exported on request using python_export().
-#
-# Example value:
-# @CODE
-# /usr/lib/python-exec/python2.7
-# @CODE
+ _python_export "${@}"
+}
-# @FUNCTION: python_export
+# @FUNCTION: _python_export
# @USAGE: [<impl>] <variables>...
+# @INTERNAL
# @DESCRIPTION:
# Set and export the Python implementation-relevant variables passed
# as parameters.
@@ -350,7 +258,7 @@ _python_impl_matches() {
# The variables which can be exported are: PYTHON, EPYTHON,
# PYTHON_SITEDIR. They are described more completely in the eclass
# variable documentation.
-python_export() {
+_python_export() {
debug-print-function ${FUNCNAME} "${@}"
local impl var
@@ -367,7 +275,7 @@ python_export() {
*)
impl=${EPYTHON}
if [[ -z ${impl} ]]; then
- die "python_export called without a python implementation and EPYTHON is unset"
+ die "_python_export called without a python implementation and EPYTHON is unset"
fi
;;
esac
@@ -523,7 +431,7 @@ python_export() {
debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}"
;;
*)
- die "python_export: unknown variable ${var}"
+ die "_python_export: unknown variable ${var}"
esac
done
}
@@ -534,13 +442,10 @@ python_export() {
# Obtain and print the 'site-packages' path for the given
# implementation. If no implementation is provided, ${EPYTHON} will
# be used.
-#
-# If you just need to have PYTHON_SITEDIR set (and exported), then it is
-# better to use python_export() directly instead.
python_get_sitedir() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_SITEDIR
+ _python_export "${@}" PYTHON_SITEDIR
echo "${PYTHON_SITEDIR}"
}
@@ -549,13 +454,10 @@ python_get_sitedir() {
# @DESCRIPTION:
# Obtain and print the include path for the given implementation. If no
# implementation is provided, ${EPYTHON} will be used.
-#
-# If you just need to have PYTHON_INCLUDEDIR set (and exported), then it
-# is better to use python_export() directly instead.
python_get_includedir() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_INCLUDEDIR
+ _python_export "${@}" PYTHON_INCLUDEDIR
echo "${PYTHON_INCLUDEDIR}"
}
@@ -570,7 +472,7 @@ python_get_includedir() {
python_get_library_path() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_LIBPATH
+ _python_export "${@}" PYTHON_LIBPATH
echo "${PYTHON_LIBPATH}"
}
@@ -587,7 +489,7 @@ python_get_library_path() {
python_get_CFLAGS() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_CFLAGS
+ _python_export "${@}" PYTHON_CFLAGS
echo "${PYTHON_CFLAGS}"
}
@@ -604,7 +506,7 @@ python_get_CFLAGS() {
python_get_LIBS() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_LIBS
+ _python_export "${@}" PYTHON_LIBS
echo "${PYTHON_LIBS}"
}
@@ -621,7 +523,7 @@ python_get_LIBS() {
python_get_PYTHON_CONFIG() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_CONFIG
+ _python_export "${@}" PYTHON_CONFIG
echo "${PYTHON_CONFIG}"
}
@@ -634,7 +536,7 @@ python_get_PYTHON_CONFIG() {
python_get_scriptdir() {
debug-print-function ${FUNCNAME} "${@}"
- python_export "${@}" PYTHON_SCRIPTDIR
+ _python_export "${@}" PYTHON_SCRIPTDIR
echo "${PYTHON_SCRIPTDIR}"
}
@@ -699,7 +601,7 @@ python_optimize() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=${PYTHON}
- [[ ${PYTHON} ]] || python_export PYTHON
+ [[ ${PYTHON} ]] || _python_export PYTHON
# default to sys.path
if [[ ${#} -eq 0 ]]; then
@@ -803,7 +705,7 @@ python_newexe() {
local newfn=${2}
local PYTHON_SCRIPTDIR d
- python_export PYTHON_SCRIPTDIR PYTHON_EPREFIX
+ _python_export PYTHON_SCRIPTDIR PYTHON_EPREFIX
d=${PYTHON_SCRIPTDIR#${PYTHON_EPREFIX}}
(
@@ -931,7 +833,7 @@ python_domodule() {
else
# relative to site-packages
local PYTHON_SITEDIR=${PYTHON_SITEDIR}
- [[ ${PYTHON_SITEDIR} ]] || python_export PYTHON_SITEDIR PYTHON_EPREFIX
+ [[ ${PYTHON_SITEDIR} ]] || _python_export PYTHON_SITEDIR PYTHON_EPREFIX
d=${PYTHON_SITEDIR#${PYTHON_EPREFIX:-${EPREFIX}}}/${python_moduleroot}
fi
@@ -964,7 +866,7 @@ python_doheader() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR}
- [[ ${PYTHON_INCLUDEDIR} ]] || python_export PYTHON_INCLUDEDIR PYTHON_EPREFIX
+ [[ ${PYTHON_INCLUDEDIR} ]] || _python_export PYTHON_INCLUDEDIR PYTHON_EPREFIX
d=${PYTHON_INCLUDEDIR#${PYTHON_EPREFIX:-${EPREFIX}}}
@@ -978,6 +880,21 @@ python_doheader() {
# @FUNCTION: python_wrapper_setup
# @USAGE: [<path> [<impl>]]
# @DESCRIPTION:
+# Backwards compatibility function. The relevant API is now considered
+# private, please use python_setup instead.
+python_wrapper_setup() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ eqawarn "python_wrapper_setup() is part of private eclass API."
+ eqawarn "Please call python_setup() instead."
+
+ _python_wrapper_setup "${@}"
+}
+
+# @FUNCTION: _python_wrapper_setup
+# @USAGE: [<path> [<impl>]]
+# @INTERNAL
+# @DESCRIPTION:
# Create proper 'python' executable and pkg-config wrappers
# (if available) in the directory named by <path>. Set up PATH
# and PKG_CONFIG_PATH appropriately. <path> defaults to ${T}/${EPYTHON}.
@@ -989,7 +906,7 @@ python_doheader() {
# be assumed to contain proper wrappers already and only environment
# setup will be done. If wrapper update is requested, the directory
# shall be removed first.
-python_wrapper_setup() {
+_python_wrapper_setup() {
debug-print-function ${FUNCNAME} "${@}"
local workdir=${1:-${T}/${EPYTHON}}
@@ -1009,7 +926,7 @@ python_wrapper_setup() {
rm -f "${workdir}"/pkgconfig/python{2,3}{,-embed}.pc || die
local EPYTHON PYTHON
- python_export "${impl}" EPYTHON PYTHON
+ _python_export "${impl}" EPYTHON PYTHON
local pyver pyother
if python_is_python3; then
@@ -1119,7 +1036,7 @@ python_is_installed() {
esac
local PYTHON_PKG_DEP
- python_export "${impl}" PYTHON_PKG_DEP
+ _python_export "${impl}" PYTHON_PKG_DEP
has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
}
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2020-05-26 6:44 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2020-05-26 6:44 UTC (permalink / raw
To: gentoo-commits
commit: c9c2e1e4cd1cc1306c3ab8f533cea6bbccf90f94
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue May 26 06:43:45 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue May 26 06:43:45 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=c9c2e1e4
eclass/python-utils-r1: sync with gx86
this is mostly for python3_9 support
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 87f0821b68..0caece1344 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -41,7 +41,7 @@ inherit toolchain-funcs
_PYTHON_ALL_IMPLS=(
pypy3
python2_7
- python3_6 python3_7 python3_8
+ python3_6 python3_7 python3_8 python3_9
)
readonly _PYTHON_ALL_IMPLS
@@ -77,7 +77,7 @@ _python_impl_supported() {
# keep in sync with _PYTHON_ALL_IMPLS!
# (not using that list because inline patterns shall be faster)
case "${impl}" in
- python2_7|python3_[678]|pypy3)
+ python2_7|python3_[6789]|pypy3)
return 0
;;
jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[56]|python3_[12345])
@@ -361,10 +361,14 @@ _python_export() {
local val
case "${impl}" in
- python*)
- # python-2.7, python-3.2, etc.
+ python2*|python3.6|python3.7*)
+ # python* up to 3.7
val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) || die
;;
+ python*)
+ # python3.8+
+ val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}-embed) || die
+ ;;
*)
die "${impl}: obtaining ${var} not supported"
;;
@@ -395,16 +399,12 @@ _python_export() {
case ${impl} in
python2.7)
PYTHON_PKG_DEP='>=dev-lang/python-2.7.5-r2:2.7';;
- python3.3)
- PYTHON_PKG_DEP='>=dev-lang/python-3.3.2-r2:3.3';;
python*)
PYTHON_PKG_DEP="dev-lang/python:${impl#python}";;
pypy)
- PYTHON_PKG_DEP='>=dev-python/pypy-5:0=';;
+ PYTHON_PKG_DEP='>=dev-python/pypy-7.3.0:0=';;
pypy3)
- PYTHON_PKG_DEP='>=dev-python/pypy3-5:0=';;
- jython2.7)
- PYTHON_PKG_DEP='dev-java/jython:2.7';;
+ PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.0:0=';;
*)
die "Invalid implementation: ${impl}"
esac
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2020-06-22 13:56 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2020-06-22 13:56 UTC (permalink / raw
To: gentoo-commits
commit: ca4ff31ddc211a1313d8868e04bed57d50c04c2f
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 22 13:55:36 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Jun 22 13:55:36 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ca4ff31d
eclass/toolchain: sync with gx86 and add Darwin support
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 134 ++++++++++++++++++++++++------------------------
1 file changed, 68 insertions(+), 66 deletions(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 57c4177d70..744d68853f 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -14,7 +14,7 @@ tc_is_live() {
}
if tc_is_live ; then
- EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
+ EGIT_REPO_URI="https://gcc.gnu.org/git/gcc.git"
# naming style:
# gcc-10.1.0_pre9999 -> gcc-10-branch
# Note that the micro version is required or lots of stuff will break.
@@ -158,7 +158,13 @@ tc_has_feature() {
}
if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
- IUSE+=" altivec debug +cxx +nptl" TC_FEATURES+=(nptl)
+ # --enable-altivec was dropped before gcc-4. We don't set it.
+ # We drop USE=altivec for newer gccs only to avoid rebuilds
+ # for most stable users. Once gcc-10 is stable we can drop it.
+ if ! tc_version_is_at_least 10; then
+ IUSE+=" altivec"
+ fi
+ IUSE+=" debug +cxx +nptl" TC_FEATURES+=(nptl)
[[ -n ${PIE_VER} ]] && IUSE+=" nopie"
[[ -n ${HTB_VER} ]] && IUSE+=" boundschecking"
[[ -n ${D_VER} ]] && IUSE+=" d"
@@ -175,8 +181,9 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
tc_version_is_at_least 4.2 && IUSE+=" +openmp"
tc_version_is_at_least 4.3 && IUSE+=" fixed-point"
tc_version_is_at_least 4.7 && IUSE+=" go"
- tc_version_is_at_least 4.8 &&
- IUSE+=" +sanitize"
+ # sanitizer support appeared in gcc-4.8, but <gcc-5 does not
+ # support modern glibc.
+ tc_version_is_at_least 5 && IUSE+=" +sanitize"
# Note:
# <gcc-4.8 supported graphite, it required forked ppl
# versions which we dropped. Since graphite was also experimental in
@@ -186,7 +193,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
tc_version_is_at_least 6.5 &&
IUSE+=" graphite" TC_FEATURES+=(graphite)
tc_version_is_between 4.9 8 && IUSE+=" cilk"
- tc_version_is_at_least 4.9 && IUSE+=" +vtv"
+ tc_version_is_at_least 4.9 && IUSE+=" ada +vtv"
tc_version_is_at_least 5.0 && IUSE+=" jit"
tc_version_is_between 5.0 9 && IUSE+=" mpx"
tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch"
@@ -428,17 +435,7 @@ SRC_URI=$(get_gcc_src_uri)
#---->> pkg_pretend <<----
-toolchain_is_unsupported() {
- [[ -n ${SNAPSHOT} ]] || tc_is_live
-}
-
toolchain_pkg_pretend() {
- if toolchain_is_unsupported &&
- [[ -z ${I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS} ]] ; then
- die "Please \`export I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS=1\` or define it" \
- "in your make.conf if you want to use this version."
- fi
-
if ! use_if_iuse cxx ; then
use_if_iuse go && ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"'
use_if_iuse objc++ && ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"'
@@ -541,7 +538,7 @@ toolchain_src_prepare() {
"${S}"/gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
# add prefixed Frameworks to default search paths (may want to
# change this in a cross-compile)
- sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
+ sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/MacOSX.sdk/Frameworks\"\, \"${EPREFIX}/Frameworks\"\, " \
"${S}"/gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
# make sure the pkg config files install into multilib dirs.
@@ -666,9 +663,13 @@ do_gcc_CYGWINPORTS_patches() {
local p d="${WORKDIR}/gcc-${CYGWINPORTS_GITREV}"
# readarray -t is available since bash-4.4 only, #690686
- local patches=( $(for p in $(
- sed -e '1,/PATCH_URI="/d;/"/,$d' < "${d}"/gcc.cygport
- ); do echo "${d}/${p}"; done) )
+ local patches=( $(
+ for p in $(
+ sed -e '1,/PATCH_URI="/d;/"/,$d' < "${d}"/gcc.cygport
+ ); do
+ echo "${d}/${p}"
+ done
+ ) )
tc_apply_patches "Applying cygwin port patches ..." ${patches[*]}
}
@@ -924,8 +925,7 @@ toolchain_src_configure() {
is_f77 && GCC_LANG+=",f77"
is_f95 && GCC_LANG+=",f95"
- # We do NOT want 'ADA support' in here!
- # is_ada && GCC_LANG+=",ada"
+ is_ada && GCC_LANG+=",ada"
confgcc+=( --enable-languages=${GCC_LANG} )
@@ -1087,6 +1087,13 @@ toolchain_src_configure() {
# for, which is unrelated to TOOLCHAIN_PREFIX, a.k.a.
# PREFIX
confgcc+=( --with-local-prefix="${TPREFIX}/usr" )
+
+ # enable the CommandLine SDK, Apple no longer installs stuff
+ # into /usr
+ if [[ ${CTARGET} == *-darwin* && ${CTARGET##*-darwin} -gt 9 ]]
+ then
+ confgcc+=( --with-native-system-header-dir="${EPREFIX}/MacOSX.sdk/usr/include" )
+ fi
fi
fi
@@ -1132,9 +1139,6 @@ toolchain_src_configure() {
gcc-multilib-configure
- # ppc altivec support
- in_iuse altivec && confgcc+=( $(use_enable altivec) )
-
# gcc has fixed-point arithmetic support in 4.3 for mips targets that can
# significantly increase compile time by several hours. This will allow
# users to control this feature in the event they need the support.
@@ -1306,6 +1310,10 @@ toolchain_src_configure() {
fi
fi
+ if in_iuse ada ; then
+ confgcc+=( --disable-libada )
+ fi
+
if in_iuse cilk ; then
confgcc+=( $(use_enable cilk libcilkrts) )
fi
@@ -1355,9 +1363,13 @@ toolchain_src_configure() {
confgcc+=( --without-{cloog,ppl} )
fi
- if tc_version_is_at_least 4.8 && in_iuse sanitize ; then
- # See Note [implicitly enabled flags]
- confgcc+=( $(usex sanitize '' --disable-libsanitizer) )
+ if tc_version_is_at_least 4.8; then
+ if in_iuse sanitize ; then
+ # See Note [implicitly enabled flags]
+ confgcc+=( $(usex sanitize '' --disable-libsanitizer) )
+ else
+ confgcc+=( --disable-libsanitizer )
+ fi
fi
if tc_version_is_at_least 6.0 && in_iuse pie ; then
@@ -1442,6 +1454,7 @@ downgrade_arch_flags() {
# "added" "arch" "replacement"
local archlist=(
+ 9 znver2 znver1
4.9 bdver4 bdver3
4.9 bonnell atom
4.9 broadwell core-avx2
@@ -1605,8 +1618,9 @@ gcc_do_filter_flags() {
;;
*-macos)
# http://gcc.gnu.org/PR25127
- tc_version_is_between 4.0 4.2 && \
- filter-flags '-mcpu=*' '-march=*' '-mtune=*'
+ # used to break on 4.1 4.2 now breaks on 10 too, so
+ # filter everywhere
+ filter-flags '-mcpu=*' '-march=*' '-mtune=*'
;;
esac
fi
@@ -1695,6 +1709,11 @@ toolchain_src_compile() {
[[ ! -x /usr/bin/perl ]] \
&& find "${WORKDIR}"/build -name '*.[17]' -exec touch {} +
+ # To compile ada library standard files special compiler options are passed
+ # via ADAFLAGS in the Makefile.
+ # Unset ADAFLAGS as setting this override the options
+ 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.
# This needs to be set for compile as well, as it's used in libtool
@@ -1766,6 +1785,17 @@ gcc_do_make() {
${GCC_MAKE_TARGET} \
|| die "emake failed with ${GCC_MAKE_TARGET}"
+ if is_ada; then
+ # Without these links it is not getting the good compiler
+ # 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
+ emake -C gcc gnattools
+ fi
+
if ! is_crosscompile && use_if_iuse cxx && use_if_iuse doc ; then
if type -p doxygen > /dev/null ; then
if tc_version_is_at_least 4.3 ; then
@@ -1938,13 +1968,8 @@ toolchain_src_install() {
# prune empty dirs left behind
find "${ED}" -depth -type d -delete 2>/dev/null
- # Rather install the script, else portage with changing $FILESDIR
- # between binary and source package borks things ....
if ! is_crosscompile && [[ ${PN} != "kgcc64" ]] ; then
- insinto "${DATAPATH#${EPREFIX}}"
- newins "$(prefixify_ro "${FILESDIR}"/awk/fixlafiles.awk-no_gcc_la)" fixlafiles.awk || die
exeinto "${DATAPATH#${EPREFIX}}"
- doexe "$(prefixify_ro "${FILESDIR}"/fix_libtool_files.sh)" || die
doexe "${FILESDIR}"/c{89,99} || die
fi
@@ -2249,34 +2274,16 @@ toolchain_pkg_postinst() {
fi
if ! is_crosscompile && [[ ${PN} != "kgcc64" ]] ; then
- echo
- ewarn "If you have issues with packages unable to locate libstdc++.la,"
- ewarn "then try running 'fix_libtool_files.sh' on the old gcc versions."
- echo
- ewarn "You might want to review the GCC upgrade guide when moving between"
- ewarn "major versions (like 4.2 to 4.3):"
- ewarn "https://wiki.gentoo.org/wiki/Upgrading_GCC"
- echo
-
- # Clean up old paths
- rm -f "${EROOT%/}"/*/rcscripts/awk/fixlafiles.awk "${EROOT%/}"/sbin/fix_libtool_files.sh
- rmdir "${EROOT%/}"/*/rcscripts{/awk,} 2>/dev/null
-
- mkdir -p "${EROOT%/}"/usr/{share/gcc-data,sbin,bin}
- # DATAPATH has EPREFIX already, use ROOT with it
- cp "${ROOT%/}${DATAPATH}"/fixlafiles.awk "${EROOT%/}"/usr/share/gcc-data/ || die
- cp "${ROOT%/}${DATAPATH}"/fix_libtool_files.sh "${EROOT%/}"/usr/sbin/ || die
+ # gcc stopped installing .la files fixer in June 2020.
+ # Cleaning can be removed in June 2022.
+ rm -f "${EROOT%/}"/sbin/fix_libtool_files.sh
+ rm -f "${EROOT%/}"/usr/share/gcc-data/fixlafiles.awk
+ mkdir -p "${EROOT%/}"/usr/bin
# Since these aren't critical files and portage sucks with
# handling of binpkgs, don't require these to be found
cp "${ROOT%/}${DATAPATH}"/c{89,99} "${EROOT%/}"/usr/bin/ 2>/dev/null
fi
-
- if toolchain_is_unsupported ; then
- einfo "This GCC ebuild is provided for your convenience, and the use"
- einfo "of this compiler is not supported by the Gentoo Developers."
- einfo "Please report bugs to upstream at http://gcc.gnu.org/bugzilla/"
- fi
}
toolchain_pkg_postrm() {
@@ -2301,15 +2308,10 @@ toolchain_pkg_postrm() {
return 0
fi
- # ROOT isnt handled by the script
- [[ ${ROOT%/} ]] && return 0
-
- if [[ ! -e ${LIBPATH}/libstdc++.so ]] ; then
- einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'"
- fix_libtool_files.sh ${GCC_RELEASE_VER}
- fi
-
- return 0
+ # gcc stopped installing .la files fixer in June 2020.
+ # Cleaning can be removed in June 2022.
+ rm -f "${EROOT%/}"/sbin/fix_libtool_files.sh
+ rm -f "${EROOT%/}"/usr/share/gcc-data/fixlafiles.awk
}
do_gcc_config() {
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2020-06-22 18:28 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2020-06-22 18:28 UTC (permalink / raw
To: gentoo-commits
commit: cf750927d63e81bed003dd2d4aab7ca34be12b1f
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 22 18:27:51 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Jun 22 18:27:51 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=cf750927
eclass/toolchain: fix SDK Framework path on Darwin
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 744d68853f..293158b91e 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -538,7 +538,7 @@ toolchain_src_prepare() {
"${S}"/gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
# add prefixed Frameworks to default search paths (may want to
# change this in a cross-compile)
- sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/MacOSX.sdk/Frameworks\"\, \"${EPREFIX}/Frameworks\"\, " \
+ sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/MacOSX.sdk/System/Library/Frameworks\"\, \"${EPREFIX}/Frameworks\"\, " \
"${S}"/gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
# make sure the pkg config files install into multilib dirs.
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2020-08-09 8:14 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2020-08-09 8:14 UTC (permalink / raw
To: gentoo-commits
commit: fad409ec352330b9ad88e82dc67bca029c866531
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 9 08:14:04 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Aug 9 08:14:04 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=fad409ec
eclass/python-utils-r1.eclass: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 36 +++++++++++++++++++++++++++++++++++-
1 file changed, 35 insertions(+), 1 deletion(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 0caece1344..1b1f6b4d4b 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -45,6 +45,18 @@ _PYTHON_ALL_IMPLS=(
)
readonly _PYTHON_ALL_IMPLS
+# @ECLASS-VARIABLE: _PYTHON_HISTORICAL_IMPLS
+# @INTERNAL
+# @DESCRIPTION:
+# All historical Python implementations that are no longer supported.
+_PYTHON_HISTORICAL_IMPLS=(
+ jython2_7
+ pypy pypy1_{8,9} pypy2_0
+ python2_{5,6}
+ python3_{1,2,3,4,5}
+)
+readonly _PYTHON_HISTORICAL_IMPLS
+
# @ECLASS-VARIABLE: PYTHON_COMPAT_NO_STRICT
# @INTERNAL
# @DESCRIPTION:
@@ -89,6 +101,28 @@ _python_impl_supported() {
esac
}
+# @FUNCTION: _python_verify_patterns
+# @USAGE: <pattern>...
+# @INTERNAL
+# @DESCRIPTION:
+# Verify whether the patterns passed to the eclass function are correct
+# (i.e. can match any valid implementation). Dies on wrong pattern.
+_python_verify_patterns() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local impl pattern
+ for pattern; do
+ [[ ${pattern} == -[23] ]] && continue
+
+ for impl in "${_PYTHON_ALL_IMPLS[@]}" "${_PYTHON_HISTORICAL_IMPLS[@]}"
+ do
+ [[ ${impl} == ${pattern/./_} ]] && continue 2
+ done
+
+ die "Invalid implementation pattern: ${pattern}"
+ done
+}
+
# @FUNCTION: _python_set_impls
# @INTERNAL
# @DESCRIPTION:
@@ -1197,8 +1231,8 @@ python_fix_shebang() {
# @FUNCTION: _python_check_locale_sanity
# @USAGE: <locale>
-# @INTERNAL
# @RETURN: 0 if sane, 1 otherwise
+# @INTERNAL
# @DESCRIPTION:
# Check whether the specified locale sanely maps between lowercase
# and uppercase ASCII characters.
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2020-11-29 13:41 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2020-11-29 13:41 UTC (permalink / raw
To: gentoo-commits
commit: 22340228f5dbbfcbb63f05b3b848616d6892f245
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 29 13:41:04 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Nov 29 13:41:04 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=22340228
eclass/flag-o-matic: sync with gx86, bug #757258
Closes: https://bugs.gentoo.org/757258
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/flag-o-matic.eclass | 129 ++++++++++++++++++++++++++++++++++-----------
1 file changed, 99 insertions(+), 30 deletions(-)
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index 1a5d1e8099..f75a975a08 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: flag-o-matic.eclass
@@ -27,7 +27,14 @@ setup-allowed-flags() {
'-fstack-protector*' '-fsanitize*' '-fstack-check*' -fno-stack-check
-fbounds-check -fbounds-checking -fno-strict-overflow
-fno-PIE -fno-pie -nopie -no-pie -fno-unit-at-a-time
- -g '-g[0-9]' -ggdb '-ggdb[0-9]' '-gdwarf-*' gstabs -gstabs+ -gz
+
+ # debugging symbols should generally be very safe to add
+ -g '-g[0-9]'
+ -ggdb '-ggdb[0-9]'
+ -gdwarf '-gdwarf-*'
+ -gstabs -gstabs+
+ -gz
+
-fno-ident -fpermissive -frecord-gcc-switches
'-fdiagnostics*' '-fplugin*'
'-W*' -w
@@ -56,7 +63,9 @@ setup-allowed-flags() {
-mno-faster-structs -mfaster-structs -m32 -m64 -mx32 -mabi
-mlittle-endian -mbig-endian -EL -EB -fPIC -mlive-g0 -mcmodel
-mstack-bias -mno-stack-bias -msecure-plt '-m*-toc' -mfloat-abi
- -mfix-r10000 -mno-fix-r10000 -mthumb -marm
+ -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400
+ -mfix-rm7000 -mno-fix-rm7000 -mfix-r10000 -mno-fix-r10000
+ -mr10k-cache-barrier -mthumb -marm
# gcc 4.5
-mno-fma4 -mno-movbe -mno-xop -mno-lwp
@@ -395,6 +404,7 @@ filter-mfpmath() {
# Strip *FLAGS of everything except known good/safe flags. This runs over all
# flags returned by all_flag_vars().
strip-flags() {
+ [[ $# -ne 0 ]] && die "strip-flags takes no arguments"
local x y var
local ALLOWED_FLAGS
@@ -436,25 +446,81 @@ test-flag-PROG() {
local lang=$2
shift 2
- [[ -z ${comp} || -z $1 ]] && return 1
+ if [[ -z ${comp} ]]; then
+ return 1
+ fi
+ if [[ -z $1 ]]; then
+ return 1
+ fi
- local src=${T}/tf-${comp}-${SECONDS}.${lang}
+ # verify selected compiler exists before using it
+ comp=($(tc-get${comp}))
+ # 'comp' can already contain compiler options.
+ # 'type' needs a binary name
+ if ! type -p ${comp[0]} >/dev/null; then
+ return 1
+ fi
+
+ # Set up test file.
+ local in_src in_ext cmdline_extra=()
+ case "${lang}" in
+ # compiler/assembler only
+ c)
+ in_ext='c'
+ in_src='int main(void) { return 0; }'
+ cmdline_extra+=(-xc -c)
+ ;;
+ c++)
+ in_ext='cc'
+ in_src='int main(void) { return 0; }'
+ cmdline_extra+=(-xc++ -c)
+ ;;
+ f77)
+ in_ext='f'
+ # fixed source form
+ in_src=' end'
+ cmdline_extra+=(-xf77 -c)
+ ;;
+ f95)
+ in_ext='f90'
+ in_src='end'
+ cmdline_extra+=(-xf95 -c)
+ ;;
+
+ # C compiler/assembler/linker
+ c+ld)
+ in_ext='c'
+ in_src='int main(void) { return 0; }'
+ cmdline_extra+=(-xc)
+ ;;
+ esac
+ local test_in=${T}/test-flag.${in_ext}
+ local test_out=${T}/test-flag.exe
+
+ printf "%s\n" "${in_src}" > "${test_in}" || die "Failed to create '${test_in}'"
+
+ # Currently we rely on warning-free output of a compiler
+ # before the flag to see if a flag prduces any warnings.
+ # This has a few drawbacks:
+ # - if compiler already generates warnings we filter out
+ # every single flag: bug #712488
+ # - if user actually wants to see warnings we just strip
+ # them regardless of warnings type.
+ #
+ # We can add more selective detection of no-op flags via
+ # '-Werror=ignored-optimization-argument' and similar error options
+ # similar to what we are doing with '-Qunused-arguments'.
local cmdline=(
- $(tc-get${comp})
+ "${comp[@]}"
# Clang will warn about unknown gcc flags but exit 0.
# Need -Werror to force it to exit non-zero.
-Werror
- # Use -c so we can test the assembler as well.
- # don't use -o /dev/null: /usr/ccs/bin/as: File exists (Sun LD)
- -c -o "${src}.o"
+ "$@"
+ # -x<lang> options need to go before first source file
+ "${cmdline_extra[@]}"
+
+ "${test_in}" -o "${test_out}"
)
- if "${cmdline[@]}" -x${lang} - </dev/null &>/dev/null ; then
- cmdline+=( "$@" -x${lang} - )
- else
- # don't use /dev/null as input: -xc flag needs not to exist #254120
- echo "int main() { return 0; }" > "${src}"
- cmdline+=( "$@" -c -o "${src}.o" "${src}" )
- fi
if ! "${cmdline[@]}" </dev/null &>/dev/null; then
# -Werror makes clang bail out on unused arguments as well;
@@ -464,9 +530,6 @@ test-flag-PROG() {
cmdline+=( -Qunused-arguments )
"${cmdline[@]}" </dev/null &>/dev/null
fi
- local ret=$?
- rm -f "${src}"{,.o}
- [[ ${ret} == 0 ]] && true || false
}
# @FUNCTION: test-flag-CC
@@ -493,6 +556,12 @@ test-flag-F77() { test-flag-PROG "F77" f77 "$@"; }
# Returns shell true if <flag> is supported by the Fortran 90 compiler, else returns shell false.
test-flag-FC() { test-flag-PROG "FC" f95 "$@"; }
+# @FUNCTION: test-flag-CCLD
+# @USAGE: <flag>
+# @DESCRIPTION:
+# Returns shell true if <flag> is supported by the C compiler and linker, else returns shell false.
+test-flag-CCLD() { test-flag-PROG "CC" c+ld "$@"; }
+
test-flags-PROG() {
local comp=$1
local flags=()
@@ -549,6 +618,12 @@ test-flags-F77() { test-flags-PROG "F77" "$@"; }
# Returns shell true if <flags> are supported by the Fortran 90 compiler, else returns shell false.
test-flags-FC() { test-flags-PROG "FC" "$@"; }
+# @FUNCTION: test-flags-CCLD
+# @USAGE: <flags>
+# @DESCRIPTION:
+# Returns shell true if <flags> are supported by the C compiler and default linker, else returns shell false.
+test-flags-CCLD() { test-flags-PROG "CCLD" "$@"; }
+
# @FUNCTION: test-flags
# @USAGE: <flags>
# @DESCRIPTION:
@@ -573,13 +648,12 @@ test_version_info() {
# @DESCRIPTION:
# Strip {C,CXX,F,FC}FLAGS of any flags not supported by the active toolchain.
strip-unsupported-flags() {
+ [[ $# -ne 0 ]] && die "strip-unsupported-flags takes no arguments"
export CFLAGS=$(test-flags-CC ${CFLAGS})
export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS})
export FFLAGS=$(test-flags-F77 ${FFLAGS})
export FCFLAGS=$(test-flags-FC ${FCFLAGS})
- # note: this does not verify the linker flags but it is enough
- # to strip invalid C flags which are much more likely, #621274
- export LDFLAGS=$(test-flags-CC ${LDFLAGS})
+ export LDFLAGS=$(test-flags-CCLD ${LDFLAGS})
}
# @FUNCTION: get-flag
@@ -587,6 +661,7 @@ strip-unsupported-flags() {
# @DESCRIPTION:
# Find and echo the value for a particular flag. Accepts shell globs.
get-flag() {
+ [[ $# -ne 1 ]] && die "usage: <flag>"
local f var findflag="$1"
# this code looks a little flaky but seems to work for
@@ -605,18 +680,11 @@ get-flag() {
return 1
}
-has_m64() {
- die "${FUNCNAME}: don't use this anymore"
-}
-
-has_m32() {
- die "${FUNCNAME}: don't use this anymore"
-}
-
# @FUNCTION: replace-sparc64-flags
# @DESCRIPTION:
# Sets mcpu to v8 and uses the original value as mtune if none specified.
replace-sparc64-flags() {
+ [[ $# -ne 0 ]] && die "replace-sparc64-flags takes no arguments"
local SPARC64_CPUS="ultrasparc3 ultrasparc v9"
if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]; then
@@ -700,6 +768,7 @@ raw-ldflags() {
# @FUNCTION: no-as-needed
# @RETURN: Flag to disable asneeded behavior for use with append-ldflags.
no-as-needed() {
+ [[ $# -ne 0 ]] && die "no-as-needed takes no arguments"
case $($(tc-getLD) -v 2>&1 </dev/null) in
*GNU*) # GNU ld
echo "-Wl,--no-as-needed" ;;
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2020-11-29 14:24 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2020-11-29 14:24 UTC (permalink / raw
To: gentoo-commits
commit: 10f753d0678eced907b182c0b15b1dde6901f676
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Nov 29 14:23:40 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Nov 29 14:23:40 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=10f753d0
eclass/toolchain: sync with gx86
this should in particular fix the dangling symlinks for the versioned
tooling variants and the numerous warnings about use_if_iuse
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 306 +++++++++++++++---------------------------------
1 file changed, 97 insertions(+), 209 deletions(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 293158b91e..e5d4dd6ca9 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -7,7 +7,7 @@
DESCRIPTION="The GNU Compiler Collection"
HOMEPAGE="https://gcc.gnu.org/"
-inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
+inherit eutils flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
tc_is_live() {
[[ ${PV} == *9999* ]]
@@ -102,11 +102,7 @@ fi
PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr}
-if tc_version_is_at_least 3.4.0 ; then
- LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
-else
- LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc-lib/${CTARGET}/${GCC_CONFIG_VER}}
-fi
+LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${LIBPATH}/include}
if is_crosscompile ; then
@@ -124,20 +120,7 @@ STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${LIBPATH}/include/g++-v${GCC_BRANCH_VE
#---->> LICENSE+SLOT+IUSE logic <<----
-if tc_version_is_at_least 4.6 ; then
- LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.3+"
-elif tc_version_is_at_least 4.4 ; then
- LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2+"
-elif tc_version_is_at_least 4.3 ; then
- LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ ) FDL-1.2+"
-elif tc_version_is_at_least 4.2 ; then
- LICENSE="GPL-3+ LGPL-2.1+ || ( GPL-3+ libgcc libstdc++ ) FDL-1.2+"
-elif tc_version_is_at_least 3.3 ; then
- LICENSE="GPL-2+ LGPL-2.1+ FDL-1.2+"
-else
- LICENSE="GPL-2+ LGPL-2.1+ FDL-1.1+"
-fi
-
+LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.3+"
IUSE="test vanilla +nls"
RESTRICT="!test? ( test )"
@@ -166,8 +149,6 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
fi
IUSE+=" debug +cxx +nptl" TC_FEATURES+=(nptl)
[[ -n ${PIE_VER} ]] && IUSE+=" nopie"
- [[ -n ${HTB_VER} ]] && IUSE+=" boundschecking"
- [[ -n ${D_VER} ]] && IUSE+=" d"
[[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
# fortran support appeared in 4.1, but 4.1 needs outdated mpfr
tc_version_is_at_least 4.2 && IUSE+=" +fortran" TC_FEATURES+=(fortran)
@@ -176,7 +157,6 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
tc_version_is_at_least 3.3 && IUSE+=" pgo"
tc_version_is_at_least 4.0 &&
IUSE+=" objc-gc" TC_FEATURES+=(objc-gc)
- tc_version_is_between 4.0 4.9 && IUSE+=" mudflap"
tc_version_is_at_least 4.1 && IUSE+=" libssp objc++"
tc_version_is_at_least 4.2 && IUSE+=" +openmp"
tc_version_is_at_least 4.3 && IUSE+=" fixed-point"
@@ -203,6 +183,8 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
tc_version_is_at_least 9.0 && IUSE+=" d"
tc_version_is_at_least 9.1 && IUSE+=" lto"
tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=(zstd)
+ tc_version_is_at_least 11 && IUSE+=" valgrind" TC_FEATURES+=(valgrind)
+ tc_version_is_at_least 11 && IUSE+=" custom-cflags"
fi
if tc_version_is_at_least 10; then
@@ -275,10 +257,15 @@ if tc_has_feature zstd ; then
DEPEND+=" zstd? ( app-arch/zstd )"
fi
+if tc_has_feature valgrind; then
+ BDEPEND+=" valgrind? ( dev-util/valgrind )"
+fi
+
case ${EAPI:-0} in
5*|6) DEPEND+=" ${BDEPEND}" ;;
esac
+# Prefix: our version is 1.9, so can't go with gx86's 2.3
PDEPEND=">=sys-devel/gcc-config-1.7"
#---->> S + SRC_URI essentials <<----
@@ -351,13 +338,6 @@ gentoo_urls() {
# The resulting filename of this tarball will be:
# gcc-${SPECS_GCC_VER:-${GCC_RELEASE_VER}}-specs-${SPECS_VER}.tar.bz2
#
-# HTB_VER
-# HTB_GCC_VER
-# These variables control whether or not an ebuild supports Herman
-# ten Brugge's bounds-checking patches. If you want to use a patch
-# for an older gcc version with a new gcc, make sure you set
-# HTB_GCC_VER to that version of gcc.
-#
# CYGWINPORTS_GITREV
# If set, this variable signals that we should apply additional patches
# maintained by upstream Cygwin developers at github/cygwinports/gcc,
@@ -402,19 +382,6 @@ get_gcc_src_uri() {
[[ -n ${SPECS_VER} ]] && \
GCC_SRC_URI+=" $(gentoo_urls gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2)"
- # gcc bounds checking patch
- if [[ -n ${HTB_VER} ]] ; then
- local HTBFILE="bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
- GCC_SRC_URI+="
- boundschecking? (
- mirror://sourceforge/boundschecking/${HTBFILE}
- $(gentoo_urls ${HTBFILE})
- )"
- fi
-
- [[ -n ${D_VER} ]] && \
- GCC_SRC_URI+=" d? ( mirror://sourceforge/dgcc/gdc-${D_VER}-src.tar.bz2 )"
-
if tc_has_feature gcj ; then
if tc_version_is_at_least 4.5 ; then
GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )"
@@ -436,10 +403,13 @@ SRC_URI=$(get_gcc_src_uri)
#---->> pkg_pretend <<----
toolchain_pkg_pretend() {
- if ! use_if_iuse cxx ; then
- use_if_iuse go && ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"'
- use_if_iuse objc++ && ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"'
- use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"'
+ if ! _tc_use_if_iuse cxx ; then
+ _tc_use_if_iuse go && \
+ ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"'
+ _tc_use_if_iuse objc++ && \
+ ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"'
+ _tc_use_if_iuse gcj && \
+ ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"'
fi
want_minispecs
@@ -494,20 +464,7 @@ toolchain_src_prepare() {
export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}"
cd "${S}"
- if [[ -n ${D_VER} ]] && use d ; then
- mv "${WORKDIR}"/d gcc/d || die
- ebegin "Adding support for the D language"
- ./gcc/d/setup-gcc.sh >& "${T}"/dgcc.log
- if ! eend $? ; then
- eerror "The D GCC package failed to apply"
- eerror "Please include this log file when posting a bug report:"
- eerror " ${T}/dgcc.log"
- die "failed to include the D language"
- fi
- fi
-
do_gcc_gentoo_patches
- do_gcc_HTB_patches
do_gcc_PIE_patches
do_gcc_CYGWINPORTS_patches
@@ -521,18 +478,11 @@ toolchain_src_prepare() {
*) die "Update toolchain_src_prepare() for ${EAPI}." ;;
esac
- if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) && ! use vanilla ; then
+ if ( tc_version_is_at_least 4.8.2 || _tc_use_if_iuse hardened ) \
+ && ! use vanilla ; then
make_gcc_hard
fi
- # install the libstdc++ python into the right location
- # http://gcc.gnu.org/PR51368
- if tc_version_is_between 4.5 4.7 ; then
- sed -i \
- '/^pythondir =/s:=.*:= $(datadir)/python:' \
- "${S}"/libstdc++-v3/python/Makefile.in || die
- fi
-
# we use our libtool on Darwin
sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/${CTARGET}-libtool:" \
"${S}"/gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
@@ -547,28 +497,17 @@ toolchain_src_prepare() {
find "${S}" -name Makefile.in \
-exec sed -i '/^pkgconfigdir/s:=.*:=$(toolexeclibdir)/pkgconfig:' {} +
- # No idea when this first started being fixed, but let's go with 4.3.x for now
- if ! tc_version_is_at_least 4.3 ; then
- fix_files=""
- for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; do
- [[ -e ${x} ]] && fix_files="${fix_files} ${x}"
- done
- ht_fix_file ${fix_files} */configure *.sh */Makefile.in
- fi
-
setup_multilib_osdirnames
gcc_version_patch
- if tc_version_is_at_least 4.1 ; then
- local actual_version=$(< "${S}"/gcc/BASE-VER)
- if [[ "${GCC_RELEASE_VER}" != "${actual_version}" ]] ; then
- eerror "'${S}/gcc/BASE-VER' contains '${actual_version}', expected '${GCC_RELEASE_VER}'"
- die "Please set 'TOOLCHAIN_GCC_PV' to '${actual_version}'"
- fi
+ local actual_version=$(< "${S}"/gcc/BASE-VER)
+ if [[ "${GCC_RELEASE_VER}" != "${actual_version}" ]] ; then
+ eerror "'${S}/gcc/BASE-VER' contains '${actual_version}', expected '${GCC_RELEASE_VER}'"
+ die "Please set 'TOOLCHAIN_GCC_PV' to '${actual_version}'"
fi
# >= gcc-4.3 doesn't bundle ecj.jar, so copy it
- if tc_version_is_at_least 4.3 && use_if_iuse gcj ; then
+ if tc_version_is_at_least 4.3 && _tc_use_if_iuse gcj ; then
if tc_version_is_at_least 4.5 ; then
einfo "Copying ecj-4.5.jar"
cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
@@ -578,19 +517,6 @@ toolchain_src_prepare() {
fi
fi
- # disable --as-needed from being compiled into gcc specs
- # natively when using a gcc version < 3.4.4
- # http://gcc.gnu.org/PR14992
- if ! tc_version_is_at_least 3.4.4 ; then
- sed -i -e s/HAVE_LD_AS_NEEDED/USE_LD_AS_NEEDED/g "${S}"/gcc/config.in
- fi
-
- # In gcc 3.3.x and 3.4.x, rename the java bins to gcc-specific names
- # in line with gcc-4.
- if tc_version_is_between 3.3 4.0 ; then
- do_gcc_rename_java_bins
- fi
-
# Prevent libffi from being installed
if tc_version_is_between 3.0 4.8 ; then
sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in || die
@@ -640,14 +566,6 @@ do_gcc_gentoo_patches() {
fi
}
-do_gcc_HTB_patches() {
- use_if_iuse boundschecking || return 0
-
- # modify the bounds checking patch with a regression patch
- tc_apply_patches "Bounds checking patch" "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch"
- BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${HTB_VER}"
-}
-
do_gcc_PIE_patches() {
want_pie || return 0
use vanilla && return 0
@@ -686,13 +604,13 @@ make_gcc_hard() {
# Gcc >= 6.X we can use configurations options to turn pie/ssp on as default
if tc_version_is_at_least 6.0 ; then
- if use_if_iuse pie ; then
+ if _tc_use_if_iuse pie ; then
einfo "Updating gcc to use automatic PIE building ..."
fi
- if use_if_iuse ssp ; then
+ if _tc_use_if_iuse ssp ; then
einfo "Updating gcc to use automatic SSP building ..."
fi
- if use_if_iuse hardened ; then
+ if _tc_use_if_iuse hardened ; then
# Will add some hardened options as default, like:
# -fstack-clash-protection
# -z now
@@ -702,7 +620,7 @@ make_gcc_hard() {
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
fi
else
- if use_if_iuse hardened ; then
+ if _tc_use_if_iuse hardened ; then
# rebrand to make bug reports easier
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
if hardened_gcc_works ; then
@@ -813,41 +731,6 @@ gcc_version_patch() {
sed -i "${gcc_sed[@]}" "${S}"/gcc/version.c || die
}
-do_gcc_rename_java_bins() {
- # bug #139918 - conflict between gcc and java-config-2 for ownership of
- # /usr/bin/rmi{c,registry}. Done with mv & sed rather than a patch
- # because patches would be large (thanks to the rename of man files),
- # and it's clear from the sed invocations that all that changes is the
- # rmi{c,registry} names to grmi{c,registry} names.
- # Kevin F. Quinn 2006-07-12
- einfo "Renaming jdk executables rmic and rmiregistry to grmic and grmiregistry."
- # 1) Move the man files if present (missing prior to gcc-3.4)
- for manfile in rmic rmiregistry ; do
- [[ -f ${S}/gcc/doc/${manfile}.1 ]] || continue
- mv "${S}"/gcc/doc/${manfile}.1 "${S}"/gcc/doc/g${manfile}.1
- done
- # 2) Fixup references in the docs if present (mission prior to gcc-3.4)
- for jfile in gcc/doc/gcj.info gcc/doc/grmic.1 gcc/doc/grmiregistry.1 gcc/java/gcj.texi ; do
- [[ -f ${S}/${jfile} ]] || continue
- sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} ||
- die "Failed to fixup file ${jfile} for rename to grmiregistry"
- sed -i -e 's:rmic:grmic:g' "${S}"/${jfile} ||
- die "Failed to fixup file ${jfile} for rename to grmic"
- done
- # 3) Fixup Makefiles to build the changed executable names
- # These are present in all 3.x versions, and are the important bit
- # to get gcc to build with the new names.
- for jfile in libjava/Makefile.am libjava/Makefile.in gcc/java/Make-lang.in ; do
- sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} ||
- die "Failed to fixup file ${jfile} for rename to grmiregistry"
- # Careful with rmic on these files; it's also the name of a directory
- # which should be left unchanged. Replace occurrences of 'rmic$',
- # 'rmic_' and 'rmic '.
- sed -i -e 's:rmic\([$_ ]\):grmic\1:g' "${S}"/${jfile} ||
- die "Failed to fixup file ${jfile} for rename to grmic"
- done
-}
-
#---->> src_configure <<----
toolchain_src_configure() {
@@ -973,12 +856,12 @@ toolchain_src_configure() {
fi
# Build compiler itself using LTO
- if tc_version_is_at_least 9.1 && use_if_iuse lto ; then
+ if tc_version_is_at_least 9.1 && _tc_use_if_iuse lto ; then
confgcc+=( --with-build-config=bootstrap-lto )
fi
# Support to disable pch when building libstdcxx
- if tc_version_is_at_least 6.0 && ! use_if_iuse pch ; then
+ if tc_version_is_at_least 6.0 && ! _tc_use_if_iuse pch ; then
confgcc+=( --disable-libstdcxx-pch )
fi
@@ -1051,6 +934,9 @@ toolchain_src_configure() {
esac
if [[ -n ${needed_libc} ]] ; then
local confgcc_no_libc=( --disable-shared )
+ # requires libc: bug #734820
+ tc_version_is_at_least 4.6 && confgcc_no_libc+=( --disable-libquadmath )
+ # requires libc
tc_version_is_at_least 4.8 && confgcc_no_libc+=( --disable-libatomic )
if ! has_version ${CATEGORY}/${needed_libc} ; then
confgcc+=(
@@ -1058,6 +944,14 @@ toolchain_src_configure() {
--disable-threads
--without-headers
)
+ if [[ $needed_libc == glibc ]]; then
+ # By default gcc looks at glibc's headers
+ # to detect long double support. This does
+ # not work for --disable-headers mode.
+ # Any >=glibc-2.4 is good enough for float128.
+ # The option appeared in gcc-4.2.
+ confgcc+=( --with-long-double-128 )
+ fi
elif has_version "${CATEGORY}/${needed_libc}[headers-only(-)]" ; then
confgcc+=(
"${confgcc_no_libc[@]}"
@@ -1088,7 +982,7 @@ toolchain_src_configure() {
# PREFIX
confgcc+=( --with-local-prefix="${TPREFIX}/usr" )
- # enable the CommandLine SDK, Apple no longer installs stuff
+ # enable the configured SDK, Apple no longer installs stuff
# into /usr
if [[ ${CTARGET} == *-darwin* && ${CTARGET##*-darwin} -gt 9 ]]
then
@@ -1281,13 +1175,7 @@ toolchain_src_configure() {
fi
if tc_version_is_at_least 4.0 ; then
- if in_iuse mudflap ; then
- confgcc+=( $(use_enable mudflap libmudflap) )
- else
- confgcc+=( --disable-libmudflap )
- fi
-
- if use_if_iuse libssp ; then
+ if _tc_use_if_iuse libssp ; then
confgcc+=( --enable-libssp )
else
# Not all libcs have ssp built in. I assume only glibc has
@@ -1296,7 +1184,7 @@ toolchain_src_configure() {
if hardened_gcc_is_stable ssp; then
export gcc_cv_libc_provides_ssp=yes
fi
- if use_if_iuse ssp; then
+ if _tc_use_if_iuse ssp; then
# On some targets USE="ssp -libssp" is an invalid
# configuration as target libc does not provide
# stack_chk_* functions. Do not disable libssp there.
@@ -1326,6 +1214,10 @@ toolchain_src_configure() {
confgcc+=( $(use_enable systemtap) )
fi
+ if in_iuse valgrind ; then
+ confgcc+=( $(use_enable valgrind valgrind-annotations) )
+ fi
+
if in_iuse vtv ; then
confgcc+=(
$(use_enable vtv vtable-verify)
@@ -1338,12 +1230,6 @@ toolchain_src_configure() {
confgcc+=( $(use_with zstd) )
fi
- # newer gcc's come with libquadmath, but only fortran uses
- # it, so auto punt it when we don't care
- if tc_version_is_at_least 4.6 && ! is_fortran ; then
- confgcc+=( --disable-libquadmath )
- fi
-
if tc_version_is_at_least 4.6 ; then
confgcc+=( --enable-lto )
elif tc_version_is_at_least 4.5 ; then
@@ -1555,12 +1441,18 @@ downgrade_arch_flags() {
}
gcc_do_filter_flags() {
- # Be conservative here:
- # - don't allow -O3 and like to over-optimize libgcc # 701786
- # - don't allow -O0 to generate potentially invalid startup code
- strip-flags
- filter-flags '-O?'
- append-flags -O2
+ # Allow users to explicitly avoid flag sanitization via
+ # USE=custom-cflags.
+ if ! _tc_use_if_iuse custom-cflags; then
+ # Over-zealous CFLAGS can often cause problems. What may work for one
+ # person may not work for another. To avoid a large influx of bugs
+ # relating to failed builds, we strip most CFLAGS out to ensure as few
+ # problems as possible.
+ strip-flags
+ # Lock gcc at -O2; we want to be conservative here.
+ filter-flags '-O?'
+ append-flags -O2
+ fi
# dont want to funk ourselves
filter-flags '-mabi*' -m31 -m32 -m64
@@ -1689,7 +1581,7 @@ gcc-abi-map() {
local map=()
case ${CTARGET} in
mips*) map=("o32 32" "n32 n32" "n64 64") ;;
- riscv*) map=("lp64d lp64d" "lp64 lp64") ;;
+ riscv*) map=("lp64d lp64d" "lp64 lp64" "ilp32d ilp32d" "ilp32 ilp32") ;;
x86_64*) map=("amd64 m64" "x86 m32" "x32 mx32") ;;
esac
@@ -1738,7 +1630,7 @@ gcc_do_make() {
# resulting binaries natively ^^;
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
else
- if tc_version_is_at_least 3.3 && use_if_iuse pgo; then
+ if tc_version_is_at_least 3.3 && _tc_use_if_iuse pgo; then
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap}
else
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
@@ -1747,8 +1639,7 @@ gcc_do_make() {
# Older versions of GCC could not do profiledbootstrap in parallel due to
# collisions with profiling info.
- # boundschecking also seems to introduce parallel build issues.
- if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] || use_if_iuse boundschecking ; then
+ if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]]; then
! tc_version_is_at_least 4.6 && export MAKEOPTS="${MAKEOPTS} -j1"
fi
@@ -1796,7 +1687,7 @@ gcc_do_make() {
emake -C gcc gnattools
fi
- if ! is_crosscompile && use_if_iuse cxx && use_if_iuse doc ; then
+ if ! is_crosscompile && _tc_use_if_iuse cxx && _tc_use_if_iuse doc ; then
if type -p doxygen > /dev/null ; then
if tc_version_is_at_least 4.3 ; then
cd "${CTARGET}"/libstdc++-v3/doc
@@ -1907,11 +1798,11 @@ toolchain_src_install() {
if [[ -f ${CTARGET}-${x} ]] ; then
if ! is_crosscompile ; then
ln -sf ${CTARGET}-${x} ${x}
- dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
+ dosym ${BINPATH}/${CTARGET}-${x} \
/usr/bin/${x}-${GCC_CONFIG_VER}
fi
# Create versioned symlinks
- dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
+ dosym ${BINPATH}/${CTARGET}-${x} \
/usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER}
fi
@@ -1968,11 +1859,6 @@ toolchain_src_install() {
# prune empty dirs left behind
find "${ED}" -depth -type d -delete 2>/dev/null
- if ! is_crosscompile && [[ ${PN} != "kgcc64" ]] ; then
- exeinto "${DATAPATH#${EPREFIX}}"
- doexe "${FILESDIR}"/c{89,99} || die
- fi
-
# libstdc++.la: Delete as it doesn't add anything useful: g++ itself
# handles linkage correctly in the dynamic & static case. It also just
# causes us pain: any C++ progs/libs linking with libtool will gain a
@@ -2019,7 +1905,7 @@ toolchain_src_install() {
chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${D}${LIBPATH}" 2>/dev/null
# Installing gdb pretty-printers into gdb-specific location.
- local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/}
+ local py gdbdir=/usr/share/gdb/auto-load${LIBPATH}
pushd "${D}${LIBPATH}" >/dev/null
for py in $(find . -name '*-gdb.py') ; do
local multidir=${py%/*}
@@ -2062,6 +1948,12 @@ gcc_movelibs() {
dodir "${HOSTLIBPATH#${EPREFIX}}"
mv "${ED}"/usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die
fi
+ # libgccjit gets installed to /usr/lib, not /usr/$(get_libdir). Probably
+ # due to a bug in gcc build system.
+ if is_jit ; then
+ dodir "${LIBPATH#${EPREFIX}}"
+ mv "${ED}"/usr/lib/libgccjit* "${D}${LIBPATH}" || die
+ fi
# For all the libs that are built for CTARGET, move them into the
# compiler-specific CTARGET internal dir.
@@ -2277,12 +2169,8 @@ toolchain_pkg_postinst() {
# gcc stopped installing .la files fixer in June 2020.
# Cleaning can be removed in June 2022.
rm -f "${EROOT%/}"/sbin/fix_libtool_files.sh
+ rm -f "${EROOT%/}"/usr/sbin/fix_libtool_files.sh
rm -f "${EROOT%/}"/usr/share/gcc-data/fixlafiles.awk
-
- mkdir -p "${EROOT%/}"/usr/bin
- # Since these aren't critical files and portage sucks with
- # handling of binpkgs, don't require these to be found
- cp "${ROOT%/}${DATAPATH}"/c{89,99} "${EROOT%/}"/usr/bin/ 2>/dev/null
fi
}
@@ -2292,11 +2180,6 @@ toolchain_pkg_postrm() {
eselect compiler-shadow clean all
fi
- # to make our lives easier (and saner), we do the fix_libtool stuff here.
- # rather than checking SLOT's and trying in upgrade paths, we just see if
- # the common libstdc++.la exists in the ${LIBPATH} of the gcc that we are
- # unmerging. if it does, that means this was a simple re-emerge.
-
# clean up the cruft left behind by cross-compilers
if is_crosscompile ; then
if [[ -z $(ls "${EROOT%/}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
@@ -2403,44 +2286,48 @@ gcc-lang-supported() {
has $1 ${TOOLCHAIN_ALLOWED_LANGS}
}
+_tc_use_if_iuse() {
+ in_iuse $1 && use $1
+}
+
is_ada() {
gcc-lang-supported ada || return 1
- use_if_iuse ada
+ _tc_use_if_iuse ada
}
is_cxx() {
gcc-lang-supported 'c++' || return 1
- use_if_iuse cxx
+ _tc_use_if_iuse cxx
}
is_d() {
gcc-lang-supported d || return 1
- use_if_iuse d
+ _tc_use_if_iuse d
}
is_f77() {
gcc-lang-supported f77 || return 1
- use_if_iuse fortran
+ _tc_use_if_iuse fortran
}
is_f95() {
gcc-lang-supported f95 || return 1
- use_if_iuse fortran
+ _tc_use_if_iuse fortran
}
is_fortran() {
gcc-lang-supported fortran || return 1
- use_if_iuse fortran
+ _tc_use_if_iuse fortran
}
is_gcj() {
gcc-lang-supported java || return 1
- use_if_iuse cxx && use_if_iuse gcj
+ _tc_use_if_iuse cxx && _tc_use_if_iuse gcj
}
is_go() {
gcc-lang-supported go || return 1
- use_if_iuse cxx && use_if_iuse go
+ _tc_use_if_iuse cxx && _tc_use_if_iuse go
}
is_jit() {
@@ -2449,22 +2336,22 @@ is_jit() {
# to generate code for a target. On target like avr
# libgcclit.so can't link at all: bug #594572
is_crosscompile && return 1
- use_if_iuse jit
+ _tc_use_if_iuse jit
}
is_multilib() {
tc_version_is_at_least 3 || return 1
- use_if_iuse multilib
+ _tc_use_if_iuse multilib
}
is_objc() {
gcc-lang-supported objc || return 1
- use_if_iuse objc
+ _tc_use_if_iuse objc
}
is_objcxx() {
gcc-lang-supported 'obj-c++' || return 1
- use_if_iuse cxx && use_if_iuse objc++
+ _tc_use_if_iuse cxx && _tc_use_if_iuse objc++
}
# Grab a variable from the build system (taken from linux-info.eclass)
@@ -2489,12 +2376,12 @@ hardened_gcc_works() {
[[ ${CTARGET} == *-freebsd* ]] && return 1
want_pie || return 1
- use_if_iuse nopie && return 1
+ _tc_use_if_iuse nopie && return 1
hardened_gcc_is_stable pie
return $?
elif [[ $1 == "ssp" ]] ; then
[[ -n ${SPECS_VER} ]] || return 1
- use_if_iuse nossp && return 1
+ _tc_use_if_iuse nossp && return 1
hardened_gcc_is_stable ssp
return $?
else
@@ -2532,12 +2419,12 @@ want_minispecs() {
if tc_version_is_at_least 6.0 ; then
return 0
fi
- if tc_version_is_at_least 4.3.2 && use_if_iuse hardened ; then
+ if tc_version_is_at_least 4.3.2 && _tc_use_if_iuse hardened ; then
if ! want_pie ; then
ewarn "PIE_VER or SPECS_VER is not defined in the GCC ebuild."
elif use vanilla ; then
ewarn "You will not get hardened features if you have the vanilla USE-flag."
- elif use_if_iuse nopie && use_if_iuse nossp ; then
+ elif _tc_use_if_iuse nopie && _tc_use_if_iuse nossp ; then
ewarn "You will not get hardened features if you have the nopie and nossp USE-flag."
elif ! hardened_gcc_works ; then
ewarn "Your $(tc-arch) arch is not supported."
@@ -2551,11 +2438,12 @@ want_minispecs() {
}
want_pie() {
- ! use_if_iuse hardened && [[ -n ${PIE_VER} ]] && use_if_iuse nopie && return 1
+ ! _tc_use_if_iuse hardened && [[ -n ${PIE_VER} ]] \
+ && _tc_use_if_iuse nopie && return 1
[[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0
tc_version_is_at_least 4.3.2 && return 1
[[ -z ${PIE_VER} ]] && return 1
- use_if_iuse nopie || return 0
+ _tc_use_if_iuse nopie || return 0
return 1
}
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2020-12-15 7:48 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2020-12-15 7:48 UTC (permalink / raw
To: gentoo-commits
commit: a788e4c0792d7b6cd70747d75c01da9cd97df54e
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 15 07:47:24 2020 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Dec 15 07:47:24 2020 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=a788e4c0
eclass/db.eclass: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/db.eclass | 66 ++++++++++++++++++++++++++++++--------------------------
1 file changed, 35 insertions(+), 31 deletions(-)
diff --git a/eclass/db.eclass b/eclass/db.eclass
index 7f80f13823..8d905c9c4e 100644
--- a/eclass/db.eclass
+++ b/eclass/db.eclass
@@ -20,18 +20,19 @@ db_fix_so() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
LIB="${EROOT}/usr/$(get_libdir)"
- cd "${LIB}"
+ cd "${LIB}" || die
# first clean up old symlinks
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname)" -exec rm \{} \;
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname "[23]")" -exec rm \{} \;
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname)" -delete || die
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname "[23]")" -delete || die
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -delete || die
# now rebuild all the correct ones
+ local ext
for ext in so a dylib sl; do
for name in libdb libdb_{cxx,tcl,java,sql,stl}; do
- target=`find . -maxdepth 1 -type f -name "${name}-*.${ext}" |sort -n |tail -n 1`
- [ -n "${target}" ] || continue;
+ target="$(find . -maxdepth 1 -type f -name "${name}-*.${ext}" |sort -V |tail -n 1)"
+ [[ -n "${target}" ]] || continue;
case ${CHOST} in
*-aix*)
aixdll --merge-runtime \
@@ -48,14 +49,15 @@ db_fix_so() {
done;
# db[23] gets some extra-special stuff
- if [ -f libdb1$(get_libname 2) ]; then
+ if [[ -f libdb1$(get_libname 2) ]]; then
ln -sf libdb1$(get_libname 2) libdb$(get_libname 2)
ln -sf libdb1$(get_libname 2) libdb1$(get_libname)
ln -sf libdb1$(get_libname 2) libdb-1$(get_libname)
fi
# what do we do if we ever get 3.3 ?
+ local i
for i in libdb libdb_{cxx,tcl,java,sql,stl}; do
- if [ -f $i-3$(get_libname 2) ]; then
+ if [[ -f $i-3$(get_libname 2) ]]; then
ln -sf $i-3$(get_libname 2) $i-3$(get_libname)
ln -sf $i-3$(get_libname 2) $i$(get_libname 3)
fi
@@ -64,15 +66,15 @@ db_fix_so() {
# do the same for headers now
# but since there are only two of them, just overwrite them
cd "${EROOT}"/usr/include
- target=`find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -n |cut -d/ -f2- | tail -n1`
- if [ -n "${target}" ] && [ -e "${target}/db.h" ] && ( ! [[ -e db.h ]] || [[ -h db.h ]] ); then
+ target="$(find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -V |cut -d/ -f2- | tail -n1)"
+ if [[ -n "${target}" ]] && [[ -e "${target}/db.h" ]] && ( ! [[ -e db.h ]] || [[ -h db.h ]] ); then
einfo "Creating db.h symlinks to ${target}"
ln -sf "${target}"/db.h .
ln -sf "${target}"/db_185.h .
- elif [ ! -e "${target}/db.h" ]; then
- if [ -n "${target}" ]; then
+ elif [[ ! -e "${target}/db.h" ]]; then
+ if [[ -n "${target}" ]]; then
ewarn "Could not find ${target}/db.h"
- elif [ -h db.h ]; then
+ elif [[ -h db.h ]]; then
einfo "Apparently you just removed the last instance of $PN. Removing the symlinks"
rm -f db.h db_185.h
fi
@@ -84,7 +86,7 @@ db_src_install_doc() {
# not everybody wants this wad of documentation as it is primarily API docs
if use doc; then
dodir /usr/share/doc/${PF}/html
- mv "${ED}"/usr/docs/* "${ED}"/usr/share/doc/${PF}/html/
+ mv "${ED}"/usr/docs/* "${ED}"/usr/share/doc/${PF}/html/ || die
rm -rf "${ED}"/usr/docs
else
rm -rf "${ED}"/usr/docs
@@ -96,16 +98,17 @@ db_src_install_doc() {
db_src_install_examples() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
if use examples ; then
- local langs="c cxx stl"
+ local langs=( c cxx stl )
[[ "${IUSE/java}" != "${IUSE}" ]] \
&& use java \
- && langs="${langs} java"
- for i in $langs ; do
+ && langs+=( java )
+ local i
+ for i in ${langs[@]} ; do
destdir="/usr/share/doc/${PF}/"
src="${S}/../examples_${i}/"
- if [ -f "${src}" ]; then
+ if [[ -f "${src}" ]]; then
dodir "${destdir}"
- cp -ra "${src}" "${ED}${destdir}/"
+ cp -ra "${src}" "${ED}${destdir}/" || die
fi
done
fi
@@ -114,6 +117,7 @@ db_src_install_examples() {
db_src_install_usrbinslot() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
# slot all program names to avoid overwriting
+ local fname
for fname in "${ED}"/usr/bin/db*
do
dn="$(dirname "${fname}")"
@@ -128,7 +132,7 @@ db_src_install_headerslot() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
# install all headers in a slotted location
dodir /usr/include/db${SLOT}
- mv "${ED}"/usr/include/*.h "${ED}"/usr/include/db${SLOT}/
+ mv "${ED}"/usr/include/*.h "${ED}"/usr/include/db${SLOT}/ || die
}
db_src_install_usrlibcleanup() {
@@ -137,24 +141,24 @@ db_src_install_usrlibcleanup() {
# Clean out the symlinks so that they will not be recorded in the
# contents (bug #60732)
- if [ "${ED}" = "" ]; then
- die "Calling clean_links while \$ED not defined"
+ if [[ "${ED}" = "" ]]; then
+ die "Calling clean_links while \${ED} not defined"
fi
- if [ -e "${LIB}"/libdb.a ] && [ ! -e "${LIB}"/libdb-${SLOT}.a ]; then
+ if [[ -e "${LIB}"/libdb.a ]] && [[ ! -e "${LIB}"/libdb-${SLOT}.a ]]; then
einfo "Moving libdb.a to a versioned name"
- mv "${LIB}/libdb.a" "${LIB}/libdb-${SLOT}.a"
+ mv "${LIB}/libdb.a" "${LIB}/libdb-${SLOT}.a" || die
fi
- if [ -e "${LIB}"/libdb_cxx.a ] && [ ! -e "${LIB}"/libdb_cxx-${SLOT}.a ]; then
+ if [[ -e "${LIB}"/libdb_cxx.a ]] && [[ ! -e "${LIB}"/libdb_cxx-${SLOT}.a ]]; then
einfo "Moving libdb_cxx.a to a versioned name"
- mv "${LIB}/libdb_cxx.a" "${LIB}/libdb_cxx-${SLOT}.a"
+ mv "${LIB}/libdb_cxx.a" "${LIB}/libdb_cxx-${SLOT}.a" || die
fi
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname)" -exec rm \{} \;
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname "[23]")" -exec rm \{} \;
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname)" -delete || die
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname "[23]")" -delete || die
einfo "removing unversioned static archives"
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -exec rm \{} \;
+ find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -delete || die
rm -f \
"${ED}"/usr/include/{db,db_185}.h \
@@ -174,7 +178,7 @@ db_src_test() {
ewarn "This can take 6+ hours on modern machines"
# Fix stuff that fails with relative paths, and upstream moving files
# around...
- local test_parallel=''
+ local test_parallel='' t
for t in \
"${S}"/test/parallel.tcl \
"${S}"/../test/parallel.tcl \
@@ -200,7 +204,7 @@ db_src_test() {
echo "run_parallel $(makeopts_jobs) run_std" >> testrunner.tcl
tclsh testrunner.tcl
- egrep -qs '^FAIL' ALL.OUT* && die "Some tests failed, please see ${S}/ALL.OUT*"
+ grep -Eqs '^FAIL' ALL.OUT* && die "Some tests failed, please see ${S}/ALL.OUT*"
else
eerror "You must have USE=tcl to run the sys-libs/db testsuite."
fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-01-11 19:53 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-01-11 19:53 UTC (permalink / raw
To: gentoo-commits
commit: a55104775503512dd6d735dd0132bd6f13735212
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 11 19:53:40 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Jan 11 19:53:40 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=a5510477
eclass/db: fix incorrect db 3.2 handling
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/db.eclass | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/eclass/db.eclass b/eclass/db.eclass
index 8d905c9c4e..df1e361e9b 100644
--- a/eclass/db.eclass
+++ b/eclass/db.eclass
@@ -57,9 +57,9 @@ db_fix_so() {
# what do we do if we ever get 3.3 ?
local i
for i in libdb libdb_{cxx,tcl,java,sql,stl}; do
- if [[ -f $i-3$(get_libname 2) ]]; then
- ln -sf $i-3$(get_libname 2) $i-3$(get_libname)
- ln -sf $i-3$(get_libname 2) $i$(get_libname 3)
+ if [[ -f $i-3.2$(get_libname) ]]; then
+ ln -sf $i-3.2$(get_libname) $i-3$(get_libname)
+ ln -sf $i-3.2$(get_libname) $i$(get_libname 3)
fi
done
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-01-12 13:32 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-01-12 13:32 UTC (permalink / raw
To: gentoo-commits
commit: 2b77d5b1db1d723f8ce576a58a0b2dd6a1ce9806
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 12 13:32:35 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Jan 12 13:32:35 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=2b77d5b1
eclass/db: remove AIX stuff
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/db.eclass | 18 +++---------------
1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/eclass/db.eclass b/eclass/db.eclass
index df1e361e9b..96a857a196 100644
--- a/eclass/db.eclass
+++ b/eclass/db.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2017 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: db.eclass
@@ -29,22 +29,10 @@ db_fix_so() {
# now rebuild all the correct ones
local ext
- for ext in so a dylib sl; do
+ for ext in so dylib a; do
for name in libdb libdb_{cxx,tcl,java,sql,stl}; do
target="$(find . -maxdepth 1 -type f -name "${name}-*.${ext}" |sort -V |tail -n 1)"
- [[ -n "${target}" ]] || continue;
- case ${CHOST} in
- *-aix*)
- aixdll --merge-runtime \
- --keepdir=false \
- --target="${name}.${ext}" \
- --current="${target}" \
- `find . -maxdepth 1 -type f -name "${name}-*.${ext}"`
- ;;
- *)
- ln -sf ${target//.\//} ${name}.${ext}
- ;;
- esac;
+ [[ -n "${target}" ]] && ln -sf ${target//.\//} ${name}.${ext}
done;
done;
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-01-14 8:02 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-01-14 8:02 UTC (permalink / raw
To: gentoo-commits
commit: d689573d4e6f4a21922de047db82e8a716f6c633
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 14 08:02:08 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Jan 14 08:02:08 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=d689573d
eclass/toolchain.eclass: set DYLD_LIBRARY_PATH for Darwin9 libstdc++
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index e5d4dd6ca9..6e7411559a 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -2080,6 +2080,19 @@ create_gcc_env_entry() {
GCC_SPECS="${gcc_specs_file}"
MULTIOSDIRS="${mosdirs}"
EOF
+
+ # crude hack, but necessary :(
+ # Darwin9's libstdc++ is incompatible with later GCC's libstdc++
+ # causing ugly malloc warnings about non-aligned pointers, but in
+ # cmake's case, also crashes, unfortunately. See also:
+ # https://trac.macports.org/ticket/59832
+ # our only way out here is to set DYLD_LIBRARY_PATH to replace the
+ # libstdc++ used by the Frameworks that cmake links in
+ if [[ ${CHOST} == *-darwin9 ]] ; then
+ cat <<-EOF >> ${gcc_envd_file}
+ DYLD_LIBRARY_PATH="${LIBPATH}"
+ EOF
+ fi
}
create_revdep_rebuild_entry() {
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-01-24 9:47 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-01-24 9:47 UTC (permalink / raw
To: gentoo-commits
commit: 378beb67f9a4c08e2ad3ffdb0b62af01ceddcf06
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 24 09:44:58 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jan 24 09:44:58 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=378beb67
toolchain-funcs.eclass: drop long gone targets from ninj()
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain-funcs.eclass | 15 ---------------
1 file changed, 15 deletions(-)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index a491b75522..e8541f25b2 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -629,26 +629,11 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
case ${host} in
powerpc-apple-darwin*) echo ppc-macos;;
- powerpc64-apple-darwin*) echo ppc64-macos;;
- i?86-apple-darwin*) echo x86-macos;;
x86_64-apple-darwin*) echo x64-macos;;
sparc-sun-solaris*) echo sparc-solaris;;
sparcv9-sun-solaris*) echo sparc64-solaris;;
i?86-pc-solaris*) echo x86-solaris;;
x86_64-pc-solaris*) echo x64-solaris;;
- powerpc-ibm-aix*) echo ppc-aix;;
- mips-sgi-irix*) echo mips-irix;;
- ia64w-hp-hpux*) echo ia64w-hpux;;
- ia64-hp-hpux*) echo ia64-hpux;;
- hppa*64*-hp-hpux*) echo hppa64-hpux;;
- hppa*-hp-hpux*) echo hppa-hpux;;
- i?86-pc-freebsd*) echo x86-freebsd;;
- x86_64-pc-freebsd*) echo x64-freebsd;;
- powerpc-unknown-openbsd*) echo ppc-openbsd;;
- i?86-pc-openbsd*) echo x86-openbsd;;
- x86_64-pc-openbsd*) echo x64-openbsd;;
- i?86-pc-netbsd*) echo x86-netbsd;;
- i?86-pc-interix*) echo x86-interix;;
i?86-pc-winnt*) echo x86-winnt;;
aarch64*) echo arm64;;
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-02-07 19:23 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-02-07 19:23 UTC (permalink / raw
To: gentoo-commits
commit: 6cc6d48909ec277399f170bf5bcbe56fe337f1ad
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 7 19:22:13 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Feb 7 19:22:13 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=6cc6d489
toolchain-funcs.eclass: forcefully disable softfloat for arm64-macos
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain-funcs.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index c2ac4a5d15..d591c9574e 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -229,7 +229,7 @@ tc-detect-is-softfloat() {
case ${CTARGET:-${CHOST}} in
# Avoid autodetection for bare-metal targets. bug #666896
- *-newlib|*-elf|*-eabi)
+ *-newlib|*-elf|*-eabi|arm64-apple-darwin*)
return 1 ;;
# arm-unknown-linux-gnueabi is ambiguous. We used to treat it as
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-03-13 9:54 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-03-13 9:54 UTC (permalink / raw
To: gentoo-commits
commit: 1cff42d8e2a83f810aba7f77eb3f5128d8074a4b
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 13 09:52:32 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Mar 13 09:53:54 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=1cff42d8
java-utils-2.eclass: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/java-utils-2.eclass | 55 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 49 insertions(+), 6 deletions(-)
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index e8e8575eda..c4d980c607 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 2004-2018 Gentoo Authors
+# Copyright 2004-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-utils-2.eclass
@@ -28,6 +28,8 @@ export WANT_JAVA_CONFIG="2"
# Prefix variables are only available for EAPI>=3
has "${EAPI:-0}" 0 1 2 && ED="${D}" EPREFIX= EROOT="${ROOT}"
+has test ${JAVA_PKG_IUSE} && RESTRICT+=" !test? ( test )"
+
# @VARIABLE: JAVA_PKG_E_DEPEND
# @INTERNAL
# @DESCRIPTION:
@@ -264,7 +266,7 @@ java-pkg_addres() {
}
# @FUNCTION: java-pkg_rm_files
-# @USAGE: java-pkg_rm_files File1.java File2.java ...
+# @USAGE: <File1.java> [File2.java] ...
# @DESCRIPTION:
# Remove unneeded files in ${S}.
#
@@ -416,7 +418,7 @@ java-pkg_regjar() {
# java-pkg_regjar ${ED}/opt/java/*.jar
# such call will fall into this case (-e ${jar}) and will
# record paths with ${D} in package.env
- java-pkg_append_ JAVA_PKG_CLASSPATH "${jar#${D%/}}"
+ java-pkg_append_ JAVA_PKG_CLASSPATH "${jar#${D}}"
else
if [[ ${jar} = *\** ]]; then
eerror "The argument ${jar} to ${FUNCNAME}"
@@ -1863,6 +1865,44 @@ ejunit4() {
ejunit_ "junit-4" "${@}"
}
+# @FUNCTION: etestng
+# @USAGE: etestng_ [-cp $classpath] <test classes>
+# @INTERNAL
+# @DESCRIPTION:
+# Testng wrapper function. Makes it easier to run the tests.
+# Launches the tests using org.testng.TestNG.
+#
+# @CODE
+# $1 - -cp or -classpath
+# $2 - the classpath passed to it
+# $@ - test classes for testng to run.
+# @CODE
+etestng() {
+ debug-print-function ${FUNCNAME} $*
+
+ local runner=org.testng.TestNG
+ local cp=$(java-pkg_getjars --with-dependencies testng)
+ local tests
+
+ if [[ ${1} = -cp || ${1} = -classpath ]]; then
+ cp="${cp}:${2}"
+ shift 2
+ else
+ cp="${cp}:."
+ fi
+
+ for test in ${@}; do
+ tests+="${test},"
+ done
+
+ debug-print "java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\""\
+ "-Djava.awt.headless=true ${runner}"\
+ "-usedefaultlisteners false -testclass ${tests}"
+ java -cp "${cp}" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true\
+ ${runner} -usedefaultlisteners false -testclass ${tests}\
+ || die "Running TestNG failed."
+}
+
# @FUNCTION: java-utils-2_src_prepare
# @DESCRIPTION:
# src_prepare Searches for bundled jars
@@ -2737,10 +2777,13 @@ java-pkg_jar-list() {
java-pkg_verify-classes() {
#$(find ${ED} -type f -name '*.jar' -o -name '*.class')
- local version_verify="${EPREFIX}/usr/bin/class-version-verify.py"
+ local version_verify_1="${EPREFIX}/usr/$(get_libdir)/javatoolkit/bin/class-version-verify.py"
+ local version_verify_2="${EPREFIX}/usr/libexec/javatoolkit/class-version-verify.py"
- if [[ ! -x "${version_verify}" ]]; then
- version_verify="${EPREFIX}/usr/$(get_libdir)/javatoolkit/bin/class-version-verify.py"
+ if [[ -x "${version_verify_1}" ]]; then
+ local version_verify=${version_verify_1}
+ else
+ local version_verify=${version_verify_2}
fi
if [[ ! -x "${version_verify}" ]]; then
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-04-10 7:09 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2021-04-10 7:09 UTC (permalink / raw
To: gentoo-commits
commit: 576b06627578c9846b2b265085c13509692ea49f
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 10 07:08:52 2021 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 10 07:08:52 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=576b0662
python-utils-r1.eclass: sync with ::gentoo
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/python-utils-r1.eclass | 304 +++++++++++-------------------------------
1 file changed, 81 insertions(+), 223 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 1b1f6b4d4b..88b258a7f6 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: python-utils-r1.eclass
@@ -7,7 +7,7 @@
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
# Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 6 7
# @BLURB: Utility functions for packages with Python parts.
# @DESCRIPTION:
# A utility eclass providing functions to query Python implementations,
@@ -19,9 +19,12 @@
# For more information, please see the Python Guide:
# https://dev.gentoo.org/~mgorny/python-guide/
+# NOTE: When dropping support for EAPIs here, we need to update
+# metadata/install-qa-check.d/60python-pyc
+# See bug #704286, bug #781878
case "${EAPI:-0}" in
- [0-4]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
- [5-7]) ;;
+ [0-5]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
+ [6-7]) ;;
*) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
esac
@@ -31,7 +34,6 @@ fi
if [[ ! ${_PYTHON_UTILS_R1} ]]; then
-[[ ${EAPI} == 5 ]] && inherit eutils multilib
inherit toolchain-funcs
# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
@@ -40,8 +42,7 @@ inherit toolchain-funcs
# All supported Python implementations, most preferred last.
_PYTHON_ALL_IMPLS=(
pypy3
- python2_7
- python3_6 python3_7 python3_8 python3_9
+ python3_7 python3_8 python3_9
)
readonly _PYTHON_ALL_IMPLS
@@ -52,8 +53,8 @@ readonly _PYTHON_ALL_IMPLS
_PYTHON_HISTORICAL_IMPLS=(
jython2_7
pypy pypy1_{8,9} pypy2_0
- python2_{5,6}
- python3_{1,2,3,4,5}
+ python2_{5..7}
+ python3_{1..6}
)
readonly _PYTHON_HISTORICAL_IMPLS
@@ -69,38 +70,6 @@ readonly _PYTHON_HISTORICAL_IMPLS
# which can involve revisions of this eclass that support a different
# set of Python implementations.
-# @FUNCTION: _python_impl_supported
-# @USAGE: <impl>
-# @INTERNAL
-# @DESCRIPTION:
-# Check whether the implementation <impl> (PYTHON_COMPAT-form)
-# is still supported.
-#
-# Returns 0 if the implementation is valid and supported. If it is
-# unsupported, returns 1 -- and the caller should ignore the entry.
-# If it is invalid, dies with an appopriate error messages.
-_python_impl_supported() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${#} -eq 1 ]] || die "${FUNCNAME}: takes exactly 1 argument (impl)."
-
- local impl=${1}
-
- # keep in sync with _PYTHON_ALL_IMPLS!
- # (not using that list because inline patterns shall be faster)
- case "${impl}" in
- python2_7|python3_[6789]|pypy3)
- return 0
- ;;
- jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[56]|python3_[12345])
- return 1
- ;;
- *)
- [[ ${PYTHON_COMPAT_NO_STRICT} ]] && return 1
- die "Invalid implementation in PYTHON_COMPAT: ${impl}"
- esac
-}
-
# @FUNCTION: _python_verify_patterns
# @USAGE: <pattern>...
# @INTERNAL
@@ -149,10 +118,26 @@ _python_set_impls() {
if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then
die 'PYTHON_COMPAT must be an array.'
fi
- for i in "${PYTHON_COMPAT[@]}"; do
- # trigger validity checks
- _python_impl_supported "${i}"
- done
+ if [[ ! ${PYTHON_COMPAT_NO_STRICT} ]]; then
+ for i in "${PYTHON_COMPAT[@]}"; do
+ # check for incorrect implementations
+ # we're using pattern matching as an optimization
+ # please keep them in sync with _PYTHON_ALL_IMPLS
+ # and _PYTHON_HISTORICAL_IMPLS
+ case ${i} in
+ jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9])
+ ;;
+ *)
+ if has "${i}" "${_PYTHON_ALL_IMPLS[@]}" \
+ "${_PYTHON_HISTORICAL_IMPLS[@]}"
+ then
+ die "Mis-synced patterns in _python_set_impls: missing ${i}"
+ else
+ die "Invalid implementation in PYTHON_COMPAT: ${i}"
+ fi
+ esac
+ done
+ fi
local supp=() unsupp=()
@@ -165,7 +150,13 @@ _python_set_impls() {
done
if [[ ! ${supp[@]} ]]; then
- die "No supported implementation in PYTHON_COMPAT."
+ # special-case python2_7 for python-any-r1
+ if [[ ${_PYTHON_ALLOW_PY27} ]] && has python2_7 "${PYTHON_COMPAT[@]}"
+ then
+ supp+=( python2_7 )
+ else
+ die "No supported implementation in PYTHON_COMPAT."
+ fi
fi
if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then
@@ -636,6 +627,7 @@ python_optimize() {
local PYTHON=${PYTHON}
[[ ${PYTHON} ]] || _python_export PYTHON
+ [[ -x ${PYTHON} ]] || die "PYTHON (${PYTHON}) is not executable"
# default to sys.path
if [[ ${#} -eq 0 ]]; then
@@ -950,8 +942,6 @@ _python_wrapper_setup() {
[[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON specified."
if [[ ! -x ${workdir}/bin/python ]]; then
- _python_check_dead_variables
-
mkdir -p "${workdir}"/{bin,pkgconfig} || die
# Clean up, in case we were supposed to do a cheap update.
@@ -1058,16 +1048,8 @@ python_is_python3() {
python_is_installed() {
local impl=${1:-${EPYTHON}}
[[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON"
- local hasv_args=()
-
- case ${EAPI} in
- 5|6)
- hasv_args+=( --host-root )
- ;;
- *)
- hasv_args+=( -b )
- ;;
- esac
+ local hasv_args=( -b )
+ [[ ${EAPI} == 6 ]] && hasv_args=( --host-root )
local PYTHON_PKG_DEP
_python_export "${impl}" PYTHON_PKG_DEP
@@ -1214,17 +1196,14 @@ python_fix_shebang() {
done < <(find -H "${path}" -type f -print0 || die)
if [[ ! ${any_fixed} ]]; then
- local cmd=eerror
- [[ ${EAPI} == 5 ]] && cmd=eqawarn
-
- "${cmd}" "QA warning: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files."
+ eerror "QA error: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files."
if [[ ${any_correct} ]]; then
- "${cmd}" "All files have ${EPYTHON} shebang already."
+ eerror "All files have ${EPYTHON} shebang already."
else
- "${cmd}" "There are no Python files in specified directory."
+ eerror "There are no Python files in specified directory."
fi
- [[ ${cmd} == eerror ]] && die "${FUNCNAME} did not match any fixable files (QA warning fatal in EAPI ${EAPI})"
+ die "${FUNCNAME} did not match any fixable files"
fi
done
}
@@ -1321,172 +1300,51 @@ build_sphinx() {
HTML_DOCS+=( "${dir}/_build/html/." )
}
-# -- python.eclass functions --
-
-_python_check_dead_variables() {
- local v
-
- for v in PYTHON_DEPEND PYTHON_USE_WITH{,_OR,_OPT} {RESTRICT,SUPPORT}_PYTHON_ABIS
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Ebuild_head"
- fi
- done
-
- for v in PYTHON_{CPPFLAGS,CFLAGS,CXXFLAGS,LDFLAGS}
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#PYTHON_CFLAGS"
- fi
- done
-
- for v in PYTHON_TESTS_RESTRICTED_ABIS PYTHON_EXPORT_PHASE_FUNCTIONS \
- PYTHON_VERSIONED_{SCRIPTS,EXECUTABLES} PYTHON_NONVERSIONED_EXECUTABLES
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for python-r1 suite"
- fi
- done
-
- for v in DISTUTILS_USE_SEPARATE_SOURCE_DIRECTORIES DISTUTILS_SETUP_FILES \
- DISTUTILS_GLOBAL_OPTIONS DISTUTILS_SRC_TEST PYTHON_MODNAME
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for distutils-r1, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#${v}"
- fi
- done
-
- if [[ ${DISTUTILS_DISABLE_TEST_DEPENDENCY} ]]; then
- die "${v} is invalid for distutils-r1, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#DISTUTILS_SRC_TEST"
- fi
-
- # python.eclass::progress
- for v in PYTHON_BDEPEND PYTHON_MULTIPLE_ABIS PYTHON_ABI_TYPE \
- PYTHON_RESTRICTED_ABIS PYTHON_TESTS_FAILURES_TOLERANT_ABIS \
- PYTHON_CFFI_MODULES_GENERATION_COMMANDS
- do
- if [[ ${!v} ]]; then
- die "${v} is invalid for python-r1 suite"
- fi
- done
-}
-
-python_pkg_setup() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#pkg_setup"
-}
-
-python_convert_shebangs() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#python_convert_shebangs"
-}
-
-python_clean_py-compile_files() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_clean_installation_image() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_execute_function() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#python_execute_function"
-}
-
-python_generate_wrapper_scripts() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_merge_intermediate_installation_images() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_set_active_version() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#pkg_setup"
-}
-
-python_need_rebuild() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-PYTHON() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#.24.28PYTHON.29.2C_.24.7BEPYTHON.7D"
-}
-
-python_get_implementation() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_implementational_package() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_libdir() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_library() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_version() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_get_implementation_and_version() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_execute_nosetests() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_execute_py.test() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_execute_trial() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_enable_pyc() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_disable_pyc() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
-
-python_mod_optimize() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Python_byte-code_compilation"
-}
-
-python_mod_cleanup() {
- die "${FUNCNAME}() is invalid for python-r1 suite, please take a look @ https://wiki.gentoo.org/wiki/Project:Python/Python.eclass_conversion#Python_byte-code_compilation"
-}
+# @FUNCTION: epytest
+# @USAGE: [<args>...]
+# @DESCRIPTION:
+# Run pytest, passing the standard set of pytest options, followed
+# by user-specified options.
+#
+# This command dies on failure and respects nonfatal.
+epytest() {
+ debug-print-function ${FUNCNAME} "${@}"
-# python.eclass::progress
+ [[ -n ${EPYTHON} ]] || die "EPYTHON unset, invalid call context"
-python_abi_depend() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
+ local args=(
+ # verbose progress reporting and tracebacks
+ -vv
+ # list all non-passed tests in the summary for convenience
+ # (includes failures, skips, xfails...)
+ -ra
+ # print local variables in tracebacks, useful for debugging
+ -l
+ )
+ set -- "${EPYTHON}" -m pytest "${args[@]}" "${@}"
-python_install_executables() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
+ echo "${@}" >&2
+ "${@}" || die -n "pytest failed with ${EPYTHON}"
+ return ${?}
}
-python_get_extension_module_suffix() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
+# @FUNCTION: eunittest
+# @USAGE: [<args>...]
+# @DESCRIPTION:
+# Run unit tests using dev-python/unittest-or-fail, passing the standard
+# set of options, followed by user-specified options.
+#
+# This command dies on failure and respects nonfatal.
+eunittest() {
+ debug-print-function ${FUNCNAME} "${@}"
-python_byte-compile_modules() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
+ [[ -n ${EPYTHON} ]] || die "EPYTHON unset, invalid call context"
-python_clean_byte-compiled_modules() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
-}
+ set -- "${EPYTHON}" -m unittest_or_fail discover -v "${@}"
-python_generate_cffi_modules() {
- die "${FUNCNAME}() is invalid for python-r1 suite"
+ echo "${@}" >&2
+ "${@}" || die -n "Tests failed with ${EPYTHON}"
+ return ${?}
}
_PYTHON_UTILS_R1=1
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-04-10 7:15 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2021-04-10 7:15 UTC (permalink / raw
To: gentoo-commits
commit: 3a1668e93a4b74fc147f3664d890ece129446067
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 10 07:15:01 2021 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 10 07:15:01 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=3a1668e9
toolchain-funcs.eclass: sync with ::gentoo
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/toolchain-funcs.eclass | 44 ++++++++++++++++++++++++++++++++++---------
1 file changed, 35 insertions(+), 9 deletions(-)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index d591c9574e..70709b96d6 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1,4 +1,4 @@
-# Copyright 2002-2019 Gentoo Authors
+# Copyright 2002-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: toolchain-funcs.eclass
@@ -73,6 +73,10 @@ tc-getCXX() { tc-getPROG CXX g++ "$@"; }
# @USAGE: [toolchain prefix]
# @RETURN: name of the linker
tc-getLD() { tc-getPROG LD ld "$@"; }
+# @FUNCTION: tc-getSTRINGS
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the strings program
+tc-getSTRINGS() { tc-getPROG STRINGS strings "$@"; }
# @FUNCTION: tc-getSTRIP
# @USAGE: [toolchain prefix]
# @RETURN: name of the strip program
@@ -83,8 +87,12 @@ tc-getSTRIP() { tc-getPROG STRIP strip "$@"; }
tc-getNM() { tc-getPROG NM nm "$@"; }
# @FUNCTION: tc-getRANLIB
# @USAGE: [toolchain prefix]
-# @RETURN: name of the archiver indexer
+# @RETURN: name of the archive indexer
tc-getRANLIB() { tc-getPROG RANLIB ranlib "$@"; }
+# @FUNCTION: tc-getREADELF
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the ELF reader
+tc-getREADELF() { tc-getPROG READELF readelf "$@"; }
# @FUNCTION: tc-getOBJCOPY
# @USAGE: [toolchain prefix]
# @RETURN: name of the object copier
@@ -146,6 +154,10 @@ tc-getBUILD_CXX() { tc-getBUILD_PROG CXX g++ "$@"; }
# @USAGE: [toolchain prefix]
# @RETURN: name of the linker for building binaries to run on the build machine
tc-getBUILD_LD() { tc-getBUILD_PROG LD ld "$@"; }
+# @FUNCTION: tc-getBUILD_STRINGS
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the strings program for building binaries to run on the build machine
+tc-getBUILD_STRINGS() { tc-getBUILD_PROG STRINGS strings "$@"; }
# @FUNCTION: tc-getBUILD_STRIP
# @USAGE: [toolchain prefix]
# @RETURN: name of the strip program for building binaries to run on the build machine
@@ -156,8 +168,12 @@ tc-getBUILD_STRIP() { tc-getBUILD_PROG STRIP strip "$@"; }
tc-getBUILD_NM() { tc-getBUILD_PROG NM nm "$@"; }
# @FUNCTION: tc-getBUILD_RANLIB
# @USAGE: [toolchain prefix]
-# @RETURN: name of the archiver indexer for building binaries to run on the build machine
+# @RETURN: name of the archive indexer for building binaries to run on the build machine
tc-getBUILD_RANLIB() { tc-getBUILD_PROG RANLIB ranlib "$@"; }
+# @FUNCTION: tc-getBUILD_READELF
+# @USAGE: [toolchain prefix]
+# @RETURN: name of the ELF reader for building binaries to run on the build machine
+tc-getBUILD_READELF() { tc-getBUILD_PROG READELF readelf "$@"; }
# @FUNCTION: tc-getBUILD_OBJCOPY
# @USAGE: [toolchain prefix]
# @RETURN: name of the object copier for building binaries to run on the build machine
@@ -378,6 +394,7 @@ tc-env_build() {
NM=$(tc-getBUILD_NM) \
PKG_CONFIG=$(tc-getBUILD_PKG_CONFIG) \
RANLIB=$(tc-getBUILD_RANLIB) \
+ READELF=$(tc-getBUILD_READELF) \
"$@"
}
@@ -490,12 +507,21 @@ tc-ld-is-lld() {
# If the gold linker is currently selected, configure the compilation
# settings so that we use the older bfd linker instead.
tc-ld-disable-gold() {
- if ! tc-ld-is-gold "$@" ; then
- # They aren't using gold, so nothing to do!
+ tc-ld-is-gold "$@" && tc-ld-force-bfd "$@"
+}
+
+# @FUNCTION: tc-ld-force-bfd
+# @USAGE: [toolchain prefix]
+# @DESCRIPTION:
+# If the gold or lld linker is currently selected, configure the compilation
+# settings so that we use the bfd linker instead.
+tc-ld-force-bfd() {
+ if ! tc-ld-is-gold "$@" && ! tc-ld-is-lld "$@" ; then
+ # They aren't using gold or lld, so nothing to do!
return
fi
- ewarn "Forcing usage of the BFD linker instead of GOLD"
+ ewarn "Forcing usage of the BFD linker"
# Set up LD to point directly to bfd if it's available.
# We need to extract the first word in case there are flags appended
@@ -505,7 +531,7 @@ tc-ld-disable-gold() {
local path_ld=$(which "${bfd_ld}" 2>/dev/null)
[[ -e ${path_ld} ]] && export LD=${bfd_ld}
- # Set up LDFLAGS to select gold based on the gcc / clang version.
+ # Set up LDFLAGS to select bfd based on the gcc / clang version.
local fallback="true"
if tc-is-gcc; then
local major=$(gcc-major-version "$@")
@@ -533,7 +559,7 @@ tc-ld-disable-gold() {
ln -sf "${path_ld}" "${d}"/ld
export LDFLAGS="${LDFLAGS} -B${d}"
else
- die "unable to locate a BFD linker to bypass gold"
+ die "unable to locate a BFD linker"
fi
fi
}
@@ -665,7 +691,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
mips*) echo mips;;
nios2*) echo nios2;;
nios*) echo nios;;
- or1k|or32*) echo openrisc;;
+ or1k*|or32*) echo openrisc;;
powerpc*)
# Starting with linux-2.6.15, the 'ppc' and 'ppc64' trees
# have been unified into simply 'powerpc', but until 2.6.16,
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-04-10 7:15 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2021-04-10 7:15 UTC (permalink / raw
To: gentoo-commits
commit: f5a6979fe1a87f55b485b5d20e7989330e1a7777
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 10 07:14:00 2021 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 10 07:14:00 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f5a6979f
flag-o-matic.eclass: sync with ::gentoo
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/flag-o-matic.eclass | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
index f75a975a08..20ee39d98b 100644
--- a/eclass/flag-o-matic.eclass
+++ b/eclass/flag-o-matic.eclass
@@ -234,10 +234,7 @@ append-fflags() {
append-lfs-flags() {
[[ $# -ne 0 ]] && die "append-lfs-flags takes no arguments"
# see comments in filter-lfs-flags func for meaning of these
- case ${CHOST} in
- *-aix*) append-cppflags -D_LARGE_FILES -D_LARGE_FILE_API ;;
- *) append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE ;;
- esac
+ append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
}
# @FUNCTION: append-ldflags
@@ -522,13 +519,13 @@ test-flag-PROG() {
"${test_in}" -o "${test_out}"
)
- if ! "${cmdline[@]}" </dev/null &>/dev/null; then
+ if ! "${cmdline[@]}" &>/dev/null; then
# -Werror makes clang bail out on unused arguments as well;
# try to add -Qunused-arguments to work-around that
# other compilers don't support it but then, it's failure like
# any other
cmdline+=( -Qunused-arguments )
- "${cmdline[@]}" </dev/null &>/dev/null
+ "${cmdline[@]}" &>/dev/null
fi
}
@@ -573,7 +570,8 @@ test-flags-PROG() {
while (( $# )); do
case "$1" in
- --param)
+ # '-B /foo': bug # 687198
+ --param|-B)
if test-flag-${comp} "$1" "$2"; then
flags+=( "$1" "$2" )
fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-04-10 7:15 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2021-04-10 7:15 UTC (permalink / raw
To: gentoo-commits
commit: 00e19f7ec43cd9d94d894f87114fbfab0b405df3
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Apr 10 07:12:24 2021 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Apr 10 07:13:14 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=00e19f7e
autotools.eclass: sync with ::gentoo
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/autotools.eclass | 78 ++++++++++++++++++++++++++++++++++++-------------
1 file changed, 57 insertions(+), 21 deletions(-)
diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index 5a59c8d2d5..ded5436a45 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: autotools.eclass
@@ -34,16 +34,19 @@ esac
inherit libtool
# @ECLASS-VARIABLE: WANT_AUTOCONF
+# @PRE_INHERIT
# @DESCRIPTION:
# The major version of autoconf your package needs
: ${WANT_AUTOCONF:=latest}
# @ECLASS-VARIABLE: WANT_AUTOMAKE
+# @PRE_INHERIT
# @DESCRIPTION:
# The major version of automake your package needs
: ${WANT_AUTOMAKE:=latest}
# @ECLASS-VARIABLE: WANT_LIBTOOL
+# @PRE_INHERIT
# @DESCRIPTION:
# Do you want libtool? Valid values here are "latest" and "none".
: ${WANT_LIBTOOL:=latest}
@@ -54,18 +57,20 @@ inherit libtool
# CONSTANT!
# The latest major unstable and stable version/slot of automake available
# on each arch.
+# Only add unstable version if it is in a different slot than latest stable
+# version.
# 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.
-#
+#
+# See bug #312315 and bug #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.16.1:1.16 1.15.1:1.15 )
+_LATEST_AUTOMAKE=( 1.16.2-r1:1.16 )
_automake_atom="sys-devel/automake"
_autoconf_atom="sys-devel/autoconf"
@@ -73,7 +78,7 @@ if [[ -n ${WANT_AUTOMAKE} ]]; then
case ${WANT_AUTOMAKE} in
# Even if the package doesn't use automake, we still need to depend
# on it because we run aclocal to process m4 macros. This matches
- # the autoreconf tool, so this requirement is correct. #401605
+ # the autoreconf tool, so this requirement is correct, bug #401605.
none) ;;
latest)
# Use SLOT deps if we can. For EAPI=0, we get pretty close.
@@ -118,6 +123,7 @@ AUTOTOOLS_DEPEND="!<sys-devel/gettext-0.18.1.1-r3
RDEPEND=""
# @ECLASS-VARIABLE: AUTOTOOLS_AUTO_DEPEND
+# @PRE_INHERIT
# @DESCRIPTION:
# Set to 'no' to disable automatically adding to DEPEND. This lets
# ebuilds form conditional depends by using ${AUTOTOOLS_DEPEND} in
@@ -139,6 +145,12 @@ unset _automake_atom _autoconf_atom
# Additional options to pass to automake during
# eautoreconf call.
+# @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.
+
# @ECLASS-VARIABLE: AT_NOEAUTOMAKE
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -154,11 +166,13 @@ unset _automake_atom _autoconf_atom
# particular options
# @ECLASS-VARIABLE: AT_M4DIR
+# @DEFAULT_UNSET
# @DESCRIPTION:
# Additional director(y|ies) aclocal should search
: ${AT_M4DIR:=}
# @ECLASS-VARIABLE: AT_SYS_M4DIR
+# @DEFAULT_UNSET
# @INTERNAL
# @DESCRIPTION:
# For system integrators, a list of additional aclocal search paths.
@@ -177,13 +191,13 @@ unset _automake_atom _autoconf_atom
eautoreconf() {
local x g
- # Subdirs often share a common build dir #529404. If so, we can't safely
+ # Subdirs often share a common build dir, bug #529404. If so, we can't safely
# run in parallel because many tools clobber the content in there. Libtool
# and automake both `rm && cp` while aclocal reads the output. We might be
# able to handle this if we split the steps and grab locks on the dirs the
# tools actually write to. Then we'd run all the common tools that use
# those inputs. Doing this in bash does not scale easily.
- # If we do re-enable parallel support, make sure #426512 is handled.
+ # If we do re-enable parallel support, make sure bug #426512 is handled.
if [[ -z ${AT_NO_RECURSIVE} ]] ; then
# Take care of subdirs
for x in $(autotools_check_macro_val AC_CONFIG_SUBDIRS) ; do
@@ -239,7 +253,7 @@ eautoreconf() {
else
eautoconf --force
fi
- eautoheader
+ [[ ${AT_NOEAUTOHEADER} != "yes" ]] && eautoheader
[[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS}
if [[ ${AT_NOELIBTOOLIZE} != "yes" ]] ; then
@@ -289,8 +303,8 @@ eaclocal_amflags() {
[[ -e ${amflags_file} ]] || continue
# setup the env in case the pkg does something crazy
# in their ACLOCAL_AMFLAGS. like run a shell script
- # which turns around and runs autotools. #365401
- # or split across multiple lines. #383525
+ # which turns around and runs autotools (bug #365401)
+ # or split across multiple lines (bug #383525)
autotools_env_setup
aclocal_opts=$(sed -n \
"/^ACLOCAL_AMFLAGS[[:space:]]*=/{ \
@@ -312,7 +326,7 @@ eaclocal_amflags() {
# specified parametes. The name of the tool run is the same of the function
# without e prefix.
# They also force installing the support files for safety.
-# Respects AT_M4DIR for additional directories to search for macro's.
+# Respects AT_M4DIR for additional directories to search for macros.
eaclocal() {
[[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \
autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags)
@@ -360,6 +374,19 @@ eautoconf() {
eqawarn "when it finds this file. See https://bugs.gentoo.org/426262 for details."
fi
+ # Install config.guess and config.sub which are required by many macros
+ # in autoconf >=2.70.
+ local _gnuconfig
+ case ${EAPI:-0} in
+ 0|1|2|3|4|5|6)
+ _gnuconfig="${EPREFIX}/usr/share/gnuconfig"
+ ;;
+ *)
+ _gnuconfig="${BROOT}/usr/share/gnuconfig"
+ ;;
+ esac
+ cp "${_gnuconfig}"/config.{guess,sub} . || die
+
autotools_run_tool --at-m4flags autoconf "$@"
}
@@ -406,7 +433,7 @@ eautomake() {
|| extra_opts+=( --foreign )
# Older versions of automake do not support --force-missing. But we want
- # to use this whenever possible to update random bundled files #133489.
+ # to use this whenever possible to update random bundled files, bug #133489.
case $(_automake_version) in
1.4|1.4[.-]*) ;;
*) extra_opts+=( --force-missing ) ;;
@@ -429,7 +456,16 @@ eautopoint() {
# use gettext directly. So we have to copy it in manually since
# we can't let `autopoint` do it for us.
config_rpath_update() {
- local dst src=$(type -P gettext | sed 's:bin/gettext:share/gettext/config.rpath:')
+ local dst src
+
+ case ${EAPI:-0} in
+ 0|1|2|3|4|5|6)
+ src="${EPREFIX}/usr/share/gettext/config.rpath"
+ ;;
+ *)
+ src="${BROOT}/usr/share/gettext/config.rpath"
+ ;;
+ esac
[[ $# -eq 0 ]] && set -- $(find -name config.rpath)
[[ $# -eq 0 ]] && return 0
@@ -496,17 +532,17 @@ autotools_run_tool() {
done
if [[ ${EBUILD_PHASE} != "unpack" && ${EBUILD_PHASE} != "prepare" ]]; then
- ewarn "QA Warning: running $1 in ${EBUILD_PHASE} phase"
+ ewarn "QA Warning: running '$1' in ${EBUILD_PHASE} phase"
fi
if ${missing_ok} && ! type -P ${1} >/dev/null ; then
- einfo "Skipping '$*' due $1 not installed"
+ einfo "Skipping '$*' because '$1' not installed"
return 0
fi
autotools_env_setup
- # Allow people to pass in full paths. #549268
+ # Allow people to pass in full paths, bug #549268
local STDERR_TARGET="${T}/${1##*/}.out"
# most of the time, there will only be one run, but if there are
# more, make sure we get unique log filenames
@@ -520,7 +556,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.
@@ -535,13 +571,13 @@ autotools_run_tool() {
"$@" >> "${STDERR_TARGET}" 2>&1
if ! eend $? && ${autofail} ; then
echo
- eerror "Failed Running $1 !"
+ eerror "Failed running '$1'!"
eerror
- eerror "Include in your bugreport the contents of:"
+ eerror "Include in your bug report the contents of:"
eerror
eerror " ${STDERR_TARGET}"
echo
- die "Failed Running $1 !"
+ die "Failed running '$1'!"
fi
}
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-05-04 17:09 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-05-04 17:09 UTC (permalink / raw
To: gentoo-commits
commit: 811aed4f00904b87f49ade8e75a1f00683dc9904
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue May 4 17:09:11 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue May 4 17:09:11 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=811aed4f
eclass/python-utils-r1: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 88b258a7f6..5023750fd6 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -42,7 +42,7 @@ inherit toolchain-funcs
# All supported Python implementations, most preferred last.
_PYTHON_ALL_IMPLS=(
pypy3
- python3_7 python3_8 python3_9
+ python3_{7..10}
)
readonly _PYTHON_ALL_IMPLS
@@ -125,7 +125,7 @@ _python_set_impls() {
# please keep them in sync with _PYTHON_ALL_IMPLS
# and _PYTHON_HISTORICAL_IMPLS
case ${i} in
- jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9])
+ jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9]|python3_10)
;;
*)
if has "${i}" "${_PYTHON_ALL_IMPLS[@]}" \
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-05-04 17:20 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-05-04 17:20 UTC (permalink / raw
To: gentoo-commits
commit: 5b4bc212f92575f039a0a39aec988beae66f6701
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue May 4 17:15:51 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue May 4 17:15:51 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=5b4bc212
eclass/flag-o-matic: drop from prefix
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/flag-o-matic.eclass | 776 ---------------------------------------------
1 file changed, 776 deletions(-)
diff --git a/eclass/flag-o-matic.eclass b/eclass/flag-o-matic.eclass
deleted file mode 100644
index 20ee39d98b..0000000000
--- a/eclass/flag-o-matic.eclass
+++ /dev/null
@@ -1,776 +0,0 @@
-# Copyright 1999-2020 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: flag-o-matic.eclass
-# @MAINTAINER:
-# toolchain@gentoo.org
-# @BLURB: common functions to manipulate and query toolchain flags
-# @DESCRIPTION:
-# This eclass contains a suite of functions to help developers sanely
-# and safely manage toolchain flags in their builds.
-
-if [[ -z ${_FLAG_O_MATIC_ECLASS} ]]; then
-_FLAG_O_MATIC_ECLASS=1
-
-inherit eutils toolchain-funcs multilib
-
-# Return all the flag variables that our high level funcs operate on.
-all-flag-vars() {
- echo {ADA,C,CPP,CXX,CCAS,F,FC,LD}FLAGS
-}
-
-# {C,CPP,CXX,CCAS,F,FC,LD}FLAGS that we allow in strip-flags
-# Note: shell globs and character lists are allowed
-setup-allowed-flags() {
- ALLOWED_FLAGS=(
- -pipe -O '-O[12sg]' -mcpu -march -mtune
- '-fstack-protector*' '-fsanitize*' '-fstack-check*' -fno-stack-check
- -fbounds-check -fbounds-checking -fno-strict-overflow
- -fno-PIE -fno-pie -nopie -no-pie -fno-unit-at-a-time
-
- # debugging symbols should generally be very safe to add
- -g '-g[0-9]'
- -ggdb '-ggdb[0-9]'
- -gdwarf '-gdwarf-*'
- -gstabs -gstabs+
- -gz
-
- -fno-ident -fpermissive -frecord-gcc-switches
- '-fdiagnostics*' '-fplugin*'
- '-W*' -w
-
- # CPPFLAGS and LDFLAGS
- '-[DUILR]*' '-Wl,*'
-
- # Linker choice flag
- '-fuse-ld'
- )
-
- # allow a bunch of flags that negate features / control ABI
- ALLOWED_FLAGS+=(
- '-fno-stack-protector*' '-fabi-version=*'
- -fno-strict-aliasing -fno-bounds-check -fno-bounds-checking -fstrict-overflow
- -fno-omit-frame-pointer '-fno-builtin*'
- )
- ALLOWED_FLAGS+=(
- -mregparm -mno-app-regs -mapp-regs -mno-mmx -mno-sse
- -mno-sse2 -mno-sse3 -mno-ssse3 -mno-sse4 -mno-sse4.1 -mno-sse4.2
- -mno-avx -mno-aes -mno-pclmul -mno-sse4a -mno-3dnow -mno-popcnt
- -mno-abm -mips1 -mips2 -mips3 -mips4 -mips32 -mips64 -mips16 -mplt
- -msoft-float -mno-soft-float -mhard-float -mno-hard-float -mfpu
- -mieee -mieee-with-inexact -mschedule -mfloat-gprs -mspe -mno-spe
- -mtls-direct-seg-refs -mno-tls-direct-seg-refs -mflat -mno-flat
- -mno-faster-structs -mfaster-structs -m32 -m64 -mx32 -mabi
- -mlittle-endian -mbig-endian -EL -EB -fPIC -mlive-g0 -mcmodel
- -mstack-bias -mno-stack-bias -msecure-plt '-m*-toc' -mfloat-abi
- -mfix-r4000 -mno-fix-r4000 -mfix-r4400 -mno-fix-r4400
- -mfix-rm7000 -mno-fix-rm7000 -mfix-r10000 -mno-fix-r10000
- -mr10k-cache-barrier -mthumb -marm
-
- # gcc 4.5
- -mno-fma4 -mno-movbe -mno-xop -mno-lwp
- # gcc 4.6
- -mno-fsgsbase -mno-rdrnd -mno-f16c -mno-bmi -mno-tbm
- # gcc 4.7
- -mno-avx2 -mno-bmi2 -mno-fma -mno-lzcnt
- # gcc 4.8
- -mno-fxsr -mno-hle -mno-rtm -mno-xsave -mno-xsaveopt
- # gcc 4.9
- -mno-avx512cd -mno-avx512er -mno-avx512f -mno-avx512pf -mno-sha
- )
-
- # Allow some safe individual flags. Should come along with the bug reference.
- ALLOWED_FLAGS+=(
- # Allow explicit stack realignment to run non-conformant
- # binaries: bug #677852
- -mstackrealign
- )
-}
-
-# inverted filters for hardened compiler. This is trying to unpick
-# the hardened compiler defaults.
-_filter-hardened() {
- local f
- for f in "$@" ; do
- case "${f}" in
- # Ideally we should only concern ourselves with PIE flags,
- # not -fPIC or -fpic, but too many places filter -fPIC without
- # thinking about -fPIE.
- -fPIC|-fpic|-fPIE|-fpie|-Wl,pie|-pie)
- gcc-specs-pie || continue
- if ! is-flagq -nopie && ! is-flagq -no-pie ; then
- # Support older Gentoo form first (-nopie) before falling
- # back to the official gcc-6+ form (-no-pie).
- if test-flags -nopie >/dev/null ; then
- append-flags -nopie
- else
- append-flags -no-pie
- fi
- fi
- ;;
- -fstack-protector)
- gcc-specs-ssp || continue
- is-flagq -fno-stack-protector || append-flags $(test-flags -fno-stack-protector);;
- -fstack-protector-all)
- gcc-specs-ssp-to-all || continue
- is-flagq -fno-stack-protector-all || append-flags $(test-flags -fno-stack-protector-all);;
- -fno-strict-overflow)
- gcc-specs-nostrict || continue
- is-flagq -fstrict-overflow || append-flags $(test-flags -fstrict-overflow);;
- esac
- done
-}
-
-# Remove occurrences of strings from variable given in $1
-# Strings removed are matched as globs, so for example
-# '-O*' would remove -O1, -O2 etc.
-_filter-var() {
- local f x var=$1 new=()
- shift
-
- for f in ${!var} ; do
- for x in "$@" ; do
- # Note this should work with globs like -O*
- [[ ${f} == ${x} ]] && continue 2
- done
- new+=( "${f}" )
- done
- export ${var}="${new[*]}"
-}
-
-# @FUNCTION: filter-flags
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Remove particular <flags> from {C,CPP,CXX,CCAS,F,FC,LD}FLAGS. Accepts shell globs.
-filter-flags() {
- _filter-hardened "$@"
- local v
- for v in $(all-flag-vars) ; do
- _filter-var ${v} "$@"
- done
- return 0
-}
-
-# @FUNCTION: filter-lfs-flags
-# @DESCRIPTION:
-# Remove flags that enable Large File Support.
-filter-lfs-flags() {
- [[ $# -ne 0 ]] && die "filter-lfs-flags takes no arguments"
- # http://www.gnu.org/s/libc/manual/html_node/Feature-Test-Macros.html
- # _LARGEFILE_SOURCE: enable support for new LFS funcs (ftello/etc...)
- # _LARGEFILE64_SOURCE: enable support for 64bit variants (off64_t/fseeko64/etc...)
- # _FILE_OFFSET_BITS: default to 64bit variants (off_t is defined as off64_t)
- filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-}
-
-# @FUNCTION: filter-ldflags
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Remove particular <flags> from LDFLAGS. Accepts shell globs.
-filter-ldflags() {
- _filter-var LDFLAGS "$@"
- return 0
-}
-
-# @FUNCTION: append-cppflags
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Add extra <flags> to the current CPPFLAGS.
-append-cppflags() {
- [[ $# -eq 0 ]] && return 0
- export CPPFLAGS+=" $*"
- return 0
-}
-
-# @FUNCTION: append-cflags
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Add extra <flags> to the current CFLAGS. If a flag might not be supported
-# with different compilers (or versions), then use test-flags-CC like so:
-# @CODE
-# append-cflags $(test-flags-CC -funky-flag)
-# @CODE
-append-cflags() {
- [[ $# -eq 0 ]] && return 0
- # Do not do automatic flag testing ourselves. #417047
- export CFLAGS+=" $*"
- return 0
-}
-
-# @FUNCTION: append-cxxflags
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Add extra <flags> to the current CXXFLAGS. If a flag might not be supported
-# with different compilers (or versions), then use test-flags-CXX like so:
-# @CODE
-# append-cxxflags $(test-flags-CXX -funky-flag)
-# @CODE
-append-cxxflags() {
- [[ $# -eq 0 ]] && return 0
- # Do not do automatic flag testing ourselves. #417047
- export CXXFLAGS+=" $*"
- return 0
-}
-
-# @FUNCTION: append-fflags
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Add extra <flags> to the current {F,FC}FLAGS. If a flag might not be supported
-# with different compilers (or versions), then use test-flags-F77 like so:
-# @CODE
-# append-fflags $(test-flags-F77 -funky-flag)
-# @CODE
-append-fflags() {
- [[ $# -eq 0 ]] && return 0
- # Do not do automatic flag testing ourselves. #417047
- export FFLAGS+=" $*"
- export FCFLAGS+=" $*"
- return 0
-}
-
-# @FUNCTION: append-lfs-flags
-# @DESCRIPTION:
-# Add flags that enable Large File Support.
-append-lfs-flags() {
- [[ $# -ne 0 ]] && die "append-lfs-flags takes no arguments"
- # see comments in filter-lfs-flags func for meaning of these
- append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-}
-
-# @FUNCTION: append-ldflags
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Add extra <flags> to the current LDFLAGS.
-append-ldflags() {
- [[ $# -eq 0 ]] && return 0
- local flag
- for flag in "$@"; do
- [[ ${flag} == -l* ]] && \
- eqawarn "Appending a library link instruction (${flag}); libraries to link to should not be passed through LDFLAGS"
- done
-
- export LDFLAGS="${LDFLAGS} $*"
- return 0
-}
-
-# @FUNCTION: append-flags
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Add extra <flags> to your current {C,CXX,F,FC}FLAGS.
-append-flags() {
- [[ $# -eq 0 ]] && return 0
- case " $* " in
- *' '-[DIU]*) eqawarn 'please use append-cppflags for preprocessor flags' ;;
- *' '-L*|\
- *' '-Wl,*) eqawarn 'please use append-ldflags for linker flags' ;;
- esac
- append-cflags "$@"
- append-cxxflags "$@"
- append-fflags "$@"
- return 0
-}
-
-# @FUNCTION: replace-flags
-# @USAGE: <old> <new>
-# @DESCRIPTION:
-# Replace the <old> flag with <new>. Accepts shell globs for <old>.
-replace-flags() {
- [[ $# != 2 ]] && die "Usage: replace-flags <old flag> <new flag>"
-
- local f var new
- for var in $(all-flag-vars) ; do
- # Looping over the flags instead of using a global
- # substitution ensures that we're working with flag atoms.
- # Otherwise globs like -O* have the potential to wipe out the
- # list of flags.
- new=()
- for f in ${!var} ; do
- # Note this should work with globs like -O*
- [[ ${f} == ${1} ]] && f=${2}
- new+=( "${f}" )
- done
- export ${var}="${new[*]}"
- done
-
- return 0
-}
-
-# @FUNCTION: replace-cpu-flags
-# @USAGE: <old> <new>
-# @DESCRIPTION:
-# Replace cpu flags (like -march/-mcpu/-mtune) that select the <old> cpu
-# with flags that select the <new> cpu. Accepts shell globs for <old>.
-replace-cpu-flags() {
- local newcpu="$#" ; newcpu="${!newcpu}"
- while [ $# -gt 1 ] ; do
- # quote to make sure that no globbing is done (particularly on
- # ${oldcpu}) prior to calling replace-flags
- replace-flags "-march=${1}" "-march=${newcpu}"
- replace-flags "-mcpu=${1}" "-mcpu=${newcpu}"
- replace-flags "-mtune=${1}" "-mtune=${newcpu}"
- shift
- done
- return 0
-}
-
-_is_flagq() {
- local x var="$1[*]"
- for x in ${!var} ; do
- [[ ${x} == $2 ]] && return 0
- done
- return 1
-}
-
-# @FUNCTION: is-flagq
-# @USAGE: <flag>
-# @DESCRIPTION:
-# Returns shell true if <flag> is in {C,CXX,F,FC}FLAGS, else returns shell false. Accepts shell globs.
-is-flagq() {
- [[ -n $2 ]] && die "Usage: is-flag <flag>"
-
- local var
- for var in $(all-flag-vars) ; do
- _is_flagq ${var} "$1" && return 0
- done
- return 1
-}
-
-# @FUNCTION: is-flag
-# @USAGE: <flag>
-# @DESCRIPTION:
-# Echo's "true" if flag is set in {C,CXX,F,FC}FLAGS. Accepts shell globs.
-is-flag() {
- is-flagq "$@" && echo true
-}
-
-# @FUNCTION: is-ldflagq
-# @USAGE: <flag>
-# @DESCRIPTION:
-# Returns shell true if <flag> is in LDFLAGS, else returns shell false. Accepts shell globs.
-is-ldflagq() {
- [[ -n $2 ]] && die "Usage: is-ldflag <flag>"
- _is_flagq LDFLAGS $1
-}
-
-# @FUNCTION: is-ldflag
-# @USAGE: <flag>
-# @DESCRIPTION:
-# Echo's "true" if flag is set in LDFLAGS. Accepts shell globs.
-is-ldflag() {
- is-ldflagq "$@" && echo true
-}
-
-# @FUNCTION: filter-mfpmath
-# @USAGE: <math types>
-# @DESCRIPTION:
-# Remove specified math types from the fpmath flag. For example, if the user
-# has -mfpmath=sse,386, running `filter-mfpmath sse` will leave the user with
-# -mfpmath=386.
-filter-mfpmath() {
- local orig_mfpmath new_math prune_math
-
- # save the original -mfpmath flag
- orig_mfpmath=$(get-flag -mfpmath)
- # get the value of the current -mfpmath flag
- new_math=$(get-flag mfpmath)
- # convert "both" to something we can filter
- new_math=${new_math/both/387,sse}
- new_math=" ${new_math//[,+]/ } "
- # figure out which math values are to be removed
- prune_math=""
- for prune_math in "$@" ; do
- new_math=${new_math/ ${prune_math} / }
- done
- new_math=$(echo ${new_math})
- new_math=${new_math// /,}
-
- if [[ -z ${new_math} ]] ; then
- # if we're removing all user specified math values are
- # slated for removal, then we just filter the flag
- filter-flags ${orig_mfpmath}
- else
- # if we only want to filter some of the user specified
- # math values, then we replace the current flag
- replace-flags ${orig_mfpmath} -mfpmath=${new_math}
- fi
- return 0
-}
-
-# @FUNCTION: strip-flags
-# @DESCRIPTION:
-# Strip *FLAGS of everything except known good/safe flags. This runs over all
-# flags returned by all_flag_vars().
-strip-flags() {
- [[ $# -ne 0 ]] && die "strip-flags takes no arguments"
- local x y var
-
- local ALLOWED_FLAGS
- setup-allowed-flags
-
- set -f # disable pathname expansion
-
- for var in $(all-flag-vars) ; do
- local new=()
-
- for x in ${!var} ; do
- local flag=${x%%=*}
- for y in "${ALLOWED_FLAGS[@]}" ; do
- if [[ -z ${flag%%${y}} ]] ; then
- new+=( "${x}" )
- break
- fi
- done
- done
-
- # In case we filtered out all optimization flags fallback to -O2
- if _is_flagq ${var} "-O*" && ! _is_flagq new "-O*" ; then
- new+=( -O2 )
- fi
-
- if [[ ${!var} != "${new[*]}" ]] ; then
- einfo "strip-flags: ${var}: changed '${!var}' to '${new[*]}'"
- fi
- export ${var}="${new[*]}"
- done
-
- set +f # re-enable pathname expansion
-
- return 0
-}
-
-test-flag-PROG() {
- local comp=$1
- local lang=$2
- shift 2
-
- if [[ -z ${comp} ]]; then
- return 1
- fi
- if [[ -z $1 ]]; then
- return 1
- fi
-
- # verify selected compiler exists before using it
- comp=($(tc-get${comp}))
- # 'comp' can already contain compiler options.
- # 'type' needs a binary name
- if ! type -p ${comp[0]} >/dev/null; then
- return 1
- fi
-
- # Set up test file.
- local in_src in_ext cmdline_extra=()
- case "${lang}" in
- # compiler/assembler only
- c)
- in_ext='c'
- in_src='int main(void) { return 0; }'
- cmdline_extra+=(-xc -c)
- ;;
- c++)
- in_ext='cc'
- in_src='int main(void) { return 0; }'
- cmdline_extra+=(-xc++ -c)
- ;;
- f77)
- in_ext='f'
- # fixed source form
- in_src=' end'
- cmdline_extra+=(-xf77 -c)
- ;;
- f95)
- in_ext='f90'
- in_src='end'
- cmdline_extra+=(-xf95 -c)
- ;;
-
- # C compiler/assembler/linker
- c+ld)
- in_ext='c'
- in_src='int main(void) { return 0; }'
- cmdline_extra+=(-xc)
- ;;
- esac
- local test_in=${T}/test-flag.${in_ext}
- local test_out=${T}/test-flag.exe
-
- printf "%s\n" "${in_src}" > "${test_in}" || die "Failed to create '${test_in}'"
-
- # Currently we rely on warning-free output of a compiler
- # before the flag to see if a flag prduces any warnings.
- # This has a few drawbacks:
- # - if compiler already generates warnings we filter out
- # every single flag: bug #712488
- # - if user actually wants to see warnings we just strip
- # them regardless of warnings type.
- #
- # We can add more selective detection of no-op flags via
- # '-Werror=ignored-optimization-argument' and similar error options
- # similar to what we are doing with '-Qunused-arguments'.
- local cmdline=(
- "${comp[@]}"
- # Clang will warn about unknown gcc flags but exit 0.
- # Need -Werror to force it to exit non-zero.
- -Werror
- "$@"
- # -x<lang> options need to go before first source file
- "${cmdline_extra[@]}"
-
- "${test_in}" -o "${test_out}"
- )
-
- if ! "${cmdline[@]}" &>/dev/null; then
- # -Werror makes clang bail out on unused arguments as well;
- # try to add -Qunused-arguments to work-around that
- # other compilers don't support it but then, it's failure like
- # any other
- cmdline+=( -Qunused-arguments )
- "${cmdline[@]}" &>/dev/null
- fi
-}
-
-# @FUNCTION: test-flag-CC
-# @USAGE: <flag>
-# @DESCRIPTION:
-# Returns shell true if <flag> is supported by the C compiler, else returns shell false.
-test-flag-CC() { test-flag-PROG "CC" c "$@"; }
-
-# @FUNCTION: test-flag-CXX
-# @USAGE: <flag>
-# @DESCRIPTION:
-# Returns shell true if <flag> is supported by the C++ compiler, else returns shell false.
-test-flag-CXX() { test-flag-PROG "CXX" c++ "$@"; }
-
-# @FUNCTION: test-flag-F77
-# @USAGE: <flag>
-# @DESCRIPTION:
-# Returns shell true if <flag> is supported by the Fortran 77 compiler, else returns shell false.
-test-flag-F77() { test-flag-PROG "F77" f77 "$@"; }
-
-# @FUNCTION: test-flag-FC
-# @USAGE: <flag>
-# @DESCRIPTION:
-# Returns shell true if <flag> is supported by the Fortran 90 compiler, else returns shell false.
-test-flag-FC() { test-flag-PROG "FC" f95 "$@"; }
-
-# @FUNCTION: test-flag-CCLD
-# @USAGE: <flag>
-# @DESCRIPTION:
-# Returns shell true if <flag> is supported by the C compiler and linker, else returns shell false.
-test-flag-CCLD() { test-flag-PROG "CC" c+ld "$@"; }
-
-test-flags-PROG() {
- local comp=$1
- local flags=()
- local x
-
- shift
-
- [[ -z ${comp} ]] && return 1
-
- while (( $# )); do
- case "$1" in
- # '-B /foo': bug # 687198
- --param|-B)
- if test-flag-${comp} "$1" "$2"; then
- flags+=( "$1" "$2" )
- fi
- shift 2
- ;;
- *)
- if test-flag-${comp} "$1"; then
- flags+=( "$1" )
- fi
- shift 1
- ;;
- esac
- done
-
- echo "${flags[*]}"
-
- # Just bail if we dont have any flags
- [[ ${#flags[@]} -gt 0 ]]
-}
-
-# @FUNCTION: test-flags-CC
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Returns shell true if <flags> are supported by the C compiler, else returns shell false.
-test-flags-CC() { test-flags-PROG "CC" "$@"; }
-
-# @FUNCTION: test-flags-CXX
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Returns shell true if <flags> are supported by the C++ compiler, else returns shell false.
-test-flags-CXX() { test-flags-PROG "CXX" "$@"; }
-
-# @FUNCTION: test-flags-F77
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Returns shell true if <flags> are supported by the Fortran 77 compiler, else returns shell false.
-test-flags-F77() { test-flags-PROG "F77" "$@"; }
-
-# @FUNCTION: test-flags-FC
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Returns shell true if <flags> are supported by the Fortran 90 compiler, else returns shell false.
-test-flags-FC() { test-flags-PROG "FC" "$@"; }
-
-# @FUNCTION: test-flags-CCLD
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Returns shell true if <flags> are supported by the C compiler and default linker, else returns shell false.
-test-flags-CCLD() { test-flags-PROG "CCLD" "$@"; }
-
-# @FUNCTION: test-flags
-# @USAGE: <flags>
-# @DESCRIPTION:
-# Short-hand that should hopefully work for both C and C++ compiler, but
-# its really only present due to the append-flags() abomination.
-test-flags() { test-flags-CC "$@"; }
-
-# @FUNCTION: test_version_info
-# @USAGE: <version>
-# @DESCRIPTION:
-# Returns shell true if the current C compiler version matches <version>, else returns shell false.
-# Accepts shell globs.
-test_version_info() {
- if [[ $($(tc-getCC) --version 2>&1) == *$1* ]]; then
- return 0
- else
- return 1
- fi
-}
-
-# @FUNCTION: strip-unsupported-flags
-# @DESCRIPTION:
-# Strip {C,CXX,F,FC}FLAGS of any flags not supported by the active toolchain.
-strip-unsupported-flags() {
- [[ $# -ne 0 ]] && die "strip-unsupported-flags takes no arguments"
- export CFLAGS=$(test-flags-CC ${CFLAGS})
- export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS})
- export FFLAGS=$(test-flags-F77 ${FFLAGS})
- export FCFLAGS=$(test-flags-FC ${FCFLAGS})
- export LDFLAGS=$(test-flags-CCLD ${LDFLAGS})
-}
-
-# @FUNCTION: get-flag
-# @USAGE: <flag>
-# @DESCRIPTION:
-# Find and echo the value for a particular flag. Accepts shell globs.
-get-flag() {
- [[ $# -ne 1 ]] && die "usage: <flag>"
- local f var findflag="$1"
-
- # this code looks a little flaky but seems to work for
- # everything we want ...
- # for example, if CFLAGS="-march=i686":
- # `get-flag -march` == "-march=i686"
- # `get-flag march` == "i686"
- for var in $(all-flag-vars) ; do
- for f in ${!var} ; do
- if [ "${f/${findflag}}" != "${f}" ] ; then
- printf "%s\n" "${f/-${findflag}=}"
- return 0
- fi
- done
- done
- return 1
-}
-
-# @FUNCTION: replace-sparc64-flags
-# @DESCRIPTION:
-# Sets mcpu to v8 and uses the original value as mtune if none specified.
-replace-sparc64-flags() {
- [[ $# -ne 0 ]] && die "replace-sparc64-flags takes no arguments"
- local SPARC64_CPUS="ultrasparc3 ultrasparc v9"
-
- if [ "${CFLAGS/mtune}" != "${CFLAGS}" ]; then
- for x in ${SPARC64_CPUS}; do
- CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8}"
- done
- else
- for x in ${SPARC64_CPUS}; do
- CFLAGS="${CFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}"
- done
- fi
-
- if [ "${CXXFLAGS/mtune}" != "${CXXFLAGS}" ]; then
- for x in ${SPARC64_CPUS}; do
- CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8}"
- done
- else
- for x in ${SPARC64_CPUS}; do
- CXXFLAGS="${CXXFLAGS/-mcpu=${x}/-mcpu=v8 -mtune=${x}}"
- done
- fi
-
- export CFLAGS CXXFLAGS
-}
-
-# @FUNCTION: append-libs
-# @USAGE: <libs>
-# @DESCRIPTION:
-# Add extra <libs> to the current LIBS. All arguments should be prefixed with
-# either -l or -L. For compatibility, if arguments are not prefixed as
-# options, they are given a -l prefix automatically.
-append-libs() {
- [[ $# -eq 0 ]] && return 0
- local flag
- for flag in "$@"; do
- if [[ -z "${flag// }" ]]; then
- eqawarn "Appending an empty argument to LIBS is invalid! Skipping."
- continue
- fi
- case $flag in
- -[lL]*)
- export LIBS="${LIBS} ${flag}"
- ;;
- -*)
- eqawarn "Appending non-library to LIBS (${flag}); Other linker flags should be passed via LDFLAGS"
- export LIBS="${LIBS} ${flag}"
- ;;
- *)
- export LIBS="${LIBS} -l${flag}"
- esac
- done
-
- return 0
-}
-
-# @FUNCTION: raw-ldflags
-# @USAGE: [flags]
-# @DESCRIPTION:
-# Turn C style ldflags (-Wl,-foo) into straight ldflags - the results
-# are suitable for passing directly to 'ld'; note LDFLAGS is usually passed
-# to gcc where it needs the '-Wl,'.
-#
-# If no flags are specified, then default to ${LDFLAGS}.
-raw-ldflags() {
- local x input="$@"
- [[ -z ${input} ]] && input=${LDFLAGS}
- set --
- for x in ${input} ; do
- case ${x} in
- -Wl,*)
- x=${x#-Wl,}
- set -- "$@" ${x//,/ }
- ;;
- *) # Assume it's a compiler driver flag, so throw it away #441808
- ;;
- esac
- done
- echo "$@"
-}
-
-# @FUNCTION: no-as-needed
-# @RETURN: Flag to disable asneeded behavior for use with append-ldflags.
-no-as-needed() {
- [[ $# -ne 0 ]] && die "no-as-needed takes no arguments"
- case $($(tc-getLD) -v 2>&1 </dev/null) in
- *GNU*) # GNU ld
- echo "-Wl,--no-as-needed" ;;
- esac
-}
-
-fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-05-04 17:20 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-05-04 17:20 UTC (permalink / raw
To: gentoo-commits
commit: d971f4704326c583cb3bc8425997851f9df96579
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue May 4 17:13:42 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue May 4 17:13:42 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=d971f470
eclass/db: drop from prefix
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/db.eclass | 199 -------------------------------------------------------
1 file changed, 199 deletions(-)
diff --git a/eclass/db.eclass b/eclass/db.eclass
deleted file mode 100644
index 96a857a196..0000000000
--- a/eclass/db.eclass
+++ /dev/null
@@ -1,199 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: db.eclass
-# @MAINTAINER:
-# base-system@gentoo.org
-# @BLURB: Internal eclass used by sys-libs/db ebuilds
-
-inherit eutils multilib multiprocessing
-
-IUSE="doc test examples"
-
-EXPORT_FUNCTIONS src_test
-
-DEPEND="test? ( >=dev-lang/tcl-8.4 )"
-
-RDEPEND=""
-
-db_fix_so() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
- LIB="${EROOT}/usr/$(get_libdir)"
-
- cd "${LIB}" || die
-
- # first clean up old symlinks
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname)" -delete || die
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname "[23]")" -delete || die
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -delete || die
-
- # now rebuild all the correct ones
- local ext
- for ext in so dylib a; do
- for name in libdb libdb_{cxx,tcl,java,sql,stl}; do
- target="$(find . -maxdepth 1 -type f -name "${name}-*.${ext}" |sort -V |tail -n 1)"
- [[ -n "${target}" ]] && ln -sf ${target//.\//} ${name}.${ext}
- done;
- done;
-
- # db[23] gets some extra-special stuff
- if [[ -f libdb1$(get_libname 2) ]]; then
- ln -sf libdb1$(get_libname 2) libdb$(get_libname 2)
- ln -sf libdb1$(get_libname 2) libdb1$(get_libname)
- ln -sf libdb1$(get_libname 2) libdb-1$(get_libname)
- fi
- # what do we do if we ever get 3.3 ?
- local i
- for i in libdb libdb_{cxx,tcl,java,sql,stl}; do
- if [[ -f $i-3.2$(get_libname) ]]; then
- ln -sf $i-3.2$(get_libname) $i-3$(get_libname)
- ln -sf $i-3.2$(get_libname) $i$(get_libname 3)
- fi
- done
-
- # do the same for headers now
- # but since there are only two of them, just overwrite them
- cd "${EROOT}"/usr/include
- target="$(find . -maxdepth 1 -type d -name 'db[0-9]*' | sort -V |cut -d/ -f2- | tail -n1)"
- if [[ -n "${target}" ]] && [[ -e "${target}/db.h" ]] && ( ! [[ -e db.h ]] || [[ -h db.h ]] ); then
- einfo "Creating db.h symlinks to ${target}"
- ln -sf "${target}"/db.h .
- ln -sf "${target}"/db_185.h .
- elif [[ ! -e "${target}/db.h" ]]; then
- if [[ -n "${target}" ]]; then
- ewarn "Could not find ${target}/db.h"
- elif [[ -h db.h ]]; then
- einfo "Apparently you just removed the last instance of $PN. Removing the symlinks"
- rm -f db.h db_185.h
- fi
- fi
-}
-
-db_src_install_doc() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
- # not everybody wants this wad of documentation as it is primarily API docs
- if use doc; then
- dodir /usr/share/doc/${PF}/html
- mv "${ED}"/usr/docs/* "${ED}"/usr/share/doc/${PF}/html/ || die
- rm -rf "${ED}"/usr/docs
- else
- rm -rf "${ED}"/usr/docs
- fi
-
- db_src_install_examples
-}
-
-db_src_install_examples() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
- if use examples ; then
- local langs=( c cxx stl )
- [[ "${IUSE/java}" != "${IUSE}" ]] \
- && use java \
- && langs+=( java )
- local i
- for i in ${langs[@]} ; do
- destdir="/usr/share/doc/${PF}/"
- src="${S}/../examples_${i}/"
- if [[ -f "${src}" ]]; then
- dodir "${destdir}"
- cp -ra "${src}" "${ED}${destdir}/" || die
- fi
- done
- fi
-}
-
-db_src_install_usrbinslot() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
- # slot all program names to avoid overwriting
- local fname
- for fname in "${ED}"/usr/bin/db*
- do
- dn="$(dirname "${fname}")"
- bn="$(basename "${fname}")"
- bn="${bn/db/db${SLOT}}"
- mv "${fname}" "${dn}/${bn}" || \
- die "Failed to rename ${fname} to ${dn}/${bn}"
- done
-}
-
-db_src_install_headerslot() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
- # install all headers in a slotted location
- dodir /usr/include/db${SLOT}
- mv "${ED}"/usr/include/*.h "${ED}"/usr/include/db${SLOT}/ || die
-}
-
-db_src_install_usrlibcleanup() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
- LIB="${ED}/usr/$(get_libdir)"
- # Clean out the symlinks so that they will not be recorded in the
- # contents (bug #60732)
-
- if [[ "${ED}" = "" ]]; then
- die "Calling clean_links while \${ED} not defined"
- fi
-
- if [[ -e "${LIB}"/libdb.a ]] && [[ ! -e "${LIB}"/libdb-${SLOT}.a ]]; then
- einfo "Moving libdb.a to a versioned name"
- mv "${LIB}/libdb.a" "${LIB}/libdb-${SLOT}.a" || die
- fi
-
- if [[ -e "${LIB}"/libdb_cxx.a ]] && [[ ! -e "${LIB}"/libdb_cxx-${SLOT}.a ]]; then
- einfo "Moving libdb_cxx.a to a versioned name"
- mv "${LIB}/libdb_cxx.a" "${LIB}/libdb_cxx-${SLOT}.a" || die
- fi
-
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname)" -delete || die
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*'"$(get_libname "[23]")" -delete || die
- einfo "removing unversioned static archives"
- find "${LIB}" -maxdepth 1 -type l -name 'libdb[1._-]*a' -delete || die
-
- rm -f \
- "${ED}"/usr/include/{db,db_185}.h \
- "${LIB}"/libdb{,_{cxx,sql,stl,java,tcl}}.a
-}
-
-db_src_test() {
- if [[ $UID -eq 0 ]]; then
- M="You must run the testsuite as non-root, skipping"
- ewarn "${M}"
- elog "${M}"
- return 0
- fi
-
- if use tcl; then
- einfo "Running sys-libs/db testsuite"
- ewarn "This can take 6+ hours on modern machines"
- # Fix stuff that fails with relative paths, and upstream moving files
- # around...
- local test_parallel='' t
- for t in \
- "${S}"/test/parallel.tcl \
- "${S}"/../test/parallel.tcl \
- "${S}"/test/tcl/parallel.tcl \
- "${S}"/../test/tcl/parallel.tcl \
- ; do
- [[ -f "${t}" ]] && test_parallel="${t}" && break
- done
-
- sed -ri \
- -e '/regsub .test_path ./s,(regsub),#\1,g' \
- -e '/regsub .src_root ./s,(regsub),#\1,g' \
- -e '/regsub .tcl_utils ./s,(regsub),#\1,g' \
- "${test_parallel}"
- cd "${S}"
- for t in \
- ../test/test.tcl \
- ../test/tcl/test.tcl \
- ; do
- [[ -f "${t}" ]] && testbase="${t}" && break
- done
- echo "source ${t}" > testrunner.tcl
- echo "run_parallel $(makeopts_jobs) run_std" >> testrunner.tcl
-
- tclsh testrunner.tcl
- grep -Eqs '^FAIL' ALL.OUT* && die "Some tests failed, please see ${S}/ALL.OUT*"
- else
- eerror "You must have USE=tcl to run the sys-libs/db testsuite."
- fi
-}
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-05-04 17:20 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-05-04 17:20 UTC (permalink / raw
To: gentoo-commits
commit: eabb513a9e31d0c5f12742fd8183527a6a7cc766
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue May 4 17:17:57 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue May 4 17:17:57 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=eabb513a
eclass/java-utils-2: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/java-utils-2.eclass | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index c4d980c607..cef79405bf 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 2004-2020 Gentoo Authors
+# Copyright 2004-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-utils-2.eclass
@@ -1484,7 +1484,6 @@ java-pkg_ensure-vm-version-sufficient() {
# @FUNCTION: java-pkg_is-vm-version-sufficient
# @INTERNAL
-# @DESCRIPTION:
# @RETURN: zero - VM is sufficient; non-zero - VM is not sufficient
java-pkg_is-vm-version-sufficient() {
debug-print-function ${FUNCNAME} $*
@@ -2194,8 +2193,6 @@ use_doc() {
java-pkg_init() {
debug-print-function ${FUNCNAME} $*
- [[ ${CHOST} == *-winnt* ]] && return
-
# Don't set up build environment if installing from binary. #206024 #258423
[[ "${MERGE_TYPE}" == "binary" ]] && return
# Also try Portage's nonstandard EMERGE_FROM for old EAPIs, if it doesn't
@@ -2600,14 +2597,14 @@ java-pkg_needs-vm() {
# @FUNCTION: java-pkg_get-current-vm
# @INTERNAL
-# @RETURN - The current VM being used
+# @RETURN: The current VM being used
java-pkg_get-current-vm() {
java-config -f
}
# @FUNCTION: java-pkg_get-vm-vendor
# @INTERNAL
-# @RETURN - The vendor of the current VM
+# @RETURN: The vendor of the current VM
java-pkg_get-vm-vendor() {
debug-print-function ${FUNCNAME} $*
@@ -2618,7 +2615,7 @@ java-pkg_get-vm-vendor() {
# @FUNCTION: java-pkg_get-vm-version
# @INTERNAL
-# @RETURN - The version of the current VM
+# @RETURN: The version of the current VM
java-pkg_get-vm-version() {
debug-print-function ${FUNCNAME} $*
@@ -2627,12 +2624,12 @@ java-pkg_get-vm-version() {
# @FUNCTION: java-pkg_build-vm-from-handle
# @INTERNAL
+# @RETURN: VM handle of an available JDK
# @DESCRIPTION:
# Selects a build vm from a list of vm handles. First checks for the system-vm
# beeing usable, then steps through the listed handles till a suitable vm is
# found.
#
-# @RETURN - VM handle of an available JDK
java-pkg_build-vm-from-handle() {
debug-print-function ${FUNCNAME} "$*"
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-05-04 17:20 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-05-04 17:20 UTC (permalink / raw
To: gentoo-commits
commit: 5983d5a7f7dc72f345af2575639d2f4b1dacd3f6
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue May 4 17:12:29 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue May 4 17:12:29 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=5983d5a7
eclass/autotools: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/autotools.eclass | 110 +++++++++++++++++++++++-------------------------
1 file changed, 53 insertions(+), 57 deletions(-)
diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index ded5436a45..196d5075f4 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -4,7 +4,7 @@
# @ECLASS: autotools.eclass
# @MAINTAINER:
# base-system@gentoo.org
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7
# @BLURB: Regenerates auto* build scripts
# @DESCRIPTION:
# This eclass is for safely handling autotooled software packages that need to
@@ -19,19 +19,23 @@ if [[ ${__AUTOTOOLS_AUTO_DEPEND+set} == "set" ]] ; then
# 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 autotools.eclass first! ${__AUTOTOOLS_AUTO_DEPEND} -> ${AUTOTOOLS_AUTO_DEPEND}"
+ die "AUTOTOOLS_AUTO_DEPEND changed value between inherits; please inherit ${ECLASS} first! ${__AUTOTOOLS_AUTO_DEPEND} -> ${AUTOTOOLS_AUTO_DEPEND}"
fi
fi
-if [[ -z ${_AUTOTOOLS_ECLASS} ]]; then
+if [[ -z ${_AUTOTOOLS_ECLASS} ]] ; then
_AUTOTOOLS_ECLASS=1
-case ${EAPI:-0} in
- 0|1|2|3|4|5|6|7) ;;
+case ${EAPI} in
+ 5|6)
+ # Needed for eqawarn
+ inherit eutils
+ ;;
+ 7) ;;
*) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
esac
-inherit libtool
+inherit gnuconfig libtool
# @ECLASS-VARIABLE: WANT_AUTOCONF
# @PRE_INHERIT
@@ -74,21 +78,14 @@ _LATEST_AUTOMAKE=( 1.16.2-r1:1.16 )
_automake_atom="sys-devel/automake"
_autoconf_atom="sys-devel/autoconf"
-if [[ -n ${WANT_AUTOMAKE} ]]; then
+if [[ -n ${WANT_AUTOMAKE} ]] ; then
case ${WANT_AUTOMAKE} in
# Even if the package doesn't use automake, we still need to depend
# on it because we run aclocal to process m4 macros. This matches
# the autoreconf tool, so this requirement is correct, bug #401605.
none) ;;
- latest)
- # Use SLOT deps if we can. For EAPI=0, we get pretty close.
- if [[ ${EAPI:-0} != 0 ]] ; then
- _automake_atom="|| ( `printf '>=sys-devel/automake-%s:%s ' ${_LATEST_AUTOMAKE[@]/:/ }` )"
- else
- _automake_atom="|| ( `printf '>=sys-devel/automake-%s ' ${_LATEST_AUTOMAKE[@]/%:*}` )"
- fi
- ;;
- *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*" ;;
+ latest) _automake_atom="|| ( `printf '>=sys-devel/automake-%s:%s ' ${_LATEST_AUTOMAKE[@]/:/ }` )" ;;
+ *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*";;
esac
export WANT_AUTOMAKE
fi
@@ -114,10 +111,12 @@ 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}
+# @ECLASS-VARIABLE: AUTOTOOLS_DEPEND
+# @INTERNAL
+# @DESCRIPTION:
+# Contains the combination of requested automake/autoconf/libtool
+# versions in *DEPEND format.
+AUTOTOOLS_DEPEND="${_automake_atom}
${_autoconf_atom}
${_libtool_atom}"
RDEPEND=""
@@ -130,8 +129,8 @@ RDEPEND=""
# their own DEPEND string.
: ${AUTOTOOLS_AUTO_DEPEND:=yes}
if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then
- case ${EAPI:-0} in
- 0|1|2|3|4|5|6) DEPEND=${AUTOTOOLS_DEPEND} ;;
+ case ${EAPI} in
+ 5|6) DEPEND=${AUTOTOOLS_DEPEND} ;;
7) BDEPEND=${AUTOTOOLS_DEPEND} ;;
esac
fi
@@ -144,12 +143,14 @@ unset _automake_atom _autoconf_atom
# @DESCRIPTION:
# Additional options to pass to automake during
# eautoreconf call.
+: ${AM_OPTS:=}
# @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
# @DEFAULT_UNSET
@@ -157,6 +158,7 @@ unset _automake_atom _autoconf_atom
# Don't run eautomake command if set to 'yes'; only used to workaround
# broken packages. Generally you should, instead, fix the package to
# not call AM_INIT_AUTOMAKE if it doesn't actually use automake.
+: ${AT_NOEAUTOMAKE:=}
# @ECLASS-VARIABLE: AT_NOELIBTOOLIZE
# @DEFAULT_UNSET
@@ -164,6 +166,7 @@ unset _automake_atom _autoconf_atom
# Don't run elibtoolize command if set to 'yes',
# useful when elibtoolize needs to be ran with
# particular options
+: ${AT_NOELIBTOOLIZE:=}
# @ECLASS-VARIABLE: AT_M4DIR
# @DEFAULT_UNSET
@@ -248,7 +251,7 @@ eautoreconf() {
done
${rerun_aclocal} && eaclocal
- if [[ ${WANT_AUTOCONF} = 2.1 ]] ; then
+ if [[ ${WANT_AUTOCONF} == "2.1" ]] ; then
eautoconf
else
eautoconf --force
@@ -268,6 +271,7 @@ eautoreconf() {
# @FUNCTION: _at_uses_pkg
# @USAGE: <macros>
# @INTERNAL
+# @DESCRIPTION:
# See if the specified macros are enabled.
_at_uses_pkg() {
if [[ -n $(autotools_check_macro "$@") ]] ; then
@@ -340,7 +344,7 @@ eaclocal() {
_elibtoolize() {
local LIBTOOLIZE=${LIBTOOLIZE:-$(type -P glibtoolize > /dev/null && echo glibtoolize || echo libtoolize)}
- if [[ $1 == "--auto-ltdl" ]] ; then
+ if [[ ${1} == "--auto-ltdl" ]] ; then
shift
_at_uses_libltdl && set -- "$@" --ltdl
fi
@@ -368,6 +372,7 @@ eautoconf() {
echo
die "No configure.{ac,in} present!"
fi
+
if [[ ${WANT_AUTOCONF} != "2.1" && -e configure.in ]] ; then
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"
@@ -376,15 +381,7 @@ eautoconf() {
# Install config.guess and config.sub which are required by many macros
# in autoconf >=2.70.
- local _gnuconfig
- case ${EAPI:-0} in
- 0|1|2|3|4|5|6)
- _gnuconfig="${EPREFIX}/usr/share/gnuconfig"
- ;;
- *)
- _gnuconfig="${BROOT}/usr/share/gnuconfig"
- ;;
- esac
+ local _gnuconfig=$(gnuconfig_findnewest)
cp "${_gnuconfig}"/config.{guess,sub} . || die
autotools_run_tool --at-m4flags autoconf "$@"
@@ -412,7 +409,7 @@ eautomake() {
if [[ -z ${makefile_name} ]] ; then
_at_uses_automake || return 0
- elif [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]]; then
+ elif [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]] ; then
local used_automake
local installed_automake
@@ -420,7 +417,7 @@ eautomake() {
used_automake=$(head -n 1 < ${makefile_name%.am}.in | \
sed -e 's:.*by automake \(.*\) from .*:\1:')
- if [[ ${installed_automake} != ${used_automake} ]]; then
+ if [[ ${installed_automake} != ${used_automake} ]] ; then
ewarn "Automake used for the package (${used_automake}) differs from" \
"the installed version (${installed_automake})."
ewarn "Forcing a full rebuild of the autotools to workaround."
@@ -435,8 +432,8 @@ eautomake() {
# Older versions of automake do not support --force-missing. But we want
# to use this whenever possible to update random bundled files, bug #133489.
case $(_automake_version) in
- 1.4|1.4[.-]*) ;;
- *) extra_opts+=( --force-missing ) ;;
+ 1.4|1.4[.-]*) ;;
+ *) extra_opts+=( --force-missing ) ;;
esac
autotools_run_tool automake --add-missing --copy "${extra_opts[@]}" "$@"
@@ -458,8 +455,8 @@ eautopoint() {
config_rpath_update() {
local dst src
- case ${EAPI:-0} in
- 0|1|2|3|4|5|6)
+ case ${EAPI} in
+ 5|6)
src="${EPREFIX}/usr/share/gettext/config.rpath"
;;
*)
@@ -493,7 +490,7 @@ autotools_env_setup() {
for pv in ${_LATEST_AUTOMAKE[@]/#*:} ; do
# Break on first hit to respect _LATEST_AUTOMAKE order.
local hv_args=""
- case ${EAPI:-0} in
+ case ${EAPI} in
5|6)
hv_args="--host-root"
;;
@@ -506,7 +503,6 @@ autotools_env_setup() {
[[ ${WANT_AUTOMAKE} == "latest" ]] && \
die "Cannot find the latest automake! Tried ${_LATEST_AUTOMAKE[*]}"
fi
- [[ ${WANT_AUTOMAKE} == "latest" ]] && export WANT_AUTOMAKE=${_LATEST_AUTOMAKE[0]#*:}
[[ ${WANT_AUTOCONF} == "latest" ]] && export WANT_AUTOCONF=2.5
}
@@ -519,24 +515,24 @@ autotools_env_setup() {
autotools_run_tool() {
# Process our own internal flags first
local autofail=true m4flags=false missing_ok=false return_output=false
- while [[ -n $1 ]] ; do
- case $1 in
- --at-no-fail) autofail=false;;
- --at-m4flags) m4flags=true;;
- --at-missing) missing_ok=true;;
- --at-output) return_output=true;;
- # whatever is left goes to the actual tool
- *) break;;
+ while [[ -n ${1} ]] ; do
+ case ${1} in
+ --at-no-fail) autofail=false ;;
+ --at-m4flags) m4flags=true ;;
+ --at-missing) missing_ok=true ;;
+ --at-output) return_output=true ;;
+ # whatever is left goes to the actual tool
+ *) break ;;
esac
shift
done
- if [[ ${EBUILD_PHASE} != "unpack" && ${EBUILD_PHASE} != "prepare" ]]; then
- ewarn "QA Warning: running '$1' in ${EBUILD_PHASE} phase"
+ if [[ ${EBUILD_PHASE_FUNC} != "src_unpack" && ${EBUILD_PHASE_FUNC} != "src_prepare" ]] ; then
+ eqawarn "Running '${1}' in ${EBUILD_PHASE_FUNC} phase"
fi
if ${missing_ok} && ! type -P ${1} >/dev/null ; then
- einfo "Skipping '$*' because '$1' not installed"
+ einfo "Skipping '$*' because '${1}' not installed"
return 0
fi
@@ -565,19 +561,19 @@ autotools_run_tool() {
return
fi
- printf "***** $1 *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}"
+ printf "***** ${1} *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}"
- ebegin "Running $@"
+ ebegin "Running '$@'"
"$@" >> "${STDERR_TARGET}" 2>&1
if ! eend $? && ${autofail} ; then
echo
- eerror "Failed running '$1'!"
+ eerror "Failed running '${1}'!"
eerror
eerror "Include in your bug report the contents of:"
eerror
eerror " ${STDERR_TARGET}"
echo
- die "Failed running '$1'!"
+ die "Failed running '${1}'!"
fi
}
@@ -650,7 +646,7 @@ _autotools_m4dir_include() {
# We handle it below
-${flag}) ;;
*)
- [[ ! -d ${x} ]] && ewarn "autotools.eclass: '${x}' does not exist"
+ [[ ! -d ${x} ]] && ewarn "${ECLASS}: '${x}' does not exist"
include_opts+=" -${flag} ${x}"
;;
esac
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-05-04 17:20 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-05-04 17:20 UTC (permalink / raw
To: gentoo-commits
commit: 6029c8fcb03f40eba4da6e9d870b91de43670c67
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue May 4 17:20:52 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue May 4 17:20:52 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=6029c8fc
eclass/toolchain: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 6e7411559a..e85900934f 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -173,7 +173,16 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
tc_version_is_at_least 6.5 &&
IUSE+=" graphite" TC_FEATURES+=(graphite)
tc_version_is_between 4.9 8 && IUSE+=" cilk"
- tc_version_is_at_least 4.9 && IUSE+=" ada +vtv"
+ tc_version_is_at_least 4.9 && IUSE+=" ada"
+
+ # Don't enable USE=vtv starting from gcc-10. Once gcc-10
+ # stable everywhere disable by default on older versions
+ # as well.
+ if tc_version_is_at_least 10; then
+ IUSE+=" vtv"
+ elif tc_version_is_at_least 4.9; then
+ IUSE+=" +vtv"
+ fi
tc_version_is_at_least 5.0 && IUSE+=" jit"
tc_version_is_between 5.0 9 && IUSE+=" mpx"
tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch"
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-06-29 6:23 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-06-29 6:23 UTC (permalink / raw
To: gentoo-commits
commit: ae01728421dd36f2c5d669cc1d0edfbdef5cc479
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 29 06:22:14 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Jun 29 06:22:52 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ae017284
eclass/*: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/java-utils-2.eclass | 37 +++++----------
eclass/python-utils-r1.eclass | 102 ++++++++++++++++++++++++------------------
eclass/toolchain-funcs.eclass | 29 ++++--------
eclass/toolchain.eclass | 5 ++-
4 files changed, 81 insertions(+), 92 deletions(-)
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index cef79405bf..1b7fcc295a 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -6,6 +6,7 @@
# java@gentoo.org
# @AUTHOR:
# Thomas Matthijs <axxo@gentoo.org>, Karl Trygve Kalleberg <karltk@gentoo.org>
+# @SUPPORTED_EAPIS: 5 6 7
# @BLURB: Base eclass for Java packages
# @DESCRIPTION:
# This eclass provides functionality which is used by java-pkg-2.eclass,
@@ -16,18 +17,23 @@
# that have optional Java support. In addition you can inherit java-ant-2 for
# Ant-based packages.
+case ${EAPI:-0} in
+ [567]) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+if [[ -z ${_JAVA_UTILS_2_ECLASS} ]] ; then
+_JAVA_UTILS_2_ECLASS=1
+
# EAPI 7 has version functions built-in. Use eapi7-ver for all earlier eclasses.
# Keep versionator inheritance in case consumers are using it implicitly.
-[[ ${EAPI} == [0123456] ]] && inherit eapi7-ver eutils multilib versionator
+[[ ${EAPI} == [56] ]] && inherit eapi7-ver eutils multilib versionator
IUSE="elibc_FreeBSD"
# Make sure we use java-config-2
export WANT_JAVA_CONFIG="2"
-# Prefix variables are only available for EAPI>=3
-has "${EAPI:-0}" 0 1 2 && ED="${D}" EPREFIX= EROOT="${ROOT}"
-
has test ${JAVA_PKG_IUSE} && RESTRICT+=" !test? ( test )"
# @VARIABLE: JAVA_PKG_E_DEPEND
@@ -975,10 +981,6 @@ java-pkg_jar-from() {
[[ -z ${target_pkg} ]] && die "Must specify a package"
- if [[ "${EAPI}" == "1" ]]; then
- target_pkg="${target_pkg//:/-}"
- fi
-
# default destjar to the target jar
[[ -z "${destjar}" ]] && destjar="${target_jar}"
@@ -1114,10 +1116,6 @@ java-pkg_getjars() {
local pkgs="${1}"
- if [[ "${EAPI}" == "1" ]]; then
- pkgs="${pkgs//:/-}"
- fi
-
jars="$(java-config ${deep} --classpath=${pkgs})"
[[ $? != 0 ]] && die "java-config --classpath=${pkgs} failed"
debug-print "${pkgs}:${jars}"
@@ -1183,10 +1181,6 @@ java-pkg_getjar() {
local pkg="${1}" target_jar="${2}" jar
- if [[ "${EAPI}" == "1" ]]; then
- pkg="${pkg//:/-}"
- fi
-
[[ -z ${pkg} ]] && die "Must specify package to get a jar from"
[[ -z ${target_jar} ]] && die "Must specify jar to get"
@@ -1272,10 +1266,6 @@ java-pkg_register-dependency() {
[[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified"
- if [[ "${EAPI}" == "1" ]]; then
- pkgs="${pkgs//:/-}"
- fi
-
if [[ -z "${jar}" ]]; then
for pkg in ${pkgs//,/ }; do
java-pkg_ensure-dep runtime "${pkg}"
@@ -1329,10 +1319,6 @@ java-pkg_register-optional-dependency() {
[[ -z "${pkgs}" ]] && die "${FUNCNAME} called with no package(s) specified"
- if [[ "${EAPI}" == "1" ]]; then
- pkgs="${pkgs//:/-}"
- fi
-
if [[ -z "${jar}" ]]; then
for pkg in ${pkgs//,/ }; do
java-pkg_record-jar_ --optional "${pkg}"
@@ -2195,9 +2181,6 @@ java-pkg_init() {
# Don't set up build environment if installing from binary. #206024 #258423
[[ "${MERGE_TYPE}" == "binary" ]] && return
- # Also try Portage's nonstandard EMERGE_FROM for old EAPIs, if it doesn't
- # work nothing is lost.
- has ${EAPI:-0} 0 1 2 3 && [[ "${EMERGE_FROM}" == "binary" ]] && return
unset JAVAC
unset JAVA_HOME
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 5023750fd6..0c173e2308 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -7,7 +7,7 @@
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
# Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 6 7 8
# @BLURB: Utility functions for packages with Python parts.
# @DESCRIPTION:
# A utility eclass providing functions to query Python implementations,
@@ -24,7 +24,7 @@
# See bug #704286, bug #781878
case "${EAPI:-0}" in
[0-5]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
- [6-7]) ;;
+ [6-8]) ;;
*) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
esac
@@ -34,6 +34,7 @@ fi
if [[ ! ${_PYTHON_UTILS_R1} ]]; then
+[[ ${EAPI} == [67] ]] && inherit eapi8-dosym
inherit toolchain-funcs
# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
@@ -42,7 +43,7 @@ inherit toolchain-funcs
# All supported Python implementations, most preferred last.
_PYTHON_ALL_IMPLS=(
pypy3
- python3_{7..10}
+ python3_{8..10}
)
readonly _PYTHON_ALL_IMPLS
@@ -54,7 +55,7 @@ _PYTHON_HISTORICAL_IMPLS=(
jython2_7
pypy pypy1_{8,9} pypy2_0
python2_{5..7}
- python3_{1..6}
+ python3_{1..7}
)
readonly _PYTHON_HISTORICAL_IMPLS
@@ -188,11 +189,8 @@ _python_set_impls() {
# of the patterns following it. Return 0 if it does, 1 otherwise.
# Matches if no patterns are provided.
#
-# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns can be
-# either:
-# a) fnmatch-style patterns, e.g. 'python2*', 'pypy'...
-# b) '-2' to indicate all Python 2 variants (= !python_is_python3)
-# c) '-3' to indicate all Python 3 variants (= python_is_python3)
+# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns
+# are fnmatch-style.
_python_impl_matches() {
[[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter"
[[ ${#} -eq 1 ]] && return 0
@@ -201,15 +199,30 @@ _python_impl_matches() {
shift
for pattern; do
- if [[ ${pattern} == -2 ]]; then
- python_is_python3 "${impl}" || return 0
- elif [[ ${pattern} == -3 ]]; then
- python_is_python3 "${impl}" && return 0
- return
- # unify value style to allow lax matching
- elif [[ ${impl/./_} == ${pattern/./_} ]]; then
- return 0
- fi
+ case ${pattern} in
+ -2|python2*|pypy)
+ if [[ ${EAPI} != [67] ]]; then
+ eerror
+ eerror "Python 2 is no longer supported in Gentoo, please remove Python 2"
+ eerror "${FUNCNAME[1]} calls."
+ die "Passing ${pattern} to ${FUNCNAME[1]} is banned in EAPI ${EAPI}"
+ fi
+ ;;
+ -3)
+ # NB: "python3*" is fine, as "not pypy3"
+ if [[ ${EAPI} != [67] ]]; then
+ eerror
+ eerror "Python 2 is no longer supported in Gentoo, please remove Python 2"
+ eerror "${FUNCNAME[1]} calls."
+ die "Passing ${pattern} to ${FUNCNAME[1]} is banned in EAPI ${EAPI}"
+ fi
+ return 0
+ ;;
+ *)
+ # unify value style to allow lax matching
+ [[ ${impl/./_} == ${pattern/./_} ]] && return 0
+ ;;
+ esac
done
return 1
@@ -265,6 +278,8 @@ python_export() {
eqawarn "python_export() is part of private eclass API."
eqawarn "Please call python_get*() instead."
+ [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
+
_python_export "${@}"
}
@@ -690,7 +705,7 @@ python_optimize() {
python_scriptinto() {
debug-print-function ${FUNCNAME} "${@}"
- python_scriptroot=${1}
+ _PYTHON_SCRIPTROOT=${1}
}
# @FUNCTION: python_doexe
@@ -725,7 +740,7 @@ python_newexe() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
[[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>"
- local wrapd=${python_scriptroot:-/usr/bin}
+ local wrapd=${_PYTHON_SCRIPTROOT:-/usr/bin}
local f=${1}
local newfn=${2}
@@ -742,8 +757,9 @@ python_newexe() {
)
# install the wrapper
- _python_ln_rel "${ED%/}"/usr/lib/python-exec/python-exec2 \
- "${ED%/}/${wrapd}/${newfn}" || die
+ local dosym=dosym
+ [[ ${EAPI} == [67] ]] && dosym=dosym8
+ "${dosym}" -r /usr/lib/python-exec/python-exec2 "${wrapd}/${newfn}"
# don't use this at home, just call python_doscript() instead
if [[ ${_PYTHON_REWRITE_SHEBANG} ]]; then
@@ -829,7 +845,7 @@ python_newscript() {
python_moduleinto() {
debug-print-function ${FUNCNAME} "${@}"
- python_moduleroot=${1}
+ _PYTHON_MODULEROOT=${1}
}
# @FUNCTION: python_domodule
@@ -853,15 +869,13 @@ python_domodule() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local d
- if [[ ${python_moduleroot} == /* ]]; then
+ if [[ ${_PYTHON_MODULEROOT} == /* ]]; then
# absolute path
- d=${python_moduleroot}
+ d=${_PYTHON_MODULEROOT}
else
# relative to site-packages
- local PYTHON_SITEDIR=${PYTHON_SITEDIR}
- [[ ${PYTHON_SITEDIR} ]] || _python_export PYTHON_SITEDIR PYTHON_EPREFIX
-
- d=${PYTHON_SITEDIR#${PYTHON_EPREFIX:-${EPREFIX}}}/${python_moduleroot}
+ local sitedir=$(python_get_sitedir)
+ d=${sitedir#${EPREFIX}}/${_PYTHON_MODULEROOT//.//}
fi
(
@@ -891,10 +905,8 @@ python_doheader() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
- local d PYTHON_INCLUDEDIR=${PYTHON_INCLUDEDIR}
- [[ ${PYTHON_INCLUDEDIR} ]] || _python_export PYTHON_INCLUDEDIR PYTHON_EPREFIX
-
- d=${PYTHON_INCLUDEDIR#${PYTHON_EPREFIX:-${EPREFIX}}}
+ local includedir=$(python_get_includedir)
+ local d=${includedir#${EPREFIX}}
(
insopts -m 0644
@@ -914,6 +926,8 @@ python_wrapper_setup() {
eqawarn "python_wrapper_setup() is part of private eclass API."
eqawarn "Please call python_setup() instead."
+ [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
+
_python_wrapper_setup "${@}"
}
@@ -953,7 +967,7 @@ _python_wrapper_setup() {
_python_export "${impl}" EPYTHON PYTHON
local pyver pyother
- if python_is_python3; then
+ if [[ ${EPYTHON} != python2* ]]; then
pyver=3
pyother=2
else
@@ -1032,6 +1046,9 @@ _python_wrapper_setup() {
#
# Returns 0 (true) if it is, 1 (false) otherwise.
python_is_python3() {
+ eqawarn "${FUNCNAME} is deprecated, as Python 2 is not supported anymore"
+ [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
+
local impl=${1:-${EPYTHON}}
[[ ${impl} ]] || die "python_is_python3: no impl nor EPYTHON"
@@ -1130,32 +1147,31 @@ python_fix_shebang() {
if [[ ${i} == *python2 ]]; then
from=python2
if [[ ! ${force} ]]; then
- python_is_python3 "${EPYTHON}" && error=1
+ error=1
fi
elif [[ ${i} == *python3 ]]; then
from=python3
- if [[ ! ${force} ]]; then
- python_is_python3 "${EPYTHON}" || error=1
- fi
else
from=python
fi
break
;;
- *python[23].[0123456789]|*pypy|*pypy3|*jython[23].[0123456789])
+ *python[23].[0-9]|*python3.[1-9][0-9]|*pypy|*pypy3|*jython[23].[0-9])
# Explicit mismatch.
if [[ ! ${force} ]]; then
error=1
else
case "${i}" in
- *python[23].[0123456789])
- from="python[23].[0123456789]";;
+ *python[23].[0-9])
+ from="python[23].[0-9]";;
+ *python3.[1-9][0-9])
+ from="python3.[1-9][0-9]";;
*pypy)
from="pypy";;
*pypy3)
from="pypy3";;
- *jython[23].[0123456789])
- from="jython[23].[0123456789]";;
+ *jython[23].[0-9])
+ from="jython[23].[0-9]";;
*)
die "${FUNCNAME}: internal error in 2nd pattern match";;
esac
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 70709b96d6..170ea19057 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -4,6 +4,7 @@
# @ECLASS: toolchain-funcs.eclass
# @MAINTAINER:
# Toolchain Ninjas <toolchain@gentoo.org>
+# @SUPPORTED_EAPIS: 5 6 7 8
# @BLURB: functions to query common info about the toolchain
# @DESCRIPTION:
# The toolchain-funcs aims to provide a complete suite of functions
@@ -12,6 +13,12 @@
# in such a way that you can rely on the function always returning
# something sane.
+case ${EAPI:-0} in
+ # EAPI=0 is still used by crossdev, bug #797367
+ 0|5|6|7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
if [[ -z ${_TOOLCHAIN_FUNCS_ECLASS} ]]; then
_TOOLCHAIN_FUNCS_ECLASS=1
@@ -1040,7 +1047,7 @@ gen_usr_ldscript() {
# Eventually we'd like to get rid of this func completely #417451
case ${CTARGET:-${CHOST}} in
- *-darwin*) type -P scanmacho > /dev/null || return ;; # excluded for now due to known breakage
+ *-darwin*) ;;
*-android*) return 0 ;;
*linux*|*-freebsd*|*-openbsd*|*-netbsd*)
use prefix && return 0 ;;
@@ -1115,26 +1122,6 @@ gen_usr_ldscript() {
-id "${EPREFIX}"/${libdir}/${tlib} \
"${ED}"/${libdir}/${tlib} || die "install_name_tool failed"
[[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}"
- # In the build image, stuff may have already recorded the now moved
- # install_name, so hunt those down and fix the install_name
- # references.
- local l obj needed lib
- scanmacho -qyRF '%p;%n' "${D}" | { while IFS= read l ; do
- obj=${l%%;*}
- needed=${l#*;}
- # this is ugly, paths with spaces won't work
- for lib in ${needed//,/ } ; do
- if [[ ${lib} == */usr/lib*/${tlib} ]] ; then
- # don't masquerade other problems, only remove usr/
- # from input
- local s=${lib%usr/*}${lib##*/usr/}
- [[ ${lib} != ${s} ]] || continue
- einfo "gen_usr_ldscript: correcting install_name from ${lib} to ${s} in ${obj}"
- install_name_tool -change \
- "${lib}" "${s}" "${D}${obj}"
- fi
- done
- done }
# Now as we don't use GNU binutils and our linker doesn't
# understand linker scripts, just create a symlink.
pushd "${ED}/usr/${libdir}" > /dev/null
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index e85900934f..ff032dac0b 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
@@ -7,6 +7,8 @@
DESCRIPTION="The GNU Compiler Collection"
HOMEPAGE="https://gcc.gnu.org/"
+# TODO: Please audit this inherit list on future EAPI bumps and ideally
+# conditonalise them where possible.
inherit eutils flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
tc_is_live() {
@@ -1349,6 +1351,7 @@ downgrade_arch_flags() {
# "added" "arch" "replacement"
local archlist=(
+ 10 znver3 znver2
9 znver2 znver1
4.9 bdver4 bdver3
4.9 bonnell atom
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-06-29 6:48 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-06-29 6:48 UTC (permalink / raw
To: gentoo-commits
commit: 639a46bc1d1b9974c18ef834a82b07f94d809ef4
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 29 06:48:03 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Jun 29 06:48:03 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=639a46bc
eclass/java-utils-2: fix sync error
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/java-utils-2.eclass | 2 ++
1 file changed, 2 insertions(+)
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 1b7fcc295a..8a6db80fdb 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -2945,3 +2945,5 @@ java-pkg_gen-cp() {
fi
done
}
+
+fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-07-13 9:02 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-07-13 9:02 UTC (permalink / raw
To: gentoo-commits
commit: 7f1ba932dc75585e05798e171d2ee2324e06b69e
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 13 09:02:31 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Jul 13 09:02:31 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=7f1ba932
autotools.eclass: sync for EAPI=8
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/autotools.eclass | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index 196d5075f4..5b4d4457ee 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -4,7 +4,7 @@
# @ECLASS: autotools.eclass
# @MAINTAINER:
# base-system@gentoo.org
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
# @BLURB: Regenerates auto* build scripts
# @DESCRIPTION:
# This eclass is for safely handling autotooled software packages that need to
@@ -31,7 +31,7 @@ case ${EAPI} in
# Needed for eqawarn
inherit eutils
;;
- 7) ;;
+ 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
esac
@@ -373,10 +373,21 @@ eautoconf() {
die "No configure.{ac,in} present!"
fi
+
if [[ ${WANT_AUTOCONF} != "2.1" && -e configure.in ]] ; then
- 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."
+ case ${EAPI:-0} in
+ 0|1|2|3|4|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."
+ ;;
+ *)
+ # Move configure file to the new location only on newer EAPIs to ensure
+ # checks are done rather than retroactively breaking ebuilds.
+ eqawarn "Moving configure.in to configure.ac (bug #426262)"
+ mv configure.{in,ac} || die
+ ;;
+ esac
fi
# Install config.guess and config.sub which are required by many macros
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-10-13 4:05 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2021-10-13 4:05 UTC (permalink / raw
To: gentoo-commits
commit: 8c54a32b4cb76ea135c3cdfe2509a3a96f18ddee
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 13 04:04:27 2021 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 13 04:05:53 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=8c54a32b
toolchain.eclass: add ~sam to distfiles
Mirrored slyfox's distfiles to my devspace.
Closes: https://bugs.gentoo.org/812278
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/toolchain.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index ff032dac0b..da707d504d 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -296,7 +296,7 @@ S=$(
gentoo_urls() {
local devspace="HTTP~vapier/dist/URI HTTP~rhill/dist/URI
HTTP~zorry/patches/gcc/URI HTTP~blueness/dist/URI
- HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
+ HTTP~tamiko/distfiles/URI HTTP~sam/distfiles/URI HTTP~slyfox/distfiles/URI"
devspace=${devspace//HTTP/https:\/\/dev.gentoo.org\/}
echo mirror://gentoo/$1 ${devspace//URI/$1}
}
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-10-14 6:15 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2021-10-14 6:15 UTC (permalink / raw
To: gentoo-commits
commit: 46cb1cb5a5e1f8eeba77ad733d3af149d8a4ce19
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 14 06:14:08 2021 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 14 06:14:46 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=46cb1cb5
toolchain.eclass: depend on virtual/libcrypt with USE=sanitize
Bug: https://bugs.gentoo.org/802648
Closes: https://bugs.gentoo.org/817974
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/toolchain.eclass | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index da707d504d..2bdc8f5633 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -259,6 +259,13 @@ if tc_has_feature gcj ; then
DEPEND+=" gcj? ( awt? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )"
fi
+if tc_has_feature sanitize ; then
+ # libsanitizer relies on 'crypt.h' to be present
+ # on target. glibc userdto provide it unconditionally.
+ # Nowadays it's a standalone library: #802648
+ DEPEND+=" sanitize? ( virtual/libcrypt )"
+fi
+
if tc_has_feature systemtap ; then
# gcc needs sys/sdt.h headers on target
DEPEND+=" systemtap? ( dev-util/systemtap )"
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-10-14 6:15 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2021-10-14 6:15 UTC (permalink / raw
To: gentoo-commits
commit: 5ac47e9af517a4723bd5381df16d354d3288187e
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 14 06:15:43 2021 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Oct 14 06:15:46 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=5ac47e9a
toolchain.eclass: fix typo in comment
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/toolchain.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 2bdc8f5633..a07f9b680e 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -261,7 +261,7 @@ fi
if tc_has_feature sanitize ; then
# libsanitizer relies on 'crypt.h' to be present
- # on target. glibc userdto provide it unconditionally.
+ # on target. glibc used to provide it unconditionally.
# Nowadays it's a standalone library: #802648
DEPEND+=" sanitize? ( virtual/libcrypt )"
fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-10-21 6:39 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-10-21 6:39 UTC (permalink / raw
To: gentoo-commits
commit: ce4687a8c9a175ac2b08b42881efead4218a7f58
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Oct 21 06:39:04 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Oct 21 06:39:04 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ce4687a8
python-utils-r1: sync with gx86, bug #818043
Bug: https://bugs.gentoo.org/818043
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 117 ++++++++++++++++++++++--------------------
1 file changed, 62 insertions(+), 55 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 0c173e2308..5e035f86a9 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -35,7 +35,7 @@ fi
if [[ ! ${_PYTHON_UTILS_R1} ]]; then
[[ ${EAPI} == [67] ]] && inherit eapi8-dosym
-inherit toolchain-funcs
+inherit multiprocessing toolchain-funcs
# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
# @INTERNAL
@@ -353,16 +353,13 @@ _python_export() {
;;
PYTHON_SITEDIR)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- # sysconfig can't be used because:
- # 1) pypy doesn't give site-packages but stdlib
- # 2) jython gives paths with wrong case
- PYTHON_SITEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())') || die
+ PYTHON_SITEDIR=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_path("purelib"))') || die
export PYTHON_SITEDIR
debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
;;
PYTHON_INCLUDEDIR)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())') || die
+ PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_path("platinclude"))') || die
export PYTHON_INCLUDEDIR
debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
@@ -580,46 +577,6 @@ python_get_scriptdir() {
echo "${PYTHON_SCRIPTDIR}"
}
-# @FUNCTION: _python_ln_rel
-# @USAGE: <from> <to>
-# @INTERNAL
-# @DESCRIPTION:
-# Create a relative symlink.
-_python_ln_rel() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local target=${1}
- local symname=${2}
-
- local tgpath=${target%/*}/
- local sympath=${symname%/*}/
- local rel_target=
-
- while [[ ${sympath} ]]; do
- local tgseg= symseg=
-
- while [[ ! ${tgseg} && ${tgpath} ]]; do
- tgseg=${tgpath%%/*}
- tgpath=${tgpath#${tgseg}/}
- done
-
- while [[ ! ${symseg} && ${sympath} ]]; do
- symseg=${sympath%%/*}
- sympath=${sympath#${symseg}/}
- done
-
- if [[ ${tgseg} != ${symseg} ]]; then
- rel_target=../${rel_target}${tgseg:+${tgseg}/}
- fi
- done
- rel_target+=${tgpath}${target##*/}
-
- debug-print "${FUNCNAME}: ${symname} -> ${target}"
- debug-print "${FUNCNAME}: rel_target = ${rel_target}"
-
- ln -fs "${rel_target}" "${symname}"
-}
-
# @FUNCTION: python_optimize
# @USAGE: [<directory>...]
# @DESCRIPTION:
@@ -661,6 +618,9 @@ python_optimize() {
debug-print "${FUNCNAME}: using sys.path: ${*/%/;}"
fi
+ local jobs=$(makeopts_jobs "${MAKEOPTS}" INF)
+ [[ ${jobs} == INF ]] && jobs=$(get_nproc)
+
local d
for d; do
# make sure to get a nice path without //
@@ -672,11 +632,14 @@ python_optimize() {
"${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
"${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
;;
- python*|pypy3)
+ python3.[5678]|pypy3)
# both levels of optimization are separate since 3.5
- "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -O -m compileall -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
+ "${PYTHON}" -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
+ "${PYTHON}" -O -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
+ "${PYTHON}" -OO -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
+ ;;
+ python*)
+ "${PYTHON}" -m compileall -j "${jobs}" -o 0 -o 1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}"
;;
*)
"${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
@@ -1316,17 +1279,46 @@ build_sphinx() {
HTML_DOCS+=( "${dir}/_build/html/." )
}
+# @FUNCTION: _python_check_EPYTHON
+# @INTERNAL
+# @DESCRIPTION:
+# Check if EPYTHON is set, die if not.
+_python_check_EPYTHON() {
+ if [[ -z ${EPYTHON} ]]; then
+ die "EPYTHON unset, invalid call context"
+ fi
+}
+
+# @VARIABLE: EPYTEST_DESELECT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Specifies an array of tests to be deselected via pytest's --deselect
+# parameter, when calling epytest. The list can include file paths,
+# specific test functions or parametrized test invocations.
+#
+# Note that the listed files will still be subject to collection,
+# i.e. modules imported in global scope will need to be available.
+# If this is undesirable, EPYTEST_IGNORE can be used instead.
+
+# @VARIABLE: EPYTEST_IGNORE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Specifies an array of paths to be ignored via pytest's --ignore
+# parameter, when calling epytest. The listed files will be entirely
+# skipped from test collection.
+
# @FUNCTION: epytest
# @USAGE: [<args>...]
# @DESCRIPTION:
-# Run pytest, passing the standard set of pytest options, followed
-# by user-specified options.
+# Run pytest, passing the standard set of pytest options, then
+# --deselect and --ignore options based on EPYTEST_DESELECT
+# and EPYTEST_IGNORE, then user-specified options.
#
# This command dies on failure and respects nonfatal.
epytest() {
debug-print-function ${FUNCNAME} "${@}"
- [[ -n ${EPYTHON} ]] || die "EPYTHON unset, invalid call context"
+ _python_check_EPYTHON
local args=(
# verbose progress reporting and tracebacks
@@ -1336,12 +1328,27 @@ epytest() {
-ra
# print local variables in tracebacks, useful for debugging
-l
+ # override filterwarnings=error, we do not really want -Werror
+ # for end users, as it tends to fail on new warnings from deps
+ -Wdefault
)
+ local x
+ for x in "${EPYTEST_DESELECT[@]}"; do
+ args+=( --deselect "${x}" )
+ done
+ for x in "${EPYTEST_IGNORE[@]}"; do
+ args+=( --ignore "${x}" )
+ done
set -- "${EPYTHON}" -m pytest "${args[@]}" "${@}"
echo "${@}" >&2
"${@}" || die -n "pytest failed with ${EPYTHON}"
- return ${?}
+ local ret=${?}
+
+ # remove common temporary directories left over by pytest plugins
+ rm -rf .hypothesis .pytest_cache || die
+
+ return ${ret}
}
# @FUNCTION: eunittest
@@ -1354,7 +1361,7 @@ epytest() {
eunittest() {
debug-print-function ${FUNCNAME} "${@}"
- [[ -n ${EPYTHON} ]] || die "EPYTHON unset, invalid call context"
+ _python_check_EPYTHON
set -- "${EPYTHON}" -m unittest_or_fail discover -v "${@}"
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2021-12-03 10:03 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2021-12-03 10:03 UTC (permalink / raw
To: gentoo-commits
commit: d0cd35d2637e0d8ecb9ca17836cf42928f179a5a
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 3 10:03:22 2021 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Dec 3 10:03:22 2021 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=d0cd35d2
eclass/java-utils-2: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/java-utils-2.eclass | 35 +++++++++++++++++++++++++----------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index 8a6db80fdb..a778b387b3 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -6,7 +6,7 @@
# java@gentoo.org
# @AUTHOR:
# Thomas Matthijs <axxo@gentoo.org>, Karl Trygve Kalleberg <karltk@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
# @BLURB: Base eclass for Java packages
# @DESCRIPTION:
# This eclass provides functionality which is used by java-pkg-2.eclass,
@@ -18,7 +18,7 @@
# Ant-based packages.
case ${EAPI:-0} in
- [567]) ;;
+ [5678]) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -118,13 +118,29 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
# Normally this is determined from the jre/jdk version specified in RDEPEND.
# See java-pkg_get-target function below.
#
-# Should generallyonly be used for testing and debugging.
+# Should generally only be used for testing and debugging.
#
# emerge bar to be compatible with 1.3
# @CODE
# JAVA_PKG_WANT_TARGET=1.3 emerge bar
# @CODE
+# @ECLASS-VARIABLE: JAVA_TEST_EXTRA_ARGS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array of extra arguments that should be passed to java command when running tests.
+# It is useful when you need to pass a value to a Java program that uses
+# System.getProperty(). If it uses System.getenv(), use `export var=value` instead.
+#
+# It is used only when running tests.
+#
+# @CODE
+# JAVA_TEST_EXTRA_ARGS=(
+# -Dsome.var=x
+# "-Dother.var=\"y z\""
+# )
+# @CODE
+
# @ECLASS-VARIABLE: JAVA_PKG_DEBUG
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -1549,8 +1565,7 @@ java-pkg_ensure-vm-version-ge() {
# Parameters:
# $@ - VM version to compare current VM to
# @CODE
-# @RETURN: zero - current VM version is greater than checked version;
-# non-zero - current VM version is not greater than checked version
+# @RETURN: zero - current VM version is greater than checked version; non-zero - current VM version is not greater than checked version
java-pkg_is-vm-version-ge() {
debug-print-function ${FUNCNAME} $*
@@ -1801,8 +1816,8 @@ 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 ${runner} ${@}"
- java -cp "${cp}" -Djava.io.tmpdir="${T}/" -Djava.awt.headless=true ${runner} "${@}" || die "Running junit failed"
+ 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"
}
# @FUNCTION: ejunit
@@ -1881,9 +1896,9 @@ etestng() {
done
debug-print "java -cp \"${cp}\" -Djava.io.tmpdir=\"${T}\""\
- "-Djava.awt.headless=true ${runner}"\
+ "-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 -cp "${cp}" -Djava.io.tmpdir=\"${T}\" -Djava.awt.headless=true ${JAVA_TEST_EXTRA_ARGS[@]}\
${runner} -usedefaultlisteners false -testclass ${tests}\
|| die "Running TestNG failed."
}
@@ -1894,7 +1909,7 @@ etestng() {
# Don't call directly, but via java-pkg-2_src_prepare!
java-utils-2_src_prepare() {
case ${EAPI:-0} in
- [0-5])
+ 5)
java-pkg_func-exists java_prepare && java_prepare ;;
*)
java-pkg_func-exists java_prepare &&
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2022-01-23 1:21 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2022-01-23 1:21 UTC (permalink / raw
To: gentoo-commits
commit: aabb74b757d604aa524af81c800cb686260aa18c
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 23 01:16:21 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 23 01:16:21 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=aabb74b7
python-utils-r1.eclass: sync with ::gentoo
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/python-utils-r1.eclass | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 5e035f86a9..9170229202 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -436,6 +436,12 @@ _python_export() {
case ${impl} in
python2.7)
PYTHON_PKG_DEP='>=dev-lang/python-2.7.5-r2:2.7';;
+ python3.8)
+ PYTHON_PKG_DEP=">=dev-lang/python-3.8.8_p1-r1:3.8";;
+ python3.9)
+ PYTHON_PKG_DEP=">=dev-lang/python-3.9.6_p1-r1:3.9";;
+ python3.10)
+ PYTHON_PKG_DEP=">=dev-lang/python-3.10.0_p1-r1:3.10";;
python*)
PYTHON_PKG_DEP="dev-lang/python:${impl#python}";;
pypy)
@@ -1273,7 +1279,8 @@ build_sphinx() {
sed -i -e 's:^intersphinx_mapping:disabled_&:' \
"${dir}"/conf.py || die
# not all packages include the Makefile in pypi tarball
- sphinx-build -b html -d "${dir}"/_build/doctrees "${dir}" \
+ "${EPYTHON}" -m sphinx.cmd.build \
+ -b html -d "${dir}"/_build/doctrees "${dir}" \
"${dir}"/_build/html || die
HTML_DOCS+=( "${dir}/_build/html/." )
@@ -1320,6 +1327,16 @@ epytest() {
_python_check_EPYTHON
+ local color
+ case ${NOCOLOR} in
+ true|yes)
+ color=no
+ ;;
+ *)
+ color=yes
+ ;;
+ esac
+
local args=(
# verbose progress reporting and tracebacks
-vv
@@ -1331,6 +1348,8 @@ epytest() {
# override filterwarnings=error, we do not really want -Werror
# for end users, as it tends to fail on new warnings from deps
-Wdefault
+ # override color output
+ "--color=${color}"
)
local x
for x in "${EPYTEST_DESELECT[@]}"; do
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2022-01-23 2:27 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2022-01-23 2:27 UTC (permalink / raw
To: gentoo-commits
commit: 33992d50c1a2f182d04182a7213c7247ee10aba6
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 23 02:27:13 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 23 02:27:13 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=33992d50
autotools.eclass: sync with ::gentoo
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/autotools.eclass | 38 +++++++++++++++++++++++++-------------
1 file changed, 25 insertions(+), 13 deletions(-)
diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index 5b4d4457ee..cf1c3461f9 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -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
# @ECLASS: autotools.eclass
@@ -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.2-r1:1.16 )
+_LATEST_AUTOMAKE=( 1.16.4:1.16 )
_automake_atom="sys-devel/automake"
_autoconf_atom="sys-devel/autoconf"
@@ -95,7 +95,7 @@ if [[ -n ${WANT_AUTOCONF} ]] ; then
none) _autoconf_atom="" ;; # some packages don't require autoconf at all
2.1) _autoconf_atom="~sys-devel/autoconf-2.13" ;;
# if you change the "latest" version here, change also autotools_env_setup
- latest|2.5) _autoconf_atom=">=sys-devel/autoconf-2.69" ;;
+ latest|2.5) _autoconf_atom=">=sys-devel/autoconf-2.71" ;;
*) die "Invalid WANT_AUTOCONF value '${WANT_AUTOCONF}'" ;;
esac
export WANT_AUTOCONF
@@ -112,7 +112,7 @@ if [[ -n ${WANT_LIBTOOL} ]] ; then
fi
# @ECLASS-VARIABLE: AUTOTOOLS_DEPEND
-# @INTERNAL
+# @OUTPUT_VARIABLE
# @DESCRIPTION:
# Contains the combination of requested automake/autoconf/libtool
# versions in *DEPEND format.
@@ -131,7 +131,7 @@ RDEPEND=""
if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then
case ${EAPI} in
5|6) DEPEND=${AUTOTOOLS_DEPEND} ;;
- 7) BDEPEND=${AUTOTOOLS_DEPEND} ;;
+ *) BDEPEND=${AUTOTOOLS_DEPEND} ;;
esac
fi
__AUTOTOOLS_AUTO_DEPEND=${AUTOTOOLS_AUTO_DEPEND} # See top of eclass
@@ -332,8 +332,26 @@ eaclocal_amflags() {
# They also force installing the support files for safety.
# Respects AT_M4DIR for additional directories to search for macros.
eaclocal() {
+ # Feed in a list of paths:
+ # - ${BROOT}/usr/share/aclocal
+ # - ${ESYSROOT}/usr/share/aclocal
+ # See bug #677002
+ if [[ ${EAPI} != [56] ]] ; then
+ if [[ ! -f "${T}"/aclocal/dirlist ]] ; then
+ mkdir "${T}"/aclocal || die
+ cat <<- EOF > "${T}"/aclocal/dirlist || die
+ ${BROOT}/usr/share/aclocal
+ ${ESYSROOT}/usr/share/aclocal
+ EOF
+ fi
+
+ local system_acdir=" --system-acdir=${T}/aclocal"
+ else
+ local system_acdir=""
+ fi
+
[[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \
- autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags)
+ autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags) ${system_acdir}
}
# @FUNCTION: _elibtoolize
@@ -514,7 +532,7 @@ autotools_env_setup() {
[[ ${WANT_AUTOMAKE} == "latest" ]] && \
die "Cannot find the latest automake! Tried ${_LATEST_AUTOMAKE[*]}"
fi
- [[ ${WANT_AUTOCONF} == "latest" ]] && export WANT_AUTOCONF=2.5
+ [[ ${WANT_AUTOCONF} == "latest" ]] && export WANT_AUTOCONF=2.71
}
# @FUNCTION: autotools_run_tool
@@ -670,12 +688,6 @@ autotools_m4sysdir_include() {
# First try to use the paths the system integrator has set up.
local paths=( $(eval echo ${AT_SYS_M4DIR}) )
- if [[ ${#paths[@]} -eq 0 && -n ${SYSROOT} ]] ; then
- # If they didn't give us anything, then default to the SYSROOT.
- # This helps when cross-compiling.
- local path="${SYSROOT}/usr/share/aclocal"
- [[ -d ${path} ]] && paths+=( "${path}" )
- fi
_autotools_m4dir_include "${paths[@]}"
}
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2022-01-31 1:07 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2022-01-31 1:07 UTC (permalink / raw
To: gentoo-commits
commit: f207c793fd9e0bcb44628813ee5ec1c68dba72b9
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 31 01:07:08 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan 31 01:07:08 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=f207c793
python-utils-r1.eclass: sync with ::gentoo
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/python-utils-r1.eclass | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 9170229202..53a305f40e 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -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
# @ECLASS: python-utils-r1.eclass
@@ -17,7 +17,7 @@
# functions. It can be inherited safely.
#
# For more information, please see the Python Guide:
-# https://dev.gentoo.org/~mgorny/python-guide/
+# https://projects.gentoo.org/python/guide/
# NOTE: When dropping support for EAPIs here, we need to update
# metadata/install-qa-check.d/60python-pyc
@@ -1350,6 +1350,14 @@ epytest() {
-Wdefault
# override color output
"--color=${color}"
+ # disable the undesirable-dependency plugins by default to
+ # trigger missing argument strips. strip options that require
+ # them from config files. enable them explicitly via "-p ..."
+ # if you *really* need them.
+ -p no:cov
+ -p no:flake8
+ -p no:flakes
+ -p no:pylint
)
local x
for x in "${EPYTEST_DESELECT[@]}"; do
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2022-02-10 8:54 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2022-02-10 8:54 UTC (permalink / raw
To: gentoo-commits
commit: 7497d1d744af477e3c34862ad9e2c068d66c379d
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 10 08:54:04 2022 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Feb 10 08:54:04 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=7497d1d7
eclass/python-utils-r1: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 224 ++++++++++++++++++++++++------------------
1 file changed, 126 insertions(+), 98 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 53a305f40e..8c29a02090 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -82,7 +82,11 @@ _python_verify_patterns() {
local impl pattern
for pattern; do
- [[ ${pattern} == -[23] ]] && continue
+ case ${pattern} in
+ -[23]|3.[89]|3.10)
+ continue
+ ;;
+ esac
for impl in "${_PYTHON_ALL_IMPLS[@]}" "${_PYTHON_HISTORICAL_IMPLS[@]}"
do
@@ -119,6 +123,8 @@ _python_set_impls() {
if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then
die 'PYTHON_COMPAT must be an array.'
fi
+
+ local obsolete=()
if [[ ! ${PYTHON_COMPAT_NO_STRICT} ]]; then
for i in "${PYTHON_COMPAT[@]}"; do
# check for incorrect implementations
@@ -126,7 +132,10 @@ _python_set_impls() {
# please keep them in sync with _PYTHON_ALL_IMPLS
# and _PYTHON_HISTORICAL_IMPLS
case ${i} in
- jython2_7|pypy|pypy1_[89]|pypy2_0|pypy3|python2_[5-7]|python3_[1-9]|python3_10)
+ pypy3|python2_7|python3_[89]|python3_10)
+ ;;
+ jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-6]|python3_[1-7])
+ obsolete+=( "${i}" )
;;
*)
if has "${i}" "${_PYTHON_ALL_IMPLS[@]}" \
@@ -140,6 +149,17 @@ _python_set_impls() {
done
fi
+ if [[ -n ${obsolete[@]} && ${EBUILD_PHASE} == setup ]]; then
+ # complain if people don't clean up old impls while touching
+ # the ebuilds recently. use the copyright year to infer last
+ # modification
+ # NB: this check doesn't have to work reliably
+ if [[ $(head -n 1 "${EBUILD}" 2>/dev/null) == *2022* ]]; then
+ eqawarn "Please clean PYTHON_COMPAT of obsolete implementations:"
+ eqawarn " ${obsolete[*]}"
+ fi
+ fi
+
local supp=() unsupp=()
for i in "${_PYTHON_ALL_IMPLS[@]}"; do
@@ -190,12 +210,14 @@ _python_set_impls() {
# Matches if no patterns are provided.
#
# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns
-# are fnmatch-style.
+# can either be fnmatch-style or stdlib versions, e.g. "3.8", "3.9".
+# In the latter case, pypy3 will match if there is at least one pypy3
+# version matching the stdlib version.
_python_impl_matches() {
[[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter"
[[ ${#} -eq 1 ]] && return 0
- local impl=${1} pattern
+ local impl=${1/./_} pattern
shift
for pattern; do
@@ -218,9 +240,17 @@ _python_impl_matches() {
fi
return 0
;;
+ 3.8)
+ # the only unmasked pypy3 version is pypy3.8 atm
+ [[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] &&
+ return 0
+ ;;
+ 3.9|3.10)
+ [[ ${impl} == python${pattern/./_} ]] && return 0
+ ;;
*)
# unify value style to allow lax matching
- [[ ${impl/./_} == ${pattern/./_} ]] && return 0
+ [[ ${impl} == ${pattern/./_} ]] && return 0
;;
esac
done
@@ -266,23 +296,6 @@ _python_impl_matches() {
# python2.7
# @CODE
-# @FUNCTION: python_export
-# @USAGE: [<impl>] <variables>...
-# @INTERNAL
-# @DESCRIPTION:
-# Backwards compatibility function. The relevant API is now considered
-# private, please use python_get* instead.
-python_export() {
- debug-print-function ${FUNCNAME} "${@}"
-
- eqawarn "python_export() is part of private eclass API."
- eqawarn "Please call python_get*() instead."
-
- [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
-
- _python_export "${@}"
-}
-
# @FUNCTION: _python_export
# @USAGE: [<impl>] <variables>...
# @INTERNAL
@@ -353,13 +366,23 @@ _python_export() {
;;
PYTHON_SITEDIR)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_SITEDIR=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_path("purelib"))') || die
+ PYTHON_SITEDIR=$(
+ "${PYTHON}" - <<-EOF || die
+ import sysconfig
+ print(sysconfig.get_path("purelib"))
+ EOF
+ )
export PYTHON_SITEDIR
debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
;;
PYTHON_INCLUDEDIR)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_INCLUDEDIR=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_path("platinclude"))') || die
+ PYTHON_INCLUDEDIR=$(
+ "${PYTHON}" - <<-EOF || die
+ import sysconfig
+ print(sysconfig.get_path("platinclude"))
+ EOF
+ )
export PYTHON_INCLUDEDIR
debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
@@ -370,7 +393,17 @@ _python_export() {
;;
PYTHON_LIBPATH)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_LIBPATH=$("${PYTHON}" -c 'import os.path, sysconfig; print(os.path.join(sysconfig.get_config_var("LIBDIR"), sysconfig.get_config_var("LDLIBRARY")) if sysconfig.get_config_var("LDLIBRARY") else "")') || die
+ PYTHON_LIBPATH=$(
+ "${PYTHON}" - <<-EOF || die
+ import os.path, sysconfig
+ print(
+ os.path.join(
+ sysconfig.get_config_var("LIBDIR"),
+ sysconfig.get_config_var("LDLIBRARY"))
+ if sysconfig.get_config_var("LDLIBRARY")
+ else "")
+ EOF
+ )
export PYTHON_LIBPATH
debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
@@ -420,7 +453,13 @@ _python_export() {
case "${impl}" in
python*)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- flags=$("${PYTHON}" -c 'import sysconfig; print(sysconfig.get_config_var("ABIFLAGS") or "")') || die
+ flags=$(
+ "${PYTHON}" - <<-EOF || die
+ import sysconfig
+ print(sysconfig.get_config_var("ABIFLAGS")
+ or "")
+ EOF
+ )
val=${PYTHON}${flags}-config
;;
*)
@@ -437,9 +476,9 @@ _python_export() {
python2.7)
PYTHON_PKG_DEP='>=dev-lang/python-2.7.5-r2:2.7';;
python3.8)
- PYTHON_PKG_DEP=">=dev-lang/python-3.8.8_p1-r1:3.8";;
+ PYTHON_PKG_DEP=">=dev-lang/python-3.8.12_p1-r1:3.8";;
python3.9)
- PYTHON_PKG_DEP=">=dev-lang/python-3.9.6_p1-r1:3.9";;
+ PYTHON_PKG_DEP=">=dev-lang/python-3.9.9-r1:3.9";;
python3.10)
PYTHON_PKG_DEP=">=dev-lang/python-3.10.0_p1-r1:3.10";;
python*)
@@ -447,7 +486,7 @@ _python_export() {
pypy)
PYTHON_PKG_DEP='>=dev-python/pypy-7.3.0:0=';;
pypy3)
- PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.0:0=';;
+ PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.7-r1:0=';;
*)
die "Invalid implementation: ${impl}"
esac
@@ -592,15 +631,6 @@ python_get_scriptdir() {
python_optimize() {
debug-print-function ${FUNCNAME} "${@}"
- if [[ ${EBUILD_PHASE} == pre* || ${EBUILD_PHASE} == post* ]]; then
- eerror "The new Python eclasses expect the compiled Python files to"
- eerror "be controlled by the Package Manager. For this reason,"
- eerror "the python_optimize function can be used only during src_* phases"
- eerror "(src_install most commonly) and not during pkg_* phases."
- echo
- die "python_optimize is not to be used in pre/post* phases"
- fi
-
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local PYTHON=${PYTHON}
@@ -619,7 +649,12 @@ python_optimize() {
if [[ ${f} == /* && -d ${D%/}${f} ]]; then
set -- "${D%/}${f}" "${@}"
fi
- done < <("${PYTHON}" -c 'import sys; print("".join(x + "\0" for x in sys.path))' || die)
+ done < <(
+ "${PYTHON}" - <<-EOF || die
+ import sys
+ print("".join(x + "\0" for x in sys.path))
+ EOF
+ )
debug-print "${FUNCNAME}: using sys.path: ${*/%/;}"
fi
@@ -633,6 +668,7 @@ python_optimize() {
local instpath=${d#${D%/}}
instpath=/${instpath##/}
+ einfo "Optimize Python modules for ${instpath}"
case "${EPYTHON}" in
python2.7|python3.[34])
"${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
@@ -714,9 +750,8 @@ python_newexe() {
local f=${1}
local newfn=${2}
- local PYTHON_SCRIPTDIR d
- _python_export PYTHON_SCRIPTDIR PYTHON_EPREFIX
- d=${PYTHON_SCRIPTDIR#${PYTHON_EPREFIX}}
+ local scriptdir=$(python_get_scriptdir)
+ local d=${scriptdir#${EPREFIX}}
(
dodir "${wrapd}"
@@ -884,22 +919,6 @@ python_doheader() {
)
}
-# @FUNCTION: python_wrapper_setup
-# @USAGE: [<path> [<impl>]]
-# @DESCRIPTION:
-# Backwards compatibility function. The relevant API is now considered
-# private, please use python_setup instead.
-python_wrapper_setup() {
- debug-print-function ${FUNCNAME} "${@}"
-
- eqawarn "python_wrapper_setup() is part of private eclass API."
- eqawarn "Please call python_setup() instead."
-
- [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
-
- _python_wrapper_setup "${@}"
-}
-
# @FUNCTION: _python_wrapper_setup
# @USAGE: [<path> [<impl>]]
# @INTERNAL
@@ -1007,41 +1026,6 @@ _python_wrapper_setup() {
export PATH PKG_CONFIG_PATH
}
-# @FUNCTION: python_is_python3
-# @USAGE: [<impl>]
-# @DESCRIPTION:
-# Check whether <impl> (or ${EPYTHON}) is a Python3k variant
-# (i.e. uses syntax and stdlib of Python 3.*).
-#
-# Returns 0 (true) if it is, 1 (false) otherwise.
-python_is_python3() {
- eqawarn "${FUNCNAME} is deprecated, as Python 2 is not supported anymore"
- [[ ${EAPI} == [67] ]] || die "${FUNCNAME} banned in EAPI ${EAPI}"
-
- local impl=${1:-${EPYTHON}}
- [[ ${impl} ]] || die "python_is_python3: no impl nor EPYTHON"
-
- [[ ${impl} == python3* || ${impl} == pypy3 ]]
-}
-
-# @FUNCTION: python_is_installed
-# @USAGE: [<impl>]
-# @DESCRIPTION:
-# Check whether the interpreter for <impl> (or ${EPYTHON}) is installed.
-# Uses has_version with a proper dependency string.
-#
-# Returns 0 (true) if it is, 1 (false) otherwise.
-python_is_installed() {
- local impl=${1:-${EPYTHON}}
- [[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON"
- local hasv_args=( -b )
- [[ ${EAPI} == 6 ]] && hasv_args=( --host-root )
-
- local PYTHON_PKG_DEP
- _python_export "${impl}" PYTHON_PKG_DEP
- has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
-}
-
# @FUNCTION: python_fix_shebang
# @USAGE: [-f|--force] [-q|--quiet] <path>...
# @DESCRIPTION:
@@ -1222,7 +1206,7 @@ python_export_utf8_locale() {
debug-print-function ${FUNCNAME} "${@}"
# If the locale program isn't available, just return.
- type locale >/dev/null || return 0
+ type locale &>/dev/null || return 0
if [[ $(locale charmap) != UTF-8 ]]; then
# Try English first, then everything else.
@@ -1278,10 +1262,24 @@ build_sphinx() {
sed -i -e 's:^intersphinx_mapping:disabled_&:' \
"${dir}"/conf.py || die
- # not all packages include the Makefile in pypi tarball
- "${EPYTHON}" -m sphinx.cmd.build \
- -b html -d "${dir}"/_build/doctrees "${dir}" \
- "${dir}"/_build/html || die
+ # 1. not all packages include the Makefile in pypi tarball,
+ # so we call sphinx-build directly
+ # 2. if autodoc is used, we need to call sphinx via EPYTHON,
+ # to ensure that PEP 517 venv is respected
+ # 3. if autodoc is not used, then sphinx might not be installed
+ # for the current impl, so we need a fallback to sphinx-build
+ local command=( "${EPYTHON}" -m sphinx.cmd.build )
+ if ! "${EPYTHON}" -c "import sphinx.cmd.build" 2>/dev/null; then
+ command=( sphinx-build )
+ fi
+ command+=(
+ -b html
+ -d "${dir}"/_build/doctrees
+ "${dir}"
+ "${dir}"/_build/html
+ )
+ echo "${command[@]}" >&2
+ "${command[@]}" || die
HTML_DOCS+=( "${dir}/_build/html/." )
}
@@ -1397,5 +1395,35 @@ eunittest() {
return ${?}
}
+# @FUNCTION: _python_run_check_deps
+# @INTERNAL
+# @USAGE: <impl>
+# @DESCRIPTION:
+# Verify whether <impl> is an acceptable choice to run any-r1 style
+# code. Checks whether the interpreter is installed, runs
+# python_check_deps() if declared.
+_python_run_check_deps() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local impl=${1}
+ local hasv_args=( -b )
+ [[ ${EAPI} == 6 ]] && hasv_args=( --host-root )
+
+ einfo "Checking whether ${impl} is suitable ..."
+
+ local PYTHON_PKG_DEP
+ _python_export "${impl}" PYTHON_PKG_DEP
+ ebegin " ${PYTHON_PKG_DEP}"
+ has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
+ eend ${?} || return 1
+ declare -f python_check_deps >/dev/null || return 0
+
+ local PYTHON_USEDEP="python_targets_${impl}(-)"
+ local PYTHON_SINGLE_USEDEP="python_single_target_${impl}(-)"
+ ebegin " python_check_deps"
+ python_check_deps
+ eend ${?}
+}
+
_PYTHON_UTILS_R1=1
fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2022-02-17 0:12 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2022-02-17 0:12 UTC (permalink / raw
To: gentoo-commits
commit: fe5e2ea127bff7c96b417e9b87233f749870f272
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 17 00:11:05 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Feb 17 00:11:05 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=fe5e2ea1
python-utils-r1.eclass: fix sync with ::gentoo (adjust Python dependencies)
Our Python (base/actual non-revision versions) are older than ::gentoo,
but I've made the necessary dep adjustments / ebuild changes in them already,
so adjust to the latest versions in ::prefix which should be fine.
Reported-by: tgbugs
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/python-utils-r1.eclass | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 8c29a02090..a96fbc78a7 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -476,9 +476,9 @@ _python_export() {
python2.7)
PYTHON_PKG_DEP='>=dev-lang/python-2.7.5-r2:2.7';;
python3.8)
- PYTHON_PKG_DEP=">=dev-lang/python-3.8.12_p1-r1:3.8";;
+ PYTHON_PKG_DEP=">=dev-lang/python-3.8.8_p1-r1:3.8";;
python3.9)
- PYTHON_PKG_DEP=">=dev-lang/python-3.9.9-r1:3.9";;
+ PYTHON_PKG_DEP=">=dev-lang/python-3.9.6_p1-r1:3.9";;
python3.10)
PYTHON_PKG_DEP=">=dev-lang/python-3.10.0_p1-r1:3.10";;
python*)
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2022-05-10 6:22 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2022-05-10 6:22 UTC (permalink / raw
To: gentoo-commits
commit: 65bd67b167c1f5445f433cb4d62fdf7931d3fb7a
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue May 10 06:22:06 2022 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue May 10 06:22:06 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=65bd67b1
python-utils-r1.eclass: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 211 ++++++++++++++++++++++--------------------
1 file changed, 112 insertions(+), 99 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index a96fbc78a7..48b6ea484b 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -37,17 +37,17 @@ if [[ ! ${_PYTHON_UTILS_R1} ]]; then
[[ ${EAPI} == [67] ]] && inherit eapi8-dosym
inherit multiprocessing toolchain-funcs
-# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
+# @ECLASS_VARIABLE: _PYTHON_ALL_IMPLS
# @INTERNAL
# @DESCRIPTION:
# All supported Python implementations, most preferred last.
_PYTHON_ALL_IMPLS=(
pypy3
- python3_{8..10}
+ python3_{8..11}
)
readonly _PYTHON_ALL_IMPLS
-# @ECLASS-VARIABLE: _PYTHON_HISTORICAL_IMPLS
+# @ECLASS_VARIABLE: _PYTHON_HISTORICAL_IMPLS
# @INTERNAL
# @DESCRIPTION:
# All historical Python implementations that are no longer supported.
@@ -59,7 +59,7 @@ _PYTHON_HISTORICAL_IMPLS=(
)
readonly _PYTHON_HISTORICAL_IMPLS
-# @ECLASS-VARIABLE: PYTHON_COMPAT_NO_STRICT
+# @ECLASS_VARIABLE: PYTHON_COMPAT_NO_STRICT
# @INTERNAL
# @DESCRIPTION:
# Set to a non-empty value in order to make eclass tolerate (ignore)
@@ -83,7 +83,7 @@ _python_verify_patterns() {
local impl pattern
for pattern; do
case ${pattern} in
- -[23]|3.[89]|3.10)
+ -[23]|3.[89]|3.1[01])
continue
;;
esac
@@ -132,7 +132,7 @@ _python_set_impls() {
# please keep them in sync with _PYTHON_ALL_IMPLS
# and _PYTHON_HISTORICAL_IMPLS
case ${i} in
- pypy3|python2_7|python3_[89]|python3_10)
+ pypy3|python2_7|python3_[89]|python3_1[01])
;;
jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-6]|python3_[1-7])
obsolete+=( "${i}" )
@@ -240,12 +240,12 @@ _python_impl_matches() {
fi
return 0
;;
- 3.8)
- # the only unmasked pypy3 version is pypy3.8 atm
+ 3.9)
+ # the only unmasked pypy3 version is pypy3.9 atm
[[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] &&
return 0
;;
- 3.9|3.10)
+ 3.8|3.1[01])
[[ ${impl} == python${pattern/./_} ]] && return 0
;;
*)
@@ -258,7 +258,7 @@ _python_impl_matches() {
return 1
}
-# @ECLASS-VARIABLE: PYTHON
+# @ECLASS_VARIABLE: PYTHON
# @DEFAULT_UNSET
# @DESCRIPTION:
# The absolute path to the current Python interpreter.
@@ -277,7 +277,7 @@ _python_impl_matches() {
# /usr/bin/python2.7
# @CODE
-# @ECLASS-VARIABLE: EPYTHON
+# @ECLASS_VARIABLE: EPYTHON
# @DEFAULT_UNSET
# @DESCRIPTION:
# The executable name of the current Python interpreter.
@@ -476,11 +476,13 @@ _python_export() {
python2.7)
PYTHON_PKG_DEP='>=dev-lang/python-2.7.5-r2:2.7';;
python3.8)
- PYTHON_PKG_DEP=">=dev-lang/python-3.8.8_p1-r1:3.8";;
+ PYTHON_PKG_DEP=">=dev-lang/python-3.8.12_p1-r1:3.8";;
python3.9)
- PYTHON_PKG_DEP=">=dev-lang/python-3.9.6_p1-r1:3.9";;
+ PYTHON_PKG_DEP=">=dev-lang/python-3.9.9-r1:3.9";;
python3.10)
PYTHON_PKG_DEP=">=dev-lang/python-3.10.0_p1-r1:3.10";;
+ python3.11)
+ PYTHON_PKG_DEP=">=dev-lang/python-3.11.0_beta1-r1:3.11";;
python*)
PYTHON_PKG_DEP="dev-lang/python:${impl#python}";;
pypy)
@@ -659,9 +661,7 @@ python_optimize() {
debug-print "${FUNCNAME}: using sys.path: ${*/%/;}"
fi
- local jobs=$(makeopts_jobs "${MAKEOPTS}" INF)
- [[ ${jobs} == INF ]] && jobs=$(get_nproc)
-
+ local jobs=$(makeopts_jobs)
local d
for d; do
# make sure to get a nice path without //
@@ -1029,25 +1029,30 @@ _python_wrapper_setup() {
# @FUNCTION: python_fix_shebang
# @USAGE: [-f|--force] [-q|--quiet] <path>...
# @DESCRIPTION:
-# Replace the shebang in Python scripts with the current Python
-# implementation (EPYTHON). If a directory is passed, works recursively
-# on all Python scripts.
+# Replace the shebang in Python scripts with the full path
+# to the current Python implementation (PYTHON, including EPREFIX).
+# If a directory is passed, works recursively on all Python scripts
+# found inside the directory tree.
#
-# Only files having a 'python*' shebang will be modified. Files with
-# other shebang will either be skipped when working recursively
-# on a directory or treated as error when specified explicitly.
+# Only files having a Python shebang (a path to any known Python
+# interpreter, optionally preceded by env(1) invocation) will
+# be processed. Files with any other shebang will either be skipped
+# silently when a directory was passed, or an error will be reported
+# for any files without Python shebangs specified explicitly.
#
-# Shebangs matching explicitly current Python version will be left
-# unmodified. Shebangs requesting another Python version will be treated
-# as fatal error, unless --force is given.
+# Shebangs that are compatible with the current Python version will be
+# mangled unconditionally. Incompatible shebangs will cause a fatal
+# error, unless --force is specified.
#
-# --force causes the function to replace even shebangs that require
-# incompatible Python version. --quiet causes the function not to list
-# modified files verbosely.
+# --force causes the function to replace shebangs with incompatible
+# Python version (but not non-Python shebangs). --quiet causes
+# the function not to list modified files verbosely.
python_fix_shebang() {
debug-print-function ${FUNCNAME} "${@}"
[[ ${EPYTHON} ]] || die "${FUNCNAME}: EPYTHON unset (pkg_setup not called?)"
+ local PYTHON
+ _python_export "${EPYTHON}" PYTHON
local force quiet
while [[ ${@} ]]; do
@@ -1063,13 +1068,13 @@ python_fix_shebang() {
local path f
for path; do
- local any_correct any_fixed is_recursive
+ local any_fixed is_recursive
[[ -d ${path} ]] && is_recursive=1
while IFS= read -r -d '' f; do
local shebang i
- local error= from=
+ local error= match=
# note: we can't ||die here since read will fail if file
# has no newline characters
@@ -1078,64 +1083,36 @@ python_fix_shebang() {
# First, check if it's shebang at all...
if [[ ${shebang} == '#!'* ]]; then
local split_shebang=()
- read -r -a split_shebang <<<${shebang} || die
-
- # Match left-to-right in a loop, to avoid matching random
- # repetitions like 'python2.7 python2'.
- for i in "${split_shebang[@]}"; do
- case "${i}" in
- *"${EPYTHON}")
- debug-print "${FUNCNAME}: in file ${f#${D%/}}"
- debug-print "${FUNCNAME}: shebang matches EPYTHON: ${shebang}"
-
- # Nothing to do, move along.
- any_correct=1
- from=${EPYTHON}
- break
- ;;
- *python|*python[23])
- debug-print "${FUNCNAME}: in file ${f#${D%/}}"
- debug-print "${FUNCNAME}: rewriting shebang: ${shebang}"
-
- if [[ ${i} == *python2 ]]; then
- from=python2
- if [[ ! ${force} ]]; then
- error=1
- fi
- elif [[ ${i} == *python3 ]]; then
- from=python3
- else
- from=python
- fi
- break
- ;;
- *python[23].[0-9]|*python3.[1-9][0-9]|*pypy|*pypy3|*jython[23].[0-9])
- # Explicit mismatch.
- if [[ ! ${force} ]]; then
- error=1
- else
- case "${i}" in
- *python[23].[0-9])
- from="python[23].[0-9]";;
- *python3.[1-9][0-9])
- from="python3.[1-9][0-9]";;
- *pypy)
- from="pypy";;
- *pypy3)
- from="pypy3";;
- *jython[23].[0-9])
- from="jython[23].[0-9]";;
- *)
- die "${FUNCNAME}: internal error in 2nd pattern match";;
- esac
- fi
- break
- ;;
- esac
- done
+ read -r -a split_shebang <<<${shebang#"#!"} || die
+
+ local in_path=${split_shebang[0]}
+ local from='^#! *[^ ]*'
+ # if the first component is env(1), skip it
+ if [[ ${in_path} == */env ]]; then
+ in_path=${split_shebang[1]}
+ from+=' *[^ ]*'
+ fi
+
+ case ${in_path##*/} in
+ "${EPYTHON}")
+ match=1
+ ;;
+ python|python[23])
+ match=1
+ [[ ${in_path##*/} == python2 ]] && error=1
+ ;;
+ python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|jython[23].[0-9])
+ # Explicit mismatch.
+ match=1
+ error=1
+ ;;
+ esac
fi
- if [[ ! ${error} && ! ${from} ]]; then
+ # disregard mismatches in force mode
+ [[ ${force} ]] && error=
+
+ if [[ ! ${match} ]]; then
# Non-Python shebang. Allowed in recursive mode,
# disallowed when specifying file explicitly.
[[ ${is_recursive} ]] && continue
@@ -1147,13 +1124,9 @@ python_fix_shebang() {
fi
if [[ ! ${error} ]]; then
- # We either want to match ${from} followed by space
- # or at end-of-string.
- if [[ ${shebang} == *${from}" "* ]]; then
- sed -i -e "1s:${from} :${EPYTHON} :" "${f}" || die
- else
- sed -i -e "1s:${from}$:${EPYTHON}:" "${f}" || die
- fi
+ debug-print "${FUNCNAME}: in file ${f#${D%/}}"
+ debug-print "${FUNCNAME}: rewriting shebang: ${shebang}"
+ sed -i -e "1s@${from}@#!${PYTHON}@" "${f}" || die
any_fixed=1
else
eerror "The file has incompatible shebang:"
@@ -1166,12 +1139,7 @@ python_fix_shebang() {
if [[ ! ${any_fixed} ]]; then
eerror "QA error: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files."
- if [[ ${any_correct} ]]; then
- eerror "All files have ${EPYTHON} shebang already."
- else
- eerror "There are no Python files in specified directory."
- fi
-
+ eerror "There are no Python files in specified directory."
die "${FUNCNAME} did not match any fixable files"
fi
done
@@ -1348,6 +1316,9 @@ epytest() {
-Wdefault
# override color output
"--color=${color}"
+ # count is more precise when we're dealing with a large number
+ # of tests
+ -o console_output_style=count
# disable the undesirable-dependency plugins by default to
# trigger missing argument strips. strip options that require
# them from config files. enable them explicitly via "-p ..."
@@ -1425,5 +1396,47 @@ _python_run_check_deps() {
eend ${?}
}
+# @FUNCTION: python_has_version
+# @USAGE: [-b|-d|-r] <atom>...
+# @DESCRIPTION:
+# A convenience wrapper for has_version() with verbose output and better
+# defaults for use in python_check_deps().
+#
+# The wrapper accepts EAPI 7+-style -b/-d/-r options to indicate
+# the root to perform the lookup on. Unlike has_version, the default
+# is -b. In EAPI 6, -b and -d are translated to --host-root
+# for compatibility.
+#
+# The wrapper accepts multiple package specifications. For the check
+# to succeed, *all* specified atoms must match.
+python_has_version() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local root_arg=( -b )
+ case ${1} in
+ -b|-d|-r)
+ root_arg=( "${1}" )
+ shift
+ ;;
+ esac
+
+ if [[ ${EAPI} == 6 ]]; then
+ if [[ ${root_arg} == -r ]]; then
+ root_arg=()
+ else
+ root_arg=( --host-root )
+ fi
+ fi
+
+ local pkg
+ for pkg; do
+ ebegin " ${pkg}"
+ has_version "${root_arg[@]}" "${pkg}"
+ eend ${?} || return
+ done
+
+ return 0
+}
+
_PYTHON_UTILS_R1=1
fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2022-06-06 8:42 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2022-06-06 8:42 UTC (permalink / raw
To: gentoo-commits
commit: 5027081b510a47cbccec3cabd2dc6504b0484821
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 6 08:41:37 2022 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Jun 6 08:41:37 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=5027081b
toolchain.eclass: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 1327 +++++++++++++++++++++++++++--------------------
1 file changed, 751 insertions(+), 576 deletions(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index a07f9b680e..ed8c227c4a 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1,23 +1,33 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-# Maintainer: Toolchain Ninjas <toolchain@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6 7
+# @ECLASS: toolchain.eclass
+# @MAINTAINER:
+# Toolchain Ninjas <toolchain@gentoo.org>
+# @SUPPORTED_EAPIS: 7 8
+# @BLURB: Common code for sys-devel/gcc ebuilds
+
+case ${EAPI} in
+ 7) inherit eutils ;;
+ 8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
+
+if [[ ! ${_TOOLCHAIN_ECLASS} ]]; then
+_TOOLCHAIN_ECLASS=1
DESCRIPTION="The GNU Compiler Collection"
HOMEPAGE="https://gcc.gnu.org/"
-# TODO: Please audit this inherit list on future EAPI bumps and ideally
-# conditonalise them where possible.
-inherit eutils flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
+inherit edo flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
tc_is_live() {
[[ ${PV} == *9999* ]]
}
if tc_is_live ; then
- EGIT_REPO_URI="https://gcc.gnu.org/git/gcc.git"
- # naming style:
+ EGIT_REPO_URI="https://gcc.gnu.org/git/gcc.git https://github.com/gcc-mirror/gcc"
+ # Naming style:
# gcc-10.1.0_pre9999 -> gcc-10-branch
# Note that the micro version is required or lots of stuff will break.
# To checkout master set gcc_LIVE_BRANCH="master" in the ebuild before
@@ -25,20 +35,12 @@ if tc_is_live ; then
EGIT_BRANCH="releases/${PN}-${PV%.?.?_pre9999}"
EGIT_BRANCH=${EGIT_BRANCH//./_}
inherit git-r3
+elif [[ -n ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+ inherit git-r3
fi
FEATURES=${FEATURES/multilib-strict/}
-case ${EAPI:-0} in
- 0|1|2|3|4*) die "Need to upgrade to at least EAPI=5" ;;
- 5*|6) inherit eapi7-ver ;;
- 7) ;;
- *) die "I don't speak EAPI ${EAPI}." ;;
-esac
-
-EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \
- src_compile src_test src_install pkg_postinst pkg_postrm
-
#---->> globals <<----
export CTARGET=${CTARGET:-${CHOST}}
@@ -58,50 +60,116 @@ is_crosscompile() {
# The target prefix defaults to the host prefix, except for cross compilers, which targets the empty prefix by default.
: ${TPREFIX:=$(is_crosscompile || echo "${EPREFIX}")}
-# General purpose version check. Without a second arg matches up to minor version (x.x.x)
+# @FUNCTION: tc_version_is_at_least
+# @USAGE: ver1 [ver2]
+# @DESCRIPTION:
+# General purpose version check. Without a second argument, matches
+# up to minor version (x.x.x).
tc_version_is_at_least() {
ver_test "${2:-${GCC_RELEASE_VER}}" -ge "$1"
}
-# General purpose version range check
+# @FUNCTION: tc_version_is_between
+# @USAGE: ver1 ver2
+# @DESCRIPTION:
+# General purpose version range check.
# Note that it matches up to but NOT including the second version
tc_version_is_between() {
tc_version_is_at_least "${1}" && ! tc_version_is_at_least "${2}"
}
+# @ECLASS_VARIABLE: TOOLCHAIN_GCC_PV
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Used to override GCC version. Useful for e.g. live ebuilds or snapshots.
+# Defaults to ${PV}.
+
+# @ECLASS_VARIABLE: TOOLCHAIN_USE_GIT_PATCHES
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Used to force fetching patches from git. Useful for non-released versions
+# of GCC where we don't want to keep creating patchset tarballs for a new
+# release series (e.g. suppose 12.0 just got released, then adding snapshots
+# for 13.0, we don't want to create new patchsets for every single 13.0 snapshot,
+# so just grab patches from git each time if this variable is set).
+
+# @ECLASS_VARIABLE: TOOLCHAIN_PATCH_DEV
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Indicate the developer who hosts the patchset for an ebuild.
+
+# @ECLASS_VARIABLE: GCC_PV
+# @INTERNAL
+# @DESCRIPTION:
+# Internal variable representing (spoofed) GCC version.
GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}}
+
+# @ECLASS_VARIABLE: GCC_PVR
+# @INTERNAL
+# @DESCRIPTION:
+# Full GCC version including revision.
GCC_PVR=${GCC_PV}
[[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR}
+# @ECLASS_VARIABLE: GCC_RELEASE_VER
+# @INTERNAL
+# @DESCRIPTION:
# GCC_RELEASE_VER must always match 'gcc/BASE-VER' value.
# It's an internal representation of gcc version used for:
# - versioned paths on disk
# - 'gcc -dumpversion' output. Must always match <digit>.<digit>.<digit>.
GCC_RELEASE_VER=$(ver_cut 1-3 ${GCC_PV})
+# @ECLASS_VARIABLE: GCC_BRANCH_VER
+# @INTERNAL
+# @DESCRIPTION:
+# GCC branch version.
GCC_BRANCH_VER=$(ver_cut 1-2 ${GCC_PV})
+# @ECLASS_VARIABLE: GCCMAJOR
+# @INTERNAL
+# @DESCRIPTION:
+# Major GCC version.
GCCMAJOR=$(ver_cut 1 ${GCC_PV})
+# @ECLASS_VARIABLE: GCCMINOR
+# @INTERNAL
+# @DESCRIPTION:
+# Minor GCC version.
GCCMINOR=$(ver_cut 2 ${GCC_PV})
+# @ECLASS_VARIABLE: GCCMICRO
+# @INTERNAL
+# @DESCRIPTION:
+# GCC micro version.
GCCMICRO=$(ver_cut 3 ${GCC_PV})
+# @ECLASS_VARIABLE: GCC_CONFIG_VER
+# @INTERNAL
+# @DESCRIPTION:
# Ideally this variable should allow for custom gentoo versioning
# of binary and gcc-config names not directly tied to upstream
-# versioning. In practive it's hard to untangle from gcc/BASE-VER
+# versioning. In practice it's hard to untangle from gcc/BASE-VER
# (GCC_RELEASE_VER) value.
GCC_CONFIG_VER=${GCC_RELEASE_VER}
# Pre-release support. Versioning schema:
# 1.0.0_pre9999: live ebuild
-# 1.2.3_alphaYYYYMMDD: weekly snapshots
+# 1.2.3_pYYYYMMDD (or 1.2.3_preYYYYMMDD for unreleased major versions): weekly snapshots
# 1.2.3_rcYYYYMMDD: release candidates
-if [[ ${GCC_PV} == *_alpha* ]] ; then
- # weekly snapshots
- SNAPSHOT=${GCCMAJOR}-${GCC_PV##*_alpha}
+if [[ ${GCC_PV} == *_pre* ]] ; then
+ # Weekly snapshots
+ SNAPSHOT=${GCCMAJOR}-${GCC_PV##*_pre}
+elif [[ ${GCC_PV} == *_p* ]] ; then
+ # Weekly snapshots
+ SNAPSHOT=${GCCMAJOR}-${GCC_PV##*_p}
elif [[ ${GCC_PV} == *_rc* ]] ; then
- # release candidates
+ # Release candidates
SNAPSHOT=${GCC_PV%_rc*}-RC-${GCC_PV##*_rc}
fi
+# Require minimum gcc version to simplify assumptions.
+# Normally we would require gcc-6+ (based on sys-devel/gcc)
+# but we still have sys-devel/gcc-apple-4.2.1_p5666.
+tc_version_is_at_least 4.2.1 || die "${ECLASS}: ${GCC_RELEASE_VER} is too old."
+
PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr}
LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
@@ -116,7 +184,7 @@ fi
DATAPATH=${TOOLCHAIN_DATAPATH:-${PREFIX}/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}}
-# Dont install in /usr/include/g++-v3/, but in gcc internal directory.
+# Don't install in /usr/include/g++-v3/, but instead to gcc's internal directory.
# We will handle /usr/include/g++-v3/ with gcc-config ...
STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${LIBPATH}/include/g++-v${GCC_BRANCH_VER/\.*/}}
@@ -126,46 +194,33 @@ LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-excepti
IUSE="test vanilla +nls"
RESTRICT="!test? ( test )"
-tc_supports_dostrip() {
- case ${EAPI:-0} in
- 5*|6) return 1 ;;
- 7) return 0 ;;
- *) die "Update apply_patches() for ${EAPI}." ;;
- esac
-}
-
-tc_supports_dostrip || RESTRICT+=" strip" # cross-compilers need controlled stripping
-
TC_FEATURES=()
tc_has_feature() {
has "$1" "${TC_FEATURES[@]}"
}
-if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
- # --enable-altivec was dropped before gcc-4. We don't set it.
- # We drop USE=altivec for newer gccs only to avoid rebuilds
- # for most stable users. Once gcc-10 is stable we can drop it.
- if ! tc_version_is_at_least 10; then
- IUSE+=" altivec"
- fi
- IUSE+=" debug +cxx +nptl" TC_FEATURES+=(nptl)
+# Prefix: allow gcc-apple post 4.2.1
+if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ||
+ [[ ${PN} == "gcc-apple" && tc_version_is_at_least 12.1 ]] ; then
+ IUSE+=" debug +cxx +nptl" TC_FEATURES+=( nptl )
[[ -n ${PIE_VER} ]] && IUSE+=" nopie"
[[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
- # fortran support appeared in 4.1, but 4.1 needs outdated mpfr
- tc_version_is_at_least 4.2 && IUSE+=" +fortran" TC_FEATURES+=(fortran)
- tc_version_is_at_least 3 && IUSE+=" doc hardened multilib objc"
- tc_version_is_between 3 7 && IUSE+=" awt gcj" TC_FEATURES+=(gcj)
- tc_version_is_at_least 3.3 && IUSE+=" pgo"
- tc_version_is_at_least 4.0 &&
- IUSE+=" objc-gc" TC_FEATURES+=(objc-gc)
- tc_version_is_at_least 4.1 && IUSE+=" libssp objc++"
- tc_version_is_at_least 4.2 && IUSE+=" +openmp"
+ IUSE+=" +fortran" TC_FEATURES+=( fortran )
+ IUSE+=" doc hardened multilib objc"
+ tc_version_is_between 3 7 && IUSE+=" awt gcj" TC_FEATURES+=( gcj )
+ IUSE+=" pgo"
+ IUSE+=" objc-gc" TC_FEATURES+=( objc-gc )
+ IUSE+=" libssp objc++"
+ IUSE+=" +openmp"
+
tc_version_is_at_least 4.3 && IUSE+=" fixed-point"
tc_version_is_at_least 4.7 && IUSE+=" go"
+
# sanitizer support appeared in gcc-4.8, but <gcc-5 does not
# support modern glibc.
- tc_version_is_at_least 5 && IUSE+=" +sanitize"
+ tc_version_is_at_least 5 && IUSE+=" +sanitize" TC_FEATURES+=( sanitize )
+
# Note:
# <gcc-4.8 supported graphite, it required forked ppl
# versions which we dropped. Since graphite was also experimental in
@@ -173,28 +228,24 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
# <gcc-5 supported graphite, it required cloog
# <gcc-6.5 supported graphite, it required old incompatible isl
tc_version_is_at_least 6.5 &&
- IUSE+=" graphite" TC_FEATURES+=(graphite)
+ IUSE+=" graphite" TC_FEATURES+=( graphite )
+
tc_version_is_between 4.9 8 && IUSE+=" cilk"
tc_version_is_at_least 4.9 && IUSE+=" ada"
-
- # Don't enable USE=vtv starting from gcc-10. Once gcc-10
- # stable everywhere disable by default on older versions
- # as well.
- if tc_version_is_at_least 10; then
- IUSE+=" vtv"
- elif tc_version_is_at_least 4.9; then
- IUSE+=" +vtv"
- fi
+ tc_version_is_at_least 4.9 && IUSE+=" vtv"
tc_version_is_at_least 5.0 && IUSE+=" jit"
tc_version_is_between 5.0 9 && IUSE+=" mpx"
tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch"
+
# systemtap is a gentoo-specific switch: bug #654748
tc_version_is_at_least 8.0 &&
- IUSE+=" systemtap" TC_FEATURES+=(systemtap)
+ IUSE+=" systemtap" TC_FEATURES+=( systemtap )
+
tc_version_is_at_least 9.0 && IUSE+=" d"
tc_version_is_at_least 9.1 && IUSE+=" lto"
- tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=(zstd)
- tc_version_is_at_least 11 && IUSE+=" valgrind" TC_FEATURES+=(valgrind)
+ tc_version_is_at_least 10 && IUSE+=" cet"
+ tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=( zstd )
+ tc_version_is_at_least 11 && IUSE+=" valgrind" TC_FEATURES+=( valgrind )
tc_version_is_at_least 11 && IUSE+=" custom-cflags"
fi
@@ -209,17 +260,15 @@ fi
#---->> DEPEND <<----
RDEPEND="sys-libs/zlib
- nls? ( virtual/libintl )"
-
-tc_version_is_at_least 3 && RDEPEND+=" virtual/libiconv"
-
-if tc_version_is_at_least 4 ; then
- GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2:0= >=dev-libs/mpfr-2.4.2:0="
- if tc_version_is_at_least 4.3 ; then
- RDEPEND+=" ${GMP_MPFR_DEPS}"
- elif tc_has_feature fortran ; then
- RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
- fi
+ virtual/libiconv
+ nls? ( virtual/libintl )
+"
+
+GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2:0= >=dev-libs/mpfr-2.4.2:0="
+if tc_version_is_at_least 4.3 ; then
+ RDEPEND+=" ${GMP_MPFR_DEPS}"
+elif tc_has_feature fortran ; then
+ RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
fi
tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0="
@@ -245,24 +294,28 @@ BDEPEND="
DEPEND="${RDEPEND}"
if tc_has_feature gcj ; then
- GCJ_DEPS=">=media-libs/libart_lgpl-2.1"
- GCJ_GTK_DEPS="
- x11-base/xorg-proto
- x11-libs/libXt
- x11-libs/libX11
- x11-libs/libXtst
- =x11-libs/gtk+-2*
- virtual/pkgconfig
+ DEPEND+="
+ gcj? (
+ app-arch/zip
+ app-arch/unzip
+ >=media-libs/libart_lgpl-2.1
+ awt? (
+ x11-base/xorg-proto
+ x11-libs/libXt
+ x11-libs/libX11
+ x11-libs/libXtst
+ =x11-libs/gtk+-2*
+ x11-libs/pango
+ virtual/pkgconfig
+ )
+ )
"
- tc_version_is_at_least 3.4 && GCJ_GTK_DEPS+=" x11-libs/pango"
- tc_version_is_at_least 4.2 && GCJ_DEPS+=" app-arch/zip app-arch/unzip"
- DEPEND+=" gcj? ( awt? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )"
fi
if tc_has_feature sanitize ; then
# libsanitizer relies on 'crypt.h' to be present
- # on target. glibc used to provide it unconditionally.
- # Nowadays it's a standalone library: #802648
+ # on target. glibc user to provide it unconditionally.
+ # Nowadays it's a standalone library: bug #802648
DEPEND+=" sanitize? ( virtual/libcrypt )"
fi
@@ -272,40 +325,86 @@ if tc_has_feature systemtap ; then
fi
if tc_has_feature zstd ; then
- DEPEND+=" zstd? ( app-arch/zstd )"
+ DEPEND+=" zstd? ( app-arch/zstd:= )"
+ RDEPEND+=" zstd? ( app-arch/zstd:= )"
fi
if tc_has_feature valgrind; then
BDEPEND+=" valgrind? ( dev-util/valgrind )"
fi
-case ${EAPI:-0} in
- 5*|6) DEPEND+=" ${BDEPEND}" ;;
-esac
-
# Prefix: our version is 1.9, so can't go with gx86's 2.3
-PDEPEND=">=sys-devel/gcc-config-1.7"
+PDEPEND=">=sys-devel/gcc-config-1.9"
#---->> S + SRC_URI essentials <<----
+# @ECLASS_VARIABLE: TOOLCHAIN_PATCH_SUFFIX
+# @DESCRIPTION:
+# Used to override compression used for for patchsets.
+# Default is xz for EAPI 8+ and bz2 for older EAPIs.
+if [[ ${EAPI} == 8 ]] ; then
+ : ${TOOLCHAIN_PATCH_SUFFIX:=xz}
+else
+ # Older EAPIs
+ : ${TOOLCHAIN_PATCH_SUFFIX:=bz2}
+fi
+
+# @ECLASS_VARIABLE: TOOLCHAIN_SET_S
+# @DESCRIPTION:
+# Used to override value of S for snapshots and such. Mainly useful
+# if needing to set GCC_TARBALL_SRC_URI.
+: ${TOOLCHAIN_SET_S:=yes}
+
# Set the source directory depending on whether we're using
# a live git tree, snapshot, or release tarball.
-S=$(
- if tc_is_live ; then
- echo ${EGIT_CHECKOUT_DIR}
- elif [[ -n ${SNAPSHOT} ]] ; then
- echo ${WORKDIR}/gcc-${SNAPSHOT}
- else
- echo ${WORKDIR}/gcc-${GCC_RELEASE_VER}
- fi
-)
+if [[ ${TOOLCHAIN_SET_S} == yes ]] ; then
+ S=$(
+ if tc_is_live ; then
+ echo ${EGIT_CHECKOUT_DIR}
+ elif [[ -n ${SNAPSHOT} ]] ; then
+ echo ${WORKDIR}/gcc-${SNAPSHOT}
+ else
+ echo ${WORKDIR}/gcc-${GCC_RELEASE_VER}
+ fi
+ )
+fi
gentoo_urls() {
- local devspace="HTTP~vapier/dist/URI HTTP~rhill/dist/URI
- HTTP~zorry/patches/gcc/URI HTTP~blueness/dist/URI
- HTTP~tamiko/distfiles/URI HTTP~sam/distfiles/URI HTTP~slyfox/distfiles/URI"
+ # slyfox's distfiles are mirrored to sam's devspace
+ declare -A devspace_urls=(
+ [soap]=HTTP~soap/distfiles/URI
+ [sam]=HTTP~sam/distfiles/sys-devel/gcc/URI
+ [slyfox]=HTTP~sam/distfiles/URI
+ [tamiko]=HTTP~tamiko/distfiles/URI
+ [zorry]=HTTP~zorry/patches/gcc/URI
+ [vapier]=HTTP~vapier/dist/URI
+ [blueness]=HTTP~blueness/dist/URI
+ )
+
+ # Newer ebuilds should set TOOLCHAIN_PATCH_DEV and we'll just
+ # return the full URL from the array.
+ if [[ -n ${TOOLCHAIN_PATCH_DEV} ]] ; then
+ local devspace_url=${devspace_urls[${TOOLCHAIN_PATCH_DEV}]}
+ if [[ -n ${devspace_url} ]] ; then
+ local devspace_url_exp=${devspace_url//HTTP/https:\/\/dev.gentoo.org\/}
+ devspace_url_exp=${devspace_url_exp//URI/$1}
+ echo ${devspace_url_exp}
+ return
+ fi
+ fi
+
+ # But we keep the old fallback list for compatibility with
+ # older ebuilds (overlays etc).
+ local devspace="
+ HTTP~soap/distfiles/URI
+ HTTP~sam/distfiles/URI
+ HTTP~sam/distfiles/sys-devel/gcc/URI
+ HTTP~tamiko/distfiles/URI
+ HTTP~zorry/patches/gcc/URI
+ HTTP~vapier/dist/URI
+ HTTP~blueness/dist/URI"
devspace=${devspace//HTTP/https:\/\/dev.gentoo.org\/}
- echo mirror://gentoo/$1 ${devspace//URI/$1}
+ echo ${devspace//URI/$1} mirror://gentoo/$1
}
# This function handles the basics of setting the SRC_URI for a gcc ebuild.
@@ -330,19 +429,19 @@ gentoo_urls() {
# PATCH_GCC_VER
# This should be set to the version of the gentoo patch tarball.
# The resulting filename of this tarball will be:
-# gcc-${PATCH_GCC_VER:-${GCC_RELEASE_VER}}-patches-${PATCH_VER}.tar.bz2
+# gcc-${PATCH_GCC_VER:-${GCC_RELEASE_VER}}-patches-${PATCH_VER}.tar.xz
#
# PIE_VER
# PIE_GCC_VER
# These variables control patching in various updates for the logic
-# controlling Position Independant Executables. PIE_VER is expected
+# controlling Position Independent Executables. PIE_VER is expected
# to be the version of this patch, and PIE_GCC_VER the gcc version of
# the patch:
# An example:
# PIE_VER="8.7.6.5"
# PIE_GCC_VER="3.4.0"
# The resulting filename of this tarball will be:
-# gcc-${PIE_GCC_VER:-${GCC_RELEASE_VER}}-piepatches-v${PIE_VER}.tar.bz2
+# gcc-${PIE_GCC_VER:-${GCC_RELEASE_VER}}-piepatches-v${PIE_VER}.tar.xz
#
# SPECS_VER
# SPECS_GCC_VER
@@ -354,7 +453,7 @@ gentoo_urls() {
# SPECS_VER="8.7.6.5"
# SPECS_GCC_VER="3.4.0"
# The resulting filename of this tarball will be:
-# gcc-${SPECS_GCC_VER:-${GCC_RELEASE_VER}}-specs-${SPECS_VER}.tar.bz2
+# gcc-${SPECS_GCC_VER:-${GCC_RELEASE_VER}}-specs-${SPECS_VER}.tar.xz
#
# CYGWINPORTS_GITREV
# If set, this variable signals that we should apply additional patches
@@ -365,7 +464,7 @@ gentoo_urls() {
# with a Cygwin target.
get_gcc_src_uri() {
export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
- export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
+ export MUSL_GCC_VER=${MUSL_GCC_VER:-${PATCH_GCC_VER}}
export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}}
export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}}
export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}}
@@ -375,10 +474,10 @@ get_gcc_src_uri() {
if tc_is_live ; then
: # Nothing to do w/git snapshots.
elif [[ -n ${GCC_TARBALL_SRC_URI} ]] ; then
- # pull gcc tarball from another location. Frequently used by gnat-gpl.
+ # Pull gcc tarball from another location. Frequently used by gnat-gpl.
GCC_SRC_URI="${GCC_TARBALL_SRC_URI}"
elif [[ -n ${SNAPSHOT} ]] ; then
- GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz"
+ GCC_SRC_URI="https://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz"
else
if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz"
@@ -387,18 +486,18 @@ get_gcc_src_uri() {
fi
fi
- [[ -n ${UCLIBC_VER} ]] && \
- GCC_SRC_URI+=" $(gentoo_urls gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2)"
[[ -n ${PATCH_VER} ]] && \
- GCC_SRC_URI+=" $(gentoo_urls gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2)"
+ GCC_SRC_URI+=" $(gentoo_urls gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.${TOOLCHAIN_PATCH_SUFFIX})"
+ [[ -n ${MUSL_VER} ]] && \
+ GCC_SRC_URI+=" $(gentoo_urls gcc-${MUSL_GCC_VER}-musl-patches-${MUSL_VER}.tar.${TOOLCHAIN_PATCH_SUFFIX})"
[[ -n ${PIE_VER} ]] && \
- PIE_CORE=${PIE_CORE:-gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2} && \
+ PIE_CORE=${PIE_CORE:-gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.${TOOLCHAIN_PATCH_SUFFIX}} && \
GCC_SRC_URI+=" $(gentoo_urls ${PIE_CORE})"
# gcc minispec for the hardened gcc 4 compiler
[[ -n ${SPECS_VER} ]] && \
- GCC_SRC_URI+=" $(gentoo_urls gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2)"
+ GCC_SRC_URI+=" $(gentoo_urls gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.${TOOLCHAIN_PATCH_SUFFIX})"
if tc_has_feature gcj ; then
if tc_version_is_at_least 4.5 ; then
@@ -436,9 +535,40 @@ toolchain_pkg_pretend() {
#---->> pkg_setup <<----
toolchain_pkg_setup() {
- # we dont want to use the installed compiler's specs to build gcc
+ # We don't want to use the installed compiler's specs to build gcc
unset GCC_SPECS
- unset LANGUAGES #265283
+
+ # bug #265283
+ unset LANGUAGES
+
+ # See https://www.gnu.org/software/make/manual/html_node/Parallel-Output.html
+ # Avoid really confusing logs from subconfigure spam, makes logs far
+ # more legible.
+ MAKEOPTS="--output-sync=line ${MAKEOPTS}"
+}
+
+#---->> src_unpack <<----
+
+# @FUNCTION: toolchain_fetch_git_patches
+# @INTERNAL
+# @DESCRIPTION:
+# Fetch patches from Gentoo's gcc-patches repository.
+toolchain_fetch_git_patches() {
+ local gcc_patches_repo="https://anongit.gentoo.org/git/proj/gcc-patches.git https://github.com/gentoo/gcc-patches"
+
+ # If we weren't given a patchset number, pull it from git too.
+ einfo "Fetching patchset from git as PATCH_VER is unset"
+ EGIT_REPO_URI=${gcc_patches_repo} EGIT_BRANCH="master" \
+ EGIT_CHECKOUT_DIR="${WORKDIR}"/patch.tmp \
+ git-r3_src_unpack
+
+ mkdir "${WORKDIR}"/patch || die
+ mv "${WORKDIR}"/patch.tmp/${PATCH_GCC_VER}/gentoo/* "${WORKDIR}"/patch || die
+
+ if [[ -n ${MUSL_VER} || -d "${WORKDIR}"/musl ]] && [[ ${CTARGET} == *musl* ]] ; then
+ mkdir "${WORKDIR}"/musl || die
+ mv "${WORKDIR}"/patch.tmp/${PATCH_GCC_VER}/musl/* "${WORKDIR}"/musl || die
+ fi
# yuck, but how else to do it portable?
local realEPREFIX=$(python -c 'import os; print(os.path.realpath("'"${EPREFIX}"'"))')
@@ -450,37 +580,25 @@ toolchain_pkg_setup() {
fi
}
-#---->> src_unpack <<----
-
toolchain_src_unpack() {
if tc_is_live ; then
git-r3_src_unpack
+
+ if [[ -z ${PATCH_VER} ]] && ! use vanilla ; then
+ toolchain_fetch_git_patches
+ fi
+ elif [[ -z ${PATCH_VER} && -n ${TOOLCHAIN_USE_GIT_PATCHES} ]] ; then
+ toolchain_fetch_git_patches
fi
- default_src_unpack
+ default
}
#---->> src_prepare <<----
-# 'epatch' is not available in EAPI=7. Abstract away patchset application
-# until we eventually get all gcc ebuilds on EAPI=7 or later.
-tc_apply_patches() {
- [[ ${#@} -lt 2 ]] && die "usage: tc_apply_patches <message> <patches...>"
-
- einfo "$1"; shift
-
- case ${EAPI:-0} in
- # Note: even for EAPI=6 we used 'epatch' semantics. To avoid
- # breaking existing ebuilds use 'eapply' only in EAPI=7 or later.
- 5*|6) epatch "$@" ;;
- 7) eapply "$@" ;;
- *) die "Update apply_patches() for ${EAPI}." ;;
- esac
-}
-
toolchain_src_prepare() {
export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}"
- cd "${S}"
+ cd "${S}" || die
do_gcc_gentoo_patches
do_gcc_PIE_patches
@@ -490,11 +608,7 @@ toolchain_src_prepare() {
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, commit ${EGIT_VERSION}"
fi
- case ${EAPI:-0} in
- 5*) epatch_user;;
- 6|7) eapply_user ;;
- *) die "Update toolchain_src_prepare() for ${EAPI}." ;;
- esac
+ eapply_user
if ( tc_version_is_at_least 4.8.2 || _tc_use_if_iuse hardened ) \
&& ! use vanilla ; then
@@ -509,11 +623,11 @@ toolchain_src_prepare() {
sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/MacOSX.sdk/System/Library/Frameworks\"\, \"${EPREFIX}/Frameworks\"\, " \
"${S}"/gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
- # make sure the pkg config files install into multilib dirs.
- # since we configure with just one --libdir, we can't use that
- # (as gcc itself takes care of building multilibs). #435728
+ # Make sure the pkg-config files install into multilib dirs.
+ # Since we configure with just one --libdir, we can't use that
+ # (as gcc itself takes care of building multilibs). bug #435728
find "${S}" -name Makefile.in \
- -exec sed -i '/^pkgconfigdir/s:=.*:=$(toolexeclibdir)/pkgconfig:' {} +
+ -exec sed -i '/^pkgconfigdir/s:=.*:=$(toolexeclibdir)/pkgconfig:' {} + || die
setup_multilib_osdirnames
gcc_version_patch
@@ -546,7 +660,7 @@ toolchain_src_prepare() {
gnuconfig_update
- # update configure files
+ # Update configure files
local f
einfo "Fixing misc issues in configure files"
for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
@@ -555,12 +669,12 @@ toolchain_src_prepare() {
|| eerror "Please file a bug about this"
eend $?
done
- sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
+ # bug #215828
+ sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk || die
- # Prevent new texinfo from breaking old versions (see #198182, #464008)
- if tc_version_is_at_least 4.1; then
- tc_apply_patches "Remove texinfo (bug #198182, bug #464008)" "${FILESDIR}"/gcc-configure-texinfo.patch
- fi
+ # Prevent new texinfo from breaking old versions (see #198182, bug #464008)
+ einfo "Remove texinfo (bug #198182, bug #464008)"
+ eapply "${FILESDIR}"/gcc-configure-texinfo.patch
# >=gcc-4
if [[ -x contrib/gcc_update ]] ; then
@@ -574,12 +688,28 @@ toolchain_src_prepare() {
do_gcc_gentoo_patches() {
if ! use vanilla ; then
- if [[ -n ${PATCH_VER} ]] ; then
- tc_apply_patches "Applying Gentoo patches ..." "${WORKDIR}"/patch/*.patch
+ if [[ -n ${PATCH_VER} || -d "${WORKDIR}"/patch ]] ; then
+ einfo "Applying Gentoo patches ..."
+ eapply "${WORKDIR}"/patch/*.patch
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}"
fi
- if [[ -n ${UCLIBC_VER} ]] ; then
- tc_apply_patches "Applying uClibc patches ..." "${WORKDIR}"/uclibc/*.patch
+
+ if [[ -n ${MUSL_VER} || -d "${WORKDIR}"/musl ]] && [[ ${CTARGET} == *musl* ]] ; then
+ if [[ ${CATEGORY} == cross-* ]] ; then
+ # We don't want to apply some patches when cross-compiling.
+ if [[ -d "${WORKDIR}"/musl/nocross ]] ; then
+ rm -fv "${WORKDIR}"/musl/nocross/*.patch || die
+ else
+ # Just make an empty directory to make the glob below easier.
+ mkdir -p "${WORKDIR}"/musl/nocross || die
+ fi
+ fi
+
+ local shopt_save=$(shopt -p nullglob)
+ shopt -s nullglob
+ einfo "Applying musl patches ..."
+ eapply "${WORKDIR}"/musl/{,nocross/}*.patch
+ ${shopt_save}
fi
fi
}
@@ -588,7 +718,8 @@ do_gcc_PIE_patches() {
want_pie || return 0
use vanilla && return 0
- tc_apply_patches "Applying pie patches ..." "${WORKDIR}"/piepatch/*.patch
+ einfo "Applying PIE patches ..."
+ eapply "${WORKDIR}"/piepatch/*.patch
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
}
@@ -598,7 +729,7 @@ do_gcc_CYGWINPORTS_patches() {
use elibc_Cygwin || return 0
local p d="${WORKDIR}/gcc-${CYGWINPORTS_GITREV}"
- # readarray -t is available since bash-4.4 only, #690686
+ # readarray -t is available since bash-4.4 only, bug #690686
local patches=( $(
for p in $(
sed -e '1,/PATCH_URI="/d;/"/,$d' < "${d}"/gcc.cygport
@@ -606,21 +737,23 @@ do_gcc_CYGWINPORTS_patches() {
echo "${d}/${p}"
done
) )
- tc_apply_patches "Applying cygwin port patches ..." ${patches[*]}
+ einfo "Applying cygwin port patches ..."
+ eapply -- "${patches[@]}"
}
# configure to build with the hardened GCC specs as the default
make_gcc_hard() {
local gcc_hard_flags=""
- # If we use gcc-6 or newer with pie enable to compile older gcc we need to pass -no-pie
- # to stage1; bug #618908
+ # If we use gcc-6 or newer with PIE enabled to compile older gcc,
+ # we need to pass -no-pie to stage1; bug #618908
if ! tc_version_is_at_least 6.0 && [[ $(gcc-major-version) -ge 6 ]] ; then
einfo "Disabling PIE in stage1 (only) ..."
sed -i -e "/^STAGE1_LDFLAGS/ s/$/ -no-pie/" "${S}"/Makefile.in || die
fi
- # Gcc >= 6.X we can use configurations options to turn pie/ssp on as default
+ # For gcc >= 6.x, we can use configuration options to turn PIE/SSP
+ # on as default
if tc_version_is_at_least 6.0 ; then
if _tc_use_if_iuse pie ; then
einfo "Updating gcc to use automatic PIE building ..."
@@ -630,16 +763,21 @@ make_gcc_hard() {
fi
if _tc_use_if_iuse hardened ; then
# Will add some hardened options as default, like:
- # -fstack-clash-protection
- # -z now
- # see *_all_extra-options.patch gcc patches.
+ # * -fstack-clash-protection
+ # * -z now
+ # See gcc *_all_extra-options.patch patches.
gcc_hard_flags+=" -DEXTRA_OPTIONS"
- # rebrand to make bug reports easier
+
+ if _tc_use_if_iuse cet && [[ ${CTARGET} == *x86_64*-linux* ]] ; then
+ gcc_hard_flags+=" -DEXTRA_OPTIONS_CF"
+ fi
+
+ # Rebrand to make bug reports easier
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
fi
else
if _tc_use_if_iuse hardened ; then
- # rebrand to make bug reports easier
+ # Rebrand to make bug reports easier
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
if hardened_gcc_works ; then
einfo "Updating gcc to use automatic PIE + SSP building ..."
@@ -653,7 +791,7 @@ make_gcc_hard() {
ewarn "PIE has not been enabled by default"
gcc_hard_flags+=" -DEFAULT_SSP"
else
- # do nothing if hardened isn't supported, but don't die either
+ # Do nothing if hardened isn't supported, but don't die either
ewarn "hardened is not supported for this arch in this gcc version"
return 0
fi
@@ -665,16 +803,16 @@ make_gcc_hard() {
fi
fi
- # we want to be able to control the pie patch logic via something other
+ # We want to be able to control the PIE patch logic via something other
# than ALL_CFLAGS...
sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
-e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
- -i "${S}"/gcc/Makefile.in
+ -i "${S}"/gcc/Makefile.in || die
# Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
if tc_version_is_at_least 4.7 ; then
sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
-e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
- -i "${S}"/gcc/Makefile.in
+ -i "${S}"/gcc/Makefile.in || die
fi
sed -i \
@@ -703,13 +841,13 @@ setup_multilib_osdirnames() {
local config
local libdirs="../lib64 ../lib32"
- # this only makes sense for some Linux targets
+ # This only makes sense for some Linux targets
case ${CTARGET} in
- x86_64*-linux*) config="i386" ;;
- powerpc64*-linux*) config="rs6000" ;;
- sparc64*-linux*) config="sparc" ;;
- s390x*-linux*) config="s390" ;;
- *) return 0 ;;
+ x86_64*-linux*) config="i386" ;;
+ powerpc64*-linux*) config="rs6000" ;;
+ sparc64*-linux*) config="sparc" ;;
+ s390x*-linux*) config="s390" ;;
+ *) return 0 ;;
esac
config+="/t-linux64"
@@ -718,14 +856,14 @@ setup_multilib_osdirnames() {
sed_args+=( -e 's:$[(]call if_multiarch[^)]*[)]::g' )
fi
if [[ ${SYMLINK_LIB} == "yes" ]] ; then
- einfo "updating multilib directories to be: ${libdirs}"
+ einfo "Updating multilib directories to be: ${libdirs}"
if tc_version_is_at_least 4.6.4 || tc_version_is_at_least 4.7 ; then
sed_args+=( -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:' )
else
sed_args+=( -e "/^MULTILIB_OSDIRNAMES/s:=.*:= ${libdirs}:" )
fi
else
- einfo "using upstream multilib; disabling lib32 autodetection"
+ einfo "Using upstream multilib; disabling lib32 autodetection"
sed_args+=( -r -e 's:[$][(]if.*,(.*)[)]:\1:' )
fi
sed -i "${sed_args[@]}" "${S}"/gcc/config/${config} || die
@@ -737,7 +875,7 @@ gcc_version_patch() {
local version_string=${GCC_RELEASE_VER}
- einfo "patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})"
+ einfo "Patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})"
local gcc_sed=( -e 's:gcc\.gnu\.org/bugs\.html:bugs\.gentoo\.org/:' )
if grep -qs VERSUFFIX "${S}"/gcc/version.c ; then
@@ -760,10 +898,10 @@ toolchain_src_configure() {
einfo "LDFLAGS=\"${LDFLAGS}\""
# Force internal zip based jar script to avoid random
- # issues with 3rd party jar implementations. #384291
+ # issues with 3rd party jar implementations. bug #384291
export JAR=no
- # For hardened gcc 4.3 piepatchset to build the hardened specs
+ # For hardened gcc 4.3: add the pie patchset to build the hardened specs
# file (build.specs) to use when building gcc.
if ! tc_version_is_at_least 4.4 && want_minispecs ; then
setup_minispecs_gcc_build_specs
@@ -771,6 +909,8 @@ toolchain_src_configure() {
local confgcc=( --host=${CHOST} )
+ local build_config_targets=()
+
if is_crosscompile || tc-is-cross-compiler ; then
# Straight from the GCC install doc:
# "GCC has code to correctly determine the correct value for target
@@ -810,16 +950,13 @@ toolchain_src_configure() {
is_d && GCC_LANG+=",d"
is_gcj && GCC_LANG+=",java"
is_go && GCC_LANG+=",go"
- is_jit && GCC_LANG+=",jit"
if is_objc || is_objcxx ; then
GCC_LANG+=",objc"
- if tc_version_is_at_least 4 ; then
- use objc-gc && confgcc+=( --enable-objc-gc )
- fi
+ use objc-gc && confgcc+=( --enable-objc-gc )
is_objcxx && GCC_LANG+=",obj-c++"
fi
- # fortran support just got sillier! the lang value can be f77 for
+ # Fortran support just got sillier! The lang value can be f77 for
# fortran77, f95 for fortran95, or just plain old fortran for the
# currently supported standard depending on gcc version.
is_fortran && GCC_LANG+=",fortran"
@@ -845,11 +982,11 @@ toolchain_src_configure() {
confgcc+=( --disable-nls )
fi
- tc_version_is_at_least 3.4 || confgcc+=( --disable-libunwind-exceptions )
+ confgcc+=( --disable-libunwind-exceptions )
# Use the default ("release") checking because upstream usually neglects
# to test "disabled" so it has a history of breaking. bug #317217
- if tc_version_is_at_least 3.4 && in_iuse debug ; then
+ if in_iuse debug ; then
# The "release" keyword is new to 4.0. bug #551636
local off=$(tc_version_is_at_least 4.0 && echo release || echo no)
confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes ${off})}" )
@@ -861,12 +998,12 @@ toolchain_src_configure() {
--with-pkgversion="${BRANDING_GCC_PKGVERSION}"
)
- # If we want hardened support with the newer piepatchset for >=gcc 4.4
+ # If we want hardened support with the newer PIE patchset for >=gcc 4.4
if tc_version_is_at_least 4.4 && want_minispecs && in_iuse hardened ; then
confgcc+=( $(use_enable hardened esp) )
fi
- # allow gcc to search for clock funcs in the main C lib.
+ # Allow gcc to search for clock funcs in the main C lib.
# if it can't find them, then tough cookies -- we aren't
# going to link in -lrt to all C++ apps. bug #411681
if tc_version_is_at_least 4.4 && is_cxx ; then
@@ -875,17 +1012,18 @@ toolchain_src_configure() {
# Build compiler itself using LTO
if tc_version_is_at_least 9.1 && _tc_use_if_iuse lto ; then
- confgcc+=( --with-build-config=bootstrap-lto )
+ build_config_targets+=( bootstrap-lto )
+ fi
+
+ if tc_version_is_at_least 12 && _tc_use_if_iuse cet ; then
+ build_config_targets+=( bootstrap-cet )
fi
- # Support to disable pch when building libstdcxx
+ # Support to disable PCH when building libstdcxx
if tc_version_is_at_least 6.0 && ! _tc_use_if_iuse pch ; then
confgcc+=( --disable-libstdcxx-pch )
fi
- # The jit language requires this.
- is_jit && confgcc+=( --enable-host-shared )
-
# build-id was disabled for file collisions: bug #526144
#
# # Turn on the -Wl,--build-id flag by default for ELF targets. bug #525942
@@ -898,7 +1036,7 @@ toolchain_src_configure() {
# ;;
# esac
- # newer gcc versions like to bootstrap themselves with C++,
+ # Newer gcc versions like to bootstrap themselves with C++,
# so we need to manually disable it ourselves
if tc_version_is_between 4.7 4.8 && ! is_cxx ; then
confgcc+=( --disable-build-with-cxx --disable-build-poststage1-with-cxx )
@@ -914,55 +1052,65 @@ toolchain_src_configure() {
# disable a bunch of features or gcc goes boom
local needed_libc=""
case ${CTARGET} in
- *-linux) needed_libc=error-unknown-libc;;
- *-dietlibc) needed_libc=dietlibc;;
- *-elf|*-eabi)
- needed_libc=newlib
- # Bare-metal targets don't have access to clock_gettime()
- # arm-none-eabi example: bug #589672
- # But we explicitly do --enable-libstdcxx-time above.
- # Undoing it here.
- confgcc+=( --disable-libstdcxx-time )
- ;;
- *-gentoo-freebsd*) needed_libc=freebsd-lib;;
- *-gnu*) needed_libc=glibc;;
- *-klibc) needed_libc=klibc;;
- *-musl*) needed_libc=musl;;
- *-uclibc*)
- # Enable shared library support only on targets
- # that support it: bug #291870
- if ! echo '#include <features.h>' | \
- $(tc-getCPP ${CTARGET}) -E -dD - 2>/dev/null | \
- grep -q __HAVE_SHARED__
- then
- confgcc+=( --disable-shared )
- fi
- needed_libc=uclibc-ng
- ;;
- *-cygwin) needed_libc=cygwin;;
- x86_64-*-mingw*|\
- *-w64-mingw*) needed_libc=mingw64-runtime;;
- mingw*|*-mingw*) needed_libc=mingw-runtime;;
- avr) confgcc+=( --enable-shared --disable-threads );;
- *-apple-darwin*) confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}" );;
- *-solaris*) confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}"
- );;
- *-freebsd*) confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}"
- );;
+ *-linux)
+ needed_libc=error-unknown-libc
+ ;;
+ *-dietlibc)
+ needed_libc=dietlibc
+ ;;
+ *-elf|*-eabi)
+ needed_libc=newlib
+ # Bare-metal targets don't have access to clock_gettime()
+ # arm-none-eabi example: bug #589672
+ # But we explicitly do --enable-libstdcxx-time above.
+ # Undoing it here.
+ confgcc+=( --disable-libstdcxx-time )
+ ;;
+ *-gnu*)
+ needed_libc=glibc
+ ;;
+ *-klibc)
+ needed_libc=klibc
+ ;;
+ *-musl*)
+ needed_libc=musl
+ ;;
+ *-cygwin)
+ needed_libc=cygwin
+ ;;
+ x86_64-*-mingw*|*-w64-mingw*)
+ needed_libc=mingw64-runtime
+ ;;
+ avr)
+ confgcc+=( --enable-shared --disable-threads )
+ ;;
+ # Prefix targets
+ *-apple-darwin*)
+ confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}" )
+ ;;
+ *-solaris*)
+ confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}" )
+ ;;
+ *-freebsd*)
+ confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}" )
+ ;;
esac
+
if [[ -n ${needed_libc} ]] ; then
local confgcc_no_libc=( --disable-shared )
# requires libc: bug #734820
tc_version_is_at_least 4.6 && confgcc_no_libc+=( --disable-libquadmath )
# requires libc
tc_version_is_at_least 4.8 && confgcc_no_libc+=( --disable-libatomic )
+
if ! has_version ${CATEGORY}/${needed_libc} ; then
confgcc+=(
"${confgcc_no_libc[@]}"
--disable-threads
--without-headers
)
- if [[ $needed_libc == glibc ]]; then
+
+ if [[ ${needed_libc} == glibc ]] ; then
# By default gcc looks at glibc's headers
# to detect long double support. This does
# not work for --disable-headers mode.
@@ -980,7 +1128,7 @@ toolchain_src_configure() {
fi
fi
- tc_version_is_at_least 4.2 && confgcc+=( --disable-bootstrap )
+ confgcc+=( --disable-bootstrap )
else
if tc-is-static-only ; then
confgcc+=( --disable-shared )
@@ -988,10 +1136,12 @@ toolchain_src_configure() {
confgcc+=( --enable-shared )
fi
case ${CHOST} in
- mingw*|*-mingw*)
- confgcc+=( --enable-threads=win32 ) ;;
- *)
- confgcc+=( --enable-threads=posix ) ;;
+ mingw*|*-mingw*)
+ confgcc+=( --enable-threads=win32 )
+ ;;
+ *)
+ confgcc+=( --enable-threads=posix )
+ ;;
esac
if use prefix ; then
@@ -1012,39 +1162,21 @@ toolchain_src_configure() {
# __cxa_atexit is "essential for fully standards-compliant handling of
# destructors", but apparently requires glibc.
case ${CTARGET} in
- *-uclibc*)
- if tc_has_feature nptl ; then
+ *-elf|*-eabi)
+ confgcc+=( --with-newlib )
+ ;;
+ *-musl*)
+ confgcc+=( --enable-__cxa_atexit )
+ ;;
+ *-gnu*)
confgcc+=(
- --disable-__cxa_atexit
- $(use_enable nptl tls)
+ --enable-__cxa_atexit
+ --enable-clocale=gnu
)
- fi
- tc_version_is_between 3.3 3.4 && confgcc+=( --enable-sjlj-exceptions )
- if tc_version_is_between 3.4 4.3 ; then
- confgcc+=( --enable-clocale=uclibc )
- fi
- ;;
- *-elf|*-eabi)
- confgcc+=( --with-newlib )
- ;;
- *-musl*)
- confgcc+=( --enable-__cxa_atexit )
- ;;
- *-gnu*)
- confgcc+=(
- --enable-__cxa_atexit
- --enable-clocale=gnu
- )
- ;;
- *-freebsd*)
- confgcc+=( --enable-__cxa_atexit )
- ;;
- *-openbsd*)
- confgcc+=( --enable-__cxa_atexit )
- ;;
- *-solaris*)
- confgcc+=( --enable-__cxa_atexit )
- ;;
+ ;;
+ *-solaris*)
+ confgcc+=( --enable-__cxa_atexit )
+ ;;
esac
### arch options
@@ -1057,102 +1189,117 @@ toolchain_src_configure() {
tc_version_is_at_least 4.3 && in_iuse fixed-point && confgcc+=( $(use_enable fixed-point) )
case $(tc-is-softfloat) in
- yes) confgcc+=( --with-float=soft ) ;;
- softfp) confgcc+=( --with-float=softfp ) ;;
- *)
- # If they've explicitly opt-ed in, do hardfloat,
- # otherwise let the gcc default kick in.
- case ${CTARGET//_/-} in
- *-hardfloat-*|*eabihf) confgcc+=( --with-float=hard ) ;;
- esac
+ yes)
+ confgcc+=( --with-float=soft )
+ ;;
+ softfp)
+ confgcc+=( --with-float=softfp )
+ ;;
+ *)
+ # If they've explicitly opt-ed in, do hardfloat,
+ # otherwise let the gcc default kick in.
+ case ${CTARGET//_/-} in
+ *-hardfloat-*|*eabihf)
+ confgcc+=( --with-float=hard )
+ ;;
+ esac
esac
local with_abi_map=()
case $(tc-arch) in
- arm) #264534 #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
- if [[ ${arm_arch} == *${a} ]] ; then
- arm_arch=${arm_arch%${a}}
- break
+ arm)
+ # 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
+ if [[ ${arm_arch} == *${a} ]] ; then
+ arm_arch=${arm_arch%${a}}
+ break
+ fi
+ done
+
+ # Convert armv6m to armv6-m
+ [[ ${arm_arch} == armv6m ]] && arm_arch=armv6-m
+ # Convert armv7{a,r,m} to armv7-{a,r,m}
+ [[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
+ # See if this is a valid --with-arch flag
+ if (srcdir=${S}/gcc target=${CTARGET} with_arch=${arm_arch};
+ . "${srcdir}"/config.gcc) &>/dev/null
+ then
+ confgcc+=( --with-arch=${arm_arch} )
fi
- done
- # Convert armv7{a,r,m} to armv7-{a,r,m}
- [[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
- # See if this is a valid --with-arch flag
- if (srcdir=${S}/gcc target=${CTARGET} with_arch=${arm_arch};
- . "${srcdir}"/config.gcc) &>/dev/null
- then
- confgcc+=( --with-arch=${arm_arch} )
- fi
- # Make default mode thumb for microcontroller classes #418209
- [[ ${arm_arch} == *-m ]] && confgcc+=( --with-mode=thumb )
+ # Make default mode thumb for microcontroller classes #418209
+ [[ ${arm_arch} == *-m ]] && confgcc+=( --with-mode=thumb )
- # Enable hardvfp
- if [[ $(tc-is-softfloat) == "no" ]] && \
- [[ ${CTARGET} == armv[67]* ]] && \
- tc_version_is_at_least 4.5
- then
- # Follow the new arm hardfp distro standard by default
- confgcc+=( --with-float=hard )
- case ${CTARGET} in
- armv6*) confgcc+=( --with-fpu=vfp ) ;;
- armv7*) confgcc+=( --with-fpu=vfpv3-d16 ) ;;
- esac
- fi
- ;;
- mips)
- # Add --with-abi flags to set default ABI
- confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
- ;;
- amd64)
- # drop the older/ABI checks once this get's merged into some
- # version of gcc upstream
- if tc_version_is_at_least 4.8 && has x32 $(get_all_abis TARGET) ; then
+ # Enable hardvfp
+ if [[ $(tc-is-softfloat) == "no" ]] && \
+ [[ ${CTARGET} == armv[67]* ]] && \
+ tc_version_is_at_least 4.5
+ then
+ # Follow the new arm hardfp distro standard by default
+ confgcc+=( --with-float=hard )
+ case ${CTARGET} in
+ armv6*) confgcc+=( --with-fpu=vfp ) ;;
+ armv7*) confgcc+=( --with-fpu=vfpv3-d16 ) ;;
+ esac
+ fi
+ ;;
+ mips)
+ # Add --with-abi flags to set default ABI
confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
- fi
- ;;
- x86)
- # Default arch for x86 is normally i386, lets give it a bump
- # since glibc will do so based on CTARGET anyways
- confgcc+=( --with-arch=${CTARGET%%-*} )
- ;;
- hppa)
- # Enable sjlj exceptions for backward compatibility on hppa
- [[ ${GCCMAJOR} == "3" ]] && confgcc+=( --enable-sjlj-exceptions )
- ;;
- ppc)
- # Set up defaults based on current CFLAGS
- is-flagq -mfloat-gprs=double && confgcc+=( --enable-e500-double )
- [[ ${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
- # https://bugs.gentoo.org/704784
- # https://gcc.gnu.org/PR93157
- [[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( --with-abi=elfv2 )
- ;;
- riscv)
- # Add --with-abi flags to set default ABI
- confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
- ;;
+ ;;
+
+ amd64)
+ # drop the older/ABI checks once this get's merged into some
+ # version of gcc upstream
+ if tc_version_is_at_least 4.8 && has x32 $(get_all_abis TARGET) ; then
+ confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
+ fi
+ ;;
+ x86)
+ # Default arch for x86 is normally i386, lets give it a bump
+ # since glibc will do so based on CTARGET anyways
+ confgcc+=( --with-arch=${CTARGET%%-*} )
+ ;;
+ hppa)
+ # Enable sjlj exceptions for backward compatibility on hppa
+ [[ ${GCCMAJOR} == "3" ]] && confgcc+=( --enable-sjlj-exceptions )
+ ;;
+ ppc)
+ # Set up defaults based on current CFLAGS
+ is-flagq -mfloat-gprs=double && confgcc+=( --enable-e500-double )
+ [[ ${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
+ [[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( --with-abi=elfv2 )
+ ;;
+ riscv)
+ # Add --with-abi flags to set default ABI
+ confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
+ ;;
esac
# 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. #349405
- if use !prefix ; then #406689
+ # userland by not needing sys-devel/kgcc64. bug #349405
case $(tc-arch) in
- ppc|ppc64) tc_version_is_at_least 3.4 && confgcc+=( --enable-targets=all ) ;;
- sparc) tc_version_is_at_least 4.4 && confgcc+=( --enable-targets=all ) ;;
- amd64|x86) tc_version_is_at_least 4.3 && confgcc+=( --enable-targets=all ) ;;
+ ppc|ppc64)
+ confgcc+=( --enable-targets=all )
+ ;;
+ sparc)
+ tc_version_is_at_least 4.4 && confgcc+=( --enable-targets=all )
+ ;;
+ amd64|x86)
+ tc_version_is_at_least 4.3 && confgcc+=( --enable-targets=all )
+ ;;
esac
- fi
# On Darwin we need libdir to be set in order to get correct install names
# for things like libobjc-gnu, libgcj and libfortran. If we enable it on
@@ -1172,47 +1319,44 @@ toolchain_src_configure() {
fi
fi
- if tc_version_is_at_least 4.2 ; then
- if in_iuse openmp ; then
- # Make sure target has pthreads support. #326757 #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 ...
- 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
- confgcc+=( --disable-libgomp )
- fi
+ 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 ...
+ if ! is_crosscompile || \
+ $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null
+ then
+ confgcc+=( $(use_enable openmp libgomp) )
else
- # For gcc variants where we don't want openmp (e.g. kgcc)
+ # Force disable as the configure script can be dumb #359855
confgcc+=( --disable-libgomp )
fi
+ else
+ # For gcc variants where we don't want openmp (e.g. kgcc)
+ confgcc+=( --disable-libgomp )
fi
- if tc_version_is_at_least 4.0 ; then
- if _tc_use_if_iuse libssp ; then
- confgcc+=( --enable-libssp )
+ if _tc_use_if_iuse libssp ; then
+ confgcc+=( --enable-libssp )
+ else
+ 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
+ # stack_chk_* functions. Do not disable libssp there.
+ case ${CTARGET} in
+ mingw*|*-mingw*)
+ ewarn "Not disabling libssp"
+ ;;
+ *)
+ confgcc+=( --disable-libssp )
+ ;;
+ esac
else
- # Not all libcs have ssp built in. I assume only glibc has
- # this for now.
- use elibc_glibc &&
- 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
- # stack_chk_* functions. Do not disable libssp there.
- case ${CTARGET} in
- mingw*|*-mingw*) ewarn "Not disabling libssp" ;;
- *) confgcc+=( --disable-libssp ) ;;
- esac
- else
- confgcc+=( --disable-libssp )
- fi
+ confgcc+=( --disable-libssp )
fi
fi
@@ -1220,6 +1364,10 @@ toolchain_src_configure() {
confgcc+=( --disable-libada )
fi
+ if in_iuse cet ; then
+ confgcc+=( $(use_enable cet) )
+ fi
+
if in_iuse cilk ; then
confgcc+=( $(use_enable cilk libcilkrts) )
fi
@@ -1248,6 +1396,8 @@ toolchain_src_configure() {
confgcc+=( $(use_with zstd) )
fi
+ # This only controls whether the compiler *supports* LTO, not whether
+ # it's *built using* LTO. Hence we do it without a USE flag.
if tc_version_is_at_least 4.6 ; then
confgcc+=( --enable-lto )
elif tc_version_is_at_least 4.5 ; then
@@ -1255,7 +1405,7 @@ toolchain_src_configure() {
fi
# graphite was added in 4.4 but we only support it in 6.5+ due to external
- # library issues. #448024, #701270
+ # library issues. bug #448024, bug #701270
if tc_version_is_at_least 6.5 && in_iuse graphite ; then
confgcc+=( $(use_with graphite isl) )
use graphite && confgcc+=( --disable-isl-version-check )
@@ -1288,7 +1438,7 @@ toolchain_src_configure() {
fi
# Disable gcc info regeneration -- it ships with generated info pages
- # already. Our custom version/urls/etc... trigger it. #464008
+ # already. Our custom version/urls/etc... trigger it. bug #464008
export gcc_cv_prog_makeinfo_modern=no
# Do not let the X detection get in our way. We know things can be found
@@ -1299,6 +1449,11 @@ toolchain_src_configure() {
confgcc+=( "$@" ${EXTRA_ECONF} )
+ if [[ -n ${build_config_targets} ]] ; then
+ # ./configure --with-build-config='bootstrap-lto bootstrap-cet'
+ confgcc+=( --with-build-config="${build_config_targets[*]}" )
+ fi
+
# Nothing wrong with a good dose of verbosity
echo
einfo "PREFIX: ${PREFIX}"
@@ -1309,23 +1464,45 @@ toolchain_src_configure() {
echo
einfo "Languages: ${GCC_LANG}"
echo
- einfo "Configuring GCC with: ${confgcc[@]//--/\n\t--}"
- echo
# Build in a separate build tree
- mkdir -p "${WORKDIR}"/build
+ mkdir -p "${WORKDIR}"/build || die
pushd "${WORKDIR}"/build > /dev/null
- # and now to do the actual configuration
+ # ...and now to do the actual configuration
addwrite /dev/zero
- echo "${S}"/configure "${confgcc[@]}"
+
+ local gcc_shell="${BROOT}"/bin/bash
# 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.
- CONFIG_SHELL="${EPREFIX}/bin/bash" \
- bash "${S}"/configure "${confgcc[@]}" || die "failed to run configure"
+ # use of bash for them.
+ if tc_version_is_at_least 11.2 ; then
+ gcc_shell="${BROOT}"/bin/sh
+ fi
- # return to whatever directory we were in before
- popd > /dev/null
+ if is_jit ; then
+ einfo "Configuring JIT gcc"
+
+ mkdir -p "${WORKDIR}"/build-jit || die
+ pushd "${WORKDIR}"/build-jit > /dev/null || die
+ CONFIG_SHELL="${gcc_shell}" edo "${gcc_shell}" "${S}"/configure \
+ "${confgcc[@]}" \
+ --disable-libada \
+ --disable-libsanitizer \
+ --disable-libvtv \
+ --disable-libgomp \
+ --disable-libquadmath \
+ --disable-libatomic \
+ --disable-lto \
+ --disable-bootstrap \
+ --enable-host-shared \
+ --enable-languages=jit
+ popd > /dev/null || die
+ fi
+
+ CONFIG_SHELL="${gcc_shell}" edo "${gcc_shell}" "${S}"/configure "${confgcc[@]}"
+
+ # Return to whatever directory we were in before
+ popd > /dev/null || die
}
# Replace -m flags unsupported by the version being built with the best
@@ -1341,20 +1518,9 @@ downgrade_arch_flags() {
myarch=$(get-flag march)
mytune=$(get-flag mtune)
- # If -march=native isn't supported we have to tease out the actual arch
- if [[ ${myarch} == native || ${mytune} == native ]] ; then
- if ! tc_version_is_at_least 4.2 ${bver}; then
- arch=$($(tc-getCC) -march=native -v -E -P - </dev/null 2>&1 \
- | sed -rn "/cc1.*-march/s:.*-march=([^ ']*).*:\1:p")
- replace-cpu-flags native ${arch}
- fi
- fi
-
# Handle special -mtune flags
[[ ${mytune} == intel ]] && ! tc_version_is_at_least 4.9 ${bver} && replace-cpu-flags intel generic
- [[ ${mytune} == generic ]] && ! tc_version_is_at_least 4.2 ${bver} && filter-flags '-mtune=*'
[[ ${mytune} == x86-64 ]] && filter-flags '-mtune=*'
- tc_version_is_at_least 3.4 ${bver} || filter-flags '-mtune=*'
# "added" "arch" "replacement"
local archlist=(
@@ -1386,14 +1552,6 @@ downgrade_arch_flags() {
4.3 geode k6-2 # gcc.gnu.org/PR41989#c22
4.3 k8-sse3 k8
4.3 opteron-sse3 k8
- 3.4 athlon-fx x86-64
- 3.4 athlon64 x86-64
- 3.4 c3-2 c3
- 3.4 k8 x86-64
- 3.4 opteron x86-64
- 3.4 pentium-m pentium3
- 3.4 pentium3m pentium3
- 3.4 pentium4m pentium4
)
for ((i = 0; i < ${#archlist[@]}; i += 3)) ; do
@@ -1416,7 +1574,7 @@ downgrade_arch_flags() {
fi
done
- # we only check -mno* here since -m* get removed by strip-flags later on
+ # We only check -mno* here since -m* get removed by strip-flags later on
local isalist=(
4.9 -mno-sha
4.9 -mno-avx512pf
@@ -1468,35 +1626,21 @@ gcc_do_filter_flags() {
# relating to failed builds, we strip most CFLAGS out to ensure as few
# problems as possible.
strip-flags
+
# Lock gcc at -O2; we want to be conservative here.
filter-flags '-O?'
append-flags -O2
fi
- # dont want to funk ourselves
+ # Don't want to funk ourselves
filter-flags '-mabi*' -m31 -m32 -m64
- filter-flags -frecord-gcc-switches # 490738
- filter-flags -mno-rtm -mno-htm # 506202
+ # bug #490738
+ filter-flags -frecord-gcc-switches
+ # bug #506202
+ filter-flags -mno-rtm -mno-htm
- if tc_version_is_between 3.2 3.4 ; then
- # XXX: this is so outdated it's barely useful, but it don't hurt...
- replace-cpu-flags G3 750
- replace-cpu-flags G4 7400
- replace-cpu-flags G5 7400
-
- # XXX: should add a sed or something to query all supported flags
- # from the gcc source and trim everything else ...
- filter-flags -f{no-,}unit-at-a-time -f{no-,}web -mno-tls-direct-seg-refs
- filter-flags -f{no-,}stack-protector{,-all}
- filter-flags -fvisibility-inlines-hidden -fvisibility=hidden
- # and warning options
- filter-flags -Wextra -Wstack-protector
- fi
- if ! tc_version_is_at_least 4.1 ; then
- filter-flags -fdiagnostics-show-option
- filter-flags -Wstack-protector
- fi
+ filter-flags '-fsanitize=*'
if tc_version_is_between 6 8 ; then
# -mstackrealign triggers crashes in exception throwing
@@ -1505,40 +1649,37 @@ gcc_do_filter_flags() {
filter-flags -mstackrealign
fi
- if tc_version_is_at_least 3.4 ; then
- case $(tc-arch) in
- amd64|x86)
- filter-flags '-mcpu=*'
+ case $(tc-arch) in
+ amd64|x86)
+ filter-flags '-mcpu=*'
- tc_version_is_between 4.4 4.5 && append-flags -mno-avx # 357287
+ # bug #357287
+ tc_version_is_between 4.4 4.5 && append-flags -mno-avx
- if tc_version_is_between 4.6 4.7 ; then
- # https://bugs.gentoo.org/411333
- # https://bugs.gentoo.org/466454
- replace-cpu-flags c3-2 pentium2 pentium3 pentium3m pentium-m i686
- fi
- ;;
- alpha)
- # https://bugs.gentoo.org/454426
- append-ldflags -Wl,--no-relax
- ;;
- sparc)
- # temporary workaround for random ICEs reproduced by multiple users
- # https://bugs.gentoo.org/457062
- tc_version_is_between 4.6 4.8 && MAKEOPTS+=" -j1"
- ;;
- *-macos)
- # http://gcc.gnu.org/PR25127
- # used to break on 4.1 4.2 now breaks on 10 too, so
- # filter everywhere
+ if tc_version_is_between 4.6 4.7 ; then
+ # bug #411333, bug #466454
+ replace-cpu-flags c3-2 pentium2 pentium3 pentium3m pentium-m i686
+ fi
+ ;;
+ alpha)
+ # bug #454426
+ append-ldflags -Wl,--no-relax
+ ;;
+ sparc)
+ # Temporary workaround for random ICEs reproduced by multiple users
+ # bug #457062
+ tc_version_is_between 4.6 4.8 && MAKEOPTS+=" -j1"
+ ;;
+ *-macos)
+ # https://gcc.gnu.org/PR25127
+ tc_version_is_between 4.0 4.2 && \
filter-flags '-mcpu=*' '-march=*' '-mtune=*'
- ;;
- esac
- fi
+ ;;
+ esac
strip-unsupported-flags
- # these are set here so we have something sane at configure time
+ # These are set here so we have something sane at configure time
if is_crosscompile ; then
# Set this to something sane for both native and target
CFLAGS="-O2 -pipe"
@@ -1580,7 +1721,7 @@ gcc-multilib-configure() {
confgcc+=( --enable-multilib )
fi
- # translate our notion of multilibs into gcc's
+ # Translate our notion of multilibs into gcc's
local abi list
for abi in $(get_all_abis TARGET) ; do
local l=$(gcc-abi-map ${abi})
@@ -1599,9 +1740,15 @@ gcc-abi-map() {
# Convert the ABI name we use in Gentoo to what gcc uses
local map=()
case ${CTARGET} in
- mips*) map=("o32 32" "n32 n32" "n64 64") ;;
- riscv*) map=("lp64d lp64d" "lp64 lp64" "ilp32d ilp32d" "ilp32 ilp32") ;;
- x86_64*) map=("amd64 m64" "x86 m32" "x32 mx32") ;;
+ mips*)
+ map=("o32 32" "n32 n32" "n64 64")
+ ;;
+ riscv*)
+ map=("lp64d lp64d" "lp64 lp64" "ilp32d ilp32d" "ilp32 ilp32")
+ ;;
+ x86_64*)
+ map=("amd64 m64" "x86 m32" "x32 mx32")
+ ;;
esac
local m
@@ -1628,9 +1775,9 @@ toolchain_src_compile() {
# 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.
# 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): #664486
- CONFIG_SHELL="${EPREFIX}/bin/bash" \
- gcc_do_make ${GCC_MAKE_TARGET}
+ # generation, which will break install otherwise (at least in 3.3.6): bug #664486
+ CONFIG_SHELL="${BROOT}/bin/bash" \
+ gcc_do_make ${GCC_MAKE_TARGET}
}
gcc_do_make() {
@@ -1645,11 +1792,11 @@ gcc_do_make() {
# default target
if is_crosscompile || tc-is-cross-compiler ; then
- # 3 stage bootstrapping doesnt quite work when you cant run the
- # resulting binaries natively ^^;
+ # 3 stage bootstrapping doesn't quite work when you can't run the
+ # resulting binaries natively
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
else
- if tc_version_is_at_least 3.3 && _tc_use_if_iuse pgo; then
+ if _tc_use_if_iuse pgo; then
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-profiledbootstrap}
else
GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
@@ -1680,6 +1827,19 @@ gcc_do_make() {
BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"}
fi
+ if is_jit ; then
+ # TODO: docs for jit?
+ pushd "${WORKDIR}"/build-jit > /dev/null || die
+
+ einfo "Building JIT"
+ emake \
+ LDFLAGS="${LDFLAGS}" \
+ STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
+ LIBPATH="${LIBPATH}" \
+ BOOT_CFLAGS="${BOOT_CFLAGS}"
+ popd > /dev/null || die
+ fi
+
einfo "Compiling ${PN} (${GCC_MAKE_TARGET})..."
pushd "${WORKDIR}"/build >/dev/null
@@ -1692,8 +1852,7 @@ gcc_do_make() {
STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
LIBPATH="${LIBPATH}" \
BOOT_CFLAGS="${BOOT_CFLAGS}" \
- ${GCC_MAKE_TARGET} \
- || die "emake failed with ${GCC_MAKE_TARGET}"
+ ${GCC_MAKE_TARGET}
if is_ada; then
# Without these links it is not getting the good compiler
@@ -1710,16 +1869,17 @@ gcc_do_make() {
if type -p doxygen > /dev/null ; then
if tc_version_is_at_least 4.3 ; then
cd "${CTARGET}"/libstdc++-v3/doc
- emake doc-man-doxygen || ewarn "failed to make docs"
- elif tc_version_is_at_least 3.0 ; then
+ emake doc-man-doxygen
+ else
cd "${CTARGET}"/libstdc++-v3
- emake doxygen-man || ewarn "failed to make docs"
+ emake doxygen-man
fi
- # Clean bogus manpages. #113902
+ # Clean bogus manpages. bug #113902
find -name '*_build_*' -delete
- # Blow away generated directory references. Newer versions of gcc
- # have gotten better at this, but not perfect. This is easier than
- # backporting all of the various doxygen patches. #486754
+
+ # Blow away generated directory references. Newer versions of gcc
+ # have gotten better at this, but not perfect. This is easier than
+ # backporting all of the various doxygen patches. bug #486754
find -name '*_.3' -exec grep -l ' Directory Reference ' {} + | \
xargs rm -f
else
@@ -1734,6 +1894,7 @@ gcc_do_make() {
toolchain_src_test() {
cd "${WORKDIR}"/build
+
# '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.
@@ -1746,12 +1907,10 @@ toolchain_src_install() {
cd "${WORKDIR}"/build
# Don't allow symlinks in private gcc include dir as this can break the build
- # Keep them in prefix for things like 'machine->ia64' #gcc PR26189
- use prefix ||
find gcc/include*/ -type l -delete
# 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. #464008
+ # build system only expects to install out of the build dir, not the source. bug #464008
mkdir -p gcc/doc
local x=
for x in "${S}"/gcc/doc/*.info* ; do
@@ -1771,8 +1930,32 @@ toolchain_src_install() {
&& use !prefix && rm -f "${x}"
done < <(find gcc/include*/ -name '*.h')
+ if is_jit ; then
+ # See https://gcc.gnu.org/onlinedocs/gcc-11.3.0/jit/internals/index.html#packaging-notes
+ # and bug #843341.
+ #
+ # Both of the non-JIT and JIT builds are configured to install to $(DESTDIR)
+ # Install the configuration with --enable-host-shared first
+ # *then* the one without, so that the faster build
+ # of "cc1" et al overwrites the slower build.
+ #
+ # Do the 'make install' from the build directory
+ pushd "${WORKDIR}"/build-jit > /dev/null || die
+ S="${WORKDIR}"/build-jit emake DESTDIR="${D}" install
+
+ # Punt some tools which are really only useful while building gcc
+ find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
+ # This one comes with binutils
+ find "${ED}" -name libiberty.a -delete
+
+ # Move the libraries to the proper location
+ gcc_movelibs
+
+ popd > /dev/null || die
+ fi
+
# Do the 'make install' from the build directory
- S="${WORKDIR}"/build emake -j1 DESTDIR="${D}" install || die
+ S="${WORKDIR}"/build emake DESTDIR="${D}" install
# Punt some tools which are really only useful while building gcc
find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
@@ -1796,7 +1979,7 @@ toolchain_src_install() {
# Setup the gcc_env_entry for hardened gcc 4 with minispecs
want_minispecs && copy_minispecs_gcc_specs
- # Make sure we dont have stuff lying around that
+ # Make sure we don't have stuff lying around that
# can nuke multiple versions of gcc
gcc_slot_java
@@ -1835,7 +2018,7 @@ toolchain_src_install() {
# When cross-building gcc does install native tools.
if ! is_crosscompile; then
# Rename the main go binaries as we don't want to clobber dev-lang/go
- # when gcc-config runs. #567806
+ # when gcc-config runs. bug #567806
if tc_version_is_at_least 5 && is_go ; then
for x in go gofmt; do
mv ${x} ${x}-${GCCMAJOR} || die
@@ -1843,7 +2026,7 @@ toolchain_src_install() {
fi
fi
- # As gcc installs object files built against bost ${CHOST} and ${CTARGET}
+ # As gcc installs object files built against both ${CHOST} and ${CTARGET}
# ideally we will need to strip them using different tools:
# Using ${CHOST} tools:
# - "${D}${BINPATH}"
@@ -1853,29 +2036,27 @@ toolchain_src_install() {
# - "${D}${LIBPATH}"
# As dostrip does not specify host to override ${CHOST} tools just skip
# non-native binary stripping.
- is_crosscompile && tc_supports_dostrip && dostrip -x "${LIBPATH}"
+ is_crosscompile && dostrip -x "${LIBPATH}"
- cd "${S}"
+ cd "${S}" || die
if is_crosscompile; then
rm -rf "${ED}"/usr/share/{man,info}
rm -rf "${D}"${DATAPATH}/{man,info}
else
- if tc_version_is_at_least 3.0 ; then
- local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
- if [[ -d ${cxx_mandir} ]] ; then
- cp -r "${cxx_mandir}"/man? "${D}${DATAPATH}"/man/
- fi
+ local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
+ if [[ -d ${cxx_mandir} ]] ; then
+ cp -r "${cxx_mandir}"/man? "${D}${DATAPATH}"/man/
fi
fi
- # portage regenerates 'dir' files on it's own: bug #672408
+ # Portage regenerates 'dir' files on its own: bug #672408
# Drop 'dir' files to avoid collisions.
if [[ -f "${D}${DATAPATH}"/info/dir ]]; then
einfo "Deleting '${D}${DATAPATH}/info/dir'"
rm "${D}${DATAPATH}"/info/dir || die
fi
- # prune empty dirs left behind
+ # Prune empty dirs left behind
find "${ED}" -depth -type d -delete 2>/dev/null
# libstdc++.la: Delete as it doesn't add anything useful: g++ itself
@@ -1891,14 +2072,14 @@ toolchain_src_install() {
# libgomp-plugin-*.la: Same as above, and it's an internal plugin only
# loaded via dlopen.
# libgfortran.la: gfortran itself handles linkage correctly in the
- # dynamic & static case (libgfortran.spec). #573302
+ # dynamic & static case (libgfortran.spec). bug #573302
# libgfortranbegin.la: Same as above, and it's an internal lib.
# libmpx.la: gcc itself handles linkage correctly (libmpx.spec).
# libmpxwrappers.la: See above.
# libitm.la: gcc itself handles linkage correctly (libitm.spec).
# libvtv.la: gcc itself handles linkage correctly.
# lib*san.la: Sanitizer linkage is handled internally by gcc, and they
- # do not support static linking. #487550 #546700
+ # do not support static linking. bug #487550, bug #546700
find "${D}${LIBPATH}" \
'(' \
-name libstdc++.la -o \
@@ -1928,9 +2109,12 @@ toolchain_src_install() {
pushd "${D}${LIBPATH}" >/dev/null
for py in $(find . -name '*-gdb.py') ; do
local multidir=${py%/*}
+
insinto "${gdbdir}/${multidir}"
- sed -i "/^libdir =/s:=.*:= '${LIBPATH}/${multidir}':" "${py}" || die #348128
- doins "${py}" || die
+ # bug #348128
+ sed -i "/^libdir =/s:=.*:= '${LIBPATH}/${multidir}':" "${py}" || die
+ doins "${py}"
+
rm "${py}" || die
done
popd >/dev/null
@@ -1939,13 +2123,13 @@ toolchain_src_install() {
export QA_EXECSTACK="usr/lib*/go/*/*.gox"
export QA_WX_LOAD="usr/lib*/go/*/*.gox"
- # Disable RANDMMAP so PCH works. #301299
+ # 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"
fi
- # Disable MPROTECT so java works. #574808
+ # 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"
@@ -1956,9 +2140,6 @@ toolchain_src_install() {
# when installing gcc, it dumps internal libraries into /usr/lib
# instead of the private gcc lib path
gcc_movelibs() {
- # older versions of gcc did not support --print-multi-os-directory
- tc_version_is_at_least 3.2 || return 0
-
# For non-target libs which are for CHOST and not CTARGET, we want to
# move them to the compiler-specific CHOST internal dir. This is stuff
# that you want to link against when building tools rather than building
@@ -1967,9 +2148,10 @@ gcc_movelibs() {
dodir "${HOSTLIBPATH#${EPREFIX}}"
mv "${ED}"/usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die
fi
+
# libgccjit gets installed to /usr/lib, not /usr/$(get_libdir). Probably
# due to a bug in gcc build system.
- if is_jit ; then
+ if [[ ${PWD} == "${WORKDIR}"/build-jit ]] && is_jit ; then
dodir "${LIBPATH#${EPREFIX}}"
mv "${ED}"/usr/lib/libgccjit* "${D}${LIBPATH}" || die
fi
@@ -2024,8 +2206,8 @@ gcc_movelibs() {
find -depth "${ED}" -type d -exec rmdir {} + >& /dev/null
}
-# make sure the libtool archives have libdir set to where they actually
-# -are-, and not where they -used- to be. also, any dependencies we have
+# Make sure the libtool archives have libdir set to where they actually
+# -are-, and not where they -used- to be. Also, any dependencies we have
# on our own .la files need to be updated.
fix_libtool_libdir_paths() {
local libpath="$1"
@@ -2038,7 +2220,7 @@ fix_libtool_libdir_paths() {
allarchives="\(${allarchives// /\\|}\)"
popd >/dev/null
- # The libdir might not have any .la files. #548782
+ # The libdir might not have any .la files. bug #548782
find "./${dir}" -maxdepth 1 -name '*.la' \
-exec sed -i -e "/^libdir=/s:=.*:='${dir}':" {} + || die
# Would be nice to combine these, but -maxdepth can not be specified
@@ -2073,21 +2255,16 @@ create_gcc_env_entry() {
# workaround for libtool being stupid and using .la's from
# conflicting ABIs by using the first one in the search path
local ldpaths mosdirs
- if tc_version_is_at_least 3.2 ; then
- local mdir mosdir abi ldpath
- for abi in $(get_all_abis TARGET) ; do
- mdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory)
- ldpath=${LIBPATH}
- [[ ${mdir} != "." ]] && ldpath+="/${mdir}"
- ldpaths="${ldpath}${ldpaths:+:${ldpaths}}"
-
- mosdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) -print-multi-os-directory)
- mosdirs="${mosdir}${mosdirs:+:${mosdirs}}"
- done
- else
- # Older gcc's didn't do multilib, so logic is simple.
- ldpaths=${LIBPATH}
- fi
+ local mdir mosdir abi ldpath
+ for abi in $(get_all_abis TARGET) ; do
+ mdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory)
+ ldpath=${LIBPATH}
+ [[ ${mdir} != "." ]] && ldpath+="/${mdir}"
+ ldpaths="${ldpath}${ldpaths:+:${ldpaths}}"
+
+ mosdir=$($(XGCC) $(get_abi_CFLAGS ${abi}) -print-multi-os-directory)
+ mosdirs="${mosdir}${mosdirs:+:${mosdirs}}"
+ done
cat <<-EOF > ${gcc_envd_file}
GCC_PATH="${BINPATH}"
@@ -2129,12 +2306,12 @@ create_revdep_rebuild_entry() {
}
copy_minispecs_gcc_specs() {
- # on gcc 6 we don't need minispecs
+ # On gcc 6, we don't need minispecs
if tc_version_is_at_least 6.0 ; then
return 0
fi
- # setup the hardenedno* specs files and the vanilla specs file.
+ # Setup the hardenedno* specs files and the vanilla specs file.
if hardened_gcc_works ; then
create_gcc_env_entry hardenednopiessp
fi
@@ -2184,7 +2361,7 @@ gcc_slot_java() {
done
# Rename jar because it could clash with Kaffe's jar if this gcc is
- # primary compiler (aka don't have the -<version> extension)
+ # primary compiler (aka doesn't have the -<version> extension)
cd "${D}${BINPATH}"
[[ -f jar ]] && mv -f jar gcj-jar
}
@@ -2193,40 +2370,40 @@ gcc_slot_java() {
toolchain_pkg_postinst() {
do_gcc_config
- if [[ ! ${ROOT%/} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
+ if [[ ! ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
eselect compiler-shadow update all
fi
if ! is_crosscompile && [[ ${PN} != "kgcc64" ]] ; then
# gcc stopped installing .la files fixer in June 2020.
# Cleaning can be removed in June 2022.
- rm -f "${EROOT%/}"/sbin/fix_libtool_files.sh
- rm -f "${EROOT%/}"/usr/sbin/fix_libtool_files.sh
- rm -f "${EROOT%/}"/usr/share/gcc-data/fixlafiles.awk
+ rm -f "${EROOT}"/sbin/fix_libtool_files.sh
+ rm -f "${EROOT}"/usr/sbin/fix_libtool_files.sh
+ rm -f "${EROOT}"/usr/share/gcc-data/fixlafiles.awk
fi
}
toolchain_pkg_postrm() {
do_gcc_config
- if [[ ! ${ROOT%/} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
+ if [[ ! ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
eselect compiler-shadow clean all
fi
- # clean up the cruft left behind by cross-compilers
+ # Clean up the cruft left behind by cross-compilers
if is_crosscompile ; then
- if [[ -z $(ls "${EROOT%/}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
+ if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
einfo "Removing last cross-compiler instance. Deleting dangling symlinks."
- rm -f "${EROOT%/}"/etc/env.d/gcc/config-${CTARGET}
- rm -f "${EROOT%/}"/etc/env.d/??gcc-${CTARGET}
- rm -f "${EROOT%/}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
+ rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
+ rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
+ rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
fi
return 0
fi
# gcc stopped installing .la files fixer in June 2020.
# Cleaning can be removed in June 2022.
- rm -f "${EROOT%/}"/sbin/fix_libtool_files.sh
- rm -f "${EROOT%/}"/usr/share/gcc-data/fixlafiles.awk
+ rm -f "${EROOT}"/sbin/fix_libtool_files.sh
+ rm -f "${EROOT}"/usr/share/gcc-data/fixlafiles.awk
}
do_gcc_config() {
@@ -2240,12 +2417,12 @@ do_gcc_config() {
current_gcc_config=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -c ${CTARGET} 2>/dev/null)
if [[ -n ${current_gcc_config} ]] ; then
local current_specs use_specs
- # figure out which specs-specific config is active
+ # Figure out which specs-specific config is active
current_specs=$(gcc-config -S ${current_gcc_config} | awk '{print $3}')
[[ -n ${current_specs} ]] && use_specs=-${current_specs}
if [[ -n ${use_specs} ]] && \
- [[ ! -e ${EROOT%/}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
+ [[ ! -e ${EROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]]
then
ewarn "The currently selected specs-specific gcc config,"
ewarn "${current_specs}, doesn't exist anymore. This is usually"
@@ -2258,7 +2435,7 @@ do_gcc_config() {
target="${CTARGET}-${GCC_CONFIG_VER}${use_specs}"
else
# The curent target is invalid. Attempt to switch to a valid one.
- # Blindly pick the latest version. #529608
+ # Blindly pick the latest version. bug #529608
# TODO: Should update gcc-config to accept `-l ${CTARGET}` rather than
# doing a partial grep like this.
target=$(gcc-config -l 2>/dev/null | grep " ${CTARGET}-[0-9]" | tail -1 | awk '{print $2}')
@@ -2273,9 +2450,9 @@ should_we_gcc_config() {
local curr_config
curr_config=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -c ${CTARGET} 2>&1) || return 0
- # if the previously selected config has the same major.minor (branch) as
+ # If the previously selected config has the same major.minor (branch) as
# the version we are installing, then it will probably be uninstalled
- # for being in the same SLOT, make sure we run gcc-config.
+ # for being in the same SLOT, so make sure we run gcc-config.
local curr_config_ver=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -S ${curr_config} | awk '{print $2}')
local curr_branch_ver=$(ver_cut 1-2 ${curr_config_ver})
@@ -2283,12 +2460,14 @@ should_we_gcc_config() {
if [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then
return 0
else
- # if we're installing a genuinely different compiler version,
+ # If we're installing a genuinely different compiler version,
# we should probably tell the user -how- to switch to the new
- # gcc version, since we're not going to do it for him/her.
+ # gcc version, since we're not going to do it for them.
+ #
# We don't want to switch from say gcc-3.3 to gcc-3.4 right in
# the middle of an emerge operation (like an 'emerge -e world'
# which could install multiple gcc versions).
+ #
# Only warn if we're installing a pkg as we might be called from
# the pkg_{pre,post}rm steps. #446830
if [[ ${EBUILD_PHASE} == *"inst" ]] ; then
@@ -2364,15 +2543,16 @@ is_go() {
is_jit() {
gcc-lang-supported jit || return 1
+
# cross-compiler does not really support jit as it has
- # to generate code for a target. On target like avr
+ # to generate code for a target. On targets like avr,
# libgcclit.so can't link at all: bug #594572
is_crosscompile && return 1
+
_tc_use_if_iuse jit
}
is_multilib() {
- tc_version_is_at_least 3 || return 1
_tc_use_if_iuse multilib
}
@@ -2395,7 +2575,7 @@ get_make_var() {
XGCC() { get_make_var GCC_FOR_TARGET ; }
-# The gentoo piessp patches allow for 3 configurations:
+# The gentoo pie-ssp patches allow for 3 configurations:
# 1) PIE+SSP by default
# 2) PIE by default
# 3) SSP by default
@@ -2404,8 +2584,6 @@ hardened_gcc_works() {
# $gcc_cv_ld_pie is unreliable as it simply take the output of
# `ld --help | grep -- -pie`, that reports the option in all cases, also if
# the loader doesn't actually load the resulting executables.
- # To avoid breakage, blacklist FreeBSD here at least
- [[ ${CTARGET} == *-freebsd* ]] && return 1
want_pie || return 1
_tc_use_if_iuse nopie && return 1
@@ -2427,17 +2605,9 @@ hardened_gcc_works() {
hardened_gcc_is_stable() {
local tocheck
if [[ $1 == "pie" ]] ; then
- if [[ ${CTARGET} == *-uclibc* ]] ; then
- tocheck=${PIE_UCLIBC_STABLE}
- else
- tocheck=${PIE_GLIBC_STABLE}
- fi
+ tocheck=${PIE_GLIBC_STABLE}
elif [[ $1 == "ssp" ]] ; then
- if [[ ${CTARGET} == *-uclibc* ]] ; then
- tocheck=${SSP_UCLIBC_STABLE}
- elif [[ ${CTARGET} == *-gnu* ]] ; then
- tocheck=${SSP_STABLE}
- fi
+ tocheck=${SSP_STABLE}
else
die "hardened_gcc_stable needs to be called with pie or ssp"
fi
@@ -2447,7 +2617,7 @@ hardened_gcc_is_stable() {
}
want_minispecs() {
- # on gcc 6 we don't need minispecs
+ # On gcc 6, we don't need minispecs
if tc_version_is_at_least 6.0 ; then
return 0
fi
@@ -2495,6 +2665,11 @@ toolchain_death_notice() {
fi
}
+fi
+
+EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \
+ src_compile src_test src_install pkg_postinst pkg_postrm
+
# Note [implicitly enabled flags]
# -------------------------------
# Usually configure-based packages handle explicit feature requests
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2022-06-06 9:07 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2022-06-06 9:07 UTC (permalink / raw
To: gentoo-commits
commit: ca5a684e6be8154d4c4b2b6a2adb0110bfcb5c58
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 6 09:06:58 2022 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Jun 6 09:06:58 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ca5a684e
toolchain.eclass: fix syntax
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index ed8c227c4a..782cbeebf2 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -202,7 +202,7 @@ tc_has_feature() {
# Prefix: allow gcc-apple post 4.2.1
if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ||
- [[ ${PN} == "gcc-apple" && tc_version_is_at_least 12.1 ]] ; then
+ [[ ${PN} == "gcc-apple" && $(tc_version_is_at_least 12.1) == 0 ]] ; then
IUSE+=" debug +cxx +nptl" TC_FEATURES+=( nptl )
[[ -n ${PIE_VER} ]] && IUSE+=" nopie"
[[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2022-06-06 16:51 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2022-06-06 16:51 UTC (permalink / raw
To: gentoo-commits
commit: 1b3e9f1dc1e6fcce61f1ed7e26b93d69c927177a
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 6 16:49:49 2022 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Jun 6 16:49:49 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=1b3e9f1d
toolchain.eclass: update Darwin hacks for GCC-12
GCC-12 is completely C++, so patch the appropriate file(s) instead.
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 782cbeebf2..afd81cfc08 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -615,13 +615,17 @@ toolchain_src_prepare() {
make_gcc_hard
fi
- # we use our libtool on Darwin
+ # we use our libtool on Darwin (no longer applies since 12)
sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/${CTARGET}-libtool:" \
"${S}"/gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
# add prefixed Frameworks to default search paths (may want to
# change this in a cross-compile)
+ local darwindriver
+ tc_version_is_at_least 12 \
+ && darwindriver=darwin-c.cc \
+ || darwindriver=darwin-c.c
sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/MacOSX.sdk/System/Library/Frameworks\"\, \"${EPREFIX}/Frameworks\"\, " \
- "${S}"/gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
+ "${S}"/gcc/config/${darwindriver} || die "sed gcc/config/${darwindriver} failed"
# Make sure the pkg-config files install into multilib dirs.
# Since we configure with just one --libdir, we can't use that
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2022-06-07 12:35 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2022-06-07 12:35 UTC (permalink / raw
To: gentoo-commits
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
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2022-06-07 17:01 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2022-06-07 17:01 UTC (permalink / raw
To: gentoo-commits
commit: a7c1d9d5107cce52c19f638df5454ece9cbbcfa7
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 7 17:00:40 2022 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Tue Jun 7 17:00:40 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=a7c1d9d5
python-utils-r1.eclass: sync from latest gx86, unbreak python pkgs
Bug: https://bugs.gentoo.org/850406
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 55 ++++++++++++++++++++++++++++++++++---------
1 file changed, 44 insertions(+), 11 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index b9102cd320..c50da71ac8 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -712,6 +712,9 @@ python_scriptinto() {
python_doexe() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EBUILD_PHASE} != install ]] &&
+ die "${FUNCNAME} can only be used in src_install"
+
local f
for f; do
python_newexe "${f}" "${f##*/}"
@@ -730,6 +733,8 @@ python_doexe() {
python_newexe() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EBUILD_PHASE} != install ]] &&
+ die "${FUNCNAME} can only be used in src_install"
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
[[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>"
@@ -778,6 +783,9 @@ python_newexe() {
python_doscript() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EBUILD_PHASE} != install ]] &&
+ die "${FUNCNAME} can only be used in src_install"
+
local _PYTHON_REWRITE_SHEBANG=1
python_doexe "${@}"
}
@@ -802,6 +810,9 @@ python_doscript() {
python_newscript() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EBUILD_PHASE} != install ]] &&
+ die "${FUNCNAME} can only be used in src_install"
+
local _PYTHON_REWRITE_SHEBANG=1
python_newexe "${@}"
}
@@ -821,10 +832,10 @@ python_newscript() {
# site-packages directory.
#
# In the relative case, the exact path is determined directly
-# by each python_doscript/python_newscript function. Therefore,
-# python_moduleinto can be safely called before establishing the Python
-# interpreter and/or a single call can be used to set the path correctly
-# for multiple implementations, as can be seen in the following example.
+# by each python_domodule invocation. Therefore, python_moduleinto
+# can be safely called before establishing the Python interpreter and/or
+# a single call can be used to set the path correctly for multiple
+# implementations, as can be seen in the following example.
#
# Example:
# @CODE
@@ -848,6 +859,10 @@ python_moduleinto() {
# and packages (directories). All listed files will be installed
# for all enabled implementations, and compiled afterwards.
#
+# The files are installed into ${D} when run in src_install() phase.
+# Otherwise, they are installed into ${BUILD_DIR}/install location
+# that is suitable for picking up by distutils-r1 in PEP517 mode.
+#
# Example:
# @CODE
# src_install() {
@@ -870,13 +885,24 @@ python_domodule() {
d=${sitedir#${EPREFIX}}/${_PYTHON_MODULEROOT//.//}
fi
- (
- insopts -m 0644
- insinto "${d}"
- doins -r "${@}" || return ${?}
- )
-
- python_optimize "${ED%/}/${d}"
+ if [[ ${EBUILD_PHASE} == install ]]; then
+ (
+ insopts -m 0644
+ insinto "${d}"
+ doins -r "${@}" || return ${?}
+ )
+ python_optimize "${ED%/}/${d}"
+ elif [[ -n ${BUILD_DIR} ]]; then
+ local dest=${BUILD_DIR}/install${EPREFIX}/${d}
+ mkdir -p "${dest}" || die
+ cp -pR "${@}" "${dest}/" || die
+ (
+ cd "${dest}" &&
+ chmod -R a+rX "${@##*/}"
+ ) || die
+ else
+ die "${FUNCNAME} can only be used in src_install or with BUILD_DIR set"
+ fi
}
# @FUNCTION: python_doheader
@@ -895,6 +921,8 @@ python_domodule() {
python_doheader() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EBUILD_PHASE} != install ]] &&
+ die "${FUNCNAME} can only be used in src_install"
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local includedir=$(python_get_includedir)
@@ -1334,6 +1362,11 @@ epytest() {
# remove common temporary directories left over by pytest plugins
rm -rf .hypothesis .pytest_cache || die
+ # pytest plugins create additional .pyc files while testing
+ # see e.g. https://bugs.gentoo.org/847235
+ if [[ -n ${BUILD_DIR} && -d ${BUILD_DIR} ]]; then
+ find "${BUILD_DIR}" -name '*-pytest-*.pyc' -delete || die
+ fi
return ${ret}
}
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2022-06-29 14:05 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2022-06-29 14:05 UTC (permalink / raw
To: gentoo-commits
commit: 34090224b36ba20ec53ba5a1086380130e83bf33
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 29 14:05:41 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 29 14:05:53 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=34090224
autotools.eclass: sync with ::gentoo
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/autotools.eclass | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
index ecfa3c2cf9..fbe7d837f0 100644
--- a/eclass/autotools.eclass
+++ b/eclass/autotools.eclass
@@ -527,7 +527,7 @@ autotools_env_setup() {
hv_args="-b"
;;
esac
- ROOT=/ has_version ${hv_args} "=sys-devel/automake-${pv}*" && export WANT_AUTOMAKE="${pv}" && break
+ 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[*]}"
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2022-06-29 14:53 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2022-06-29 14:53 UTC (permalink / raw
To: gentoo-commits
commit: 831487b972c24579bc038521111cef314822c08b
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 29 14:37:27 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jun 29 14:37:27 2022 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=831487b9
autotools.eclass: drop, now in ::gentoo
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/autotools.eclass | 694 ------------------------------------------------
1 file changed, 694 deletions(-)
diff --git a/eclass/autotools.eclass b/eclass/autotools.eclass
deleted file mode 100644
index fbe7d837f0..0000000000
--- a/eclass/autotools.eclass
+++ /dev/null
@@ -1,694 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: autotools.eclass
-# @MAINTAINER:
-# base-system@gentoo.org
-# @SUPPORTED_EAPIS: 5 6 7 8
-# @BLURB: Regenerates auto* build scripts
-# @DESCRIPTION:
-# This eclass is for safely handling autotooled software packages that need to
-# regenerate their build scripts. All functions will abort in case of errors.
-
-# 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
- # 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}"
- fi
-fi
-
-if [[ -z ${_AUTOTOOLS_ECLASS} ]] ; then
-_AUTOTOOLS_ECLASS=1
-
-case ${EAPI} in
- 5|6)
- # Needed for eqawarn
- inherit eutils
- ;;
- 7|8) ;;
- *) die "${ECLASS}: EAPI ${EAPI} not supported" ;;
-esac
-
-inherit gnuconfig libtool
-
-# @ECLASS_VARIABLE: WANT_AUTOCONF
-# @PRE_INHERIT
-# @DESCRIPTION:
-# The major version of autoconf your package needs
-: ${WANT_AUTOCONF:=latest}
-
-# @ECLASS_VARIABLE: WANT_AUTOMAKE
-# @PRE_INHERIT
-# @DESCRIPTION:
-# The major version of automake your package needs
-: ${WANT_AUTOMAKE:=latest}
-
-# @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
-# @INTERNAL
-# @DESCRIPTION:
-# CONSTANT!
-# The latest major unstable and stable version/slot of automake available
-# on each arch.
-# Only add unstable version if it is in a different slot than latest stable
-# version.
-# 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 bug #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.16.5:1.16 )
-
-_automake_atom="sys-devel/automake"
-_autoconf_atom="sys-devel/autoconf"
-if [[ -n ${WANT_AUTOMAKE} ]] ; then
- case ${WANT_AUTOMAKE} in
- # Even if the package doesn't use automake, we still need to depend
- # on it because we run aclocal to process m4 macros. This matches
- # the autoreconf tool, so this requirement is correct, bug #401605.
- none) ;;
- latest) _automake_atom="|| ( `printf '>=sys-devel/automake-%s:%s ' ${_LATEST_AUTOMAKE[@]/:/ }` )" ;;
- *) _automake_atom="=sys-devel/automake-${WANT_AUTOMAKE}*";;
- esac
- export WANT_AUTOMAKE
-fi
-
-if [[ -n ${WANT_AUTOCONF} ]] ; then
- case ${WANT_AUTOCONF} in
- none) _autoconf_atom="" ;; # some packages don't require autoconf at all
- 2.1) _autoconf_atom="~sys-devel/autoconf-2.13" ;;
- # if you change the "latest" version here, change also autotools_env_setup
- latest|2.5) _autoconf_atom=">=sys-devel/autoconf-2.71" ;;
- *) die "Invalid WANT_AUTOCONF value '${WANT_AUTOCONF}'" ;;
- esac
- export WANT_AUTOCONF
-fi
-
-_libtool_atom=">=sys-devel/libtool-2.4"
-if [[ -n ${WANT_LIBTOOL} ]] ; then
- case ${WANT_LIBTOOL} in
- none) _libtool_atom="" ;;
- latest) ;;
- *) die "Invalid WANT_LIBTOOL value '${WANT_LIBTOOL}'" ;;
- esac
- export WANT_LIBTOOL
-fi
-
-# @ECLASS_VARIABLE: AUTOTOOLS_DEPEND
-# @OUTPUT_VARIABLE
-# @DESCRIPTION:
-# Contains the combination of requested automake/autoconf/libtool
-# versions in *DEPEND format.
-AUTOTOOLS_DEPEND="${_automake_atom}
- ${_autoconf_atom}
- ${_libtool_atom}"
-RDEPEND=""
-
-# @ECLASS_VARIABLE: AUTOTOOLS_AUTO_DEPEND
-# @PRE_INHERIT
-# @DESCRIPTION:
-# Set to 'no' to disable automatically adding to DEPEND. This lets
-# ebuilds form conditional depends by using ${AUTOTOOLS_DEPEND} in
-# their own DEPEND string.
-: ${AUTOTOOLS_AUTO_DEPEND:=yes}
-if [[ ${AUTOTOOLS_AUTO_DEPEND} != "no" ]] ; then
- case ${EAPI} in
- 5|6) DEPEND=${AUTOTOOLS_DEPEND} ;;
- *) BDEPEND=${AUTOTOOLS_DEPEND} ;;
- esac
-fi
-_AUTOTOOLS_AUTO_DEPEND=${AUTOTOOLS_AUTO_DEPEND} # See top of eclass
-
-unset _automake_atom _autoconf_atom
-
-# @ECLASS_VARIABLE: AM_OPTS
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Additional options to pass to automake during
-# eautoreconf call.
-: ${AM_OPTS:=}
-
-# @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
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Don't run eautomake command if set to 'yes'; only used to workaround
-# broken packages. Generally you should, instead, fix the package to
-# not call AM_INIT_AUTOMAKE if it doesn't actually use automake.
-: ${AT_NOEAUTOMAKE:=}
-
-# @ECLASS_VARIABLE: AT_NOELIBTOOLIZE
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Don't run elibtoolize command if set to 'yes',
-# useful when elibtoolize needs to be ran with
-# particular options
-: ${AT_NOELIBTOOLIZE:=}
-
-# @ECLASS_VARIABLE: AT_M4DIR
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Additional director(y|ies) aclocal should search
-: ${AT_M4DIR:=}
-
-# @ECLASS_VARIABLE: AT_SYS_M4DIR
-# @DEFAULT_UNSET
-# @INTERNAL
-# @DESCRIPTION:
-# For system integrators, a list of additional aclocal search paths.
-# This variable gets eval-ed, so you can use variables in the definition
-# that may not be valid until eautoreconf & friends are run.
-: ${AT_SYS_M4DIR:=}
-
-# @FUNCTION: eautoreconf
-# @DESCRIPTION:
-# This function mimes the behavior of autoreconf, but uses the different
-# eauto* functions to run the tools. It doesn't accept parameters, but
-# the directory with include files can be specified with AT_M4DIR variable.
-#
-# Should do a full autoreconf - normally what most people will be interested in.
-# Also should handle additional directories specified by AC_CONFIG_SUBDIRS.
-eautoreconf() {
- local x g
-
- # Subdirs often share a common build dir, bug #529404. If so, we can't safely
- # run in parallel because many tools clobber the content in there. Libtool
- # and automake both `rm && cp` while aclocal reads the output. We might be
- # able to handle this if we split the steps and grab locks on the dirs the
- # tools actually write to. Then we'd run all the common tools that use
- # those inputs. Doing this in bash does not scale easily.
- # If we do re-enable parallel support, make sure bug #426512 is handled.
- if [[ -z ${AT_NO_RECURSIVE} ]] ; then
- # Take care of subdirs
- for x in $(autotools_check_macro_val AC_CONFIG_SUBDIRS) ; do
- if [[ -d ${x} ]] ; then
- pushd "${x}" >/dev/null
- # Avoid unsafe nested multijob_finish_one for bug #426512.
- AT_NOELIBTOOLIZE="yes" eautoreconf || die
- popd >/dev/null
- fi
- done
- fi
-
- einfo "Running eautoreconf in '${PWD}' ..."
-
- local m4dirs=$(autotools_check_macro_val AC_CONFIG_{AUX,MACRO}_DIR)
- [[ -n ${m4dirs} ]] && mkdir -p ${m4dirs}
-
- # Run all the tools before aclocal so we can gather the .m4 files.
- local i tools=(
- # <tool> <was run> <command>
- glibgettext false "autotools_run_tool glib-gettextize --copy --force"
- gettext false "autotools_run_tool --at-missing autopoint --force"
- # intltool must come after autopoint.
- intltool false "autotools_run_tool intltoolize --automake --copy --force"
- gtkdoc false "autotools_run_tool --at-missing gtkdocize --copy"
- gnomedoc false "autotools_run_tool --at-missing gnome-doc-prepare --copy --force"
- libtool false "_elibtoolize --auto-ltdl --install --copy --force"
- )
- for (( i = 0; i < ${#tools[@]}; i += 3 )) ; do
- if _at_uses_${tools[i]} ; then
- tools[i+1]=true
- ${tools[i+2]}
- fi
- done
-
- # Generate aclocal.m4 with our up-to-date m4 files.
- local rerun_aclocal=false
- eaclocal
-
- # Check to see if we had macros expanded by other macros or in other
- # m4 files that we couldn't detect early. This is uncommon, but some
- # packages do this, so we have to handle it correctly.
- for (( i = 0; i < ${#tools[@]}; i += 3 )) ; do
- if ! ${tools[i+1]} && _at_uses_${tools[i]} ; then
- ${tools[i+2]}
- rerun_aclocal=true
- fi
- done
- ${rerun_aclocal} && eaclocal
-
- if [[ ${WANT_AUTOCONF} == "2.1" ]] ; then
- eautoconf
- else
- eautoconf --force
- fi
- [[ ${AT_NOEAUTOHEADER} != "yes" ]] && eautoheader
- [[ ${AT_NOEAUTOMAKE} != "yes" ]] && FROM_EAUTORECONF="yes" eautomake ${AM_OPTS}
-
- if [[ ${AT_NOELIBTOOLIZE} != "yes" ]] ; then
- # Call it here to prevent failures due to elibtoolize called _before_
- # eautoreconf.
- elibtoolize --force "${PWD}"
- fi
-
- return 0
-}
-
-# @FUNCTION: _at_uses_pkg
-# @USAGE: <macros>
-# @INTERNAL
-# @DESCRIPTION:
-# See if the specified macros are enabled.
-_at_uses_pkg() {
- if [[ -n $(autotools_check_macro "$@") ]] ; then
- return 0
- else
- # If the trace didn't find it (perhaps because aclocal.m4 hasn't
- # been generated yet), cheat, but be conservative.
- local macro args=()
- for macro ; do
- args+=( -e "^[[:space:]]*${macro}\>" )
- done
- grep -E -q "${args[@]}" configure.??
- fi
-}
-_at_uses_autoheader() { _at_uses_pkg A{C,M}_CONFIG_HEADER{S,}; }
-_at_uses_automake() { _at_uses_pkg AM_INIT_AUTOMAKE; }
-_at_uses_gettext() { _at_uses_pkg AM_GNU_GETTEXT_{,REQUIRE_}VERSION; }
-_at_uses_glibgettext() { _at_uses_pkg AM_GLIB_GNU_GETTEXT; }
-_at_uses_intltool() { _at_uses_pkg {AC,IT}_PROG_INTLTOOL; }
-_at_uses_gtkdoc() { _at_uses_pkg GTK_DOC_CHECK; }
-_at_uses_gnomedoc() { _at_uses_pkg GNOME_DOC_INIT; }
-_at_uses_libtool() { _at_uses_pkg A{C,M}_PROG_LIBTOOL LT_INIT; }
-_at_uses_libltdl() { _at_uses_pkg LT_CONFIG_LTDL_DIR; }
-
-# @FUNCTION: eaclocal_amflags
-# @DESCRIPTION:
-# Extract the ACLOCAL_AMFLAGS value from the Makefile.am and try to handle
-# (most) of the crazy crap that people throw at us.
-eaclocal_amflags() {
- local aclocal_opts amflags_file
-
- for amflags_file in GNUmakefile.am Makefile.am GNUmakefile.in Makefile.in ; do
- [[ -e ${amflags_file} ]] || continue
- # setup the env in case the pkg does something crazy
- # in their ACLOCAL_AMFLAGS. like run a shell script
- # which turns around and runs autotools (bug #365401)
- # or split across multiple lines (bug #383525)
- autotools_env_setup
- aclocal_opts=$(sed -n \
- "/^ACLOCAL_AMFLAGS[[:space:]]*=/{ \
- # match the first line
- s:[^=]*=::p; \
- # then gobble up all escaped lines
- : nextline /\\\\$/{ n; p; b nextline; } \
- }" ${amflags_file})
- eval aclocal_opts=\""${aclocal_opts}"\"
- break
- done
-
- echo ${aclocal_opts}
-}
-
-# @FUNCTION: eaclocal
-# @DESCRIPTION:
-# These functions runs the autotools using autotools_run_tool with the
-# specified parametes. The name of the tool run is the same of the function
-# without e prefix.
-# They also force installing the support files for safety.
-# Respects AT_M4DIR for additional directories to search for macros.
-eaclocal() {
- # Feed in a list of paths:
- # - ${BROOT}/usr/share/aclocal
- # - ${ESYSROOT}/usr/share/aclocal
- # See bug #677002
- if [[ ${EAPI} != [56] ]] ; then
- if [[ ! -f "${T}"/aclocal/dirlist ]] ; then
- mkdir "${T}"/aclocal || die
- cat <<- EOF > "${T}"/aclocal/dirlist || die
- ${BROOT}/usr/share/aclocal
- ${ESYSROOT}/usr/share/aclocal
- EOF
- fi
-
- local system_acdir=" --system-acdir=${T}/aclocal"
- else
- local system_acdir=""
- fi
-
- [[ ! -f aclocal.m4 || -n $(grep -e 'generated.*by aclocal' aclocal.m4) ]] && \
- autotools_run_tool --at-m4flags aclocal "$@" $(eaclocal_amflags) ${system_acdir}
-}
-
-# @FUNCTION: _elibtoolize
-# @DESCRIPTION:
-# Runs libtoolize.
-#
-# Note the '_' prefix: avoid collision with elibtoolize() from libtool.eclass.
-_elibtoolize() {
- local LIBTOOLIZE=${LIBTOOLIZE:-$(type -P glibtoolize > /dev/null && echo glibtoolize || echo libtoolize)}
-
- if [[ ${1} == "--auto-ltdl" ]] ; then
- shift
- _at_uses_libltdl && set -- "$@" --ltdl
- fi
-
- [[ -f GNUmakefile.am || -f Makefile.am ]] && set -- "$@" --automake
-
- autotools_run_tool ${LIBTOOLIZE} "$@"
-}
-
-# @FUNCTION: eautoheader
-# @DESCRIPTION:
-# Runs autoheader.
-eautoheader() {
- _at_uses_autoheader || return 0
- autotools_run_tool --at-no-fail --at-m4flags autoheader "$@"
-}
-
-# @FUNCTION: eautoconf
-# @DESCRIPTION:
-# Runs autoconf.
-eautoconf() {
- if [[ ! -f configure.ac && ! -f configure.in ]] ; then
- echo
- eerror "No configure.{ac,in} present in '${PWD}'!"
- echo
- die "No configure.{ac,in} present!"
- fi
-
-
- if [[ ${WANT_AUTOCONF} != "2.1" && -e configure.in ]] ; then
- 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."
- ;;
- *)
- # Move configure file to the new location only on newer EAPIs to ensure
- # checks are done rather than retroactively breaking ebuilds.
- eqawarn "Moving configure.in to configure.ac (bug #426262)"
- mv configure.{in,ac} || die
- ;;
- esac
- fi
-
- # Install config.guess and config.sub which are required by many macros
- # in autoconf >=2.70.
- local _gnuconfig=$(gnuconfig_findnewest)
- cp "${_gnuconfig}"/config.{guess,sub} . || die
-
- autotools_run_tool --at-m4flags autoconf "$@"
-}
-
-# @FUNCTION: eautomake
-# @DESCRIPTION:
-# Runs automake.
-eautomake() {
- local extra_opts=()
- local makefile_name
-
- # Run automake if:
- # - a Makefile.am type file exists
- # - the configure script is using the AM_INIT_AUTOMAKE directive
- for makefile_name in {GNUmakefile,{M,m}akefile}.am "" ; do
- [[ -f ${makefile_name} ]] && break
- done
-
- _automake_version() {
- autotools_run_tool --at-output automake --version 2>/dev/null |
- sed -n -e '1{s:.*(GNU automake) ::p;q}'
- }
-
- if [[ -z ${makefile_name} ]] ; then
- _at_uses_automake || return 0
-
- elif [[ -z ${FROM_EAUTORECONF} && -f ${makefile_name%.am}.in ]] ; then
- local used_automake
- local installed_automake
-
- installed_automake=$(WANT_AUTOMAKE= _automake_version)
- used_automake=$(head -n 1 < ${makefile_name%.am}.in | \
- sed -e 's:.*by automake \(.*\) from .*:\1:')
-
- if [[ ${installed_automake} != ${used_automake} ]] ; then
- ewarn "Automake used for the package (${used_automake}) differs from" \
- "the installed version (${installed_automake})."
- ewarn "Forcing a full rebuild of the autotools to workaround."
- eautoreconf
- return 0
- fi
- fi
-
- [[ -f INSTALL && -f AUTHORS && -f ChangeLog && -f NEWS && -f README ]] \
- || extra_opts+=( --foreign )
-
- # Older versions of automake do not support --force-missing. But we want
- # to use this whenever possible to update random bundled files, bug #133489.
- case $(_automake_version) in
- 1.4|1.4[.-]*) ;;
- *) extra_opts+=( --force-missing ) ;;
- esac
-
- autotools_run_tool automake --add-missing --copy "${extra_opts[@]}" "$@"
-}
-
-# @FUNCTION: eautopoint
-# @DESCRIPTION:
-# Runs autopoint (from the gettext package).
-eautopoint() {
- autotools_run_tool autopoint "$@"
-}
-
-# @FUNCTION: config_rpath_update
-# @USAGE: [destination]
-# @DESCRIPTION:
-# Some packages utilize the config.rpath helper script, but don't
-# use gettext directly. So we have to copy it in manually since
-# we can't let `autopoint` do it for us.
-config_rpath_update() {
- local dst src
-
- case ${EAPI} in
- 5|6)
- src="${EPREFIX}/usr/share/gettext/config.rpath"
- ;;
- *)
- src="${BROOT}/usr/share/gettext/config.rpath"
- ;;
- esac
-
- [[ $# -eq 0 ]] && set -- $(find -name config.rpath)
- [[ $# -eq 0 ]] && return 0
-
- einfo "Updating all config.rpath files"
- for dst in "$@" ; do
- einfo " ${dst}"
- cp "${src}" "${dst}" || die
- done
-}
-
-# @FUNCTION: autotools_env_setup
-# @INTERNAL
-# @DESCRIPTION:
-# Process the WANT_AUTO{CONF,MAKE} flags.
-autotools_env_setup() {
- # We do the "latest" → version switch here because it solves
- # possible order problems, see bug #270010 as an example.
- # During bootstrap in prefix there might be no automake merged yet
- # due to --nodeps, but still available somewhere in PATH.
- # For example, ncurses needs local libtool on aix and hpux.
- if [[ ${WANT_AUTOMAKE} == "latest" ]] &&
- ROOT=/ has_version "sys-devel/automake"; then
- local pv
- for pv in ${_LATEST_AUTOMAKE[@]/#*:} ; do
- # Break on first hit to respect _LATEST_AUTOMAKE order.
- local hv_args=""
- case ${EAPI} in
- 5|6)
- hv_args="--host-root"
- ;;
- *)
- hv_args="-b"
- ;;
- esac
- 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[*]}"
- fi
- [[ ${WANT_AUTOCONF} == "latest" ]] && export WANT_AUTOCONF=2.71
-}
-
-# @FUNCTION: autotools_run_tool
-# @USAGE: [--at-no-fail] [--at-m4flags] [--at-missing] [--at-output] <autotool> [tool-specific flags]
-# @INTERNAL
-# @DESCRIPTION:
-# Run the specified autotool helper, but do logging and error checking
-# around it in the process.
-autotools_run_tool() {
- # Process our own internal flags first
- local autofail=true m4flags=false missing_ok=false return_output=false
- while [[ -n ${1} ]] ; do
- case ${1} in
- --at-no-fail) autofail=false ;;
- --at-m4flags) m4flags=true ;;
- --at-missing) missing_ok=true ;;
- --at-output) return_output=true ;;
- # whatever is left goes to the actual tool
- *) break ;;
- esac
- shift
- done
-
- if [[ ${EBUILD_PHASE_FUNC} != "src_unpack" && ${EBUILD_PHASE_FUNC} != "src_prepare" ]] ; then
- eqawarn "Running '${1}' in ${EBUILD_PHASE_FUNC} phase"
- fi
-
- if ${missing_ok} && ! type -P ${1} >/dev/null ; then
- einfo "Skipping '$*' because '${1}' not installed"
- return 0
- fi
-
- autotools_env_setup
-
- # Allow people to pass in full paths, bug #549268
- local STDERR_TARGET="${T}/${1##*/}.out"
- # most of the time, there will only be one run, but if there are
- # more, make sure we get unique log filenames
- if [[ -e ${STDERR_TARGET} ]] ; then
- local i=1
- while :; do
- STDERR_TARGET="${T}/${1##*/}-${i}.out"
- [[ -e ${STDERR_TARGET} ]] || break
- : $(( i++ ))
- done
- fi
-
- if ${m4flags} ; then
- set -- "${1}" $(autotools_m4dir_include) $(autotools_m4sysdir_include) "${@:2}"
- fi
-
- # If the caller wants to probe something, then let them do it directly.
- if ${return_output} ; then
- "$@"
- return
- fi
-
- printf "***** ${1} *****\n***** PWD: ${PWD}\n***** $*\n\n" > "${STDERR_TARGET}"
-
- ebegin "Running '$@'"
- "$@" >> "${STDERR_TARGET}" 2>&1
- if ! eend $? && ${autofail} ; then
- echo
- eerror "Failed running '${1}'!"
- eerror
- eerror "Include in your bug report the contents of:"
- eerror
- eerror " ${STDERR_TARGET}"
- echo
- die "Failed running '${1}'!"
- fi
-}
-
-# Internal function to check for support
-
-# Keep a list of all the macros we might use so that we only
-# have to run the trace code once. Order doesn't matter.
-ALL_AUTOTOOLS_MACROS=(
- A{C,M}_PROG_LIBTOOL LT_INIT LT_CONFIG_LTDL_DIR
- A{C,M}_CONFIG_HEADER{S,}
- AC_CONFIG_SUBDIRS
- AC_CONFIG_AUX_DIR AC_CONFIG_MACRO_DIR
- AM_INIT_AUTOMAKE
- AM_GLIB_GNU_GETTEXT
- AM_GNU_GETTEXT_{,REQUIRE_}VERSION
- {AC,IT}_PROG_INTLTOOL
- GTK_DOC_CHECK
- GNOME_DOC_INIT
-)
-autotools_check_macro() {
- [[ -f configure.ac || -f configure.in ]] || return 0
-
- # We can run in multiple dirs, so we have to cache the trace
- # data in $PWD rather than an env var.
- local trace_file=".__autoconf_trace_data"
- if [[ ! -e ${trace_file} ]] || [[ ! aclocal.m4 -ot ${trace_file} ]] ; then
- WANT_AUTOCONF="2.5" autoconf \
- $(autotools_m4dir_include) \
- ${ALL_AUTOTOOLS_MACROS[@]/#/--trace=} > ${trace_file} 2>/dev/null
- fi
-
- local macro args=()
- for macro ; do
- has ${macro} ${ALL_AUTOTOOLS_MACROS[@]} || die "internal error: add ${macro} to ALL_AUTOTOOLS_MACROS"
- args+=( -e ":${macro}:" )
- done
- grep "${args[@]}" ${trace_file}
-}
-
-# @FUNCTION: autotools_check_macro_val
-# @USAGE: <macro> [macros]
-# @INTERNAL
-# @DESCRIPTION:
-# Look for a macro and extract its value.
-autotools_check_macro_val() {
- local macro scan_out
-
- for macro ; do
- autotools_check_macro "${macro}" | \
- gawk -v macro="${macro}" \
- '($0 !~ /^[[:space:]]*(#|dnl)/) {
- if (match($0, macro ":(.*)$", res))
- print res[1]
- }' | uniq
- done
-
- return 0
-}
-
-_autotools_m4dir_include() {
- local x include_opts flag
-
- # Use the right flag to autoconf based on the version #448986
- [[ ${WANT_AUTOCONF} == "2.1" ]] \
- && flag="l" \
- || flag="I"
-
- for x in "$@" ; do
- case ${x} in
- # We handle it below
- -${flag}) ;;
- *)
- [[ ! -d ${x} ]] && ewarn "${ECLASS}: '${x}' does not exist"
- include_opts+=" -${flag} ${x}"
- ;;
- esac
- done
-
- echo ${include_opts}
-}
-autotools_m4dir_include() { _autotools_m4dir_include ${AT_M4DIR} ; }
-autotools_m4sysdir_include() {
- # First try to use the paths the system integrator has set up.
- local paths=( $(eval echo ${AT_SYS_M4DIR}) )
-
- _autotools_m4dir_include "${paths[@]}"
-}
-
-fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2023-05-24 6:19 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2023-05-24 6:19 UTC (permalink / raw
To: gentoo-commits
commit: cc062a4c49d29c866fc83665bbafaadbb4e332a8
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed May 24 06:18:44 2023 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed May 24 06:18:44 2023 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=cc062a4c
eclass/python-utils-r1: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 140 +++++++++++++++---------------------------
1 file changed, 51 insertions(+), 89 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index c50da71ac8..0552c03d16 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: python-utils-r1.eclass
@@ -7,7 +7,7 @@
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
# Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7 8
+# @SUPPORTED_EAPIS: 7 8
# @BLURB: Utility functions for packages with Python parts.
# @DESCRIPTION:
# A utility eclass providing functions to query Python implementations,
@@ -22,19 +22,16 @@
# NOTE: When dropping support for EAPIs here, we need to update
# metadata/install-qa-check.d/60python-pyc
# See bug #704286, bug #781878
-case "${EAPI:-0}" in
- [0-5]) die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}" ;;
- [6-8]) ;;
- *) die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}" ;;
-esac
-if [[ ${_PYTHON_ECLASS_INHERITED} ]]; then
- die 'python-r1 suite eclasses can not be used with python.eclass.'
-fi
+case ${EAPI} in
+ 7|8) ;;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
+esac
-if [[ ! ${_PYTHON_UTILS_R1} ]]; then
+if [[ ! ${_PYTHON_UTILS_R1_ECLASS} ]]; then
+_PYTHON_UTILS_R1_ECLASS=1
-[[ ${EAPI} == [67] ]] && inherit eapi8-dosym
+[[ ${EAPI} == 7 ]] && inherit eapi8-dosym
inherit multiprocessing toolchain-funcs
# @ECLASS_VARIABLE: _PYTHON_ALL_IMPLS
@@ -43,7 +40,7 @@ inherit multiprocessing toolchain-funcs
# All supported Python implementations, most preferred last.
_PYTHON_ALL_IMPLS=(
pypy3
- python3_{8..11}
+ python3_{10..11}
)
readonly _PYTHON_ALL_IMPLS
@@ -55,7 +52,7 @@ _PYTHON_HISTORICAL_IMPLS=(
jython2_7
pypy pypy1_{8,9} pypy2_0
python2_{5..7}
- python3_{1..7}
+ python3_{1..9}
)
readonly _PYTHON_HISTORICAL_IMPLS
@@ -132,9 +129,9 @@ _python_set_impls() {
# please keep them in sync with _PYTHON_ALL_IMPLS
# and _PYTHON_HISTORICAL_IMPLS
case ${i} in
- pypy3|python2_7|python3_[89]|python3_1[01])
+ pypy3|python3_9|python3_1[01])
;;
- jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-6]|python3_[1-7])
+ jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-9])
obsolete+=( "${i}" )
;;
*)
@@ -171,13 +168,7 @@ _python_set_impls() {
done
if [[ ! ${supp[@]} ]]; then
- # special-case python2_7 for python-any-r1
- if [[ ${_PYTHON_ALLOW_PY27} ]] && has python2_7 "${PYTHON_COMPAT[@]}"
- then
- supp+=( python2_7 )
- else
- die "No supported implementation in PYTHON_COMPAT."
- fi
+ die "No supported implementation in PYTHON_COMPAT."
fi
if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then
@@ -223,7 +214,7 @@ _python_impl_matches() {
for pattern; do
case ${pattern} in
-2|python2*|pypy)
- if [[ ${EAPI} != [67] ]]; then
+ if [[ ${EAPI} != 7 ]]; then
eerror
eerror "Python 2 is no longer supported in Gentoo, please remove Python 2"
eerror "${FUNCNAME[1]} calls."
@@ -232,7 +223,7 @@ _python_impl_matches() {
;;
-3)
# NB: "python3*" is fine, as "not pypy3"
- if [[ ${EAPI} != [67] ]]; then
+ if [[ ${EAPI} != 7 ]]; then
eerror
eerror "Python 2 is no longer supported in Gentoo, please remove Python 2"
eerror "${FUNCNAME[1]} calls."
@@ -419,10 +410,6 @@ _python_export() {
local val
case "${impl}" in
- python2*|python3.6|python3.7*)
- # python* up to 3.7
- val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}) || die
- ;;
python*)
# python3.8+
val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}-embed) || die
@@ -461,22 +448,12 @@ _python_export() {
PYTHON_PKG_DEP)
local d
case ${impl} in
- python2.7)
- PYTHON_PKG_DEP='>=dev-lang/python-2.7.5-r2:2.7';;
- python3.8)
- PYTHON_PKG_DEP=">=dev-lang/python-3.8.12_p1-r1:3.8";;
- python3.9)
- PYTHON_PKG_DEP=">=dev-lang/python-3.9.9-r1:3.9";;
python3.10)
- PYTHON_PKG_DEP=">=dev-lang/python-3.10.0_p1-r1:3.10";;
+ PYTHON_PKG_DEP=">=dev-lang/python-3.10.9-r1:3.10";;
python3.11)
- PYTHON_PKG_DEP=">=dev-lang/python-3.11.0_beta1-r1:3.11";;
- python*)
- PYTHON_PKG_DEP="dev-lang/python:${impl#python}";;
- pypy)
- PYTHON_PKG_DEP='>=dev-python/pypy-7.3.0:0=';;
+ PYTHON_PKG_DEP=">=dev-lang/python-3.11.1-r1:3.11";;
pypy3)
- PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.7-r1:0=';;
+ PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.11-r1:0=';;
*)
die "Invalid implementation: ${impl}"
esac
@@ -658,22 +635,22 @@ python_optimize() {
einfo "Optimize Python modules for ${instpath}"
case "${EPYTHON}" in
- python2.7|python3.[34])
- "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -OO -m compileall -q -f -d "${instpath}" "${d}"
- ;;
- python3.[5678]|pypy3)
+ python3.8)
# both levels of optimization are separate since 3.5
"${PYTHON}" -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
"${PYTHON}" -O -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
"${PYTHON}" -OO -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
;;
- python*)
+ python*|pypy3)
+ # Python 3.9+
"${PYTHON}" -m compileall -j "${jobs}" -o 0 -o 1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}"
;;
- *)
+ pypy|jython2.7)
"${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
;;
+ *)
+ die "${FUNCNAME}: unexpected EPYTHON=${EPYTHON}"
+ ;;
esac
done
}
@@ -755,7 +732,7 @@ python_newexe() {
# install the wrapper
local dosym=dosym
- [[ ${EAPI} == [67] ]] && dosym=dosym8
+ [[ ${EAPI} == 7 ]] && dosym=dosym8
"${dosym}" -r /usr/lib/python-exec/python-exec2 "${wrapd}/${newfn}"
# don't use this at home, just call python_doscript() instead
@@ -970,15 +947,6 @@ _python_wrapper_setup() {
local EPYTHON PYTHON
_python_export "${impl}" EPYTHON PYTHON
- local pyver pyother
- if [[ ${EPYTHON} != python2* ]]; then
- pyver=3
- pyother=2
- else
- pyver=2
- pyother=3
- fi
-
# Python interpreter
# note: we don't use symlinks because python likes to do some
# symlink reading magic that breaks stuff
@@ -987,10 +955,10 @@ _python_wrapper_setup() {
#!/bin/sh
exec "${PYTHON}" "\${@}"
_EOF_
- cp "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die
- chmod +x "${workdir}/bin/python" "${workdir}/bin/python${pyver}" || die
+ cp "${workdir}/bin/python" "${workdir}/bin/python3" || die
+ chmod +x "${workdir}/bin/python" "${workdir}/bin/python3" || die
- local nonsupp=( "python${pyother}" "python${pyother}-config" )
+ local nonsupp=( python2 python2-config )
# CPython-specific
if [[ ${EPYTHON} == python* ]]; then
@@ -999,24 +967,22 @@ _python_wrapper_setup() {
exec "${PYTHON}-config" "\${@}"
_EOF_
cp "${workdir}/bin/python-config" \
- "${workdir}/bin/python${pyver}-config" || die
+ "${workdir}/bin/python3-config" || die
chmod +x "${workdir}/bin/python-config" \
- "${workdir}/bin/python${pyver}-config" || die
+ "${workdir}/bin/python3-config" || die
# Python 2.6+.
ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || die
# Python 2.7+.
ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}.pc \
- "${workdir}"/pkgconfig/python${pyver}.pc || die
+ "${workdir}"/pkgconfig/python3.pc || die
# Python 3.8+.
- if [[ ${EPYTHON} != python[23].[67] ]]; then
- ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}-embed.pc \
- "${workdir}"/pkgconfig/python${pyver}-embed.pc || die
- fi
+ ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}-embed.pc \
+ "${workdir}"/pkgconfig/python3-embed.pc || die
else
- nonsupp+=( 2to3 python-config "python${pyver}-config" )
+ nonsupp+=( 2to3 python-config python3-config )
fi
local x
@@ -1113,11 +1079,10 @@ python_fix_shebang() {
"${EPYTHON}")
match=1
;;
- python|python[23])
+ python|python3)
match=1
- [[ ${in_path##*/} == python2 ]] && error=1
;;
- python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|jython[23].[0-9])
+ python2|python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|jython[23].[0-9])
# Explicit mismatch.
match=1
error=1
@@ -1346,6 +1311,16 @@ epytest() {
# sterilize pytest-markdown as it runs code snippets from all
# *.md files found without any warning
-p no:markdown
+ # pytest-sugar undoes everything that's good about pytest output
+ # and makes it hard to read logs
+ -p no:sugar
+ # pytest-xvfb automatically spawns Xvfb for every test suite,
+ # effectively forcing it even when we'd prefer the tests
+ # not to have DISPLAY at all, causing crashes sometimes
+ # and causing us to miss missing virtualx usage
+ -p no:xvfb
+ # tavern is intrusive and breaks test suites of various packages
+ -p no:tavern
)
local x
for x in "${EPYTEST_DESELECT[@]}"; do
@@ -1401,15 +1376,13 @@ _python_run_check_deps() {
debug-print-function ${FUNCNAME} "${@}"
local impl=${1}
- local hasv_args=( -b )
- [[ ${EAPI} == 6 ]] && hasv_args=( --host-root )
einfo "Checking whether ${impl} is suitable ..."
local PYTHON_PKG_DEP
_python_export "${impl}" PYTHON_PKG_DEP
ebegin " ${PYTHON_PKG_DEP}"
- has_version "${hasv_args[@]}" "${PYTHON_PKG_DEP}"
+ has_version -b "${PYTHON_PKG_DEP}"
eend ${?} || return 1
declare -f python_check_deps >/dev/null || return 0
@@ -1426,10 +1399,8 @@ _python_run_check_deps() {
# A convenience wrapper for has_version() with verbose output and better
# defaults for use in python_check_deps().
#
-# The wrapper accepts EAPI 7+-style -b/-d/-r options to indicate
-# the root to perform the lookup on. Unlike has_version, the default
-# is -b. In EAPI 6, -b and -d are translated to --host-root
-# for compatibility.
+# The wrapper accepts -b/-d/-r options to indicate the root to perform
+# the lookup on. Unlike has_version, the default is -b.
#
# The wrapper accepts multiple package specifications. For the check
# to succeed, *all* specified atoms must match.
@@ -1444,14 +1415,6 @@ python_has_version() {
;;
esac
- if [[ ${EAPI} == 6 ]]; then
- if [[ ${root_arg} == -r ]]; then
- root_arg=()
- else
- root_arg=( --host-root )
- fi
- fi
-
local pkg
for pkg; do
ebegin " ${pkg}"
@@ -1462,5 +1425,4 @@ python_has_version() {
return 0
}
-_PYTHON_UTILS_R1=1
fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2023-05-24 7:55 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2023-05-24 7:55 UTC (permalink / raw
To: gentoo-commits
commit: b80146770eaafa7e45d8aa8a6d92977e41dbf5a1
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed May 24 07:55:36 2023 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed May 24 07:55:36 2023 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=b8014677
eclass/python-utils-r1: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 0552c03d16..e565a8f752 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -40,7 +40,7 @@ inherit multiprocessing toolchain-funcs
# All supported Python implementations, most preferred last.
_PYTHON_ALL_IMPLS=(
pypy3
- python3_{10..11}
+ python3_{10..12}
)
readonly _PYTHON_ALL_IMPLS
@@ -80,7 +80,7 @@ _python_verify_patterns() {
local impl pattern
for pattern; do
case ${pattern} in
- -[23]|3.[89]|3.1[01])
+ -[23]|3.[89]|3.1[012])
continue
;;
esac
@@ -129,7 +129,7 @@ _python_set_impls() {
# please keep them in sync with _PYTHON_ALL_IMPLS
# and _PYTHON_HISTORICAL_IMPLS
case ${i} in
- pypy3|python3_9|python3_1[01])
+ pypy3|python3_9|python3_1[0-2])
;;
jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-9])
obsolete+=( "${i}" )
@@ -236,7 +236,7 @@ _python_impl_matches() {
[[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] &&
return 0
;;
- 3.8|3.1[01])
+ 3.8|3.1[0-2])
[[ ${impl} == python${pattern/./_} ]] && return 0
;;
*)
@@ -452,6 +452,8 @@ _python_export() {
PYTHON_PKG_DEP=">=dev-lang/python-3.10.9-r1:3.10";;
python3.11)
PYTHON_PKG_DEP=">=dev-lang/python-3.11.1-r1:3.11";;
+ python3.12)
+ PYTHON_PKG_DEP=">=dev-lang/python-3.12.0_beta1:3.12";;
pypy3)
PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.11-r1:0=';;
*)
@@ -1358,7 +1360,12 @@ eunittest() {
_python_check_EPYTHON
- set -- "${EPYTHON}" -m unittest_or_fail discover -v "${@}"
+ # unittest fails with "no tests" correctly since Python 3.12
+ local runner=unittest
+ if _python_impl_matches "${EPYTHON}" 3.{9..11}; then
+ runner=unittest_or_fail
+ fi
+ set -- "${EPYTHON}" -m "${runner}" discover -v "${@}"
echo "${@}" >&2
"${@}" || die -n "Tests failed with ${EPYTHON}"
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2023-09-03 19:39 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2023-09-03 19:39 UTC (permalink / raw
To: gentoo-commits
commit: cbcf8a9a914d88f8c61f27e1343776159a97d218
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Sep 3 19:39:28 2023 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Sep 3 19:39:28 2023 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=cbcf8a9a
toolchain.eclass: sync from gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 1075 ++++++++++++++++++-----------------------------
1 file changed, 410 insertions(+), 665 deletions(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 642bf54a89..ce62b7b81d 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: toolchain.eclass
@@ -6,14 +6,17 @@
# Toolchain Ninjas <toolchain@gentoo.org>
# @SUPPORTED_EAPIS: 7 8
# @BLURB: Common code for sys-devel/gcc ebuilds
+# @DESCRIPTION:
+# Common code for sys-devel/gcc ebuilds (and occasionally GCC forks, like
+# GNAT for Ada). If not building GCC itself, please use toolchain-funcs.eclass
+# instead.
case ${EAPI} in
- 7) inherit eutils ;;
- 8) ;;
+ 7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
-if [[ ! ${_TOOLCHAIN_ECLASS} ]]; then
+if [[ -z ${_TOOLCHAIN_ECLASS} ]]; then
_TOOLCHAIN_ECLASS=1
DESCRIPTION="The GNU Compiler Collection"
@@ -49,9 +52,9 @@ if [[ ${CTARGET} = ${CHOST} ]] ; then
export CTARGET=${CATEGORY#cross-}
fi
fi
-: ${TARGET_ABI:=${ABI}}
-: ${TARGET_MULTILIB_ABIS:=${MULTILIB_ABIS}}
-: ${TARGET_DEFAULT_ABI:=${DEFAULT_ABI}}
+: "${TARGET_ABI:=${ABI}}"
+: "${TARGET_MULTILIB_ABIS:=${MULTILIB_ABIS}}"
+: "${TARGET_DEFAULT_ABI:=${DEFAULT_ABI}}"
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
@@ -141,6 +144,32 @@ GCCMINOR=$(ver_cut 2 ${GCC_PV})
# GCC micro version.
GCCMICRO=$(ver_cut 3 ${GCC_PV})
+tc_use_major_version_only() {
+ local use_major_version_only=0
+
+ if ! tc_version_is_at_least 10 ; then
+ return 1
+ fi
+
+ if [[ ${GCCMAJOR} -eq 10 ]] && ver_test ${PV} -ge 10.4.1_p20220929 ; then
+ use_major_version_only=1
+ elif [[ ${GCCMAJOR} -eq 11 ]] && ver_test ${PV} -ge 11.3.1_p20220930 ; then
+ use_major_version_only=1
+ elif [[ ${GCCMAJOR} -eq 12 ]] && ver_test ${PV} -ge 12.2.1_p20221001 ; then
+ use_major_version_only=1
+ elif [[ ${GCCMAJOR} -eq 13 ]] && ver_test ${PV} -ge 13.0.0_pre20221002 ; then
+ use_major_version_only=1
+ elif [[ ${GCCMAJOR} -gt 13 ]] ; then
+ use_major_version_only=1
+ fi
+
+ if [[ ${use_major_version_only} -eq 1 ]] ; then
+ return 0
+ fi
+
+ return 1
+}
+
# @ECLASS_VARIABLE: GCC_CONFIG_VER
# @INTERNAL
# @DESCRIPTION:
@@ -148,7 +177,11 @@ GCCMICRO=$(ver_cut 3 ${GCC_PV})
# of binary and gcc-config names not directly tied to upstream
# versioning. In practice it's hard to untangle from gcc/BASE-VER
# (GCC_RELEASE_VER) value.
-GCC_CONFIG_VER=${GCC_RELEASE_VER}
+if tc_use_major_version_only ; then
+ GCC_CONFIG_VER=${GCCMAJOR}
+else
+ GCC_CONFIG_VER=${GCC_RELEASE_VER}
+fi
# Pre-release support. Versioning schema:
# 1.0.0_pre9999: live ebuild
@@ -168,7 +201,7 @@ fi
# Require minimum gcc version to simplify assumptions.
# Normally we would require gcc-6+ (based on sys-devel/gcc)
# but we still have sys-devel/gcc-apple-4.2.1_p5666.
-tc_version_is_at_least 4.2.1 || die "${ECLASS}: ${GCC_RELEASE_VER} is too old."
+tc_version_is_at_least 8 || die "${ECLASS}: ${GCC_RELEASE_VER} is too old."
PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr}
@@ -204,49 +237,46 @@ tc_has_feature() {
if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ||
[[ ${PN} == "gcc-apple" && $(tc_version_is_at_least 12.1) == 0 ]] ; then
IUSE+=" debug +cxx +nptl" TC_FEATURES+=( nptl )
- [[ -n ${PIE_VER} ]] && IUSE+=" nopie"
- [[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
IUSE+=" +fortran" TC_FEATURES+=( fortran )
IUSE+=" doc hardened multilib objc"
- tc_version_is_between 3 7 && IUSE+=" awt gcj" TC_FEATURES+=( gcj )
IUSE+=" pgo"
IUSE+=" objc-gc" TC_FEATURES+=( objc-gc )
IUSE+=" libssp objc++"
- IUSE+=" +openmp"
-
- tc_version_is_at_least 4.3 && IUSE+=" fixed-point"
- tc_version_is_at_least 4.7 && IUSE+=" go"
-
- # sanitizer support appeared in gcc-4.8, but <gcc-5 does not
- # support modern glibc.
- tc_version_is_at_least 5 && IUSE+=" +sanitize" TC_FEATURES+=( sanitize )
-
- # Note:
- # <gcc-4.8 supported graphite, it required forked ppl
- # versions which we dropped. Since graphite was also experimental in
- # the older versions, we don't want to bother supporting it. #448024
- # <gcc-5 supported graphite, it required cloog
- # <gcc-6.5 supported graphite, it required old incompatible isl
- tc_version_is_at_least 6.5 &&
- IUSE+=" graphite" TC_FEATURES+=( graphite )
-
- tc_version_is_between 4.9 8 && IUSE+=" cilk"
- tc_version_is_at_least 4.9 && IUSE+=" ada"
- tc_version_is_at_least 4.9 && IUSE+=" vtv"
- tc_version_is_at_least 5.0 && IUSE+=" jit"
+
+ # Stop forcing openmp on by default in the eclass. Gradually phase it out.
+ # See bug #890999.
+ if tc_version_is_at_least 13.0.0_pre20221218 ; then
+ IUSE+=" openmp"
+ else
+ IUSE+=" +openmp"
+ fi
+
+ IUSE+=" fixed-point"
+ IUSE+=" go"
+ IUSE+=" +sanitize" TC_FEATURES+=( sanitize )
+ IUSE+=" graphite" TC_FEATURES+=( graphite )
+ IUSE+=" ada"
+ IUSE+=" vtv"
+ IUSE+=" jit"
tc_version_is_between 5.0 9 && IUSE+=" mpx"
- tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch"
+ IUSE+=" +pie +ssp +pch"
- # systemtap is a gentoo-specific switch: bug #654748
- tc_version_is_at_least 8.0 &&
- IUSE+=" systemtap" TC_FEATURES+=( systemtap )
+ IUSE+=" systemtap" TC_FEATURES+=( systemtap )
- tc_version_is_at_least 9.0 && IUSE+=" d"
+ tc_version_is_at_least 9.0 && IUSE+=" d" TC_FEATURES+=( d )
tc_version_is_at_least 9.1 && IUSE+=" lto"
tc_version_is_at_least 10 && IUSE+=" cet"
tc_version_is_at_least 10 && IUSE+=" zstd" TC_FEATURES+=( zstd )
tc_version_is_at_least 11 && IUSE+=" valgrind" TC_FEATURES+=( valgrind )
tc_version_is_at_least 11 && IUSE+=" custom-cflags"
+ tc_version_is_at_least 12 && IUSE+=" ieee-long-double"
+ tc_version_is_at_least 12.2.1_p20221203 ${PV} && IUSE+=" default-znow"
+ tc_version_is_at_least 12.2.1_p20221203 ${PV} && IUSE+=" default-stack-clash-protection"
+ tc_version_is_at_least 13.0.0_pre20221218 ${PV} && IUSE+=" modula2"
+ # See https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615944.html
+ # and https://rust-gcc.github.io/2023/04/24/gccrs-and-gcc13-release.html for why
+ # it was disabled in 13.
+ tc_version_is_at_least 14.0.0_pre20230423 ${PV} && IUSE+=" rust"
fi
if tc_version_is_at_least 10; then
@@ -259,24 +289,18 @@ fi
#---->> DEPEND <<----
-RDEPEND="sys-libs/zlib
+RDEPEND="
+ sys-libs/zlib
virtual/libiconv
nls? ( virtual/libintl )
"
GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2:0= >=dev-libs/mpfr-2.4.2:0="
-if tc_version_is_at_least 4.3 ; then
- RDEPEND+=" ${GMP_MPFR_DEPS}"
-elif tc_has_feature fortran ; then
- RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
-fi
-
-tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0="
+RDEPEND+=" ${GMP_MPFR_DEPS}"
+RDEPEND+=" >=dev-libs/mpc-0.8.1:0="
if tc_has_feature objc-gc ; then
- if tc_version_is_at_least 7 ; then
- RDEPEND+=" objc-gc? ( >=dev-libs/boehm-gc-7.4.2 )"
- fi
+ RDEPEND+=" objc-gc? ( >=dev-libs/boehm-gc-7.4.2 )"
fi
if tc_has_feature graphite ; then
@@ -290,26 +314,15 @@ BDEPEND="
test? (
>=dev-util/dejagnu-1.4.4
>=sys-devel/autogen-5.5.4
- )"
+ )
+"
DEPEND="${RDEPEND}"
-if tc_has_feature gcj ; then
- DEPEND+="
- gcj? (
- app-arch/zip
- app-arch/unzip
- >=media-libs/libart_lgpl-2.1
- awt? (
- x11-base/xorg-proto
- x11-libs/libXt
- x11-libs/libX11
- x11-libs/libXtst
- =x11-libs/gtk+-2*
- x11-libs/pango
- virtual/pkgconfig
- )
- )
- "
+if [[ ${PN} == gcc && ${PV} == *_p* ]] ; then
+ # Snapshots don't contain info pages.
+ # If they start to, adjust gcc_cv_prog_makeinfo_modern logic in toolchain_src_configure.
+ # Needed unless/until https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106899 is fixed
+ BDEPEND+=" sys-apps/texinfo"
fi
if tc_has_feature sanitize ; then
@@ -329,12 +342,26 @@ if tc_has_feature zstd ; then
RDEPEND+=" zstd? ( app-arch/zstd:= )"
fi
-if tc_has_feature valgrind; then
+if tc_has_feature valgrind ; then
BDEPEND+=" valgrind? ( dev-util/valgrind )"
fi
-# Prefix: our version is 1.9, so can't go with gx86's 2.3
-PDEPEND=">=sys-devel/gcc-config-1.9"
+# TODO: Add a pkg_setup & pkg_pretend check for whether the active compiler
+# supports Ada.
+if tc_has_feature ada ; then
+ BDEPEND+=" ada? ( || ( sys-devel/gcc[ada] dev-lang/gnat-gpl[ada] ) )"
+fi
+
+# TODO: Add a pkg_setup & pkg_pretend check for whether the active compiler
+# supports D.
+if tc_has_feature d && tc_version_is_at_least 12.0 ; then
+ # D in 12+ is self-hosting and needs D to bootstrap.
+ # TODO: package some binary we can use, like for Ada
+ # bug #840182
+ BDEPEND+=" d? ( || ( sys-devel/gcc[d(-)] <sys-devel/gcc-12[d(-)] ) )"
+fi
+
+PDEPEND=">=sys-devel/gcc-config-2.3"
#---->> S + SRC_URI essentials <<----
@@ -343,38 +370,39 @@ PDEPEND=">=sys-devel/gcc-config-1.9"
# Used to override compression used for for patchsets.
# Default is xz for EAPI 8+ and bz2 for older EAPIs.
if [[ ${EAPI} == 8 ]] ; then
- : ${TOOLCHAIN_PATCH_SUFFIX:=xz}
+ : "${TOOLCHAIN_PATCH_SUFFIX:=xz}"
else
# Older EAPIs
- : ${TOOLCHAIN_PATCH_SUFFIX:=bz2}
+ : "${TOOLCHAIN_PATCH_SUFFIX:=bz2}"
fi
# @ECLASS_VARIABLE: TOOLCHAIN_SET_S
# @DESCRIPTION:
# Used to override value of S for snapshots and such. Mainly useful
# if needing to set GCC_TARBALL_SRC_URI.
-: ${TOOLCHAIN_SET_S:=yes}
+: "${TOOLCHAIN_SET_S:=yes}"
# Set the source directory depending on whether we're using
# a live git tree, snapshot, or release tarball.
if [[ ${TOOLCHAIN_SET_S} == yes ]] ; then
- S=$(
- if tc_is_live ; then
- echo ${EGIT_CHECKOUT_DIR}
- elif [[ -n ${SNAPSHOT} ]] ; then
- echo ${WORKDIR}/gcc-${SNAPSHOT}
- else
- echo ${WORKDIR}/gcc-${GCC_RELEASE_VER}
- fi
- )
+ if tc_is_live ; then
+ S=${EGIT_CHECKOUT_DIR}
+ elif [[ -n ${SNAPSHOT} ]] ; then
+ S=${WORKDIR}/gcc-${SNAPSHOT}
+ else
+ S=${WORKDIR}/gcc-${GCC_RELEASE_VER}
+ fi
fi
gentoo_urls() {
+ # the list is sorted by likelihood of getting the patches tarball from
+ # respective devspace
# slyfox's distfiles are mirrored to sam's devspace
declare -A devspace_urls=(
[soap]=HTTP~soap/distfiles/URI
[sam]=HTTP~sam/distfiles/sys-devel/gcc/URI
[slyfox]=HTTP~sam/distfiles/URI
+ [xen0n]=HTTP~xen0n/distfiles/sys-devel/gcc/URI
[tamiko]=HTTP~tamiko/distfiles/URI
[zorry]=HTTP~zorry/patches/gcc/URI
[vapier]=HTTP~vapier/dist/URI
@@ -402,7 +430,8 @@ gentoo_urls() {
HTTP~tamiko/distfiles/URI
HTTP~zorry/patches/gcc/URI
HTTP~vapier/dist/URI
- HTTP~blueness/dist/URI"
+ HTTP~blueness/dist/URI
+ "
devspace=${devspace//HTTP/https:\/\/dev.gentoo.org\/}
echo ${devspace//URI/$1} mirror://gentoo/$1
}
@@ -431,43 +460,9 @@ gentoo_urls() {
# The resulting filename of this tarball will be:
# gcc-${PATCH_GCC_VER:-${GCC_RELEASE_VER}}-patches-${PATCH_VER}.tar.xz
#
-# PIE_VER
-# PIE_GCC_VER
-# These variables control patching in various updates for the logic
-# controlling Position Independent Executables. PIE_VER is expected
-# to be the version of this patch, and PIE_GCC_VER the gcc version of
-# the patch:
-# An example:
-# PIE_VER="8.7.6.5"
-# PIE_GCC_VER="3.4.0"
-# The resulting filename of this tarball will be:
-# gcc-${PIE_GCC_VER:-${GCC_RELEASE_VER}}-piepatches-v${PIE_VER}.tar.xz
-#
-# SPECS_VER
-# SPECS_GCC_VER
-# This is for the minispecs files included in the hardened gcc-4.x
-# The specs files for hardenedno*, vanilla and for building the "specs" file.
-# SPECS_VER is expected to be the version of this patch, SPECS_GCC_VER
-# the gcc version of the patch.
-# An example:
-# SPECS_VER="8.7.6.5"
-# SPECS_GCC_VER="3.4.0"
-# The resulting filename of this tarball will be:
-# gcc-${SPECS_GCC_VER:-${GCC_RELEASE_VER}}-specs-${SPECS_VER}.tar.xz
-#
-# CYGWINPORTS_GITREV
-# If set, this variable signals that we should apply additional patches
-# maintained by upstream Cygwin developers at github/cygwinports/gcc,
-# using the specified git commit id there. The list of patches to
-# apply is extracted from gcc.cygport, maintained there as well.
-# This is done for compilers running on Cygwin, not for cross compilers
-# with a Cygwin target.
get_gcc_src_uri() {
export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
export MUSL_GCC_VER=${MUSL_GCC_VER:-${PATCH_GCC_VER}}
- export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}}
- export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}}
- export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}}
# Set where to download gcc itself depending on whether we're using a
# live git tree, snapshot, or release tarball.
@@ -477,13 +472,12 @@ get_gcc_src_uri() {
# Pull gcc tarball from another location. Frequently used by gnat-gpl.
GCC_SRC_URI="${GCC_TARBALL_SRC_URI}"
elif [[ -n ${SNAPSHOT} ]] ; then
- GCC_SRC_URI="https://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz"
+ GCC_SRC_URI="mirror://gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz"
else
- if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
- GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz"
- else
- GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2"
- fi
+ GCC_SRC_URI="
+ mirror://gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz
+ mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz
+ "
fi
[[ -n ${PATCH_VER} ]] && \
@@ -491,27 +485,6 @@ get_gcc_src_uri() {
[[ -n ${MUSL_VER} ]] && \
GCC_SRC_URI+=" $(gentoo_urls gcc-${MUSL_GCC_VER}-musl-patches-${MUSL_VER}.tar.${TOOLCHAIN_PATCH_SUFFIX})"
- [[ -n ${PIE_VER} ]] && \
- PIE_CORE=${PIE_CORE:-gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.${TOOLCHAIN_PATCH_SUFFIX}} && \
- GCC_SRC_URI+=" $(gentoo_urls ${PIE_CORE})"
-
- # gcc minispec for the hardened gcc 4 compiler
- [[ -n ${SPECS_VER} ]] && \
- GCC_SRC_URI+=" $(gentoo_urls gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.${TOOLCHAIN_PATCH_SUFFIX})"
-
- if tc_has_feature gcj ; then
- if tc_version_is_at_least 4.5 ; then
- GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )"
- elif tc_version_is_at_least 4.3 ; then
- GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.3.jar )"
- fi
- fi
-
- # Cygwin patches from https://github.com/cygwinports/gcc
- [[ -n ${CYGWINPORTS_GITREV} ]] && \
- GCC_SRC_URI+=" elibc_Cygwin? ( https://github.com/cygwinports/gcc/archive/${CYGWINPORTS_GITREV}.tar.gz
- -> gcc-cygwinports-${CYGWINPORTS_GITREV}.tar.gz )"
-
echo "${GCC_SRC_URI}"
}
@@ -525,11 +498,7 @@ toolchain_pkg_pretend() {
ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"'
_tc_use_if_iuse objc++ && \
ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"'
- _tc_use_if_iuse gcj && \
- ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"'
fi
-
- want_minispecs
}
#---->> pkg_setup <<----
@@ -584,6 +553,11 @@ toolchain_src_unpack() {
if tc_is_live ; then
git-r3_src_unpack
+ # Needed for gcc --version to include the upstream commit used
+ # rather than only the commit after we apply our patches.
+ # It includes both with this.
+ echo "${EGIT_VERSION}" > "${S}"/gcc/REVISION || die
+
if [[ -z ${PATCH_VER} ]] && ! use vanilla ; then
toolchain_fetch_git_patches
fi
@@ -601,8 +575,6 @@ toolchain_src_prepare() {
cd "${S}" || die
do_gcc_gentoo_patches
- do_gcc_PIE_patches
- do_gcc_CYGWINPORTS_patches
if tc_is_live ; then
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, commit ${EGIT_VERSION}"
@@ -610,9 +582,8 @@ toolchain_src_prepare() {
eapply_user
- if ( tc_version_is_at_least 4.8.2 || _tc_use_if_iuse hardened ) \
- && ! use vanilla ; then
- make_gcc_hard
+ if ! use vanilla ; then
+ tc_enable_hardened_gcc
fi
# we use our libtool on Darwin (no longer applies since 12)
@@ -634,7 +605,6 @@ toolchain_src_prepare() {
-exec sed -i '/^pkgconfigdir/s:=.*:=$(toolexeclibdir)/pkgconfig:' {} + || die
setup_multilib_osdirnames
- gcc_version_patch
local actual_version=$(< "${S}"/gcc/BASE-VER)
if [[ "${GCC_RELEASE_VER}" != "${actual_version}" ]] ; then
@@ -642,23 +612,6 @@ toolchain_src_prepare() {
die "Please set 'TOOLCHAIN_GCC_PV' to '${actual_version}'"
fi
- # >= gcc-4.3 doesn't bundle ecj.jar, so copy it
- if tc_version_is_at_least 4.3 && _tc_use_if_iuse gcj ; then
- if tc_version_is_at_least 4.5 ; then
- einfo "Copying ecj-4.5.jar"
- cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
- else
- einfo "Copying ecj-4.3.jar"
- cp -pPR "${DISTDIR}/ecj-4.3.jar" "${S}/ecj.jar" || die
- fi
- fi
-
- # Prevent libffi from being installed
- if tc_version_is_between 3.0 4.8 ; then
- sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in || die
- sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile.in || die
- fi
-
# Fixup libtool to correctly generate .la files with portage
elibtoolize --portage --shallow --no-uclibc
@@ -673,21 +626,25 @@ toolchain_src_prepare() {
|| eerror "Please file a bug about this"
eend $?
done
- # bug #215828
- sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk || die
-
- # Prevent new texinfo from breaking old versions (see #198182, bug #464008)
- einfo "Remove texinfo (bug #198182, bug #464008)"
- eapply "${FILESDIR}"/gcc-configure-texinfo.patch
-
- # >=gcc-4
- if [[ -x contrib/gcc_update ]] ; then
- einfo "Touching generated files"
- ./contrib/gcc_update --touch | \
- while read f ; do
- einfo " ${f%%...}"
- done
+
+ if ! use prefix-guest && [[ -n ${EPREFIX} ]] ; then
+ einfo "Prefixifying dynamic linkers..."
+ for f in gcc/config/*/*linux*.h ; do
+ ebegin " Updating ${f}"
+ if [[ ${f} == gcc/config/rs6000/linux*.h ]]; then
+ sed -i -r "s,(DYNAMIC_LINKER_PREFIX\s+)\"\",\1\"${EPREFIX}\",g" "${f}" || die
+ else
+ sed -i -r "/_DYNAMIC_LINKER/s,([\":])(/lib),\1${EPREFIX}\2,g" "${f}" || die
+ fi
+ eend $?
+ done
fi
+
+ einfo "Touching generated files"
+ ./contrib/gcc_update --touch | \
+ while read f ; do
+ einfo " ${f%%...}"
+ done
}
do_gcc_gentoo_patches() {
@@ -718,93 +675,47 @@ do_gcc_gentoo_patches() {
fi
}
-do_gcc_PIE_patches() {
- want_pie || return 0
- use vanilla && return 0
-
- einfo "Applying PIE patches ..."
- eapply "${WORKDIR}"/piepatch/*.patch
+# configure to build with the hardened GCC specs as the default
+tc_enable_hardened_gcc() {
+ local hardened_gcc_flags=""
- BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
-}
+ if _tc_use_if_iuse pie ; then
+ einfo "Updating gcc to use automatic PIE building ..."
+ fi
-do_gcc_CYGWINPORTS_patches() {
- [[ -n ${CYGWINPORTS_GITREV} ]] || return 0
- use elibc_Cygwin || return 0
-
- local p d="${WORKDIR}/gcc-${CYGWINPORTS_GITREV}"
- # readarray -t is available since bash-4.4 only, bug #690686
- local patches=( $(
- for p in $(
- sed -e '1,/PATCH_URI="/d;/"/,$d' < "${d}"/gcc.cygport
- ); do
- echo "${d}/${p}"
- done
- ) )
- einfo "Applying cygwin port patches ..."
- eapply -- "${patches[@]}"
-}
+ if _tc_use_if_iuse ssp ; then
+ einfo "Updating gcc to use automatic SSP building ..."
+ fi
-# configure to build with the hardened GCC specs as the default
-make_gcc_hard() {
- local gcc_hard_flags=""
+ if _tc_use_if_iuse default-stack-clash-protection ; then
+ # The define DEF_GENTOO_SCP is checked in 24_all_DEF_GENTOO_SCP-fstack-clash-protection.patch
+ einfo "Updating gcc to use automatic stack clash protection ..."
+ hardened_gcc_flags+=" -DDEF_GENTOO_SCP"
+ fi
- # If we use gcc-6 or newer with PIE enabled to compile older gcc,
- # we need to pass -no-pie to stage1; bug #618908
- if ! tc_version_is_at_least 6.0 && [[ $(gcc-major-version) -ge 6 ]] ; then
- einfo "Disabling PIE in stage1 (only) ..."
- sed -i -e "/^STAGE1_LDFLAGS/ s/$/ -no-pie/" "${S}"/Makefile.in || die
+ if _tc_use_if_iuse default-znow ; then
+ # The define DEF_GENTOO_ZNOW is checked in 23_all_DEF_GENTOO_ZNOW-z-now.patch
+ einfo "Updating gcc to request symbol resolution at start (-z now) ..."
+ hardened_gcc_flags+=" -DDEF_GENTOO_ZNOW"
fi
- # For gcc >= 6.x, we can use configuration options to turn PIE/SSP
- # on as default
- if tc_version_is_at_least 6.0 ; then
- if _tc_use_if_iuse pie ; then
- einfo "Updating gcc to use automatic PIE building ..."
- fi
- if _tc_use_if_iuse ssp ; then
- einfo "Updating gcc to use automatic SSP building ..."
- fi
- if _tc_use_if_iuse hardened ; then
- # Will add some hardened options as default, like:
- # * -fstack-clash-protection
- # * -z now
- # See gcc *_all_extra-options.patch patches.
- gcc_hard_flags+=" -DEXTRA_OPTIONS"
-
- if _tc_use_if_iuse cet && [[ ${CTARGET} == *x86_64*-linux* ]] ; then
- gcc_hard_flags+=" -DEXTRA_OPTIONS_CF"
- fi
+ if _tc_use_if_iuse hardened ; then
+ # Will add some hardened options as default, e.g. for gcc-12
+ # * -fstack-clash-protection
+ # * -z now
+ # See gcc *_all_extra-options.patch patches.
+ hardened_gcc_flags+=" -DEXTRA_OPTIONS"
+ # Default to -D_FORTIFY_SOURCE=3 instead of -D_FORTIFY_SOURCE=2
+ hardened_gcc_flags+=" -DGENTOO_FORTIFY_SOURCE_LEVEL=3"
+ # Add -D_GLIBCXX_ASSERTIONS
+ hardened_gcc_flags+=" -DDEF_GENTOO_GLIBCXX_ASSERTIONS"
- # Rebrand to make bug reports easier
- BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
- fi
- else
- if _tc_use_if_iuse hardened ; then
- # Rebrand to make bug reports easier
- BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
- if hardened_gcc_works ; then
- einfo "Updating gcc to use automatic PIE + SSP building ..."
- gcc_hard_flags+=" -DEFAULT_PIE_SSP"
- elif hardened_gcc_works pie ; then
- einfo "Updating gcc to use automatic PIE building ..."
- ewarn "SSP has not been enabled by default"
- gcc_hard_flags+=" -DEFAULT_PIE"
- elif hardened_gcc_works ssp ; then
- einfo "Updating gcc to use automatic SSP building ..."
- ewarn "PIE has not been enabled by default"
- gcc_hard_flags+=" -DEFAULT_SSP"
- else
- # Do nothing if hardened isn't supported, but don't die either
- ewarn "hardened is not supported for this arch in this gcc version"
- return 0
- fi
- else
- if hardened_gcc_works ssp ; then
- einfo "Updating gcc to use automatic SSP building ..."
- gcc_hard_flags+=" -DEFAULT_SSP"
- fi
+ if _tc_use_if_iuse cet && [[ ${CTARGET} == *x86_64*-linux* ]] ; then
+ hardened_gcc_flags+=" -DEXTRA_OPTIONS_CF"
fi
+
+ # Rebrand to make bug reports easier
+ BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
fi
# We want to be able to control the PIE patch logic via something other
@@ -812,15 +723,13 @@ make_gcc_hard() {
sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
-e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
-i "${S}"/gcc/Makefile.in || die
- # Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
- if tc_version_is_at_least 4.7 ; then
- sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
- -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
- -i "${S}"/gcc/Makefile.in || die
- fi
+
+ sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
+ -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
+ -i "${S}"/gcc/Makefile.in || die
sed -i \
- -e "/^HARD_CFLAGS = /s|=|= ${gcc_hard_flags} |" \
+ -e "/^HARD_CFLAGS = /s|=|= ${hardened_gcc_flags} |" \
"${S}"/gcc/Makefile.in || die
}
@@ -832,7 +741,7 @@ make_gcc_hard() {
# Most other distros use the logic (including mainline gcc):
# lib - 32bit binaries (x86)
# lib64 - 64bit binaries (x86_64)
-# Over time, Gentoo is migrating to the latter form.
+# Over time, Gentoo is migrating to the latter form (17.1 profiles).
#
# Unfortunately, due to distros picking the lib32 behavior, newer gcc
# versions will dynamically detect whether to use lib or lib32 for its
@@ -856,16 +765,10 @@ setup_multilib_osdirnames() {
config+="/t-linux64"
local sed_args=()
- if tc_version_is_at_least 4.6 ; then
- sed_args+=( -e 's:$[(]call if_multiarch[^)]*[)]::g' )
- fi
+ sed_args+=( -e 's:$[(]call if_multiarch[^)]*[)]::g' )
if [[ ${SYMLINK_LIB} == "yes" ]] ; then
einfo "Updating multilib directories to be: ${libdirs}"
- if tc_version_is_at_least 4.6.4 || tc_version_is_at_least 4.7 ; then
- sed_args+=( -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:' )
- else
- sed_args+=( -e "/^MULTILIB_OSDIRNAMES/s:=.*:= ${libdirs}:" )
- fi
+ sed_args+=( -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:' )
else
einfo "Using upstream multilib; disabling lib32 autodetection"
sed_args+=( -r -e 's:[$][(]if.*,(.*)[)]:\1:' )
@@ -873,30 +776,18 @@ setup_multilib_osdirnames() {
sed -i "${sed_args[@]}" "${S}"/gcc/config/${config} || die
}
-gcc_version_patch() {
- # gcc-4.3+ has configure flags (whoo!)
- tc_version_is_at_least 4.3 && return 0
-
- local version_string=${GCC_RELEASE_VER}
-
- einfo "Patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})"
-
- local gcc_sed=( -e 's:gcc\.gnu\.org/bugs\.html:bugs\.gentoo\.org/:' )
- if grep -qs VERSUFFIX "${S}"/gcc/version.c ; then
- gcc_sed+=( -e "/VERSUFFIX \"\"/s:\"\":\" (${BRANDING_GCC_PKGVERSION})\":" )
- else
- version_string="${version_string} (${BRANDING_GCC_PKGVERSION})"
- gcc_sed+=( -e "/const char version_string\[\] = /s:= \".*\":= \"${version_string}\":" )
- fi
- sed -i "${gcc_sed[@]}" "${S}"/gcc/version.c || die
-}
-
#---->> src_configure <<----
toolchain_src_configure() {
downgrade_arch_flags
gcc_do_filter_flags
+ if ! tc_version_is_at_least 11 && [[ $(gcc-major-version) -ge 12 ]] ; then
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105695
+ # bug #849359
+ export ac_cv_std_swap_in_utility=no
+ fi
+
einfo "CFLAGS=\"${CFLAGS}\""
einfo "CXXFLAGS=\"${CXXFLAGS}\""
einfo "LDFLAGS=\"${LDFLAGS}\""
@@ -905,12 +796,6 @@ toolchain_src_configure() {
# issues with 3rd party jar implementations. bug #384291
export JAR=no
- # For hardened gcc 4.3: add the pie patchset to build the hardened specs
- # file (build.specs) to use when building gcc.
- if ! tc_version_is_at_least 4.4 && want_minispecs ; then
- setup_minispecs_gcc_build_specs
- fi
-
local confgcc=( --host=${CHOST} )
local build_config_targets=()
@@ -932,8 +817,19 @@ toolchain_src_configure() {
--mandir="${DATAPATH}/man"
--infodir="${DATAPATH}/info"
--with-gxx-include-dir="${STDCXX_INCDIR}"
+
+ # portage's econf() does not detect presence of --d-s-r
+ # because it greps only top-level ./configure. But not
+ # libiberty's or gcc's configure.
+ --disable-silent-rules
)
+ if tc_version_is_at_least 10 ; then
+ confgcc+=(
+ --disable-dependency-tracking
+ )
+ fi
+
# Stick the python scripts in their own slotted directory (bug #279252)
#
# --with-python-dir=DIR
@@ -943,16 +839,13 @@ toolchain_src_configure() {
# then --with-python-dir=/lib/python2.5/site-packages should be passed.
#
# This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python"
- if tc_version_is_at_least 4.4 ; then
- confgcc+=( --with-python-dir=${DATAPATH/$PREFIX/}/python )
- fi
+ confgcc+=( --with-python-dir=${DATAPATH/$PREFIX/}/python )
### language options
local GCC_LANG="c"
is_cxx && GCC_LANG+=",c++"
is_d && GCC_LANG+=",d"
- is_gcj && GCC_LANG+=",java"
is_go && GCC_LANG+=",go"
if is_objc || is_objcxx ; then
GCC_LANG+=",objc"
@@ -966,8 +859,9 @@ toolchain_src_configure() {
is_fortran && GCC_LANG+=",fortran"
is_f77 && GCC_LANG+=",f77"
is_f95 && GCC_LANG+=",f95"
-
is_ada && GCC_LANG+=",ada"
+ is_modula2 && GCC_LANG+=",m2"
+ is_rust && GCC_LANG+=",rust"
confgcc+=( --enable-languages=${GCC_LANG} )
@@ -988,32 +882,46 @@ toolchain_src_configure() {
confgcc+=( --disable-libunwind-exceptions )
- # Use the default ("release") checking because upstream usually neglects
- # to test "disabled" so it has a history of breaking. bug #317217
if in_iuse debug ; then
- # The "release" keyword is new to 4.0. bug #551636
- local off=$(tc_version_is_at_least 4.0 && echo release || echo no)
- confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes ${off})}" )
+ # Non-released versions get extra checks, follow configure.ac's default to for those
+ # unless USE=debug. Note that snapshots on stable branches don't count as "non-released"
+ # for these purposes.
+ if grep -q "experimental" gcc/DEV-PHASE ; then
+ # - USE=debug for pre-releases: yes,extra,rtl
+ # - USE=-debug for pre-releases: yes,extra (following upstream default)
+ confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes,extra,rtl yes,extra)}" )
+ else
+ # - Use the default ("release") checking because upstream usually neglects
+ # to test "disabled" so it has a history of breaking. bug #317217.
+ # - The "release" keyword is new to 4.0. bug #551636.
+ # - After discussing in #gcc, we concluded that =yes,extra,rtl makes
+ # more sense when a user explicitly requests USE=debug. If rtl is too slow,
+ # we can change this to yes,extra.
+ confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes,extra,rtl release)}" )
+ fi
fi
# Branding
- tc_version_is_at_least 4.3 && confgcc+=(
+ confgcc+=(
--with-bugurl=https://bugs.gentoo.org/
--with-pkgversion="${BRANDING_GCC_PKGVERSION}"
)
- # If we want hardened support with the newer PIE patchset for >=gcc 4.4
- if tc_version_is_at_least 4.4 && want_minispecs && in_iuse hardened ; then
- confgcc+=( $(use_enable hardened esp) )
+ if tc_use_major_version_only ; then
+ confgcc+=( --with-gcc-major-version-only )
fi
# Allow gcc to search for clock funcs in the main C lib.
# if it can't find them, then tough cookies -- we aren't
# going to link in -lrt to all C++ apps. bug #411681
- if tc_version_is_at_least 4.4 && is_cxx ; then
+ if is_cxx ; then
confgcc+=( --enable-libstdcxx-time )
fi
+ # This only controls whether the compiler *supports* LTO, not whether
+ # it's *built using* LTO. Hence we do it without a USE flag.
+ confgcc+=( --enable-lto )
+
# Build compiler itself using LTO
if tc_version_is_at_least 9.1 && _tc_use_if_iuse lto ; then
build_config_targets+=( bootstrap-lto )
@@ -1024,7 +932,7 @@ toolchain_src_configure() {
fi
# Support to disable PCH when building libstdcxx
- if tc_version_is_at_least 6.0 && ! _tc_use_if_iuse pch ; then
+ if ! _tc_use_if_iuse pch ; then
confgcc+=( --disable-libstdcxx-pch )
fi
@@ -1040,12 +948,6 @@ toolchain_src_configure() {
# ;;
# esac
- # Newer gcc versions like to bootstrap themselves with C++,
- # so we need to manually disable it ourselves
- if tc_version_is_between 4.7 4.8 && ! is_cxx ; then
- confgcc+=( --disable-build-with-cxx --disable-build-poststage1-with-cxx )
- fi
-
### Cross-compiler options
if is_crosscompile ; then
# Enable build warnings by default with cross-compilers when system
@@ -1079,15 +981,15 @@ toolchain_src_configure() {
*-musl*)
needed_libc=musl
;;
- *-cygwin)
- needed_libc=cygwin
- ;;
x86_64-*-mingw*|*-w64-mingw*)
needed_libc=mingw64-runtime
;;
avr)
confgcc+=( --enable-shared --disable-threads )
;;
+ nvptx*)
+ # "LTO is not supported for this target"
+ confgcc+=( --disable-lto )
# Prefix targets
*-apple-darwin*)
confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}" )
@@ -1095,17 +997,14 @@ toolchain_src_configure() {
*-solaris*)
confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}" )
;;
- *-freebsd*)
- confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}" )
- ;;
esac
if [[ -n ${needed_libc} ]] ; then
local confgcc_no_libc=( --disable-shared )
# requires libc: bug #734820
- tc_version_is_at_least 4.6 && confgcc_no_libc+=( --disable-libquadmath )
+ confgcc_no_libc+=( --disable-libquadmath )
# requires libc
- tc_version_is_at_least 4.8 && confgcc_no_libc+=( --disable-libatomic )
+ confgcc_no_libc+=( --disable-libatomic )
if ! has_version ${CATEGORY}/${needed_libc} ; then
confgcc+=(
@@ -1132,7 +1031,13 @@ toolchain_src_configure() {
fi
fi
- confgcc+=( --disable-bootstrap )
+ confgcc+=(
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100289
+ # TOOD: Find a way to disable this just for stage1 cross?
+ --disable-gcov
+
+ --disable-bootstrap
+ )
else
if tc-is-static-only ; then
confgcc+=( --disable-shared )
@@ -1148,7 +1053,20 @@ toolchain_src_configure() {
;;
esac
- if use prefix ; then
+ if ! use prefix-guest ; then
+ # GNU ld scripts, such as those in glibc, reference unprefixed paths
+ # as the sysroot given here is automatically prepended. For
+ # prefix-guest, we use the host's libc instead.
+ if [[ -n ${EPREFIX} ]] ; then
+ confgcc+=( --with-sysroot="${EPREFIX}" )
+ fi
+
+ # We need to build against the right headers and libraries. Again,
+ # for prefix-guest, this is the host's.
+ if [[ -n ${ESYSROOT} ]] ; then
+ confgcc+=( --with-build-sysroot="${ESYSROOT}" )
+ fi
+ elif use prefix ; then
# should be /usr, because it's the path to search includes
# for, which is unrelated to TOOLCHAIN_PREFIX, a.k.a.
# PREFIX
@@ -1190,7 +1108,7 @@ toolchain_src_configure() {
# gcc has fixed-point arithmetic support in 4.3 for mips targets that can
# significantly increase compile time by several hours. This will allow
# users to control this feature in the event they need the support.
- tc_version_is_at_least 4.3 && in_iuse fixed-point && confgcc+=( $(use_enable fixed-point) )
+ in_iuse fixed-point && confgcc+=( $(use_enable fixed-point) )
case $(tc-is-softfloat) in
yes)
@@ -1222,13 +1140,11 @@ toolchain_src_configure() {
fi
done
- # Convert armv6m to armv6-m
- [[ ${arm_arch} == armv6m ]] && arm_arch=armv6-m
# Convert armv7{a,r,m} to armv7-{a,r,m}
[[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-}
# See if this is a valid --with-arch flag
if (srcdir=${S}/gcc target=${CTARGET} with_arch=${arm_arch};
- . "${srcdir}"/config.gcc) &>/dev/null
+ . "${srcdir}"/config.gcc) &>/dev/null
then
confgcc+=( --with-arch=${arm_arch} )
fi
@@ -1237,10 +1153,7 @@ toolchain_src_configure() {
[[ ${arm_arch} == *-m ]] && confgcc+=( --with-mode=thumb )
# Enable hardvfp
- if [[ $(tc-is-softfloat) == "no" ]] && \
- [[ ${CTARGET} == armv[67]* ]] && \
- tc_version_is_at_least 4.5
- then
+ if [[ $(tc-is-softfloat) == "no" ]] && [[ ${CTARGET} == armv[67]* ]] ; then
# Follow the new arm hardfp distro standard by default
confgcc+=( --with-float=hard )
case ${CTARGET} in
@@ -1248,6 +1161,15 @@ toolchain_src_configure() {
armv7*) confgcc+=( --with-fpu=vfpv3-d16 ) ;;
esac
fi
+
+ # If multilib is used, make the compiler build multilibs
+ # for A or R and M architecture profiles. Do this only
+ # when no specific arch/mode/float is specified, e.g.
+ # for target arm-none-eabi, since doing this is
+ # incompatible with --with-arch/cpu/float/fpu.
+ if is_multilib && [[ ${arm_arch} == arm ]] ; then
+ confgcc+=( --with-multilib-list=aprofile,rmprofile )
+ fi
;;
mips)
# Add --with-abi flags to set default ABI
@@ -1255,9 +1177,9 @@ toolchain_src_configure() {
;;
amd64)
- # drop the older/ABI checks once this get's merged into some
+ # drop the older/ABI checks once this gets merged into some
# version of gcc upstream
- if tc_version_is_at_least 4.8 && has x32 $(get_all_abis TARGET) ; then
+ if has x32 $(get_all_abis TARGET) ; then
confgcc+=( --with-abi=$(gcc-abi-map ${TARGET_DEFAULT_ABI}) )
fi
;;
@@ -1266,10 +1188,6 @@ toolchain_src_configure() {
# since glibc will do so based on CTARGET anyways
confgcc+=( --with-arch=${CTARGET%%-*} )
;;
- hppa)
- # Enable sjlj exceptions for backward compatibility on hppa
- [[ ${GCCMAJOR} == "3" ]] && confgcc+=( --enable-sjlj-exceptions )
- ;;
ppc)
# Set up defaults based on current CFLAGS
is-flagq -mfloat-gprs=double && confgcc+=( --enable-e500-double )
@@ -1284,6 +1202,13 @@ toolchain_src_configure() {
# - bug #704784
# - https://gcc.gnu.org/PR93157
[[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( --with-abi=elfv2 )
+
+ if in_iuse ieee-long-double; then
+ # musl requires 64-bit long double, not IBM double-double or IEEE quad.
+ if [[ ${CTARGET} == powerpc64le-*-gnu ]]; then
+ use ieee-long-double && confgcc+=( --with-long-double-format=ieee )
+ fi
+ fi
;;
riscv)
# Add --with-abi flags to set default ABI
@@ -1295,19 +1220,15 @@ toolchain_src_configure() {
# 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
- ppc|ppc64)
+ amd64|ppc|ppc64|sparc|x86)
confgcc+=( --enable-targets=all )
;;
- sparc)
- tc_version_is_at_least 4.4 && confgcc+=( --enable-targets=all )
- ;;
- amd64|x86)
- tc_version_is_at_least 4.3 && confgcc+=( --enable-targets=all )
+ *)
;;
esac
# On Darwin we need libdir to be set in order to get correct install names
- # for things like libobjc-gnu, libgcj and libfortran. If we enable it on
+ # for things like libobjc-gnu and libfortran. If we enable it on
# non-Darwin we screw up the behaviour this eclass relies on. We in
# particular need this over --libdir for bug #255315.
[[ ${CTARGET} == *-darwin* ]] && \
@@ -1315,15 +1236,6 @@ toolchain_src_configure() {
### library options
- if tc_version_is_between 3.0 7.0 ; then
- if is_gcj ; then
- confgcc+=( --disable-gjdoc )
- use awt && confgcc+=( --enable-java-awt=gtk )
- else
- confgcc+=( --disable-libgcj )
- fi
- fi
-
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
@@ -1345,10 +1257,6 @@ toolchain_src_configure() {
if _tc_use_if_iuse libssp ; then
confgcc+=( --enable-libssp )
else
- 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 the target libc does not provide
@@ -1402,50 +1310,52 @@ toolchain_src_configure() {
confgcc+=( $(use_with zstd) )
fi
- # This only controls whether the compiler *supports* LTO, not whether
- # it's *built using* LTO. Hence we do it without a USE flag.
- if tc_version_is_at_least 4.6 ; then
- confgcc+=( --enable-lto )
- elif tc_version_is_at_least 4.5 ; then
- confgcc+=( --disable-lto )
- fi
-
# graphite was added in 4.4 but we only support it in 6.5+ due to external
# library issues. bug #448024, bug #701270
- if tc_version_is_at_least 6.5 && in_iuse graphite ; then
+ if in_iuse graphite ; then
confgcc+=( $(use_with graphite isl) )
use graphite && confgcc+=( --disable-isl-version-check )
- elif tc_version_is_at_least 5.0 ; then
+ else
confgcc+=( --without-isl )
- elif tc_version_is_at_least 4.8 ; then
- confgcc+=( --without-cloog )
- elif tc_version_is_at_least 4.4 ; then
- confgcc+=( --without-{cloog,ppl} )
fi
- if tc_version_is_at_least 4.8; then
- if in_iuse sanitize ; then
- # See Note [implicitly enabled flags]
- confgcc+=( $(usex sanitize '' --disable-libsanitizer) )
- else
- confgcc+=( --disable-libsanitizer )
- fi
+ if in_iuse sanitize ; then
+ # See Note [implicitly enabled flags]
+ confgcc+=( $(usex sanitize '' --disable-libsanitizer) )
+ else
+ confgcc+=( --disable-libsanitizer )
fi
- if tc_version_is_at_least 6.0 && in_iuse pie ; then
+ if in_iuse pie ; then
confgcc+=( $(use_enable pie default-pie) )
+
+ if tc_version_is_at_least 14.0.0_pre20230612 ${PV} ; then
+ confgcc+=( --enable-host-pie )
+ fi
+ fi
+
+ if in_iuse default-znow && tc_version_is_at_least 14.0.0_pre20230619 ${PV}; then
+ # See https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=33ebb0dff9bb022f1e0709e0e73faabfc3df7931.
+ # TODO: Add to LDFLAGS_FOR_TARGET?
+ confgcc+=(
+ $(use_enable default-znow host-bind-now)
+ )
fi
- if tc_version_is_at_least 6.0 && in_iuse ssp ; then
+ if in_iuse ssp ; then
confgcc+=(
# This defaults to -fstack-protector-strong.
$(use_enable ssp default-ssp)
)
fi
- # Disable gcc info regeneration -- it ships with generated info pages
- # already. Our custom version/urls/etc... trigger it. bug #464008
- export gcc_cv_prog_makeinfo_modern=no
+ # TODO: Ignore RCs here (but TOOLCHAIN_IS_RC isn't yet an eclass var)
+ if [[ ${PV} == *_p* && -f "${S}"/gcc/doc/gcc.info ]] ; then
+ # Safeguard against https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106899 being fixed
+ # without corresponding ebuild changes.
+ eqawarn "Snapshot release with pre-generated info pages found!"
+ eqawarn "The BDEPEND in the ebuild should be updated to drop texinfo."
+ fi
# Do not let the X detection get in our way. We know things can be found
# via system paths, so no need to hardcode things that'll break multilib.
@@ -1455,8 +1365,8 @@ toolchain_src_configure() {
confgcc+=( "$@" ${EXTRA_ECONF} )
- if [[ -n ${build_config_targets} ]] ; then
- # ./configure --with-build-config='bootstrap-lto bootstrap-cet'
+ if ! is_crosscompile && ! tc-is-cross-compiler && [[ -n ${build_config_targets} ]] ; then
+ # e.g. ./configure --with-build-config='bootstrap-lto bootstrap-cet'
confgcc+=( --with-build-config="${build_config_targets[*]}" )
fi
@@ -1529,6 +1439,7 @@ downgrade_arch_flags() {
# "added" "arch" "replacement"
local archlist=(
+ 12.3 znver4 znver3
10 znver3 znver2
9 znver2 znver1
4.9 bdver4 bdver3
@@ -1637,6 +1548,9 @@ gcc_do_filter_flags() {
append-flags -O2
fi
+ # Please use USE=lto instead (bug #906007).
+ filter-lto
+
# Avoid shooting self in foot
filter-flags '-mabi*' -m31 -m32 -m64
@@ -1647,39 +1561,14 @@ gcc_do_filter_flags() {
filter-flags '-fsanitize=*'
- if tc_version_is_between 6 8 ; then
- # -mstackrealign triggers crashes in exception throwing
- # at least on ada: bug #688580
- # The reason is unknown. Drop the flag for now.
- filter-flags -mstackrealign
- fi
-
case $(tc-arch) in
amd64|x86)
filter-flags '-mcpu=*'
-
- # bug #357287
- tc_version_is_between 4.4 4.5 && append-flags -mno-avx
-
- if tc_version_is_between 4.6 4.7 ; then
- # bug #411333, bug #466454
- replace-cpu-flags c3-2 pentium2 pentium3 pentium3m pentium-m i686
- fi
;;
alpha)
# bug #454426
append-ldflags -Wl,--no-relax
;;
- sparc)
- # Temporary workaround for random ICEs reproduced by multiple users
- # bug #457062
- tc_version_is_between 4.6 4.8 && MAKEOPTS+=" -j1"
- ;;
- *-macos)
- # https://gcc.gnu.org/PR25127
- tc_version_is_between 4.0 4.2 && \
- filter-flags '-mcpu=*' '-march=*' '-mtune=*'
- ;;
esac
strip-unsupported-flags
@@ -1695,27 +1584,6 @@ gcc_do_filter_flags() {
local VAR="CFLAGS_"${CTARGET//[-.]/_}
CXXFLAGS=${!VAR-${CFLAGS}}
fi
-
- export GCJFLAGS=${GCJFLAGS:-${CFLAGS}}
-}
-
-setup_minispecs_gcc_build_specs() {
- # Setup the "build.specs" file for gcc 4.3 to use when building.
- 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
}
gcc-multilib-configure() {
@@ -1739,7 +1607,7 @@ gcc-multilib-configure() {
if [[ -n ${list} ]] ; then
case ${CTARGET} in
x86_64*)
- tc_version_is_at_least 4.8 && confgcc+=( --with-multilib-list=${list:1} )
+ confgcc+=( --with-multilib-list=${list:1} )
;;
esac
fi
@@ -1773,7 +1641,7 @@ toolchain_src_compile() {
touch "${S}"/gcc/c-gperf.h || die
# Do not make manpages if we do not have perl ...
- [[ ! -x /usr/bin/perl ]] \
+ [[ ! -x "${BROOT}"/usr/bin/perl ]] \
&& find "${WORKDIR}"/build -name '*.[17]' -exec touch {} +
# To compile ada library standard files special compiler options are passed
@@ -1814,7 +1682,7 @@ gcc_do_make() {
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 is NOT a safe configuration for end users!"
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}
@@ -1823,17 +1691,8 @@ gcc_do_make() {
fi
fi
- # Older versions of GCC could not do profiledbootstrap in parallel due to
- # collisions with profiling info.
- if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] ; then
- ! tc_version_is_at_least 4.6 && export MAKEOPTS="${MAKEOPTS} -j1"
- fi
-
if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
- elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then
- # See bug #79852
- STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
fi
if is_crosscompile; then
@@ -1858,7 +1717,7 @@ gcc_do_make() {
LIBPATH="${LIBPATH}" \
BOOT_CFLAGS="${BOOT_CFLAGS}"
popd > /dev/null || die
- fi
+ fi
einfo "Compiling ${PN} (${GCC_MAKE_TARGET})..."
@@ -1888,13 +1747,9 @@ gcc_do_make() {
if ! is_crosscompile && _tc_use_if_iuse cxx && _tc_use_if_iuse doc ; then
if type -p doxygen > /dev/null ; then
- if tc_version_is_at_least 4.3 ; then
- cd "${CTARGET}"/libstdc++-v3/doc
- emake doc-man-doxygen
- else
- cd "${CTARGET}"/libstdc++-v3
- emake doxygen-man
- fi
+ cd "${CTARGET}"/libstdc++-v3/doc || die
+ emake doc-man-doxygen
+
# Clean bogus manpages. bug #113902
find -name '*_build_*' -delete
@@ -1923,12 +1778,39 @@ toolchain_src_test() {
# '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
+ #
+ # Nonfatal here as we die if compare_tests failed
+ SANDBOX_ON=0 LD_PRELOAD= nonfatal emake -k check
+ local success_tests=$?
+
+ if [[ ! -d "${BROOT}"/var/cache/gcc/${SLOT} ]] && ! [[ ${success_tests} -eq 0 ]] ; then
+ # We have no reference data saved from a previous run to know if
+ # the failures are tolerable or not, so we bail out.
+ eerror "Reference test data does NOT exist at ${BROOT}/var/cache/gcc/${SLOT}"
+ eerror "Tests failed and nothing to compare with, so this is a fatal error."
+ eerror "(Set GCC_TESTS_IGNORE_NO_BASELINE=1 to make this non-fatal for initial run.)"
+
+ if [[ -z ${GCC_TESTS_IGNORE_NO_BASELINE} ]] ; then
+ die "Tests failed (failures occurred with no reference data)"
+ fi
+ fi
- einfo "Testing complete."
+ einfo "Testing complete! Review the following output to check for success or failure."
einfo "Please ignore any 'mail' lines in the summary output below (no mail is sent)."
einfo "Summary:"
"${S}"/contrib/test_summary
+
+ # If previous results exist on the system, compare with it
+ # TODO: Distribute some baseline results in e.g. gcc-patches.git?
+ if [[ -d "${BROOT}"/var/cache/gcc/${SLOT} ]] ; then
+ einfo "Comparing with previous cached results at ${BROOT}/var/cache/gcc/${SLOT}"
+
+ # Exit with the following values:
+ # 0 if there is nothing of interest
+ # 1 if there are errors when comparing single test case files
+ # N for the number of errors found when comparing directories
+ "${S}"/contrib/compare_tests "${BROOT}"/var/cache/gcc/${SLOT}/ . || die "Comparison for tests results failed, error code: $?"
+ fi
}
#---->> src_install <<----
@@ -1939,26 +1821,20 @@ toolchain_src_install() {
# Don't allow symlinks in private gcc include dir as this can break the build
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 || die
- local x=
- for x in "${S}"/gcc/doc/*.info* ; do
- if [[ -f ${x} ]] ; then
- cp "${x}" gcc/doc/ || die
- fi
- done
-
- # We remove the generated fixincludes, as they can cause things to break
- # (ncurses, openssl, etc). We do not prevent them from being built, as
- # in the following commit which we revert:
- # https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/toolchain.eclass?r1=1.647&r2=1.648
- # This is because bsd userland needs fixedincludes to build gcc, while
- # linux does not. Both can dispose of them afterwards.
- while read x ; do
- grep -q 'It has been auto-edited by fixincludes from' "${x}" \
- && use !prefix && rm -f "${x}"
- done < <(find gcc/include*/ -name '*.h')
+ # Re-enable fixincludes for >= GCC 13
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107128
+ if [[ ${GCCMAJOR} -lt 13 ]] ; then
+ # We remove the generated fixincludes, as they can cause things to break
+ # (ncurses, openssl, etc). We do not prevent them from being built, as
+ # in the following commit which we revert:
+ # https://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/eclass/toolchain.eclass?r1=1.647&r2=1.648
+ # This is because bsd userland needs fixedincludes to build gcc, while
+ # linux does not. Both can dispose of them afterwards.
+ while read x ; do
+ grep -q 'It has been auto-edited by fixincludes from' "${x}" \
+ && rm -f "${x}"
+ done < <(find gcc/include*/ -name '*.h')
+ fi
if is_jit ; then
# See https://gcc.gnu.org/onlinedocs/gcc-11.3.0/jit/internals/index.html#packaging-notes
@@ -1971,7 +1847,7 @@ toolchain_src_install() {
#
# Do the 'make install' from the build directory
pushd "${WORKDIR}"/build-jit > /dev/null || die
- S="${WORKDIR}"/build-jit emake DESTDIR="${D}" install
+ S="${WORKDIR}"/build-jit emake DESTDIR="${D}" -j1 install
# Punt some tools which are really only useful while building gcc
find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
@@ -1985,7 +1861,17 @@ toolchain_src_install() {
fi
# Do the 'make install' from the build directory
- S="${WORKDIR}"/build emake DESTDIR="${D}" install
+ #
+ # Unfortunately, we have to use -j1 for make install. Upstream
+ # don't really test it and there's not much appetite for fixing bugs
+ # with it. Several reported bugs exist where the resulting image
+ # was wrong, rather than a simple compile/install failure:
+ # - bug #906155
+ # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42980
+ # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51814
+ # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103656
+ # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109898
+ S="${WORKDIR}"/build emake DESTDIR="${D}" -j1 install
# Punt some tools which are really only useful while building gcc
find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
@@ -2006,18 +1892,11 @@ toolchain_src_install() {
create_gcc_env_entry
create_revdep_rebuild_entry
- # Setup the gcc_env_entry for hardened gcc 4 with minispecs
- want_minispecs && copy_minispecs_gcc_specs
-
- # Make sure we don't have stuff lying around that
- # can nuke multiple versions of gcc
- gcc_slot_java
-
dodir /usr/bin
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
+ for x in cpp gcc gccrs g++ c++ gcov g77 gfortran gccgo gnat* ; do
# For some reason, g77 gets made instead of ${CTARGET}-g77...
# this should take care of that
if [[ -f ${x} ]] ; then
@@ -2049,7 +1928,7 @@ toolchain_src_install() {
if ! is_crosscompile; then
# Rename the main go binaries as we don't want to clobber dev-lang/go
# when gcc-config runs. bug #567806
- if tc_version_is_at_least 5 && is_go ; then
+ if is_go ; then
for x in go gofmt; do
mv ${x} ${x}-${GCCMAJOR} || die
done
@@ -2154,15 +2033,20 @@ toolchain_src_install() {
export QA_WX_LOAD="usr/lib*/go/*/*.gox"
# Disable RANDMMAP so PCH works, bug #301299
- if tc_version_is_at_least 4.3 ; then
- 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 "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/ecj1"
- pax-mark -m "${ED}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}/gij"
+ pax-mark -r "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
+ pax-mark -r "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
+
+ if use test ; then
+ # TODO: In future, install orphaned to allow comparison across
+ # more versions even after unmerged? Also would be useful for
+ # historical records and tracking down regressions a while
+ # after they first appeared, but were only just reported.
+ einfo "Copying test results to ${EPREFIX}/var/cache/gcc/${SLOT} for future comparison"
+ (
+ dodir /var/cache/gcc/${SLOT}
+ cd "${WORKDIR}"/build || die
+ find . -name \*.sum -exec cp --parents -v {} "${ED}"/var/cache/gcc/${SLOT} \;
+ )
fi
}
@@ -2174,7 +2058,7 @@ gcc_movelibs() {
# move them to the compiler-specific CHOST internal dir. This is stuff
# that you want to link against when building tools rather than building
# code to run on the target.
- if tc_version_is_at_least 5 && is_crosscompile ; then
+ if is_crosscompile ; then
dodir "${HOSTLIBPATH#${EPREFIX}}"
mv "${ED}"/usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die
fi
@@ -2216,14 +2100,6 @@ gcc_movelibs() {
fi
done
fix_libtool_libdir_paths "${LIBPATH}/${MULTIDIR}"
-
- # SLOT up libgcj.pc if it's available (and let gcc-config worry about links)
- FROMDIR="${PREFIX}/lib/${OS_MULTIDIR}"
- for x in "${D}${FROMDIR}"/pkgconfig/libgcj*.pc ; do
- [[ -f ${x} ]] || continue
- sed -i "/^libdir=/s:=.*:=${LIBPATH}/${MULTIDIR}:" "${x}" || die
- mv "${x}" "${D}${FROMDIR}"/pkgconfig/libgcj-${GCC_PV}.pc || die
- done
done
# We remove directories separately to avoid this case:
@@ -2272,7 +2148,7 @@ create_gcc_env_entry() {
local gcc_envd_file="${ED}${gcc_envd_base}"
if [[ -z $1 ]] ; then
# I'm leaving the following commented out to remind me that it
- # was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset
+ # was an insanely -bad- idea. Stuff broke. GCC_SPECS isn't unset
# on chroot or in non-toolchain.eclass gcc ebuilds!
#gcc_specs_file="${LIBPATH}/specs"
gcc_specs_file=""
@@ -2336,67 +2212,6 @@ create_revdep_rebuild_entry() {
EOF
}
-copy_minispecs_gcc_specs() {
- # On gcc 6, we don't need minispecs
- if tc_version_is_at_least 6.0 ; then
- return 0
- fi
-
- # Setup the hardenedno* specs files and the vanilla specs file.
- if hardened_gcc_works ; then
- create_gcc_env_entry hardenednopiessp
- fi
- if hardened_gcc_works pie ; then
- create_gcc_env_entry hardenednopie
- fi
- if hardened_gcc_works ssp ; then
- create_gcc_env_entry hardenednossp
- fi
- create_gcc_env_entry vanilla
- insinto ${LIBPATH#${EPREFIX}}
- doins "${WORKDIR}"/specs/*.specs || die "failed to install specs"
- # Build system specs file which, if it exists, must be a complete set of
- # specs as it completely and unconditionally overrides the builtin specs.
- if ! tc_version_is_at_least 4.4 ; then
- $(XGCC) -dumpspecs > "${WORKDIR}"/specs/specs
- cat "${WORKDIR}"/build.specs >> "${WORKDIR}"/specs/specs
- doins "${WORKDIR}"/specs/specs || die "failed to install the specs file"
- fi
-}
-
-gcc_slot_java() {
- local x
-
- # Move Java headers to compiler-specific dir
- for x in "${D}${PREFIX}"/include/gc*.h "${D}${PREFIX}"/include/j*.h ; do
- [[ -f ${x} ]] && mv -f "${x}" "${D}${LIBPATH}"/include/
- done
- for x in gcj gnu java javax org ; do
- if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
- dodir /${LIBPATH#${EPREFIX}}/include/${x}
- mv -f "${D}${PREFIX}"/include/${x}/* "${D}${LIBPATH}"/include/${x}/
- rm -rf "${D}${PREFIX}"/include/${x}
- fi
- done
-
- if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
- dodir /${LIBPATH#${EPREFIX}}/security
- mv -f "${D}${PREFIX}"/lib*/security/* "${D}${LIBPATH}"/security
- rm -rf "${D}${PREFIX}"/lib*/security
- fi
-
- # Move random gcj files to compiler-specific directories
- for x in libgcj.spec logging.properties ; do
- x="${D}${PREFIX}/lib/${x}"
- [[ -f ${x} ]] && mv -f "${x}" "${D}${LIBPATH}"/
- done
-
- # Rename jar because it could clash with Kaffe's jar if this gcc is
- # primary compiler (aka doesn't have the -<version> extension)
- cd "${D}${BINPATH}"
- [[ -f jar ]] && mv -f jar gcj-jar
-}
-
#---->> pkg_post* <<----
toolchain_pkg_postinst() {
@@ -2459,14 +2274,14 @@ do_gcc_config() {
ewarn "The currently selected specs-specific gcc config,"
ewarn "${current_specs}, doesn't exist anymore. This is usually"
ewarn "due to enabling/disabling hardened or switching to a version"
- ewarn "of gcc that doesnt create multiple specs files. The default"
+ ewarn "of gcc that doesn't create multiple specs files. The default"
ewarn "config will be used, and the previous preference forgotten."
use_specs=""
fi
target="${CTARGET}-${GCC_CONFIG_VER}${use_specs}"
else
- # The curent target is invalid. Attempt to switch to a valid one.
+ # The current target is invalid. Attempt to switch to a valid one.
# Blindly pick the latest version. bug #529608
# TODO: Should update gcc-config to accept `-l ${CTARGET}` rather than
# doing a partial grep like this.
@@ -2519,7 +2334,7 @@ should_we_gcc_config() {
#---->> support and misc functions <<----
# This is to make sure we don't accidentally try to enable support for a
-# language that doesnt exist. GCC 3.4 supports f77, while 4.0 supports f95, etc.
+# language that doesn't exist. GCC 3.4 supports f77, while 4.0 supports f95, etc.
#
# Also add a hook so special ebuilds (kgcc64) can control which languages
# exactly get enabled
@@ -2563,11 +2378,6 @@ is_fortran() {
_tc_use_if_iuse fortran
}
-is_gcj() {
- gcc-lang-supported java || return 1
- _tc_use_if_iuse cxx && _tc_use_if_iuse gcj
-}
-
is_go() {
gcc-lang-supported go || return 1
_tc_use_if_iuse cxx && _tc_use_if_iuse go
@@ -2598,6 +2408,16 @@ is_objcxx() {
_tc_use_if_iuse cxx && _tc_use_if_iuse objc++
}
+is_modula2() {
+ gcc-lang-supported m2 || return 1
+ _tc_use_if_iuse cxx && _tc_use_if_iuse modula2
+}
+
+is_rust() {
+ gcc-lang-supported rust || return 1
+ _tc_use_if_iuse rust
+}
+
# Grab a variable from the build system (taken from linux-info.eclass)
get_make_var() {
local var=$1 makefile=${2:-${WORKDIR}/build/Makefile}
@@ -2607,91 +2427,17 @@ get_make_var() {
XGCC() { get_make_var GCC_FOR_TARGET ; }
-# The gentoo pie-ssp patches allow for 3 configurations:
-# 1) PIE+SSP by default
-# 2) PIE by default
-# 3) SSP by default
-hardened_gcc_works() {
- if [[ $1 == "pie" ]] ; then
- # $gcc_cv_ld_pie is unreliable as it simply take the output of
- # `ld --help | grep -- -pie`, that reports the option in all cases, also if
- # the loader doesn't actually load the resulting executables.
-
- want_pie || return 1
- _tc_use_if_iuse nopie && return 1
- hardened_gcc_is_stable pie
- return $?
- elif [[ $1 == "ssp" ]] ; then
- [[ -n ${SPECS_VER} ]] || return 1
- _tc_use_if_iuse nossp && return 1
- hardened_gcc_is_stable ssp
- return $?
- else
- # laziness ;)
- hardened_gcc_works pie || return 1
- hardened_gcc_works ssp || return 1
- return 0
- fi
-}
-
-hardened_gcc_is_stable() {
- local tocheck
- if [[ $1 == "pie" ]] ; then
- tocheck=${PIE_GLIBC_STABLE}
- elif [[ $1 == "ssp" ]] ; then
- tocheck=${SSP_STABLE}
- else
- die "hardened_gcc_stable needs to be called with pie or ssp"
- fi
-
- has $(tc-arch) ${tocheck} && return 0
- return 1
-}
-
-want_minispecs() {
- # On gcc 6, we don't need minispecs
- if tc_version_is_at_least 6.0 ; then
- return 0
- fi
- if tc_version_is_at_least 4.3.2 && _tc_use_if_iuse hardened ; then
- if ! want_pie ; then
- ewarn "PIE_VER or SPECS_VER is not defined in the GCC ebuild."
- elif use vanilla ; then
- ewarn "You will not get hardened features if you have the vanilla USE-flag."
- elif _tc_use_if_iuse nopie && _tc_use_if_iuse nossp ; then
- ewarn "You will not get hardened features if you have the nopie and nossp USE-flag."
- elif ! hardened_gcc_works ; then
- ewarn "Your $(tc-arch) arch is not supported."
- else
- return 0
- fi
- ewarn "Hope you know what you are doing. Hardened will not work."
- return 0
- fi
- return 1
-}
-
-want_pie() {
- ! _tc_use_if_iuse hardened && [[ -n ${PIE_VER} ]] \
- && _tc_use_if_iuse nopie && return 1
- [[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0
- tc_version_is_at_least 4.3.2 && return 1
- [[ -z ${PIE_VER} ]] && return 1
- _tc_use_if_iuse nopie || return 0
- return 1
-}
-
has toolchain_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" toolchain_death_notice"
toolchain_death_notice() {
if [[ -e "${WORKDIR}"/build ]] ; then
pushd "${WORKDIR}"/build >/dev/null
(echo '' | $(tc-getCC ${CTARGET}) ${CFLAGS} -v -E - 2>&1) > gccinfo.log
[[ -e "${T}"/build.log ]] && cp "${T}"/build.log .
- tar jcf "${WORKDIR}"/gcc-build-logs.tar.bz2 \
+ tar -acf "${WORKDIR}"/gcc-build-logs.tar.xz \
gccinfo.log build.log $(find -name config.log)
rm gccinfo.log build.log
eerror
- eerror "Please include ${WORKDIR}/gcc-build-logs.tar.bz2 in your bug report."
+ eerror "Please include ${WORKDIR}/gcc-build-logs.tar.xz in your bug report."
eerror
popd >/dev/null
fi
@@ -2699,9 +2445,6 @@ toolchain_death_notice() {
fi
-EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \
- src_compile src_test src_install pkg_postinst pkg_postrm
-
# Note [implicitly enabled flags]
# -------------------------------
# Usually configure-based packages handle explicit feature requests
@@ -2719,3 +2462,5 @@ EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \
# Thus safer way to enable/disable the feature is to rely on implicit
# enabled-by-default state:
# econf $(usex foo '' --disable-foo)
+
+EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2023-09-04 6:36 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2023-09-04 6:36 UTC (permalink / raw
To: gentoo-commits
commit: 19458d996a18e60b9d80d0a8ff94ed49d870e0be
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 4 06:36:16 2023 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Sep 4 06:36:16 2023 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=19458d99
toolchain.eclass: fix merge error
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 1 +
1 file changed, 1 insertion(+)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index ce62b7b81d..4d1d4f0030 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -990,6 +990,7 @@ toolchain_src_configure() {
nvptx*)
# "LTO is not supported for this target"
confgcc+=( --disable-lto )
+ ;;
# Prefix targets
*-apple-darwin*)
confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}" )
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2023-09-11 23:33 Sam James
0 siblings, 0 replies; 89+ messages in thread
From: Sam James @ 2023-09-11 23:33 UTC (permalink / raw
To: gentoo-commits
commit: 71b917e9f7a969a319d49ae34be09550f2530139
Author: Alexey Sokolov <alexey+gentoo <AT> asokolov <DOT> org>
AuthorDate: Mon Sep 11 22:56:18 2023 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Sep 11 23:33:12 2023 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=71b917e9
eclass/toolchain-funcs.eclass: add missing functions
Copied straight from ::gentoo's version of this file
Bug: https://bugs.gentoo.org/758167
Signed-off-by: Alexey Sokolov <alexey+gentoo <AT> asokolov.org>
Closes: https://github.com/gentoo/prefix/pull/32
Signed-off-by: Sam James <sam <AT> gentoo.org>
eclass/toolchain-funcs.eclass | 64 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index b86a9682b1..1c7a34bd82 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1186,4 +1186,68 @@ gen_usr_ldscript() {
done
}
+# @FUNCTION: tc-get-cxx-stdlib
+# @DESCRIPTION:
+# Attempt to identify the C++ standard library used by the compiler.
+# If the library is identified, the function returns 0 and prints one
+# of the following:
+#
+# - ``libc++`` for ``sys-libs/libcxx``
+# - ``libstdc++`` for ``sys-devel/gcc``'s libstdc++
+#
+# If the library is not recognized, the function returns 1.
+tc-get-cxx-stdlib() {
+ local code='#include <ciso646>
+
+#if defined(_LIBCPP_VERSION)
+ HAVE_LIBCXX
+#elif defined(__GLIBCXX__)
+ HAVE_LIBSTDCPP
+#endif
+'
+ local res=$(
+ $(tc-getCXX) ${CPPFLAGS} ${CXXFLAGS} -x c++ -E -P - \
+ <<<"${code}" 2>/dev/null
+ )
+
+ case ${res} in
+ *HAVE_LIBCXX*)
+ echo libc++;;
+ *HAVE_LIBSTDCPP*)
+ echo libstdc++;;
+ *)
+ return 1;;
+ esac
+
+ return 0
+}
+
+# @FUNCTION: tc-get-c-rtlib
+# @DESCRIPTION:
+# Attempt to identify the runtime used by the C/C++ compiler.
+# If the runtime is identifed, the function returns 0 and prints one
+# of the following:
+#
+# - ``compiler-rt`` for ``sys-libs/compiler-rt``
+# - ``libgcc`` for ``sys-devel/gcc``'s libgcc
+#
+# If the runtime is not recognized, the function returns 1.
+tc-get-c-rtlib() {
+ local res=$(
+ $(tc-getCC) ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} \
+ -print-libgcc-file-name 2>/dev/null
+ )
+
+ case ${res} in
+ *libclang_rt*)
+ echo compiler-rt;;
+ *libgcc*)
+ echo libgcc;;
+ *)
+ return 1;;
+ esac
+
+ return 0
+}
+
fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2023-12-16 15:36 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2023-12-16 15:36 UTC (permalink / raw
To: gentoo-commits
commit: 5136685f4f05440d4a47d5dfa19e7d5a7448617c
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Dec 16 15:34:59 2023 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Dec 16 15:34:59 2023 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=5136685f
eclass/toolchain-funcs: add arm64-macos detection
Thanks Ryan Qian.
Closes: https://bugs.gentoo.org/920160
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain-funcs.eclass | 1 +
1 file changed, 1 insertion(+)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 1c7a34bd82..166ea71e7e 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -689,6 +689,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
case ${host} in
powerpc-apple-darwin*) echo ppc-macos;;
x86_64-apple-darwin*) echo x64-macos;;
+ arm64-apple-darwin*) echo arm64-macos;;
sparc-sun-solaris*) echo sparc-solaris;;
sparcv9-sun-solaris*) echo sparc64-solaris;;
i?86-pc-solaris*) echo x86-solaris;;
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-01-21 13:40 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-01-21 13:40 UTC (permalink / raw
To: gentoo-commits
commit: 0d1ac117b6e0bee5364324c978aee33a76492fe8
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 21 13:39:58 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jan 21 13:39:58 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=0d1ac117
eclass/toolchain: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain-funcs.eclass | 230 +++++++++++++++++++++++-------------------
eclass/toolchain.eclass | 167 ++++++++++++++++++++----------
2 files changed, 241 insertions(+), 156 deletions(-)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 166ea71e7e..5338dc6509 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -1,10 +1,10 @@
-# Copyright 2002-2022 Gentoo Authors
+# Copyright 2002-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: toolchain-funcs.eclass
# @MAINTAINER:
# Toolchain Ninjas <toolchain@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6 7 8
+# @SUPPORTED_EAPIS: 6 7 8
# @BLURB: functions to query common info about the toolchain
# @DESCRIPTION:
# The toolchain-funcs aims to provide a complete suite of functions
@@ -13,9 +13,8 @@
# in such a way that you can rely on the function always returning
# something sane.
-case ${EAPI:-0} in
- # EAPI=0 is still used by crossdev, bug #797367
- 0|5|6|7|8) ;;
+case ${EAPI} in
+ 6|7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@@ -341,7 +340,7 @@ tc-is-static-only() {
tc-stack-grows-down() {
# List the few that grow up.
case ${ARCH} in
- hppa|metag) return 1 ;;
+ hppa|metag) return 1 ;;
esac
# Assume all others grow down.
@@ -358,16 +357,16 @@ tc-export_build_env() {
# Some build envs will initialize vars like:
# : ${BUILD_LDFLAGS:-${LDFLAGS}}
# So make sure all variables are non-empty. #526734
- : ${BUILD_CFLAGS:=-O1 -pipe}
- : ${BUILD_CXXFLAGS:=-O1 -pipe}
- : ${BUILD_CPPFLAGS:= }
- : ${BUILD_LDFLAGS:= }
+ : "${BUILD_CFLAGS:=-O1 -pipe}"
+ : "${BUILD_CXXFLAGS:=-O1 -pipe}"
+ : "${BUILD_CPPFLAGS:= }"
+ : "${BUILD_LDFLAGS:= }"
else
# https://bugs.gentoo.org/654424
- : ${BUILD_CFLAGS:=${CFLAGS}}
- : ${BUILD_CXXFLAGS:=${CXXFLAGS}}
- : ${BUILD_CPPFLAGS:=${CPPFLAGS}}
- : ${BUILD_LDFLAGS:=${LDFLAGS}}
+ : "${BUILD_CFLAGS:=${CFLAGS}}"
+ : "${BUILD_CXXFLAGS:=${CXXFLAGS}}"
+ : "${BUILD_CPPFLAGS:=${CPPFLAGS}}"
+ : "${BUILD_LDFLAGS:=${LDFLAGS}}"
fi
export BUILD_{C,CXX,CPP,LD}FLAGS
@@ -380,7 +379,6 @@ tc-export_build_env() {
# @FUNCTION: tc-env_build
# @USAGE: <command> [command args]
-# @INTERNAL
# @DESCRIPTION:
# Setup the compile environment to the build tools and then execute the
# specified command. We use tc-getBUILD_XX here so that we work with
@@ -426,26 +424,27 @@ tc-env_build() {
# src_configure() {
# ECONF_SOURCE=${S}
# if tc-is-cross-compiler ; then
-# mkdir "${WORKDIR}"/${CBUILD}
-# pushd "${WORKDIR}"/${CBUILD} >/dev/null
+# mkdir "${WORKDIR}"/${CBUILD} || die
+# pushd "${WORKDIR}"/${CBUILD} >/dev/null || die
# econf_build --disable-some-unused-stuff
-# popd >/dev/null
+# popd >/dev/null || die
# fi
# ... normal build paths ...
# }
# src_compile() {
# if tc-is-cross-compiler ; then
-# pushd "${WORKDIR}"/${CBUILD} >/dev/null
+# pushd "${WORKDIR}"/${CBUILD} >/dev/null || die
# emake one-or-two-build-tools
-# ln/mv build-tools to normal build paths in ${S}/
-# popd >/dev/null
+# ln/mv build-tools to normal build paths in ${S}/ || die
+# popd >/dev/null || die
# fi
# ... normal build paths ...
# }
# @CODE
econf_build() {
local CBUILD=${CBUILD:-${CHOST}}
- tc-env_build econf --build=${CBUILD} --host=${CBUILD} "$@"
+ econf_env() { CHOST=${CBUILD} econf "$@"; }
+ tc-env_build econf_env "$@"
}
# @FUNCTION: tc-ld-is-gold
@@ -455,6 +454,9 @@ econf_build() {
tc-ld-is-gold() {
local out
+ # Ensure ld output is in English.
+ local -x LC_ALL=C
+
# First check the linker directly.
out=$($(tc-getLD "$@") --version 2>&1)
if [[ ${out} == *"GNU gold"* ]] ; then
@@ -466,7 +468,7 @@ tc-ld-is-gold() {
# options and not CFLAGS/CXXFLAGS.
local base="${T}/test-tc-gold"
cat <<-EOF > "${base}.c"
- int main() { return 0; }
+ int main(void) { return 0; }
EOF
out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1)
rm -f "${base}"*
@@ -485,6 +487,9 @@ tc-ld-is-gold() {
tc-ld-is-lld() {
local out
+ # Ensure ld output is in English.
+ local -x LC_ALL=C
+
# First check the linker directly.
out=$($(tc-getLD "$@") --version 2>&1)
if [[ ${out} == *"LLD"* ]] ; then
@@ -496,7 +501,7 @@ tc-ld-is-lld() {
# options and not CFLAGS/CXXFLAGS.
local base="${T}/test-tc-lld"
cat <<-EOF > "${base}.c"
- int main() { return 0; }
+ int main(void) { return 0; }
EOF
out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1)
rm -f "${base}"*
@@ -531,43 +536,15 @@ tc-ld-force-bfd() {
ewarn "Forcing usage of the BFD linker"
# Set up LD to point directly to bfd if it's available.
- # We need to extract the first word in case there are flags appended
- # to its value (like multilib). #545218
- local ld=$(tc-getLD "$@")
- local bfd_ld="${ld%% *}.bfd"
- local path_ld=$(which "${bfd_ld}" 2>/dev/null)
+ # Unset LD first so we get the default value from tc-getLD.
+ local ld=$(unset LD; tc-getLD "$@")
+ local bfd_ld="${ld}.bfd"
+ local path_ld=$(type -P "${bfd_ld}" 2>/dev/null)
[[ -e ${path_ld} ]] && export LD=${bfd_ld}
# Set up LDFLAGS to select bfd based on the gcc / clang version.
- local fallback="true"
- if tc-is-gcc; then
- local major=$(gcc-major-version "$@")
- local minor=$(gcc-minor-version "$@")
- if [[ ${major} -gt 4 ]] || [[ ${major} -eq 4 && ${minor} -ge 8 ]]; then
- # gcc-4.8+ supports -fuse-ld directly.
- export LDFLAGS="${LDFLAGS} -fuse-ld=bfd"
- fallback="false"
- fi
- elif tc-is-clang; then
- local major=$(clang-major-version "$@")
- local minor=$(clang-minor-version "$@")
- if [[ ${major} -gt 3 ]] || [[ ${major} -eq 3 && ${minor} -ge 5 ]]; then
- # clang-3.5+ supports -fuse-ld directly.
- export LDFLAGS="${LDFLAGS} -fuse-ld=bfd"
- fallback="false"
- fi
- fi
- if [[ ${fallback} == "true" ]] ; then
- # <=gcc-4.7 and <=clang-3.4 require some coercion.
- # Only works if bfd exists.
- if [[ -e ${path_ld} ]] ; then
- local d="${T}/bfd-linker"
- mkdir -p "${d}"
- ln -sf "${path_ld}" "${d}"/ld
- export LDFLAGS="${LDFLAGS} -B${d}"
- else
- die "unable to locate a BFD linker"
- fi
+ if tc-is-gcc || tc-is-clang ; then
+ export LDFLAGS="${LDFLAGS} -fuse-ld=bfd"
fi
}
@@ -580,7 +557,7 @@ _tc-has-openmp() {
local base="${T}/test-tc-openmp"
cat <<-EOF > "${base}.c"
#include <omp.h>
- int main() {
+ int main(void) {
int nthreads, tid, ret = 0;
#pragma omp parallel private(nthreads, tid)
{
@@ -596,23 +573,11 @@ _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
# a clear error message, telling the user how to rectify the missing
-# 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.
+# OpenMP support that has been requested by the ebuild.
#
# 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
@@ -654,6 +619,7 @@ tc-has-tls() {
return *i ? j : *i;
}
EOF
+
local flags
case $1 in
-s) flags="-S";;
@@ -680,7 +646,7 @@ tc-has-tls() {
# Parse information from CBUILD/CHOST/CTARGET rather than
# use external variables from the profile.
tc-ninja_magic_to_arch() {
-ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
+ _tc_echo_kernel_alias() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
local type=$1
local host=$2
@@ -698,14 +664,15 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
aarch64*) echo arm64;;
alpha*) echo alpha;;
+ arc*) echo arc;;
arm*) echo arm;;
- avr*) ninj avr32 avr;;
- bfin*) ninj blackfin bfin;;
+ avr*) _tc_echo_kernel_alias avr32 avr;;
+ bfin*) _tc_echo_kernel_alias blackfin bfin;;
c6x*) echo c6x;;
cris*) echo cris;;
frv*) echo frv;;
hexagon*) echo hexagon;;
- hppa*) ninj parisc hppa;;
+ hppa*) _tc_echo_kernel_alias parisc hppa;;
i?86*)
# Starting with linux-2.6.24, the 'x86_64' and 'i386'
# trees have been unified into 'x86'.
@@ -717,7 +684,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
fi
;;
ia64*) echo ia64;;
- loongarch*) ninj loongarch loong;;
+ loongarch*) _tc_echo_kernel_alias loongarch loong;;
m68*) echo m68k;;
metag*) echo metag;;
microblaze*) echo microblaze;;
@@ -740,16 +707,15 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
riscv*) echo riscv;;
s390*) echo s390;;
score*) echo score;;
- sh64*) ninj sh64 sh;;
+ sh64*) _tc_echo_kernel_alias sh64 sh;;
sh*) echo sh;;
- sparc64*) ninj sparc64 sparc;;
+ sparc64*) _tc_echo_kernel_alias sparc64 sparc;;
sparc*) [[ ${PROFILE_ARCH} == "sparc64" ]] \
- && ninj sparc64 sparc \
+ && _tc_echo_kernel_alias sparc64 sparc \
|| echo sparc
;;
tile*) echo tile;;
vax*) echo vax;;
- x86_64*freebsd*) echo amd64;;
x86_64*)
# Starting with linux-2.6.24, the 'x86_64' and 'i386'
# trees have been unified into 'x86'.
@@ -764,7 +730,7 @@ ninj() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
# since our usage of tc-arch is largely concerned with
# normalizing inputs for testing ${CTARGET}, let's filter
# other cross targets (mingw and such) into the unknown.
- *) echo unknown;;
+ *) echo unknown;;
esac
}
# @FUNCTION: tc-arch-kernel
@@ -780,6 +746,13 @@ tc-arch() {
tc-ninja_magic_to_arch portage "$@"
}
+# @FUNCTION: tc-endian
+# @USAGE: [toolchain prefix]
+# @RETURN: 'big' or 'little' corresponding to the passed (or host) endianness
+# @DESCRIPTION:
+# Accepts 'host' as an argument which defaults to CTARGET and falls back to CHOST
+# if unspecified. Returns 'big' or 'little' depending on whether 'host' is
+# big or little endian.
tc-endian() {
local host=$1
[[ -z ${host} ]] && host=${CTARGET:-${CHOST}}
@@ -789,6 +762,8 @@ tc-endian() {
aarch64*be) echo big;;
aarch64) echo little;;
alpha*) echo little;;
+ arc*b*) echo big;;
+ arc*) echo little;;
arm*b*) echo big;;
arm*) echo little;;
cris*) echo little;;
@@ -807,7 +782,7 @@ tc-endian() {
sh*) echo little;;
sparc*) echo big;;
x86_64*) echo little;;
- *) echo wtf;;
+ *) echo wtf;;
esac
}
@@ -828,8 +803,8 @@ tc-get-compiler-type() {
case ${res} in
*HAVE_PATHCC*) echo pathcc;;
*HAVE_CLANG*) echo clang;;
- *HAVE_GCC*) echo gcc;;
- *) echo unknown;;
+ *HAVE_GCC*) echo gcc;;
+ *) echo unknown;;
esac
}
@@ -847,11 +822,11 @@ tc-is-clang() {
# Internal func. The first argument is the version info to expand.
# Query the preprocessor to improve compatibility across different
-# compilers rather than maintaining a --version flag matrix. #335943
+# compilers rather than maintaining a --version flag matrix, bug #335943.
_gcc_fullversion() {
local ver="$1"; shift
set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__")
- eval echo "$ver"
+ eval echo "${ver}"
}
# @FUNCTION: gcc-fullversion
@@ -884,7 +859,7 @@ gcc-micro-version() {
_clang_fullversion() {
local ver="$1"; shift
set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__")
- eval echo "$ver"
+ eval echo "${ver}"
}
# @FUNCTION: clang-fullversion
@@ -1009,6 +984,15 @@ gcc-specs-stack-check() {
[[ "${directive/\{!fno-stack-check:}" != "${directive}" ]]
}
+# @FUNCTION: tc-enables-cxx-assertions
+# @RETURN: Truth if the current compiler enables assertions in the C++ standard library
+# @DESCRIPTION:
+# Return truth if the current compiler enables assertions in the C++ standard
+# library. For libstdc++, this is -D_GLIBCXX_ASSERTIONS, and for libcxx/libc++,
+# this is -D_LIBCPP_ENABLE_ASSERTIONS (deprecated) or -D_LIBCPP_ENABLE_HARDENED_MODE.
+tc-enables-cxx-assertions() {
+ tc-cpp-is-true "defined(_GLIBCXX_ASSERTIONS) || defined(_LIBCPP_ENABLE_ASSERTIONS) || defined(_LIBCPP_ENABLE_HARDENED_MODE)" ${CPPFLAGS} ${CXXFLAGS}
+}
# @FUNCTION: tc-enables-pie
# @RETURN: Truth if the current compiler generates position-independent code (PIC) which can be linked into executables
@@ -1016,7 +1000,16 @@ gcc-specs-stack-check() {
# Return truth if the current compiler generates position-independent code (PIC)
# which can be linked into executables.
tc-enables-pie() {
- tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS}
+ tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
+}
+
+# @FUNCTION: tc-enables-fortify-source
+# @RETURN: Truth if the current compiler enables FORTIFY_SOURCE at any level
+# @DESCRIPTION:
+# Return truth if the current compiler enables fortification (FORTIFY_SOURCE)
+# at any level (-D_FORTIFY_SOURCE).
+tc-enables-fortify-source() {
+ tc-cpp-is-true "defined(_FORTIFY_SOURCE)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
}
# @FUNCTION: tc-enables-ssp
@@ -1028,7 +1021,7 @@ tc-enables-pie() {
# -fstack-protector-strong
# -fstack-protector-all
tc-enables-ssp() {
- tc-cpp-is-true "defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
+ tc-cpp-is-true "defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
}
# @FUNCTION: tc-enables-ssp-strong
@@ -1039,7 +1032,7 @@ tc-enables-ssp() {
# -fstack-protector-strong
# -fstack-protector-all
tc-enables-ssp-strong() {
- tc-cpp-is-true "defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
+ tc-cpp-is-true "defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
}
# @FUNCTION: tc-enables-ssp-all
@@ -1049,7 +1042,7 @@ tc-enables-ssp-strong() {
# on level corresponding to any of the following options:
# -fstack-protector-all
tc-enables-ssp-all() {
- tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS}
+ tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
}
@@ -1067,18 +1060,18 @@ gen_usr_ldscript() {
tc-is-static-only && return
use prefix && return
- # We only care about stuffing / for the native ABI. #479448
+ # We only care about stuffing / for the native ABI, bug #479448
if [[ $(type -t multilib_is_native_abi) == "function" ]] ; then
multilib_is_native_abi || return 0
fi
- # Eventually we'd like to get rid of this func completely #417451
+ # Eventually we'd like to get rid of this func completely, bug #417451
case ${CTARGET:-${CHOST}} in
- *-darwin*) ;;
- *-android*) return 0 ;;
- *linux*|*-freebsd*|*-openbsd*|*-netbsd*)
- use prefix && return 0 ;;
- *) return 0 ;;
+ *-darwin*) ;;
+ *-android*) return 0 ;;
+ *linux*|*-freebsd*|*-openbsd*|*-netbsd*)
+ use prefix && return 0 ;;
+ *) return 0 ;;
esac
# Just make sure it exists
@@ -1094,10 +1087,10 @@ gen_usr_ldscript() {
# is referenced ... makes multilib saner
local flags=( ${CFLAGS} ${LDFLAGS} -Wl,--verbose )
if $(tc-getLD) --version | grep -q 'GNU gold' ; then
- # If they're using gold, manually invoke the old bfd. #487696
+ # If they're using gold, manually invoke the old bfd, bug #487696
local d="${T}/bfd-linker"
mkdir -p "${d}"
- ln -sf $(which ${CHOST}-ld.bfd) "${d}"/ld
+ ln -sf $(type -P ${CHOST}-ld.bfd) "${d}"/ld
flags+=( -B"${d}" )
fi
output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
@@ -1251,4 +1244,39 @@ tc-get-c-rtlib() {
return 0
}
+# @FUNCTION: tc-get-ptr-size
+# @RETURN: Size of a pointer in bytes for CHOST (e.g. 4 or 8).
+tc-get-ptr-size() {
+ $(tc-getCPP) -P - <<< __SIZEOF_POINTER__ ||
+ die "Could not determine CHOST pointer size"
+}
+
+# @FUNCTION: tc-get-build-ptr-size
+# @RETURN: Size of a pointer in bytes for CBUILD (e.g. 4 or 8).
+tc-get-build-ptr-size() {
+ $(tc-getBUILD_CPP) -P - <<< __SIZEOF_POINTER__ ||
+ die "Could not determine CBUILD pointer size"
+}
+
+# @FUNCTION: tc-is-lto
+# @RETURN: Shell true if we are using LTO, shell false otherwise
+tc-is-lto() {
+ local f="${T}/test-lto.o"
+
+ case $(tc-get-compiler-type) in
+ clang)
+ $(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<<"" || die
+ # If LTO is used, clang will output bytecode and llvm-bcanalyzer
+ # will run successfully. Otherwise, it will output plain object
+ # file and llvm-bcanalyzer will exit with error.
+ llvm-bcanalyzer "${f}" &>/dev/null && return 0
+ ;;
+ gcc)
+ $(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<<"" || die
+ [[ $($(tc-getREADELF) -S "${f}") == *.gnu.lto* ]] && return 0
+ ;;
+ esac
+ return 1
+}
+
fi
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 4d1d4f0030..85bb14220c 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: toolchain.eclass
@@ -258,8 +258,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ||
IUSE+=" ada"
IUSE+=" vtv"
IUSE+=" jit"
- tc_version_is_between 5.0 9 && IUSE+=" mpx"
- IUSE+=" +pie +ssp +pch"
+ IUSE+=" +pie +ssp pch"
IUSE+=" systemtap" TC_FEATURES+=( systemtap )
@@ -308,7 +307,7 @@ if tc_has_feature graphite ; then
fi
BDEPEND="
- >=sys-devel/bison-1.875
+ app-alternatives/yacc
>=sys-devel/flex-2.5.4
nls? ( sys-devel/gettext )
test? (
@@ -334,7 +333,7 @@ fi
if tc_has_feature systemtap ; then
# gcc needs sys/sdt.h headers on target
- DEPEND+=" systemtap? ( dev-util/systemtap )"
+ DEPEND+=" systemtap? ( dev-debug/systemtap )"
fi
if tc_has_feature zstd ; then
@@ -343,7 +342,7 @@ if tc_has_feature zstd ; then
fi
if tc_has_feature valgrind ; then
- BDEPEND+=" valgrind? ( dev-util/valgrind )"
+ BDEPEND+=" valgrind? ( dev-debug/valgrind )"
fi
# TODO: Add a pkg_setup & pkg_pretend check for whether the active compiler
@@ -779,6 +778,9 @@ setup_multilib_osdirnames() {
#---->> src_configure <<----
toolchain_src_configure() {
+ BUILD_CONFIG_TARGETS=()
+ is-flagq '-O3' && BUILD_CONFIG_TARGETS+=( bootstrap-O3 )
+
downgrade_arch_flags
gcc_do_filter_flags
@@ -798,8 +800,6 @@ toolchain_src_configure() {
local confgcc=( --host=${CHOST} )
- local build_config_targets=()
-
if is_crosscompile || tc-is-cross-compiler ; then
# Straight from the GCC install doc:
# "GCC has code to correctly determine the correct value for target
@@ -924,11 +924,11 @@ toolchain_src_configure() {
# Build compiler itself using LTO
if tc_version_is_at_least 9.1 && _tc_use_if_iuse lto ; then
- build_config_targets+=( bootstrap-lto )
+ BUILD_CONFIG_TARGETS+=( bootstrap-lto )
fi
if tc_version_is_at_least 12 && _tc_use_if_iuse cet ; then
- build_config_targets+=( bootstrap-cet )
+ BUILD_CONFIG_TARGETS+=( bootstrap-cet )
fi
# Support to disable PCH when building libstdcxx
@@ -1283,14 +1283,6 @@ toolchain_src_configure() {
confgcc+=( $(use_enable cet) )
fi
- if in_iuse cilk ; then
- confgcc+=( $(use_enable cilk libcilkrts) )
- fi
-
- if in_iuse mpx ; then
- confgcc+=( $(use_enable mpx libmpx) )
- fi
-
if in_iuse systemtap ; then
confgcc+=( $(use_enable systemtap) )
fi
@@ -1366,9 +1358,9 @@ toolchain_src_configure() {
confgcc+=( "$@" ${EXTRA_ECONF} )
- if ! is_crosscompile && ! tc-is-cross-compiler && [[ -n ${build_config_targets} ]] ; then
+ if ! is_crosscompile && ! tc-is-cross-compiler && [[ -n ${BUILD_CONFIG_TARGETS} ]] ; then
# e.g. ./configure --with-build-config='bootstrap-lto bootstrap-cet'
- confgcc+=( --with-build-config="${build_config_targets[*]}" )
+ confgcc+=( --with-build-config="${BUILD_CONFIG_TARGETS[*]}" )
fi
# Nothing wrong with a good dose of verbosity
@@ -1398,20 +1390,46 @@ toolchain_src_configure() {
if is_jit ; then
einfo "Configuring JIT gcc"
+ local confgcc_jit=(
+ "${confgcc[@]}"
+
+ --disable-analyzer
+ --disable-bootstrap
+ --disable-cet
+ --disable-default-pie
+ --disable-default-ssp
+ --disable-gcov
+ --disable-libada
+ --disable-libatomic
+ --disable-libgomp
+ --disable-libitm
+ --disable-libquadmath
+ --disable-libsanitizer
+ --disable-libssp
+ --disable-libstdcxx-pch
+ --disable-libvtv
+ --disable-lto
+ --disable-nls
+ --disable-objc-gc
+ --disable-systemtap
+ --enable-host-shared
+ --enable-languages=jit
+ # Might be used for the just-built GCC. Easier to just
+ # respect USE=graphite here in case the user passes some
+ # graphite flags rather than try strip them out.
+ $(use_with graphite isl)
+ --without-zstd
+ --with-system-zlib
+ )
+
+ if tc_version_is_at_least 13.1 ; then
+ confgcc_jit+=( --disable-fixincludes )
+ fi
+
mkdir -p "${WORKDIR}"/build-jit || die
pushd "${WORKDIR}"/build-jit > /dev/null || die
- CONFIG_SHELL="${gcc_shell}" edo "${gcc_shell}" "${S}"/configure \
- "${confgcc[@]}" \
- --disable-libada \
- --disable-libsanitizer \
- --disable-libvtv \
- --disable-libgomp \
- --disable-libquadmath \
- --disable-libatomic \
- --disable-lto \
- --disable-bootstrap \
- --enable-host-shared \
- --enable-languages=jit
+
+ CONFIG_SHELL="${gcc_shell}" edo "${gcc_shell}" "${S}"/configure "${confgcc_jit[@]}"
popd > /dev/null || die
fi
@@ -1546,7 +1564,29 @@ gcc_do_filter_flags() {
# Lock gcc at -O2; we want to be conservative here.
filter-flags '-O?'
- append-flags -O2
+
+ # We allow -O3 given it's a supported option upstream.
+ # Only add -O2 if we're not doing -O3.
+ if [[ ${BUILD_CONFIG_TARGETS[@]} == *bootstrap-O3* ]] ; then
+ append-flags '-O3'
+ else
+ append-flags '-O2'
+ fi
+ fi
+
+
+ if ver_test -lt 13.6 ; then
+ # These aren't supported by the just-built compiler either.
+ filter-flags -fharden-compares -fharden-conditional-branches \
+ -fharden-control-flow-redundancy -fno-harden-control-flow-redundancy \
+ -fhardcfr-skip-leaf -fhardcfr-check-exceptions \
+ -fhardcfr-check-returning-calls '-fhardcfr-check-noreturn-calls=*'
+
+ # New in GCC 14.
+ filter-flags -Walloc-size
+ else
+ # Makes things painfully slow and no real benefit for the compiler.
+ append-flags $(test-flags-CC -fno-harden-control-flow-redundancy)
fi
# Please use USE=lto instead (bug #906007).
@@ -1692,46 +1732,65 @@ gcc_do_make() {
fi
fi
- if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
- STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
- fi
+ local emakeargs=(
+ LDFLAGS="${LDFLAGS}"
+ LIBPATH="${LIBPATH}"
+ )
if is_crosscompile; then
# In 3.4, BOOT_CFLAGS is never used on a crosscompile...
# but I'll leave this in anyways as someone might have had
# some reason for putting it in here... --eradicator
BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"}
+ emakeargs+=( BOOT_CFLAGS="${BOOT_CFLAGS}" )
else
- # we only want to use the system's CFLAGS if not building a
+ # XXX: Hack for bug #914881, clean this up when fixed and go back
+ # to just calling get_abi_LDFLAGS as before.
+ local abi_ldflags="$(get_abi_LDFLAGS ${TARGET_DEFAULT_ABI})"
+ if [[ -n ${abi_ldflags} ]] ; then
+ printf -v abi_ldflags -- "-Wl,%s " ${abi_ldflags}
+ fi
+
+ # If the host compiler is too old, let's use -O0 per the upstream
+ # default to be safe (to avoid a bootstrap comparison failure later).
+ #
+ # The last known issues are with < GCC 4.9 or so, but it's easier
+ # to keep this bound somewhat fresh just to avoid problems. Ultimately,
+ # using not-O0 is just a build-time speed improvement anyway.
+ if tc-is-gcc && ver_test $(gcc-fullversion) -lt 10 ; then
+ STAGE1_CFLAGS="-O0"
+ fi
+
+ # We only want to use the system's CFLAGS if not building a
# cross-compiler.
+ STAGE1_CFLAGS=${STAGE1_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"}
+ STAGE1_LDFLAGS=${STAGE1_LDFLAGS-"${abi_ldflags} ${LDFLAGS}"}
BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS ${TARGET_DEFAULT_ABI}) ${CFLAGS}"}
+ BOOT_LDFLAGS=${BOOT_LDFLAGS-"${abi_ldflags} ${LDFLAGS}"}
+ LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}"
+
+ emakeargs+=(
+ STAGE1_CFLAGS="${STAGE1_CFLAGS}"
+ STAGE1_LDFLAGS="${STAGE1_LDFLAGS}"
+ BOOT_CFLAGS="${BOOT_CFLAGS}"
+ BOOT_LDFLAGS="${BOOT_LDFLAGS}"
+ LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET}"
+ )
fi
if is_jit ; then
# TODO: docs for jit?
- pushd "${WORKDIR}"/build-jit > /dev/null || die
-
einfo "Building JIT"
- emake \
- LDFLAGS="${LDFLAGS}" \
- STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${BOOT_CFLAGS}"
- popd > /dev/null || die
+ emake -C "${WORKDIR}"/build-jit "${emakeargs[@]}"
fi
einfo "Compiling ${PN} (${GCC_MAKE_TARGET})..."
-
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
emake \
T= \
- LDFLAGS="${LDFLAGS}" \
- STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
- LIBPATH="${LIBPATH}" \
- BOOT_CFLAGS="${BOOT_CFLAGS}" \
${GCC_MAKE_TARGET}
if is_ada; then
@@ -1984,8 +2043,6 @@ toolchain_src_install() {
# libgfortran.la: gfortran itself handles linkage correctly in the
# dynamic & static case (libgfortran.spec). bug #573302
# libgfortranbegin.la: Same as above, and it's an internal lib.
- # libmpx.la: gcc itself handles linkage correctly (libmpx.spec).
- # libmpxwrappers.la: See above.
# libitm.la: gcc itself handles linkage correctly (libitm.spec).
# libvtv.la: gcc itself handles linkage correctly.
# lib*san.la: Sanitizer linkage is handled internally by gcc, and they
@@ -2002,8 +2059,6 @@ toolchain_src_install() {
-name 'libgomp-plugin-*.la' -o \
-name libgfortran.la -o \
-name libgfortranbegin.la -o \
- -name libmpx.la -o \
- -name libmpxwrappers.la -o \
-name libitm.la -o \
-name libvtv.la -o \
-name 'lib*san.la' \
@@ -2305,7 +2360,9 @@ should_we_gcc_config() {
local curr_branch_ver=$(ver_cut 1-2 ${curr_config_ver})
- if [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then
+ if tc_use_major_version_only && [[ ${curr_config_ver} == ${GCCMAJOR} ]] ; then
+ return 0
+ elif ! tc_use_major_version_only && [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then
return 0
else
# If we're installing a genuinely different compiler version,
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-01-21 13:43 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-01-21 13:43 UTC (permalink / raw
To: gentoo-commits
commit: e94414618cb776a0d2e3808db5303667a7f007a9
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 21 13:43:36 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jan 21 13:43:36 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=e9441461
eclass/python-utils-r1: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 245 +++++++++++++++++++++++++++++++-----------
1 file changed, 180 insertions(+), 65 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index e565a8f752..5abe526b45 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: python-utils-r1.eclass
@@ -114,11 +114,18 @@ _python_verify_patterns() {
_python_set_impls() {
local i
- if ! declare -p PYTHON_COMPAT &>/dev/null; then
- die 'PYTHON_COMPAT not declared.'
+ # TODO: drop BASH_VERSINFO check when we require EAPI 8
+ if [[ ${BASH_VERSINFO[0]} -ge 5 ]]; then
+ [[ ${PYTHON_COMPAT@a} == *a* ]]
+ else
+ [[ $(declare -p PYTHON_COMPAT) == "declare -a"* ]]
fi
- if [[ $(declare -p PYTHON_COMPAT) != "declare -a"* ]]; then
- die 'PYTHON_COMPAT must be an array.'
+ if [[ ${?} -ne 0 ]]; then
+ if ! declare -p PYTHON_COMPAT &>/dev/null; then
+ die 'PYTHON_COMPAT not declared.'
+ else
+ die 'PYTHON_COMPAT must be an array.'
+ fi
fi
local obsolete=()
@@ -146,17 +153,6 @@ _python_set_impls() {
done
fi
- if [[ -n ${obsolete[@]} && ${EBUILD_PHASE} == setup ]]; then
- # complain if people don't clean up old impls while touching
- # the ebuilds recently. use the copyright year to infer last
- # modification
- # NB: this check doesn't have to work reliably
- if [[ $(head -n 1 "${EBUILD}" 2>/dev/null) == *2022* ]]; then
- eqawarn "Please clean PYTHON_COMPAT of obsolete implementations:"
- eqawarn " ${obsolete[*]}"
- fi
- fi
-
local supp=() unsupp=()
for i in "${_PYTHON_ALL_IMPLS[@]}"; do
@@ -231,12 +227,11 @@ _python_impl_matches() {
fi
return 0
;;
- 3.9)
- # the only unmasked pypy3 version is pypy3.9 atm
+ 3.10)
[[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] &&
return 0
;;
- 3.8|3.1[0-2])
+ 3.8|3.9|3.1[1-2])
[[ ${impl} == python${pattern/./_} ]] && return 0
;;
*)
@@ -332,7 +327,9 @@ _python_export() {
debug-print "${FUNCNAME}: EPYTHON = ${EPYTHON}"
;;
PYTHON)
- export PYTHON=${EPREFIX}/usr/bin/${impl}
+ # Under EAPI 7+, this should just use ${BROOT}, but Portage
+ # <3.0.50 was buggy, and prefix users need this to update.
+ export PYTHON=${BROOT-${EPREFIX}}/usr/bin/${impl}
if [[ " python jython pypy pypy3 " != *" ${PN} "* ]] \
&& [[ ! -x ${EPREFIX}/usr/bin/${impl} ]] \
&& { has prefix-stack ${USE} || has stacked-prefix ${FEATURES} ;} ; then
@@ -346,9 +343,9 @@ _python_export() {
PYTHON_SITEDIR)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
PYTHON_SITEDIR=$(
- "${PYTHON}" - <<-EOF || die
- import sysconfig
- print(sysconfig.get_path("purelib"))
+ "${PYTHON}" - "${EPREFIX}/usr" <<-EOF || die
+ import sys, sysconfig
+ print(sysconfig.get_path("purelib", vars={"base": sys.argv[1]}))
EOF
)
export PYTHON_SITEDIR
@@ -357,9 +354,9 @@ _python_export() {
PYTHON_INCLUDEDIR)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
PYTHON_INCLUDEDIR=$(
- "${PYTHON}" - <<-EOF || die
- import sysconfig
- print(sysconfig.get_path("platinclude"))
+ "${PYTHON}" - "${ESYSROOT}/usr" <<-EOF || die
+ import sys, sysconfig
+ print(sysconfig.get_path("platinclude", vars={"installed_platbase": sys.argv[1]}))
EOF
)
export PYTHON_INCLUDEDIR
@@ -448,14 +445,12 @@ _python_export() {
PYTHON_PKG_DEP)
local d
case ${impl} in
- python3.10)
- PYTHON_PKG_DEP=">=dev-lang/python-3.10.9-r1:3.10";;
- python3.11)
- PYTHON_PKG_DEP=">=dev-lang/python-3.11.1-r1:3.11";;
- python3.12)
- PYTHON_PKG_DEP=">=dev-lang/python-3.12.0_beta1:3.12";;
+ python*)
+ PYTHON_PKG_DEP="dev-lang/python:${impl#python}"
+ ;;
pypy3)
- PYTHON_PKG_DEP='>=dev-python/pypy3-7.3.11-r1:0=';;
+ PYTHON_PKG_DEP="dev-python/${impl}:="
+ ;;
*)
die "Invalid implementation: ${impl}"
esac
@@ -1035,8 +1030,6 @@ python_fix_shebang() {
debug-print-function ${FUNCNAME} "${@}"
[[ ${EPYTHON} ]] || die "${FUNCNAME}: EPYTHON unset (pkg_setup not called?)"
- local PYTHON
- _python_export "${EPYTHON}" PYTHON
local force quiet
while [[ ${@} ]]; do
@@ -1245,6 +1238,62 @@ _python_check_EPYTHON() {
fi
}
+# @FUNCTION: _python_check_occluded_packages
+# @INTERNAL
+# @DESCRIPTION:
+# Check if the current directory does not contain any incomplete
+# package sources that would block installed packages from being used
+# (and effectively e.g. make it impossible to load compiled extensions).
+_python_check_occluded_packages() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ -z ${BUILD_DIR} || ! -d ${BUILD_DIR}/install ]] && return
+
+ local sitedir="${BUILD_DIR}/install$(python_get_sitedir)"
+ # avoid unnecessarily checking if we are inside install dir
+ [[ ${sitedir} -ef . ]] && return
+
+ local f fn diff l
+ for f in "${sitedir}"/*/; do
+ f=${f%/}
+ fn=${f##*/}
+
+ # skip metadata directories
+ [[ ${fn} == *.dist-info || ${fn} == *.egg-info ]] && continue
+
+ if [[ -d ${fn} ]]; then
+ diff=$(
+ comm -1 -3 <(
+ find "${fn}" -type f -not -path '*/__pycache__/*' |
+ sort
+ assert
+ ) <(
+ cd "${sitedir}" &&
+ find "${fn}" -type f -not -path '*/__pycache__/*' |
+ sort
+ assert
+ )
+ )
+
+ if [[ -n ${diff} ]]; then
+ eqawarn "The directory ${fn} occludes package installed for ${EPYTHON}."
+ eqawarn "The installed package includes additional files:"
+ eqawarn
+ while IFS= read -r l; do
+ eqawarn " ${l}"
+ done <<<"${diff}"
+ eqawarn
+
+ if [[ ! ${_PYTHON_WARNED_OCCLUDED_PACKAGES} ]]; then
+ eqawarn "For more information on occluded packages, please see:"
+ eqawarn "https://projects.gentoo.org/python/guide/test.html#importerrors-for-c-extensions"
+ _PYTHON_WARNED_OCCLUDED_PACKAGES=1
+ fi
+ fi
+ fi
+ done
+}
+
# @VARIABLE: EPYTEST_DESELECT
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -1263,6 +1312,31 @@ _python_check_EPYTHON() {
# parameter, when calling epytest. The listed files will be entirely
# skipped from test collection.
+# @ECLASS_VARIABLE: EPYTEST_TIMEOUT
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to a non-empty value, enables pytest-timeout plugin and sets
+# test timeout to the specified value. This variable can be either set
+# in ebuilds that are known to hang, or by user to prevent hangs
+# in automated test environments. If this variable is set prior
+# to calling distutils_enable_tests in distutils-r1, a test dependency
+# on dev-python/pytest-timeout is added automatically.
+
+# @ECLASS_VARIABLE: EPYTEST_XDIST
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to a non-empty value, enables running tests in parallel
+# via pytest-xdist plugin. If this variable is set prior to calling
+# distutils_enable_tests in distutils-r1, a test dependency
+# on dev-python/pytest-xdist is added automatically.
+
+# @ECLASS_VARIABLE: EPYTEST_JOBS
+# @USER_VARIABLE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Specifies the number of jobs for parallel (pytest-xdist) test runs.
+# When unset, defaults to -j from MAKEOPTS, or the current nproc.
+
# @FUNCTION: epytest
# @USAGE: [<args>...]
# @DESCRIPTION:
@@ -1275,16 +1349,10 @@ epytest() {
debug-print-function ${FUNCNAME} "${@}"
_python_check_EPYTHON
+ _python_check_occluded_packages
- local color
- case ${NOCOLOR} in
- true|yes)
- color=no
- ;;
- *)
- color=yes
- ;;
- esac
+ local color=yes
+ [[ ${NO_COLOR} ]] && color=no
local args=(
# verbose progress reporting and tracebacks
@@ -1302,28 +1370,74 @@ epytest() {
# count is more precise when we're dealing with a large number
# of tests
-o console_output_style=count
- # disable the undesirable-dependency plugins by default to
- # trigger missing argument strips. strip options that require
- # them from config files. enable them explicitly via "-p ..."
- # if you *really* need them.
- -p no:cov
- -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
- # pytest-sugar undoes everything that's good about pytest output
- # and makes it hard to read logs
- -p no:sugar
- # pytest-xvfb automatically spawns Xvfb for every test suite,
- # effectively forcing it even when we'd prefer the tests
- # not to have DISPLAY at all, causing crashes sometimes
- # and causing us to miss missing virtualx usage
- -p no:xvfb
- # tavern is intrusive and breaks test suites of various packages
- -p no:tavern
+ # minimize the temporary directory retention, the test suites
+ # of some packages can grow them pretty large and normally
+ # we don't need to preserve them
+ -o tmp_path_retention_count=0
+ -o tmp_path_retention_policy=failed
)
+
+ if [[ ! ${PYTEST_DISABLE_PLUGIN_AUTOLOAD} ]]; then
+ args+=(
+ # disable the undesirable-dependency plugins by default to
+ # trigger missing argument strips. strip options that require
+ # them from config files. enable them explicitly via "-p ..."
+ # if you *really* need them.
+ -p no:cov
+ -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
+ # pytest-sugar undoes everything that's good about pytest output
+ # and makes it hard to read logs
+ -p no:sugar
+ # pytest-xvfb automatically spawns Xvfb for every test suite,
+ # effectively forcing it even when we'd prefer the tests
+ # not to have DISPLAY at all, causing crashes sometimes
+ # and causing us to miss missing virtualx usage
+ -p no:xvfb
+ # intrusive packages that break random test suites
+ -p no:pytest-describe
+ -p no:plus
+ -p no:tavern
+ # does something to logging
+ -p no:salt-factories
+ )
+ fi
+
+ if [[ -n ${EPYTEST_TIMEOUT} ]]; then
+ if [[ ${PYTEST_PLUGINS} != *pytest_timeout* ]]; then
+ args+=(
+ -p timeout
+ )
+ fi
+
+ args+=(
+ "--timeout=${EPYTEST_TIMEOUT}"
+ )
+ fi
+
+ if [[ ${EPYTEST_XDIST} ]]; then
+ local jobs=${EPYTEST_JOBS:-$(makeopts_jobs)}
+ if [[ ${jobs} -gt 1 ]]; then
+ if [[ ${PYTEST_PLUGINS} != *xdist.plugin* ]]; then
+ args+=(
+ # explicitly enable the plugin, in case the ebuild was
+ # using PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
+ -p xdist
+ )
+ fi
+ args+=(
+ -n "${jobs}"
+ # worksteal ensures that workers don't end up idle when heavy
+ # jobs are unevenly distributed
+ --dist=worksteal
+ )
+ fi
+ fi
+
local x
for x in "${EPYTEST_DESELECT[@]}"; do
args+=( --deselect "${x}" )
@@ -1359,6 +1473,7 @@ eunittest() {
debug-print-function ${FUNCNAME} "${@}"
_python_check_EPYTHON
+ _python_check_occluded_packages
# unittest fails with "no tests" correctly since Python 3.12
local runner=unittest
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-01-21 13:47 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-01-21 13:47 UTC (permalink / raw
To: gentoo-commits
commit: 42766d37044e2479bee6c9e885238bc9703eddd6
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 21 13:46:52 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sun Jan 21 13:46:52 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=42766d37
eclass/java-utils-2: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/java-utils-2.eclass | 158 +++++++++++++++++++++++++++++++++------------
1 file changed, 116 insertions(+), 42 deletions(-)
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index fa46b72b3d..a84f7c3002 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -1,4 +1,4 @@
-# Copyright 2004-2022 Gentoo Authors
+# Copyright 2004-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: java-utils-2.eclass
@@ -6,7 +6,7 @@
# java@gentoo.org
# @AUTHOR:
# Thomas Matthijs <axxo@gentoo.org>, Karl Trygve Kalleberg <karltk@gentoo.org>
-# @SUPPORTED_EAPIS: 5 6 7 8
+# @SUPPORTED_EAPIS: 6 7 8
# @BLURB: Base eclass for Java packages
# @DESCRIPTION:
# This eclass provides functionality which is used by java-pkg-2.eclass,
@@ -17,17 +17,17 @@
# that have optional Java support. In addition you can inherit java-ant-2 for
# Ant-based packages.
-case ${EAPI:-0} in
- [5678]) ;;
+case ${EAPI} in
+ 6|7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
if [[ -z ${_JAVA_UTILS_2_ECLASS} ]] ; then
_JAVA_UTILS_2_ECLASS=1
-# EAPI 7 has version functions built-in. Use eapi7-ver for all earlier eclasses.
+# EAPI 7 has version functions built-in. Use eapi7-ver for all earlier EAPIs.
# Keep versionator inheritance in case consumers are using it implicitly.
-[[ ${EAPI} == [56] ]] && inherit eapi7-ver eutils multilib versionator
+[[ ${EAPI} == 6 ]] && inherit eapi7-ver eqawarn multilib versionator
# Make sure we use java-config-2
export WANT_JAVA_CONFIG="2"
@@ -37,7 +37,7 @@ has test ${JAVA_PKG_IUSE} && RESTRICT+=" !test? ( test )"
# @VARIABLE: JAVA_PKG_E_DEPEND
# @INTERNAL
# @DESCRIPTION:
-# This is a convience variable to be used from the other java eclasses. This is
+# This is a convenience variable to be used from the other java eclasses. This is
# the version of java-config we want to use. Usually the latest stable version
# so that ebuilds can use new features without depending on specific versions.
JAVA_PKG_E_DEPEND=">=dev-java/java-config-2.2.0-r3"
@@ -66,6 +66,21 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
# JAVA_PKG_FORCE_VM=openjdk-11 emerge foo
# @CODE
+# @ECLASS_VARIABLE: JAVA_PKG_NO_CLEAN
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# An array of expressions to match *.class or *.jar files in order to protect
+# them against deletion by java-pkg_clean.
+#
+# @CODE
+# JAVA_PKG_NO_CLEAN=(
+# "*/standard.jar"
+# "*/launch4j.jar"
+# "*/apps/jetty/apache-tomcat*"
+# "*/lib/jetty*"
+# )
+# @CODE
+
# @ECLASS_VARIABLE: JAVA_PKG_WANT_BUILD_VM
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -124,7 +139,7 @@ JAVA_PKG_ALLOW_VM_CHANGE=${JAVA_PKG_ALLOW_VM_CHANGE:="yes"}
# )
# @CODE
-# @ECLASS-VARIABLE: JAVA_TEST_RUNNER_EXTRA_ARGS
+# @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.
@@ -203,6 +218,46 @@ JAVA_PKG_COMPILERS_CONF=${JAVA_PKG_COMPILERS_CONF:="${EPREFIX}/etc/java-config-2
# ebuild foo.ebuild compile
# @CODE
+# @ECLASS_VARIABLE: JAVADOC_CLASSPATH
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Comma or space separated list of java packages that are needed for generating
+# javadocs. Can be used to avoid overloading the compile classpath in multi-jar
+# packages if there are jar files which have different dependencies.
+#
+# @CODE
+# Example:
+# JAVADOC_CLASSPATH="
+# jna-4
+# jsch
+# "
+# @CODE
+
+# @ECLASS_VARIABLE: JAVADOC_SRC_DIRS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# An array of directories relative to ${S} which contain the sources of
+# the application. It needs to sit in global scope; if put in src_compile()
+# it would not work.
+# It is needed by the java-pkg-simple.eclass to decide whether to call ejavadoc
+# or not. If this variable is defined then java-pkg-simple_src_compile will not
+# call ejavadoc automatically. ejavadoc has then to be called explicitly from
+# the ebuild. It is meant for usage in multi-jar packages in order to avoid an
+# extra compilation run only for producing the javadocs.
+#
+# @CODE
+# Example:
+# JAVADOC_SRC_DIRS=(
+# "${PN}-core"
+# "${PN}-jsch"
+# "${PN}-pageant"
+# "${PN}-sshagent"
+# "${PN}-usocket-jna"
+# "${PN}-usocket-nc"
+# "${PN}-connector-factory"
+# )
+# @CODE
+
# TODO document me
JAVA_PKG_QA_VIOLATIONS=0
@@ -316,7 +371,6 @@ java-pkg_rm_files() {
[[ ! -f "${filename}" ]] && die "${filename} is not a regular file. Aborting."
einfo "Removing unneeded file ${filename}"
rm -f "${S}/${filename}" || die "cannot remove ${filename}"
- eend $?
done
}
@@ -769,7 +823,7 @@ java-pkg_dosrc() {
# @FUNCTION: java-pkg_dolauncher
# @USAGE: <filename> [options]
# @DESCRIPTION:
-# Make a wrapper script to lauch/start this package
+# Make a wrapper script to launch/start this package
# If necessary, the wrapper will switch to the appropriate VM.
#
# Can be called without parameters if the package installs only one jar
@@ -939,7 +993,7 @@ java-pkg_recordjavadoc()
# Example: get a specific jar from xerces slot 2
# java-pkg_jar-from xerces-2 xml-apis.jar
#
-# Example: get a specific jar from xerces slot 2, and name it diffrently
+# Example: get a specific jar from xerces slot 2, and name it differently
# java-pkg_jar-from xerces-2 xml-apis.jar xml.jar
#
# Example: get junit.jar which is needed only for building
@@ -1350,7 +1404,7 @@ java-pkg_register-optional-dependency() {
# @DESCRIPTION:
# Register an arbitrary environment variable into package.env. The gjl launcher
# for this package or any package depending on this will export it into
-# environement before executing java command.
+# environment before executing java command.
# Must only be called in src_install phase.
JAVA_PKG_EXTRA_ENV="${T}/java-pkg-extra-env"
JAVA_PKG_EXTRA_ENV_VARS=""
@@ -1696,16 +1750,6 @@ java-pkg_get-jni-cflags() {
echo ${flags}
}
-java-pkg_ensure-gcj() {
- # was enforcing sys-devel/gcc[gcj]
- die "${FUNCNAME} was removed. Use use-deps available as of EAPI 2 instead. #261562"
-}
-
-java-pkg_ensure-test() {
- # was enforcing USE=test if FEATURES=test
- die "${FUNCNAME} was removed. Package mangers handle this already. #278965"
-}
-
# @FUNCTION: java-pkg_register-ant-task
# @USAGE: [--version x.y] [<name>]
# @DESCRIPTION:
@@ -1879,13 +1923,17 @@ ejunit4() {
# @CODE
# $1 - -cp or -classpath
# $2 - the classpath passed to it
-# $@ - test classes for testng to run.
+# $@ - test classes or testng.xml for testng to run.
# @CODE
etestng() {
debug-print-function ${FUNCNAME} $*
local runner=org.testng.TestNG
- local cp=$(java-pkg_getjars --with-dependencies testng)
+ if [[ ${PN} != testng ]]; then
+ local cp=$(java-pkg_getjars --with-dependencies testng)
+ else
+ local cp=testng.jar
+ fi
local tests
if [[ ${1} = -cp || ${1} = -classpath ]]; then
@@ -1903,14 +1951,24 @@ etestng() {
-cp ${cp}
-Djava.io.tmpdir="${T}"
-Djava.awt.headless=true
+ -Dtest.resources.dir="${JAVA_TEST_RESOURCE_DIRS}"
${JAVA_TEST_EXTRA_ARGS[@]}
${runner}
${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}
)
- [[ ! "${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}" =~ "-usedefaultlisteners" ]] && args+=( -usedefaultlisteners false )
+ if [[ ! "${JAVA_TEST_RUNNER_EXTRA_ARGS[@]}" =~ "-usedefaultlisteners" ]]; then
+ args+=(
+ -verbose 3
+ -usedefaultlisteners true
+ )
+ fi
- args+=( -testclass ${tests} )
+ if [[ "${test%.xml}" == "${test}" ]]; then
+ args+=( -testclass ${tests} )
+ else
+ args+=( ${tests%,} )
+ fi
debug-print "java ${args[@]}"
java ${args[@]} || die "Running TestNG failed."
@@ -1921,13 +1979,9 @@ etestng() {
# src_prepare Searches for bundled jars
# Don't call directly, but via java-pkg-2_src_prepare!
java-utils-2_src_prepare() {
- case ${EAPI:-0} in
- 5)
- java-pkg_func-exists java_prepare && java_prepare ;;
- *)
- java-pkg_func-exists java_prepare &&
- eqawarn "java_prepare is no longer called, define src_prepare instead."
- eapply_user ;;
+ case ${EAPI} in
+ [678]) eapply_user ;;
+ *) default_src_prepare ;;
esac
# Check for files in JAVA_RM_FILES array.
@@ -2148,9 +2202,27 @@ ejavadoc() {
einfo "javadoc ${javadoc_args} ${@}"
fi
- local args=( javadoc ${javadoc_args} "${@}" )
- echo "${args[@]}" >&2
- "${args[@]}" || die "ejavadoc failed"
+ if [[ "${JAVADOC_SRC_DIRS[@]}" ]]; then
+ mkdir -p target/api || die "cannot create target/api"
+ local dependency
+ for dependency in ${JAVADOC_CLASSPATH}; do
+ classpath="${classpath}:$(java-pkg_getjars \
+ --build-only \
+ --with-dependencies \
+ ${dependency})"
+ done
+ find "${JAVADOC_SRC_DIRS[@]}" -name '*.java' > sources
+ javadoc \
+ "${javadoc_args}" \
+ -d target/api \
+ -cp "${classpath}" \
+ -quiet \
+ @sources || die "ejavadoc failed"
+ else
+ local args=( javadoc ${javadoc_args} "${@}" )
+ echo "${args[@]}" >&2
+ "${args[@]}" || die "ejavadoc failed"
+ fi
}
# @FUNCTION: java-pkg_filter-compiler
@@ -2378,7 +2450,7 @@ java-pkg_init-compiler_() {
}
-# @FUNCTION: init_paths_
+# @FUNCTION: java-pkg_init_paths_
# @INTERNAL
# @DESCRIPTION:
# Initializes some variables that will be used. These variables are mostly used
@@ -2628,7 +2700,7 @@ java-pkg_get-vm-version() {
# @RETURN: VM handle of an available JDK
# @DESCRIPTION:
# Selects a build vm from a list of vm handles. First checks for the system-vm
-# beeing usable, then steps through the listed handles till a suitable vm is
+# being usable, then steps through the listed handles till a suitable vm is
# found.
#
java-pkg_build-vm-from-handle() {
@@ -2931,11 +3003,13 @@ is-java-strict() {
# @FUNCTION: java-pkg_clean
# @DESCRIPTION:
# Java package cleaner function. This will remove all *.class and *.jar
-# files, removing any bundled dependencies.
+# files, except those specified by expressions in JAVA_PKG_NO_CLEAN.
java-pkg_clean() {
- if [[ -z "${JAVA_PKG_NO_CLEAN}" ]]; then
- find "${@}" '(' -name '*.class' -o -name '*.jar' ')' -type f -delete -print || die
- fi
+ NO_DELETE=()
+ for keep in ${JAVA_PKG_NO_CLEAN[@]}; do
+ NO_DELETE+=( '!' '-path' ${keep} )
+ done
+ find "${@}" '(' -name '*.class' -o -name '*.jar' ${NO_DELETE[@]} ')' -type f -delete -print || die
}
# @FUNCTION: java-pkg_gen-cp
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-05-09 7:14 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-05-09 7:14 UTC (permalink / raw
To: gentoo-commits
commit: 65650e5ab378910577341115bc44944cdcde974c
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed May 8 15:34:59 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed May 8 15:34:59 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=65650e5a
eclass/python-utils-r1: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 5abe526b45..3482919cd9 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -40,7 +40,7 @@ inherit multiprocessing toolchain-funcs
# All supported Python implementations, most preferred last.
_PYTHON_ALL_IMPLS=(
pypy3
- python3_{10..12}
+ python3_{10..13}
)
readonly _PYTHON_ALL_IMPLS
@@ -80,7 +80,7 @@ _python_verify_patterns() {
local impl pattern
for pattern; do
case ${pattern} in
- -[23]|3.[89]|3.1[012])
+ -[23]|3.[89]|3.1[0-3])
continue
;;
esac
@@ -136,7 +136,7 @@ _python_set_impls() {
# please keep them in sync with _PYTHON_ALL_IMPLS
# and _PYTHON_HISTORICAL_IMPLS
case ${i} in
- pypy3|python3_9|python3_1[0-2])
+ pypy3|python3_9|python3_1[0-3])
;;
jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-9])
obsolete+=( "${i}" )
@@ -231,7 +231,7 @@ _python_impl_matches() {
[[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] &&
return 0
;;
- 3.8|3.9|3.1[1-2])
+ 3.8|3.9|3.1[1-3])
[[ ${impl} == python${pattern/./_} ]] && return 0
;;
*)
@@ -900,7 +900,7 @@ python_doheader() {
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
local includedir=$(python_get_includedir)
- local d=${includedir#${EPREFIX}}
+ local d=${includedir#${ESYSROOT}}
(
insopts -m 0644
@@ -1102,7 +1102,7 @@ python_fix_shebang() {
if [[ ! ${error} ]]; then
debug-print "${FUNCNAME}: in file ${f#${D%/}}"
debug-print "${FUNCNAME}: rewriting shebang: ${shebang}"
- sed -i -e "1s@${from}@#!${PYTHON}@" "${f}" || die
+ sed -i -e "1s@${from}@#!${EPREFIX}/usr/bin/${EPYTHON}@" "${f}" || die
any_fixed=1
else
eerror "The file has incompatible shebang:"
@@ -1365,6 +1365,9 @@ epytest() {
# override filterwarnings=error, we do not really want -Werror
# for end users, as it tends to fail on new warnings from deps
-Wdefault
+ # however, do error out if the package failed to load
+ # an appropriate async plugin
+ -Werror::pytest.PytestUnhandledCoroutineWarning
# override color output
"--color=${color}"
# count is more precise when we're dealing with a large number
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-07-17 12:01 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-07-17 12:01 UTC (permalink / raw
To: gentoo-commits
commit: 3d9bf42572525fe0b46db86aaf362af70131e313
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 17 12:00:19 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Jul 17 12:00:19 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=3d9bf425
toolchain.eclass: handle quirky behaviour of --enable-host-bind-now
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 85bb14220c..b4a18a127a 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1330,9 +1330,14 @@ toolchain_src_configure() {
if in_iuse default-znow && tc_version_is_at_least 14.0.0_pre20230619 ${PV}; then
# See https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=33ebb0dff9bb022f1e0709e0e73faabfc3df7931.
# TODO: Add to LDFLAGS_FOR_TARGET?
+ # PREFIX_LOCAL
+ # configure check is flawed, --disable enables too, so omit when
+ # not set
+ if use default-znow ; then
confgcc+=(
$(use_enable default-znow host-bind-now)
)
+ fi
fi
if in_iuse ssp ; then
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-07-25 6:25 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-07-25 6:25 UTC (permalink / raw
To: gentoo-commits
commit: 8dad4bdf87218ef9c2264a320b5ba6ff83310dd2
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Jul 24 19:27:05 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Jul 24 19:27:05 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=8dad4bdf
eclass/toolchain: avoid emitting pie arguments when unset
Like host-bind-now, the configure-foo for these pie arguments is messed
up and whenever enabled/disabled enabled
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index b4a18a127a..b8c75854cb 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1320,11 +1320,16 @@ toolchain_src_configure() {
fi
if in_iuse pie ; then
+ # PREFIX_LOCAL
+ # configure check is flawed, --disable enables too, so omit when
+ # not set
+ if use pie ; then
confgcc+=( $(use_enable pie default-pie) )
if tc_version_is_at_least 14.0.0_pre20230612 ${PV} ; then
confgcc+=( --enable-host-pie )
fi
+ fi
fi
if in_iuse default-znow && tc_version_is_at_least 14.0.0_pre20230619 ${PV}; then
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-08-07 17:03 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-08-07 17:03 UTC (permalink / raw
To: gentoo-commits
commit: ff7f7d477bc015f89490fcbddb041f629cb59537
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 7 17:02:54 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Aug 7 17:02:54 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ff7f7d47
eclass/python-utils-r1: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 71 +++++++++++++++++++++++++++++++++++++++++--
1 file changed, 69 insertions(+), 2 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index 3482919cd9..ec1a3d2006 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -340,6 +340,17 @@ _python_export() {
fi
debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
;;
+ PYTHON_STDLIB)
+ [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
+ PYTHON_STDLIB=$(
+ "${PYTHON}" - "${EPREFIX}/usr" <<-EOF || die
+ import sys, sysconfig
+ print(sysconfig.get_path("stdlib", vars={"installed_base": sys.argv[1]}))
+ EOF
+ )
+ export PYTHON_STDLIB
+ debug-print "${FUNCNAME}: PYTHON_STDLIB = ${PYTHON_STDLIB}"
+ ;;
PYTHON_SITEDIR)
[[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
PYTHON_SITEDIR=$(
@@ -482,6 +493,18 @@ _python_export() {
done
}
+# @FUNCTION: python_get_stdlib
+# @USAGE: [<impl>]
+# @DESCRIPTION:
+# Obtain and print the 'stdlib' path for the given implementation. If no
+# implementation is provided, ${EPYTHON} will be used.
+python_get_stdlib() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ _python_export "${@}" PYTHON_STDLIB
+ echo "${PYTHON_STDLIB}"
+}
+
# @FUNCTION: python_get_sitedir
# @USAGE: [<impl>]
# @DESCRIPTION:
@@ -1337,6 +1360,15 @@ _python_check_occluded_packages() {
# Specifies the number of jobs for parallel (pytest-xdist) test runs.
# When unset, defaults to -j from MAKEOPTS, or the current nproc.
+# @ECLASS_VARIABLE: EPYTEST_FLAGS
+# @USER_VARIABLE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Additional flags to pass to pytest. This is intended to be set
+# in the environment when debugging packages (options such as -x or -s
+# are useful here), rather than globally. It must not be set
+# in ebuilds.
+
# @FUNCTION: epytest
# @USAGE: [<args>...]
# @DESCRIPTION:
@@ -1448,10 +1480,10 @@ epytest() {
for x in "${EPYTEST_IGNORE[@]}"; do
args+=( --ignore "${x}" )
done
- set -- "${EPYTHON}" -m pytest "${args[@]}" "${@}"
+ set -- "${EPYTHON}" -m pytest "${args[@]}" "${@}" ${EPYTEST_FLAGS}
echo "${@}" >&2
- "${@}" || die -n "pytest failed with ${EPYTHON}"
+ "${@}"
local ret=${?}
# remove common temporary directories left over by pytest plugins
@@ -1462,6 +1494,7 @@ epytest() {
find "${BUILD_DIR}" -name '*-pytest-*.pyc' -delete || die
fi
+ [[ ${ret} -ne 0 ]] && die -n "pytest failed with ${EPYTHON}"
return ${ret}
}
@@ -1550,4 +1583,38 @@ python_has_version() {
return 0
}
+# @FUNCTION: _python_sanity_checks
+# @INTERNAL
+# @DESCRIPTION:
+# Perform additional environment sanity checks.
+_python_sanity_checks() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ ${_PYTHON_SANITY_CHECKED} ]] && return
+
+ if [[ -v PYTHONPATH ]]; then
+ local x paths=()
+ mapfile -d ':' -t paths <<<${PYTHONPATH}
+
+ for x in "${paths[@]}"; do
+ if [[ ${x} != /* ]]; then
+ eerror "Relative path found in PYTHONPATH:"
+ eerror
+ eerror " PYTHONPATH=${PYTHONPATH@Q}"
+ eerror
+ eerror "This is guaranteed to cause random breakage. Please make sure that"
+ eerror "your PYTHONPATH contains absolute paths only (and only if necessary)."
+ eerror "Note that empty values (including ':' at either end and an empty"
+ eerror "PYTHONPATH) count as the current directory. If no PYTHONPATH"
+ eerror "is intended, it needs to be unset instead."
+ die "Relative paths in PYTHONPATH are forbidden: ${x@Q}"
+ fi
+ done
+
+ elog "PYTHONPATH=${PYTHONPATH@Q}"
+ fi
+
+ _PYTHON_SANITY_CHECKED=1
+}
+
fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-08-07 17:08 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-08-07 17:08 UTC (permalink / raw
To: gentoo-commits
commit: 47763c3710263623f8f539da55e5bf744b5a05ff
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 7 17:07:28 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Wed Aug 7 17:07:28 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=47763c37
eclass/python-utils-r1: use gx86 version
stacked prefix support is no longer in use, if we need it we should see
about it then
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/python-utils-r1.eclass | 1620 -----------------------------------------
1 file changed, 1620 deletions(-)
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
deleted file mode 100644
index ec1a3d2006..0000000000
--- a/eclass/python-utils-r1.eclass
+++ /dev/null
@@ -1,1620 +0,0 @@
-# Copyright 1999-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: python-utils-r1.eclass
-# @MAINTAINER:
-# Python team <python@gentoo.org>
-# @AUTHOR:
-# Author: Michał Górny <mgorny@gentoo.org>
-# Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
-# @SUPPORTED_EAPIS: 7 8
-# @BLURB: Utility functions for packages with Python parts.
-# @DESCRIPTION:
-# A utility eclass providing functions to query Python implementations,
-# install Python modules and scripts.
-#
-# This eclass does not set any metadata variables nor export any phase
-# functions. It can be inherited safely.
-#
-# For more information, please see the Python Guide:
-# https://projects.gentoo.org/python/guide/
-
-# NOTE: When dropping support for EAPIs here, we need to update
-# metadata/install-qa-check.d/60python-pyc
-# See bug #704286, bug #781878
-
-case ${EAPI} in
- 7|8) ;;
- *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
-esac
-
-if [[ ! ${_PYTHON_UTILS_R1_ECLASS} ]]; then
-_PYTHON_UTILS_R1_ECLASS=1
-
-[[ ${EAPI} == 7 ]] && inherit eapi8-dosym
-inherit multiprocessing toolchain-funcs
-
-# @ECLASS_VARIABLE: _PYTHON_ALL_IMPLS
-# @INTERNAL
-# @DESCRIPTION:
-# All supported Python implementations, most preferred last.
-_PYTHON_ALL_IMPLS=(
- pypy3
- python3_{10..13}
-)
-readonly _PYTHON_ALL_IMPLS
-
-# @ECLASS_VARIABLE: _PYTHON_HISTORICAL_IMPLS
-# @INTERNAL
-# @DESCRIPTION:
-# All historical Python implementations that are no longer supported.
-_PYTHON_HISTORICAL_IMPLS=(
- jython2_7
- pypy pypy1_{8,9} pypy2_0
- python2_{5..7}
- python3_{1..9}
-)
-readonly _PYTHON_HISTORICAL_IMPLS
-
-# @ECLASS_VARIABLE: PYTHON_COMPAT_NO_STRICT
-# @INTERNAL
-# @DESCRIPTION:
-# Set to a non-empty value in order to make eclass tolerate (ignore)
-# unknown implementations in PYTHON_COMPAT.
-#
-# This is intended to be set by the user when using ebuilds that may
-# have unknown (newer) implementations in PYTHON_COMPAT. The assumption
-# is that the ebuilds are intended to be used within multiple contexts
-# which can involve revisions of this eclass that support a different
-# set of Python implementations.
-
-# @FUNCTION: _python_verify_patterns
-# @USAGE: <pattern>...
-# @INTERNAL
-# @DESCRIPTION:
-# Verify whether the patterns passed to the eclass function are correct
-# (i.e. can match any valid implementation). Dies on wrong pattern.
-_python_verify_patterns() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local impl pattern
- for pattern; do
- case ${pattern} in
- -[23]|3.[89]|3.1[0-3])
- continue
- ;;
- esac
-
- for impl in "${_PYTHON_ALL_IMPLS[@]}" "${_PYTHON_HISTORICAL_IMPLS[@]}"
- do
- [[ ${impl} == ${pattern/./_} ]] && continue 2
- done
-
- die "Invalid implementation pattern: ${pattern}"
- done
-}
-
-# @FUNCTION: _python_set_impls
-# @INTERNAL
-# @DESCRIPTION:
-# Check PYTHON_COMPAT for well-formedness and validity, then set
-# two global variables:
-#
-# - _PYTHON_SUPPORTED_IMPLS containing valid implementations supported
-# by the ebuild (PYTHON_COMPAT - dead implementations),
-#
-# - and _PYTHON_UNSUPPORTED_IMPLS containing valid implementations that
-# are not supported by the ebuild.
-#
-# Implementations in both variables are ordered using the pre-defined
-# eclass implementation ordering.
-#
-# This function must be called once in global scope by an eclass
-# utilizing PYTHON_COMPAT.
-_python_set_impls() {
- local i
-
- # TODO: drop BASH_VERSINFO check when we require EAPI 8
- if [[ ${BASH_VERSINFO[0]} -ge 5 ]]; then
- [[ ${PYTHON_COMPAT@a} == *a* ]]
- else
- [[ $(declare -p PYTHON_COMPAT) == "declare -a"* ]]
- fi
- if [[ ${?} -ne 0 ]]; then
- if ! declare -p PYTHON_COMPAT &>/dev/null; then
- die 'PYTHON_COMPAT not declared.'
- else
- die 'PYTHON_COMPAT must be an array.'
- fi
- fi
-
- local obsolete=()
- if [[ ! ${PYTHON_COMPAT_NO_STRICT} ]]; then
- for i in "${PYTHON_COMPAT[@]}"; do
- # check for incorrect implementations
- # we're using pattern matching as an optimization
- # please keep them in sync with _PYTHON_ALL_IMPLS
- # and _PYTHON_HISTORICAL_IMPLS
- case ${i} in
- pypy3|python3_9|python3_1[0-3])
- ;;
- jython2_7|pypy|pypy1_[89]|pypy2_0|python2_[5-7]|python3_[1-9])
- obsolete+=( "${i}" )
- ;;
- *)
- if has "${i}" "${_PYTHON_ALL_IMPLS[@]}" \
- "${_PYTHON_HISTORICAL_IMPLS[@]}"
- then
- die "Mis-synced patterns in _python_set_impls: missing ${i}"
- else
- die "Invalid implementation in PYTHON_COMPAT: ${i}"
- fi
- esac
- done
- fi
-
- local supp=() unsupp=()
-
- for i in "${_PYTHON_ALL_IMPLS[@]}"; do
- if has "${i}" "${PYTHON_COMPAT[@]}"; then
- supp+=( "${i}" )
- else
- unsupp+=( "${i}" )
- fi
- done
-
- if [[ ! ${supp[@]} ]]; then
- die "No supported implementation in PYTHON_COMPAT."
- fi
-
- if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} ]]; then
- # set once already, verify integrity
- if [[ ${_PYTHON_SUPPORTED_IMPLS[@]} != ${supp[@]} ]]; then
- eerror "Supported impls (PYTHON_COMPAT) changed between inherits!"
- eerror "Before: ${_PYTHON_SUPPORTED_IMPLS[*]}"
- eerror "Now : ${supp[*]}"
- die "_PYTHON_SUPPORTED_IMPLS integrity check failed"
- fi
- if [[ ${_PYTHON_UNSUPPORTED_IMPLS[@]} != ${unsupp[@]} ]]; then
- eerror "Unsupported impls changed between inherits!"
- eerror "Before: ${_PYTHON_UNSUPPORTED_IMPLS[*]}"
- eerror "Now : ${unsupp[*]}"
- die "_PYTHON_UNSUPPORTED_IMPLS integrity check failed"
- fi
- else
- _PYTHON_SUPPORTED_IMPLS=( "${supp[@]}" )
- _PYTHON_UNSUPPORTED_IMPLS=( "${unsupp[@]}" )
- readonly _PYTHON_SUPPORTED_IMPLS _PYTHON_UNSUPPORTED_IMPLS
- fi
-}
-
-# @FUNCTION: _python_impl_matches
-# @USAGE: <impl> [<pattern>...]
-# @INTERNAL
-# @DESCRIPTION:
-# Check whether the specified <impl> matches at least one
-# of the patterns following it. Return 0 if it does, 1 otherwise.
-# Matches if no patterns are provided.
-#
-# <impl> can be in PYTHON_COMPAT or EPYTHON form. The patterns
-# can either be fnmatch-style or stdlib versions, e.g. "3.8", "3.9".
-# In the latter case, pypy3 will match if there is at least one pypy3
-# version matching the stdlib version.
-_python_impl_matches() {
- [[ ${#} -ge 1 ]] || die "${FUNCNAME}: takes at least 1 parameter"
- [[ ${#} -eq 1 ]] && return 0
-
- local impl=${1/./_} pattern
- shift
-
- for pattern; do
- case ${pattern} in
- -2|python2*|pypy)
- if [[ ${EAPI} != 7 ]]; then
- eerror
- eerror "Python 2 is no longer supported in Gentoo, please remove Python 2"
- eerror "${FUNCNAME[1]} calls."
- die "Passing ${pattern} to ${FUNCNAME[1]} is banned in EAPI ${EAPI}"
- fi
- ;;
- -3)
- # NB: "python3*" is fine, as "not pypy3"
- if [[ ${EAPI} != 7 ]]; then
- eerror
- eerror "Python 2 is no longer supported in Gentoo, please remove Python 2"
- eerror "${FUNCNAME[1]} calls."
- die "Passing ${pattern} to ${FUNCNAME[1]} is banned in EAPI ${EAPI}"
- fi
- return 0
- ;;
- 3.10)
- [[ ${impl} == python${pattern/./_} || ${impl} == pypy3 ]] &&
- return 0
- ;;
- 3.8|3.9|3.1[1-3])
- [[ ${impl} == python${pattern/./_} ]] && return 0
- ;;
- *)
- # unify value style to allow lax matching
- [[ ${impl} == ${pattern/./_} ]] && return 0
- ;;
- esac
- done
-
- return 1
-}
-
-# @ECLASS_VARIABLE: PYTHON
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The absolute path to the current Python interpreter.
-#
-# This variable is set automatically in the following contexts:
-#
-# python-r1: Set in functions called by python_foreach_impl() or after
-# calling python_setup().
-#
-# python-single-r1: Set after calling python-single-r1_pkg_setup().
-#
-# distutils-r1: Set within any of the python sub-phase functions.
-#
-# Example value:
-# @CODE
-# /usr/bin/python2.7
-# @CODE
-
-# @ECLASS_VARIABLE: EPYTHON
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# The executable name of the current Python interpreter.
-#
-# This variable is set automatically in the following contexts:
-#
-# python-r1: Set in functions called by python_foreach_impl() or after
-# calling python_setup().
-#
-# python-single-r1: Set after calling python-single-r1_pkg_setup().
-#
-# distutils-r1: Set within any of the python sub-phase functions.
-#
-# Example value:
-# @CODE
-# python2.7
-# @CODE
-
-# @FUNCTION: _python_export
-# @USAGE: [<impl>] <variables>...
-# @INTERNAL
-# @DESCRIPTION:
-# Set and export the Python implementation-relevant variables passed
-# as parameters.
-#
-# The optional first parameter may specify the requested Python
-# implementation (either as PYTHON_TARGETS value, e.g. python2_7,
-# or an EPYTHON one, e.g. python2.7). If no implementation passed,
-# the current one will be obtained from ${EPYTHON}.
-#
-# The variables which can be exported are: PYTHON, EPYTHON,
-# PYTHON_SITEDIR. They are described more completely in the eclass
-# variable documentation.
-_python_export() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local impl var
-
- case "${1}" in
- python*|jython*)
- impl=${1/_/.}
- shift
- ;;
- pypy|pypy3)
- impl=${1}
- shift
- ;;
- *)
- impl=${EPYTHON}
- if [[ -z ${impl} ]]; then
- die "_python_export called without a python implementation and EPYTHON is unset"
- fi
- ;;
- esac
- debug-print "${FUNCNAME}: implementation: ${impl}"
-
- for var; do
- case "${var}" in
- EPYTHON)
- export EPYTHON=${impl}
- debug-print "${FUNCNAME}: EPYTHON = ${EPYTHON}"
- ;;
- PYTHON)
- # Under EAPI 7+, this should just use ${BROOT}, but Portage
- # <3.0.50 was buggy, and prefix users need this to update.
- export PYTHON=${BROOT-${EPREFIX}}/usr/bin/${impl}
- 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=${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}/usr/bin/${impl}
- fi
- fi
- debug-print "${FUNCNAME}: PYTHON = ${PYTHON}"
- ;;
- PYTHON_STDLIB)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_STDLIB=$(
- "${PYTHON}" - "${EPREFIX}/usr" <<-EOF || die
- import sys, sysconfig
- print(sysconfig.get_path("stdlib", vars={"installed_base": sys.argv[1]}))
- EOF
- )
- export PYTHON_STDLIB
- debug-print "${FUNCNAME}: PYTHON_STDLIB = ${PYTHON_STDLIB}"
- ;;
- PYTHON_SITEDIR)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_SITEDIR=$(
- "${PYTHON}" - "${EPREFIX}/usr" <<-EOF || die
- import sys, sysconfig
- print(sysconfig.get_path("purelib", vars={"base": sys.argv[1]}))
- EOF
- )
- export PYTHON_SITEDIR
- debug-print "${FUNCNAME}: PYTHON_SITEDIR = ${PYTHON_SITEDIR}"
- ;;
- PYTHON_INCLUDEDIR)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_INCLUDEDIR=$(
- "${PYTHON}" - "${ESYSROOT}/usr" <<-EOF || die
- import sys, sysconfig
- print(sysconfig.get_path("platinclude", vars={"installed_platbase": sys.argv[1]}))
- EOF
- )
- export PYTHON_INCLUDEDIR
- debug-print "${FUNCNAME}: PYTHON_INCLUDEDIR = ${PYTHON_INCLUDEDIR}"
-
- # Jython gives a non-existing directory
- if [[ ! -d ${PYTHON_INCLUDEDIR} ]]; then
- die "${impl} does not install any header files!"
- fi
- ;;
- PYTHON_LIBPATH)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- PYTHON_LIBPATH=$(
- "${PYTHON}" - <<-EOF || die
- import os.path, sysconfig
- print(
- os.path.join(
- sysconfig.get_config_var("LIBDIR"),
- sysconfig.get_config_var("LDLIBRARY"))
- if sysconfig.get_config_var("LDLIBRARY")
- else "")
- EOF
- )
- export PYTHON_LIBPATH
- debug-print "${FUNCNAME}: PYTHON_LIBPATH = ${PYTHON_LIBPATH}"
-
- if [[ ! ${PYTHON_LIBPATH} ]]; then
- die "${impl} lacks a (usable) dynamic library"
- fi
- ;;
- PYTHON_CFLAGS)
- local val
-
- case "${impl}" in
- python*)
- # python-2.7, python-3.2, etc.
- val=$($(tc-getPKG_CONFIG) --cflags ${impl/n/n-}) || die
- ;;
- *)
- die "${impl}: obtaining ${var} not supported"
- ;;
- esac
-
- export PYTHON_CFLAGS=${val}
- debug-print "${FUNCNAME}: PYTHON_CFLAGS = ${PYTHON_CFLAGS}"
- ;;
- PYTHON_LIBS)
- local val
-
- case "${impl}" in
- python*)
- # python3.8+
- val=$($(tc-getPKG_CONFIG) --libs ${impl/n/n-}-embed) || die
- ;;
- *)
- die "${impl}: obtaining ${var} not supported"
- ;;
- esac
-
- export PYTHON_LIBS=${val}
- debug-print "${FUNCNAME}: PYTHON_LIBS = ${PYTHON_LIBS}"
- ;;
- PYTHON_CONFIG)
- local flags val
-
- case "${impl}" in
- python*)
- [[ -n ${PYTHON} ]] || die "PYTHON needs to be set for ${var} to be exported, or requested before it"
- flags=$(
- "${PYTHON}" - <<-EOF || die
- import sysconfig
- print(sysconfig.get_config_var("ABIFLAGS")
- or "")
- EOF
- )
- val=${PYTHON}${flags}-config
- ;;
- *)
- die "${impl}: obtaining ${var} not supported"
- ;;
- esac
-
- export PYTHON_CONFIG=${val}
- debug-print "${FUNCNAME}: PYTHON_CONFIG = ${PYTHON_CONFIG}"
- ;;
- PYTHON_PKG_DEP)
- local d
- case ${impl} in
- python*)
- PYTHON_PKG_DEP="dev-lang/python:${impl#python}"
- ;;
- pypy3)
- PYTHON_PKG_DEP="dev-python/${impl}:="
- ;;
- *)
- die "Invalid implementation: ${impl}"
- esac
-
- # use-dep
- if [[ ${PYTHON_REQ_USE} ]]; then
- PYTHON_PKG_DEP+=[${PYTHON_REQ_USE}]
- fi
-
- export PYTHON_PKG_DEP
- debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}"
- ;;
- PYTHON_SCRIPTDIR)
- local dir
- export PYTHON_SCRIPTDIR=${EPREFIX}/usr/lib/python-exec/${impl}
- 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_SCRIPTDIR=${BROOT-${PORTAGE_OVERRIDE_EPREFIX}}/usr/lib/python-exec/${impl}
- fi
- fi
- debug-print "${FUNCNAME}: PYTHON_SCRIPTDIR = ${PYTHON_SCRIPTDIR}"
- ;;
- *)
- die "_python_export: unknown variable ${var}"
- esac
- done
-}
-
-# @FUNCTION: python_get_stdlib
-# @USAGE: [<impl>]
-# @DESCRIPTION:
-# Obtain and print the 'stdlib' path for the given implementation. If no
-# implementation is provided, ${EPYTHON} will be used.
-python_get_stdlib() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_STDLIB
- echo "${PYTHON_STDLIB}"
-}
-
-# @FUNCTION: python_get_sitedir
-# @USAGE: [<impl>]
-# @DESCRIPTION:
-# Obtain and print the 'site-packages' path for the given
-# implementation. If no implementation is provided, ${EPYTHON} will
-# be used.
-python_get_sitedir() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_SITEDIR
- echo "${PYTHON_SITEDIR}"
-}
-
-# @FUNCTION: python_get_includedir
-# @USAGE: [<impl>]
-# @DESCRIPTION:
-# Obtain and print the include path for the given implementation. If no
-# implementation is provided, ${EPYTHON} will be used.
-python_get_includedir() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_INCLUDEDIR
- echo "${PYTHON_INCLUDEDIR}"
-}
-
-# @FUNCTION: python_get_library_path
-# @USAGE: [<impl>]
-# @DESCRIPTION:
-# Obtain and print the Python library path for the given implementation.
-# If no implementation is provided, ${EPYTHON} will be used.
-#
-# Please note that this function can be used with CPython only. Use
-# in another implementation will result in a fatal failure.
-python_get_library_path() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_LIBPATH
- echo "${PYTHON_LIBPATH}"
-}
-
-# @FUNCTION: python_get_CFLAGS
-# @USAGE: [<impl>]
-# @DESCRIPTION:
-# Obtain and print the compiler flags for building against Python,
-# for the given implementation. If no implementation is provided,
-# ${EPYTHON} will be used.
-#
-# Please note that this function can be used with CPython only.
-# It requires Python and pkg-config installed, and therefore proper
-# build-time dependencies need be added to the ebuild.
-python_get_CFLAGS() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_CFLAGS
- echo "${PYTHON_CFLAGS}"
-}
-
-# @FUNCTION: python_get_LIBS
-# @USAGE: [<impl>]
-# @DESCRIPTION:
-# Obtain and print the compiler flags for linking against Python,
-# for the given implementation. If no implementation is provided,
-# ${EPYTHON} will be used.
-#
-# Please note that this function can be used with CPython only.
-# It requires Python and pkg-config installed, and therefore proper
-# build-time dependencies need be added to the ebuild.
-python_get_LIBS() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_LIBS
- echo "${PYTHON_LIBS}"
-}
-
-# @FUNCTION: python_get_PYTHON_CONFIG
-# @USAGE: [<impl>]
-# @DESCRIPTION:
-# Obtain and print the PYTHON_CONFIG location for the given
-# implementation. If no implementation is provided, ${EPYTHON} will be
-# used.
-#
-# Please note that this function can be used with CPython only.
-# It requires Python installed, and therefore proper build-time
-# dependencies need be added to the ebuild.
-python_get_PYTHON_CONFIG() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_CONFIG
- echo "${PYTHON_CONFIG}"
-}
-
-# @FUNCTION: python_get_scriptdir
-# @USAGE: [<impl>]
-# @DESCRIPTION:
-# Obtain and print the script install path for the given
-# implementation. If no implementation is provided, ${EPYTHON} will
-# be used.
-python_get_scriptdir() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_export "${@}" PYTHON_SCRIPTDIR
- echo "${PYTHON_SCRIPTDIR}"
-}
-
-# @FUNCTION: python_optimize
-# @USAGE: [<directory>...]
-# @DESCRIPTION:
-# Compile and optimize Python modules in specified directories (absolute
-# paths). If no directories are provided, the default system paths
-# are used (prepended with ${D}).
-python_optimize() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
-
- local PYTHON=${PYTHON}
- [[ ${PYTHON} ]] || _python_export PYTHON
- [[ -x ${PYTHON} ]] || die "PYTHON (${PYTHON}) is not executable"
-
- # default to sys.path
- if [[ ${#} -eq 0 ]]; then
- local f
- while IFS= read -r -d '' f; do
- # 1) accept only absolute paths
- # (i.e. skip '', '.' or anything like that)
- # 2) skip paths which do not exist
- # (python2.6 complains about them verbosely)
-
- if [[ ${f} == /* && -d ${D%/}${f} ]]; then
- set -- "${D%/}${f}" "${@}"
- fi
- done < <(
- "${PYTHON}" - <<-EOF || die
- import sys
- print("".join(x + "\0" for x in sys.path))
- EOF
- )
-
- debug-print "${FUNCNAME}: using sys.path: ${*/%/;}"
- fi
-
- local jobs=$(makeopts_jobs)
- local d
- for d; do
- # make sure to get a nice path without //
- local instpath=${d#${D%/}}
- instpath=/${instpath##/}
-
- einfo "Optimize Python modules for ${instpath}"
- case "${EPYTHON}" in
- python3.8)
- # both levels of optimization are separate since 3.5
- "${PYTHON}" -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -O -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
- "${PYTHON}" -OO -m compileall -j "${jobs}" -q -f -d "${instpath}" "${d}"
- ;;
- python*|pypy3)
- # Python 3.9+
- "${PYTHON}" -m compileall -j "${jobs}" -o 0 -o 1 -o 2 --hardlink-dupes -q -f -d "${instpath}" "${d}"
- ;;
- pypy|jython2.7)
- "${PYTHON}" -m compileall -q -f -d "${instpath}" "${d}"
- ;;
- *)
- die "${FUNCNAME}: unexpected EPYTHON=${EPYTHON}"
- ;;
- esac
- done
-}
-
-# @FUNCTION: python_scriptinto
-# @USAGE: <new-path>
-# @DESCRIPTION:
-# Set the directory to which files passed to python_doexe(),
-# python_doscript(), python_newexe() and python_newscript()
-# are going to be installed. The new value needs to be relative
-# to the installation root (${ED}).
-#
-# If not set explicitly, the directory defaults to /usr/bin.
-#
-# Example:
-# @CODE
-# src_install() {
-# python_scriptinto /usr/sbin
-# python_foreach_impl python_doscript foo
-# }
-# @CODE
-python_scriptinto() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _PYTHON_SCRIPTROOT=${1}
-}
-
-# @FUNCTION: python_doexe
-# @USAGE: <files>...
-# @DESCRIPTION:
-# Install the given executables into the executable install directory,
-# for the current Python implementation (${EPYTHON}).
-#
-# The executable will be wrapped properly for the Python implementation,
-# though no shebang mangling will be performed.
-python_doexe() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EBUILD_PHASE} != install ]] &&
- die "${FUNCNAME} can only be used in src_install"
-
- local f
- for f; do
- python_newexe "${f}" "${f##*/}"
- done
-}
-
-# @FUNCTION: python_newexe
-# @USAGE: <path> <new-name>
-# @DESCRIPTION:
-# Install the given executable into the executable install directory,
-# for the current Python implementation (${EPYTHON}).
-#
-# The executable will be wrapped properly for the Python implementation,
-# though no shebang mangling will be performed. It will be renamed
-# to <new-name>.
-python_newexe() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EBUILD_PHASE} != install ]] &&
- die "${FUNCNAME} can only be used in src_install"
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
- [[ ${#} -eq 2 ]] || die "Usage: ${FUNCNAME} <path> <new-name>"
-
- local wrapd=${_PYTHON_SCRIPTROOT:-/usr/bin}
-
- local f=${1}
- local newfn=${2}
-
- local scriptdir=$(python_get_scriptdir)
- local d=${scriptdir#${EPREFIX}}
-
- (
- dodir "${wrapd}"
- exeopts -m 0755
- exeinto "${d}"
- newexe "${f}" "${newfn}" || return ${?}
- )
-
- # install the wrapper
- local dosym=dosym
- [[ ${EAPI} == 7 ]] && dosym=dosym8
- "${dosym}" -r /usr/lib/python-exec/python-exec2 "${wrapd}/${newfn}"
-
- # don't use this at home, just call python_doscript() instead
- if [[ ${_PYTHON_REWRITE_SHEBANG} ]]; then
- python_fix_shebang -q "${ED%/}/${d}/${newfn}"
- fi
-}
-
-# @FUNCTION: python_doscript
-# @USAGE: <files>...
-# @DESCRIPTION:
-# Install the given scripts into the executable install directory,
-# for the current Python implementation (${EPYTHON}).
-#
-# All specified files must start with a 'python' shebang. The shebang
-# will be converted, and the files will be wrapped properly
-# for the Python implementation.
-#
-# Example:
-# @CODE
-# src_install() {
-# python_foreach_impl python_doscript ${PN}
-# }
-# @CODE
-python_doscript() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EBUILD_PHASE} != install ]] &&
- die "${FUNCNAME} can only be used in src_install"
-
- local _PYTHON_REWRITE_SHEBANG=1
- python_doexe "${@}"
-}
-
-# @FUNCTION: python_newscript
-# @USAGE: <path> <new-name>
-# @DESCRIPTION:
-# Install the given script into the executable install directory
-# for the current Python implementation (${EPYTHON}), and name it
-# <new-name>.
-#
-# The file must start with a 'python' shebang. The shebang will be
-# converted, and the file will be wrapped properly for the Python
-# implementation. It will be renamed to <new-name>.
-#
-# Example:
-# @CODE
-# src_install() {
-# python_foreach_impl python_newscript foo.py foo
-# }
-# @CODE
-python_newscript() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EBUILD_PHASE} != install ]] &&
- die "${FUNCNAME} can only be used in src_install"
-
- local _PYTHON_REWRITE_SHEBANG=1
- python_newexe "${@}"
-}
-
-# @FUNCTION: python_moduleinto
-# @USAGE: <new-path>
-# @DESCRIPTION:
-# Set the Python module install directory for python_domodule().
-# The <new-path> can either be an absolute target system path (in which
-# case it needs to start with a slash, and ${ED} will be prepended to
-# it) or relative to the implementation's site-packages directory
-# (then it must not start with a slash). The relative path can be
-# specified either using the Python package notation (separated by dots)
-# or the directory notation (using slashes).
-#
-# When not set explicitly, the modules are installed to the top
-# site-packages directory.
-#
-# In the relative case, the exact path is determined directly
-# by each python_domodule invocation. Therefore, python_moduleinto
-# can be safely called before establishing the Python interpreter and/or
-# a single call can be used to set the path correctly for multiple
-# implementations, as can be seen in the following example.
-#
-# Example:
-# @CODE
-# src_install() {
-# python_moduleinto bar
-# # installs ${PYTHON_SITEDIR}/bar/baz.py
-# python_foreach_impl python_domodule baz.py
-# }
-# @CODE
-python_moduleinto() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _PYTHON_MODULEROOT=${1}
-}
-
-# @FUNCTION: python_domodule
-# @USAGE: <files>...
-# @DESCRIPTION:
-# Install the given modules (or packages) into the current Python module
-# installation directory. The list can mention both modules (files)
-# and packages (directories). All listed files will be installed
-# for all enabled implementations, and compiled afterwards.
-#
-# The files are installed into ${D} when run in src_install() phase.
-# Otherwise, they are installed into ${BUILD_DIR}/install location
-# that is suitable for picking up by distutils-r1 in PEP517 mode.
-#
-# Example:
-# @CODE
-# src_install() {
-# # (${PN} being a directory)
-# python_foreach_impl python_domodule ${PN}
-# }
-# @CODE
-python_domodule() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
-
- local d
- if [[ ${_PYTHON_MODULEROOT} == /* ]]; then
- # absolute path
- d=${_PYTHON_MODULEROOT}
- else
- # relative to site-packages
- local sitedir=$(python_get_sitedir)
- d=${sitedir#${EPREFIX}}/${_PYTHON_MODULEROOT//.//}
- fi
-
- if [[ ${EBUILD_PHASE} == install ]]; then
- (
- insopts -m 0644
- insinto "${d}"
- doins -r "${@}" || return ${?}
- )
- python_optimize "${ED%/}/${d}"
- elif [[ -n ${BUILD_DIR} ]]; then
- local dest=${BUILD_DIR}/install${EPREFIX}/${d}
- mkdir -p "${dest}" || die
- cp -pR "${@}" "${dest}/" || die
- (
- cd "${dest}" &&
- chmod -R a+rX "${@##*/}"
- ) || die
- else
- die "${FUNCNAME} can only be used in src_install or with BUILD_DIR set"
- fi
-}
-
-# @FUNCTION: python_doheader
-# @USAGE: <files>...
-# @DESCRIPTION:
-# Install the given headers into the implementation-specific include
-# directory. This function is unconditionally recursive, i.e. you can
-# pass directories instead of files.
-#
-# Example:
-# @CODE
-# src_install() {
-# python_foreach_impl python_doheader foo.h bar.h
-# }
-# @CODE
-python_doheader() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EBUILD_PHASE} != install ]] &&
- die "${FUNCNAME} can only be used in src_install"
- [[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
-
- local includedir=$(python_get_includedir)
- local d=${includedir#${ESYSROOT}}
-
- (
- insopts -m 0644
- insinto "${d}"
- doins -r "${@}" || return ${?}
- )
-}
-
-# @FUNCTION: _python_wrapper_setup
-# @USAGE: [<path> [<impl>]]
-# @INTERNAL
-# @DESCRIPTION:
-# Create proper 'python' executable and pkg-config wrappers
-# (if available) in the directory named by <path>. Set up PATH
-# and PKG_CONFIG_PATH appropriately. <path> defaults to ${T}/${EPYTHON}.
-#
-# The wrappers will be created for implementation named by <impl>,
-# or for one named by ${EPYTHON} if no <impl> passed.
-#
-# If the named directory contains a python symlink already, it will
-# be assumed to contain proper wrappers already and only environment
-# setup will be done. If wrapper update is requested, the directory
-# shall be removed first.
-_python_wrapper_setup() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local workdir=${1:-${T}/${EPYTHON}}
- local impl=${2:-${EPYTHON}}
-
- [[ ${workdir} ]] || die "${FUNCNAME}: no workdir specified."
- [[ ${impl} ]] || die "${FUNCNAME}: no impl nor EPYTHON specified."
-
- if [[ ! -x ${workdir}/bin/python ]]; then
- mkdir -p "${workdir}"/{bin,pkgconfig} || die
-
- # Clean up, in case we were supposed to do a cheap update.
- rm -f "${workdir}"/bin/python{,2,3}{,-config} || die
- rm -f "${workdir}"/bin/2to3 || die
- rm -f "${workdir}"/pkgconfig/python{2,3}{,-embed}.pc || die
-
- local EPYTHON PYTHON
- _python_export "${impl}" EPYTHON PYTHON
-
- # Python interpreter
- # note: we don't use symlinks because python likes to do some
- # symlink reading magic that breaks stuff
- # https://bugs.gentoo.org/show_bug.cgi?id=555752
- cat > "${workdir}/bin/python" <<-_EOF_ || die
- #!/bin/sh
- exec "${PYTHON}" "\${@}"
- _EOF_
- cp "${workdir}/bin/python" "${workdir}/bin/python3" || die
- chmod +x "${workdir}/bin/python" "${workdir}/bin/python3" || die
-
- local nonsupp=( python2 python2-config )
-
- # CPython-specific
- if [[ ${EPYTHON} == python* ]]; then
- cat > "${workdir}/bin/python-config" <<-_EOF_ || die
- #!/bin/sh
- exec "${PYTHON}-config" "\${@}"
- _EOF_
- cp "${workdir}/bin/python-config" \
- "${workdir}/bin/python3-config" || die
- chmod +x "${workdir}/bin/python-config" \
- "${workdir}/bin/python3-config" || die
-
- # Python 2.6+.
- ln -s "${PYTHON/python/2to3-}" "${workdir}"/bin/2to3 || die
-
- # Python 2.7+.
- ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}.pc \
- "${workdir}"/pkgconfig/python3.pc || die
-
- # Python 3.8+.
- ln -s "${EPREFIX}"/usr/$(get_libdir)/pkgconfig/${EPYTHON/n/n-}-embed.pc \
- "${workdir}"/pkgconfig/python3-embed.pc || die
- else
- nonsupp+=( 2to3 python-config python3-config )
- fi
-
- local x
- for x in "${nonsupp[@]}"; do
- cat >"${workdir}"/bin/${x} <<-_EOF_ || die
- #!/bin/sh
- echo "${ECLASS}: ${FUNCNAME}: ${x} is not supported by ${EPYTHON} (PYTHON_COMPAT)" >&2
- exit 127
- _EOF_
- chmod +x "${workdir}"/bin/${x} || die
- done
- fi
-
- # Now, set the environment.
- # But note that ${workdir} may be shared with something else,
- # and thus already on top of PATH.
- if [[ ${PATH##:*} != ${workdir}/bin ]]; then
- PATH=${workdir}/bin${PATH:+:${PATH}}
- fi
- if [[ ${PKG_CONFIG_PATH##:*} != ${workdir}/pkgconfig ]]; then
- PKG_CONFIG_PATH=${workdir}/pkgconfig${PKG_CONFIG_PATH:+:${PKG_CONFIG_PATH}}
- fi
- export PATH PKG_CONFIG_PATH
-}
-
-# @FUNCTION: python_fix_shebang
-# @USAGE: [-f|--force] [-q|--quiet] <path>...
-# @DESCRIPTION:
-# Replace the shebang in Python scripts with the full path
-# to the current Python implementation (PYTHON, including EPREFIX).
-# If a directory is passed, works recursively on all Python scripts
-# found inside the directory tree.
-#
-# Only files having a Python shebang (a path to any known Python
-# interpreter, optionally preceded by env(1) invocation) will
-# be processed. Files with any other shebang will either be skipped
-# silently when a directory was passed, or an error will be reported
-# for any files without Python shebangs specified explicitly.
-#
-# Shebangs that are compatible with the current Python version will be
-# mangled unconditionally. Incompatible shebangs will cause a fatal
-# error, unless --force is specified.
-#
-# --force causes the function to replace shebangs with incompatible
-# Python version (but not non-Python shebangs). --quiet causes
-# the function not to list modified files verbosely.
-python_fix_shebang() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${EPYTHON} ]] || die "${FUNCNAME}: EPYTHON unset (pkg_setup not called?)"
-
- local force quiet
- while [[ ${@} ]]; do
- case "${1}" in
- -f|--force) force=1; shift;;
- -q|--quiet) quiet=1; shift;;
- --) shift; break;;
- *) break;;
- esac
- done
-
- [[ ${1} ]] || die "${FUNCNAME}: no paths given"
-
- local path f
- for path; do
- local any_fixed is_recursive
-
- [[ -d ${path} ]] && is_recursive=1
-
- while IFS= read -r -d '' f; do
- local shebang i
- local error= match=
-
- # note: we can't ||die here since read will fail if file
- # has no newline characters
- IFS= read -r shebang <"${f}"
-
- # First, check if it's shebang at all...
- if [[ ${shebang} == '#!'* ]]; then
- local split_shebang=()
- read -r -a split_shebang <<<${shebang#"#!"} || die
-
- local in_path=${split_shebang[0]}
- local from='^#! *[^ ]*'
- # if the first component is env(1), skip it
- if [[ ${in_path} == */env ]]; then
- in_path=${split_shebang[1]}
- from+=' *[^ ]*'
- fi
-
- case ${in_path##*/} in
- "${EPYTHON}")
- match=1
- ;;
- python|python3)
- match=1
- ;;
- python2|python[23].[0-9]|python3.[1-9][0-9]|pypy|pypy3|jython[23].[0-9])
- # Explicit mismatch.
- match=1
- error=1
- ;;
- esac
- fi
-
- # disregard mismatches in force mode
- [[ ${force} ]] && error=
-
- if [[ ! ${match} ]]; then
- # Non-Python shebang. Allowed in recursive mode,
- # disallowed when specifying file explicitly.
- [[ ${is_recursive} ]] && continue
- error=1
- fi
-
- if [[ ! ${quiet} ]]; then
- einfo "Fixing shebang in ${f#${D%/}}."
- fi
-
- if [[ ! ${error} ]]; then
- debug-print "${FUNCNAME}: in file ${f#${D%/}}"
- debug-print "${FUNCNAME}: rewriting shebang: ${shebang}"
- sed -i -e "1s@${from}@#!${EPREFIX}/usr/bin/${EPYTHON}@" "${f}" || die
- any_fixed=1
- else
- eerror "The file has incompatible shebang:"
- eerror " file: ${f#${D%/}}"
- eerror " current shebang: ${shebang}"
- eerror " requested impl: ${EPYTHON}"
- die "${FUNCNAME}: conversion of incompatible shebang requested"
- fi
- done < <(find -H "${path}" -type f -print0 || die)
-
- if [[ ! ${any_fixed} ]]; then
- eerror "QA error: ${FUNCNAME}, ${path#${D%/}} did not match any fixable files."
- eerror "There are no Python files in specified directory."
- die "${FUNCNAME} did not match any fixable files"
- fi
- done
-}
-
-# @FUNCTION: _python_check_locale_sanity
-# @USAGE: <locale>
-# @RETURN: 0 if sane, 1 otherwise
-# @INTERNAL
-# @DESCRIPTION:
-# Check whether the specified locale sanely maps between lowercase
-# and uppercase ASCII characters.
-_python_check_locale_sanity() {
- local -x LC_ALL=${1}
- local IFS=
-
- local lc=( {a..z} )
- local uc=( {A..Z} )
- local input="${lc[*]}${uc[*]}"
-
- local output=$(tr '[:lower:][:upper:]' '[:upper:][:lower:]' <<<"${input}")
- [[ ${output} == "${uc[*]}${lc[*]}" ]]
-}
-
-# @FUNCTION: python_export_utf8_locale
-# @RETURN: 0 on success, 1 on failure.
-# @DESCRIPTION:
-# Attempts to export a usable UTF-8 locale in the LC_CTYPE variable. Does
-# nothing if LC_ALL is defined, or if the current locale uses a UTF-8 charmap.
-# This may be used to work around the quirky open() behavior of python3.
-python_export_utf8_locale() {
- debug-print-function ${FUNCNAME} "${@}"
-
- # If the locale program isn't available, just return.
- type locale &>/dev/null || return 0
-
- if [[ $(locale charmap) != UTF-8 ]]; then
- # Try English first, then everything else.
- local lang locales="C.UTF-8 en_US.UTF-8 en_GB.UTF-8 $(locale -a)"
-
- for lang in ${locales}; do
- if [[ $(LC_ALL=${lang} locale charmap 2>/dev/null) == UTF-8 ]]; then
- if _python_check_locale_sanity "${lang}"; then
- export LC_CTYPE=${lang}
- if [[ -n ${LC_ALL} ]]; then
- export LC_NUMERIC=${LC_ALL}
- export LC_TIME=${LC_ALL}
- export LC_COLLATE=${LC_ALL}
- export LC_MONETARY=${LC_ALL}
- export LC_MESSAGES=${LC_ALL}
- export LC_PAPER=${LC_ALL}
- export LC_NAME=${LC_ALL}
- export LC_ADDRESS=${LC_ALL}
- export LC_TELEPHONE=${LC_ALL}
- export LC_MEASUREMENT=${LC_ALL}
- export LC_IDENTIFICATION=${LC_ALL}
- export LC_ALL=
- fi
- return 0
- fi
- fi
- done
-
- ewarn "Could not find a UTF-8 locale. This may trigger build failures in"
- ewarn "some python packages. Please ensure that a UTF-8 locale is listed in"
- ewarn "/etc/locale.gen and run locale-gen."
- return 1
- fi
-
- return 0
-}
-
-# @FUNCTION: build_sphinx
-# @USAGE: <directory>
-# @DESCRIPTION:
-# Build HTML documentation using dev-python/sphinx in the specified
-# <directory>. Takes care of disabling Intersphinx and appending
-# to HTML_DOCS.
-#
-# If <directory> is relative to the current directory, care needs
-# to be taken to run einstalldocs from the same directory
-# (usually ${S}).
-build_sphinx() {
- debug-print-function ${FUNCNAME} "${@}"
- [[ ${#} -eq 1 ]] || die "${FUNCNAME} takes 1 arg: <directory>"
-
- local dir=${1}
-
- sed -i -e 's:^intersphinx_mapping:disabled_&:' \
- "${dir}"/conf.py || die
- # 1. not all packages include the Makefile in pypi tarball,
- # so we call sphinx-build directly
- # 2. if autodoc is used, we need to call sphinx via EPYTHON,
- # to ensure that PEP 517 venv is respected
- # 3. if autodoc is not used, then sphinx might not be installed
- # for the current impl, so we need a fallback to sphinx-build
- local command=( "${EPYTHON}" -m sphinx.cmd.build )
- if ! "${EPYTHON}" -c "import sphinx.cmd.build" 2>/dev/null; then
- command=( sphinx-build )
- fi
- command+=(
- -b html
- -d "${dir}"/_build/doctrees
- "${dir}"
- "${dir}"/_build/html
- )
- echo "${command[@]}" >&2
- "${command[@]}" || die
-
- HTML_DOCS+=( "${dir}/_build/html/." )
-}
-
-# @FUNCTION: _python_check_EPYTHON
-# @INTERNAL
-# @DESCRIPTION:
-# Check if EPYTHON is set, die if not.
-_python_check_EPYTHON() {
- if [[ -z ${EPYTHON} ]]; then
- die "EPYTHON unset, invalid call context"
- fi
-}
-
-# @FUNCTION: _python_check_occluded_packages
-# @INTERNAL
-# @DESCRIPTION:
-# Check if the current directory does not contain any incomplete
-# package sources that would block installed packages from being used
-# (and effectively e.g. make it impossible to load compiled extensions).
-_python_check_occluded_packages() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ -z ${BUILD_DIR} || ! -d ${BUILD_DIR}/install ]] && return
-
- local sitedir="${BUILD_DIR}/install$(python_get_sitedir)"
- # avoid unnecessarily checking if we are inside install dir
- [[ ${sitedir} -ef . ]] && return
-
- local f fn diff l
- for f in "${sitedir}"/*/; do
- f=${f%/}
- fn=${f##*/}
-
- # skip metadata directories
- [[ ${fn} == *.dist-info || ${fn} == *.egg-info ]] && continue
-
- if [[ -d ${fn} ]]; then
- diff=$(
- comm -1 -3 <(
- find "${fn}" -type f -not -path '*/__pycache__/*' |
- sort
- assert
- ) <(
- cd "${sitedir}" &&
- find "${fn}" -type f -not -path '*/__pycache__/*' |
- sort
- assert
- )
- )
-
- if [[ -n ${diff} ]]; then
- eqawarn "The directory ${fn} occludes package installed for ${EPYTHON}."
- eqawarn "The installed package includes additional files:"
- eqawarn
- while IFS= read -r l; do
- eqawarn " ${l}"
- done <<<"${diff}"
- eqawarn
-
- if [[ ! ${_PYTHON_WARNED_OCCLUDED_PACKAGES} ]]; then
- eqawarn "For more information on occluded packages, please see:"
- eqawarn "https://projects.gentoo.org/python/guide/test.html#importerrors-for-c-extensions"
- _PYTHON_WARNED_OCCLUDED_PACKAGES=1
- fi
- fi
- fi
- done
-}
-
-# @VARIABLE: EPYTEST_DESELECT
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Specifies an array of tests to be deselected via pytest's --deselect
-# parameter, when calling epytest. The list can include file paths,
-# specific test functions or parametrized test invocations.
-#
-# Note that the listed files will still be subject to collection,
-# i.e. modules imported in global scope will need to be available.
-# If this is undesirable, EPYTEST_IGNORE can be used instead.
-
-# @VARIABLE: EPYTEST_IGNORE
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Specifies an array of paths to be ignored via pytest's --ignore
-# parameter, when calling epytest. The listed files will be entirely
-# skipped from test collection.
-
-# @ECLASS_VARIABLE: EPYTEST_TIMEOUT
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# If set to a non-empty value, enables pytest-timeout plugin and sets
-# test timeout to the specified value. This variable can be either set
-# in ebuilds that are known to hang, or by user to prevent hangs
-# in automated test environments. If this variable is set prior
-# to calling distutils_enable_tests in distutils-r1, a test dependency
-# on dev-python/pytest-timeout is added automatically.
-
-# @ECLASS_VARIABLE: EPYTEST_XDIST
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# If set to a non-empty value, enables running tests in parallel
-# via pytest-xdist plugin. If this variable is set prior to calling
-# distutils_enable_tests in distutils-r1, a test dependency
-# on dev-python/pytest-xdist is added automatically.
-
-# @ECLASS_VARIABLE: EPYTEST_JOBS
-# @USER_VARIABLE
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Specifies the number of jobs for parallel (pytest-xdist) test runs.
-# When unset, defaults to -j from MAKEOPTS, or the current nproc.
-
-# @ECLASS_VARIABLE: EPYTEST_FLAGS
-# @USER_VARIABLE
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Additional flags to pass to pytest. This is intended to be set
-# in the environment when debugging packages (options such as -x or -s
-# are useful here), rather than globally. It must not be set
-# in ebuilds.
-
-# @FUNCTION: epytest
-# @USAGE: [<args>...]
-# @DESCRIPTION:
-# Run pytest, passing the standard set of pytest options, then
-# --deselect and --ignore options based on EPYTEST_DESELECT
-# and EPYTEST_IGNORE, then user-specified options.
-#
-# This command dies on failure and respects nonfatal.
-epytest() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_check_EPYTHON
- _python_check_occluded_packages
-
- local color=yes
- [[ ${NO_COLOR} ]] && color=no
-
- local args=(
- # verbose progress reporting and tracebacks
- -vv
- # list all non-passed tests in the summary for convenience
- # (includes failures, skips, xfails...)
- -ra
- # print local variables in tracebacks, useful for debugging
- -l
- # override filterwarnings=error, we do not really want -Werror
- # for end users, as it tends to fail on new warnings from deps
- -Wdefault
- # however, do error out if the package failed to load
- # an appropriate async plugin
- -Werror::pytest.PytestUnhandledCoroutineWarning
- # override color output
- "--color=${color}"
- # count is more precise when we're dealing with a large number
- # of tests
- -o console_output_style=count
- # minimize the temporary directory retention, the test suites
- # of some packages can grow them pretty large and normally
- # we don't need to preserve them
- -o tmp_path_retention_count=0
- -o tmp_path_retention_policy=failed
- )
-
- if [[ ! ${PYTEST_DISABLE_PLUGIN_AUTOLOAD} ]]; then
- args+=(
- # disable the undesirable-dependency plugins by default to
- # trigger missing argument strips. strip options that require
- # them from config files. enable them explicitly via "-p ..."
- # if you *really* need them.
- -p no:cov
- -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
- # pytest-sugar undoes everything that's good about pytest output
- # and makes it hard to read logs
- -p no:sugar
- # pytest-xvfb automatically spawns Xvfb for every test suite,
- # effectively forcing it even when we'd prefer the tests
- # not to have DISPLAY at all, causing crashes sometimes
- # and causing us to miss missing virtualx usage
- -p no:xvfb
- # intrusive packages that break random test suites
- -p no:pytest-describe
- -p no:plus
- -p no:tavern
- # does something to logging
- -p no:salt-factories
- )
- fi
-
- if [[ -n ${EPYTEST_TIMEOUT} ]]; then
- if [[ ${PYTEST_PLUGINS} != *pytest_timeout* ]]; then
- args+=(
- -p timeout
- )
- fi
-
- args+=(
- "--timeout=${EPYTEST_TIMEOUT}"
- )
- fi
-
- if [[ ${EPYTEST_XDIST} ]]; then
- local jobs=${EPYTEST_JOBS:-$(makeopts_jobs)}
- if [[ ${jobs} -gt 1 ]]; then
- if [[ ${PYTEST_PLUGINS} != *xdist.plugin* ]]; then
- args+=(
- # explicitly enable the plugin, in case the ebuild was
- # using PYTEST_DISABLE_PLUGIN_AUTOLOAD=1
- -p xdist
- )
- fi
- args+=(
- -n "${jobs}"
- # worksteal ensures that workers don't end up idle when heavy
- # jobs are unevenly distributed
- --dist=worksteal
- )
- fi
- fi
-
- local x
- for x in "${EPYTEST_DESELECT[@]}"; do
- args+=( --deselect "${x}" )
- done
- for x in "${EPYTEST_IGNORE[@]}"; do
- args+=( --ignore "${x}" )
- done
- set -- "${EPYTHON}" -m pytest "${args[@]}" "${@}" ${EPYTEST_FLAGS}
-
- echo "${@}" >&2
- "${@}"
- local ret=${?}
-
- # remove common temporary directories left over by pytest plugins
- rm -rf .hypothesis .pytest_cache || die
- # pytest plugins create additional .pyc files while testing
- # see e.g. https://bugs.gentoo.org/847235
- if [[ -n ${BUILD_DIR} && -d ${BUILD_DIR} ]]; then
- find "${BUILD_DIR}" -name '*-pytest-*.pyc' -delete || die
- fi
-
- [[ ${ret} -ne 0 ]] && die -n "pytest failed with ${EPYTHON}"
- return ${ret}
-}
-
-# @FUNCTION: eunittest
-# @USAGE: [<args>...]
-# @DESCRIPTION:
-# Run unit tests using dev-python/unittest-or-fail, passing the standard
-# set of options, followed by user-specified options.
-#
-# This command dies on failure and respects nonfatal.
-eunittest() {
- debug-print-function ${FUNCNAME} "${@}"
-
- _python_check_EPYTHON
- _python_check_occluded_packages
-
- # unittest fails with "no tests" correctly since Python 3.12
- local runner=unittest
- if _python_impl_matches "${EPYTHON}" 3.{9..11}; then
- runner=unittest_or_fail
- fi
- set -- "${EPYTHON}" -m "${runner}" discover -v "${@}"
-
- echo "${@}" >&2
- "${@}" || die -n "Tests failed with ${EPYTHON}"
- return ${?}
-}
-
-# @FUNCTION: _python_run_check_deps
-# @INTERNAL
-# @USAGE: <impl>
-# @DESCRIPTION:
-# Verify whether <impl> is an acceptable choice to run any-r1 style
-# code. Checks whether the interpreter is installed, runs
-# python_check_deps() if declared.
-_python_run_check_deps() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local impl=${1}
-
- einfo "Checking whether ${impl} is suitable ..."
-
- local PYTHON_PKG_DEP
- _python_export "${impl}" PYTHON_PKG_DEP
- ebegin " ${PYTHON_PKG_DEP}"
- has_version -b "${PYTHON_PKG_DEP}"
- eend ${?} || return 1
- declare -f python_check_deps >/dev/null || return 0
-
- local PYTHON_USEDEP="python_targets_${impl}(-)"
- local PYTHON_SINGLE_USEDEP="python_single_target_${impl}(-)"
- ebegin " python_check_deps"
- python_check_deps
- eend ${?}
-}
-
-# @FUNCTION: python_has_version
-# @USAGE: [-b|-d|-r] <atom>...
-# @DESCRIPTION:
-# A convenience wrapper for has_version() with verbose output and better
-# defaults for use in python_check_deps().
-#
-# The wrapper accepts -b/-d/-r options to indicate the root to perform
-# the lookup on. Unlike has_version, the default is -b.
-#
-# The wrapper accepts multiple package specifications. For the check
-# to succeed, *all* specified atoms must match.
-python_has_version() {
- debug-print-function ${FUNCNAME} "${@}"
-
- local root_arg=( -b )
- case ${1} in
- -b|-d|-r)
- root_arg=( "${1}" )
- shift
- ;;
- esac
-
- local pkg
- for pkg; do
- ebegin " ${pkg}"
- has_version "${root_arg[@]}" "${pkg}"
- eend ${?} || return
- done
-
- return 0
-}
-
-# @FUNCTION: _python_sanity_checks
-# @INTERNAL
-# @DESCRIPTION:
-# Perform additional environment sanity checks.
-_python_sanity_checks() {
- debug-print-function ${FUNCNAME} "${@}"
-
- [[ ${_PYTHON_SANITY_CHECKED} ]] && return
-
- if [[ -v PYTHONPATH ]]; then
- local x paths=()
- mapfile -d ':' -t paths <<<${PYTHONPATH}
-
- for x in "${paths[@]}"; do
- if [[ ${x} != /* ]]; then
- eerror "Relative path found in PYTHONPATH:"
- eerror
- eerror " PYTHONPATH=${PYTHONPATH@Q}"
- eerror
- eerror "This is guaranteed to cause random breakage. Please make sure that"
- eerror "your PYTHONPATH contains absolute paths only (and only if necessary)."
- eerror "Note that empty values (including ':' at either end and an empty"
- eerror "PYTHONPATH) count as the current directory. If no PYTHONPATH"
- eerror "is intended, it needs to be unset instead."
- die "Relative paths in PYTHONPATH are forbidden: ${x@Q}"
- fi
- done
-
- elog "PYTHONPATH=${PYTHONPATH@Q}"
- fi
-
- _PYTHON_SANITY_CHECKED=1
-}
-
-fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-08-09 9:25 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-08-09 9:25 UTC (permalink / raw
To: gentoo-commits
commit: 27820f83ce65166c1bcec65cb35e9e17fcc2ff5e
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Aug 9 09:23:43 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Aug 9 09:23:43 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=27820f83
eclass/toolchain-funcs: return arch from tc-ninja_magic_to_arch
For some reason Prefix has been returning whole keywords, but this
doesn't seem to work very well on consumer, such as go-env.eclass
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain-funcs.eclass | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 5338dc6509..156e659aa3 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -653,15 +653,7 @@ tc-ninja_magic_to_arch() {
[[ -z ${host} ]] && host=${CTARGET:-${CHOST}}
case ${host} in
- powerpc-apple-darwin*) echo ppc-macos;;
- x86_64-apple-darwin*) echo x64-macos;;
- arm64-apple-darwin*) echo arm64-macos;;
- sparc-sun-solaris*) echo sparc-solaris;;
- sparcv9-sun-solaris*) echo sparc64-solaris;;
- i?86-pc-solaris*) echo x86-solaris;;
- x86_64-pc-solaris*) echo x64-solaris;;
- i?86-pc-winnt*) echo x86-winnt;;
-
+ arm64*) echo arm64;;
aarch64*) echo arm64;;
alpha*) echo alpha;;
arc*) echo arc;;
@@ -709,6 +701,7 @@ tc-ninja_magic_to_arch() {
score*) echo score;;
sh64*) _tc_echo_kernel_alias sh64 sh;;
sh*) echo sh;;
+ sparcv9*) echo sparc64;;
sparc64*) _tc_echo_kernel_alias sparc64 sparc;;
sparc*) [[ ${PROFILE_ARCH} == "sparc64" ]] \
&& _tc_echo_kernel_alias sparc64 sparc \
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-08-10 10:48 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-08-10 10:48 UTC (permalink / raw
To: gentoo-commits
commit: 5beccb25160494deedb1112b34b2c51e5ac7bd21
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 10 10:47:49 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Aug 10 10:47:49 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=5beccb25
eclass/toolchain-funcs: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain-funcs.eclass | 32 +++++++++++++++++---------------
1 file changed, 17 insertions(+), 15 deletions(-)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
index 156e659aa3..a39b9c6111 100644
--- a/eclass/toolchain-funcs.eclass
+++ b/eclass/toolchain-funcs.eclass
@@ -665,16 +665,7 @@ tc-ninja_magic_to_arch() {
frv*) echo frv;;
hexagon*) echo hexagon;;
hppa*) _tc_echo_kernel_alias parisc hppa;;
- i?86*)
- # Starting with linux-2.6.24, the 'x86_64' and 'i386'
- # trees have been unified into 'x86'.
- # FreeBSD still uses i386
- if [[ ${type} == "kern" && ${host} == *freebsd* ]] ; then
- echo i386
- else
- echo x86
- fi
- ;;
+ i?86*) echo x86;;
ia64*) echo ia64;;
loongarch*) _tc_echo_kernel_alias loongarch loong;;
m68*) echo m68k;;
@@ -1062,8 +1053,7 @@ gen_usr_ldscript() {
case ${CTARGET:-${CHOST}} in
*-darwin*) ;;
*-android*) return 0 ;;
- *linux*|*-freebsd*|*-openbsd*|*-netbsd*)
- use prefix && return 0 ;;
+ *linux*) use prefix && return 0 ;;
*) return 0 ;;
esac
@@ -1255,6 +1245,7 @@ tc-get-build-ptr-size() {
# @RETURN: Shell true if we are using LTO, shell false otherwise
tc-is-lto() {
local f="${T}/test-lto.o"
+ local ret=1
case $(tc-get-compiler-type) in
clang)
@@ -1262,14 +1253,25 @@ tc-is-lto() {
# If LTO is used, clang will output bytecode and llvm-bcanalyzer
# will run successfully. Otherwise, it will output plain object
# file and llvm-bcanalyzer will exit with error.
- llvm-bcanalyzer "${f}" &>/dev/null && return 0
+ llvm-bcanalyzer "${f}" &>/dev/null && ret=0
;;
gcc)
$(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<<"" || die
- [[ $($(tc-getREADELF) -S "${f}") == *.gnu.lto* ]] && return 0
+ [[ $($(tc-getREADELF) -S "${f}") == *.gnu.lto* ]] && ret=0
;;
esac
- return 1
+ rm -f "${f}" || die
+ return "${ret}"
+}
+
+# @FUNCTION: tc-has-64bit-time_t
+# @RETURN: Shell true if time_t is at least 64 bits long, false otherwise
+tc-has-64bit-time_t() {
+ $(tc-getCC) ${CFLAGS} ${CPPFLAGS} -c -x c - -o /dev/null <<-EOF &>/dev/null
+ #include <sys/types.h>
+ int test[sizeof(time_t) >= 8 ? 1 : -1];
+ EOF
+ return $?
}
fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-08-10 14:24 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-08-10 14:24 UTC (permalink / raw
To: gentoo-commits
commit: 6327d79a8cc29d35138f51110c6fb63680c15a40
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 10 14:06:40 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Aug 10 14:06:40 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=6327d79a
eclass/toolchain-funcs: use gx86 version
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain-funcs.eclass | 1277 -----------------------------------------
1 file changed, 1277 deletions(-)
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
deleted file mode 100644
index a39b9c6111..0000000000
--- a/eclass/toolchain-funcs.eclass
+++ /dev/null
@@ -1,1277 +0,0 @@
-# Copyright 2002-2024 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-# @ECLASS: toolchain-funcs.eclass
-# @MAINTAINER:
-# Toolchain Ninjas <toolchain@gentoo.org>
-# @SUPPORTED_EAPIS: 6 7 8
-# @BLURB: functions to query common info about the toolchain
-# @DESCRIPTION:
-# The toolchain-funcs aims to provide a complete suite of functions
-# for gleaning useful information about the toolchain and to simplify
-# ugly things like cross-compiling and multilib. All of this is done
-# in such a way that you can rely on the function always returning
-# something sane.
-
-case ${EAPI} in
- 6|7|8) ;;
- *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
-esac
-
-if [[ -z ${_TOOLCHAIN_FUNCS_ECLASS} ]]; then
-_TOOLCHAIN_FUNCS_ECLASS=1
-
-inherit multilib prefix
-
-# tc-getPROG <VAR [search vars]> <default> [tuple]
-_tc-getPROG() {
- local tuple=$1
- local v var vars=$2
- local prog=( $3 )
-
- var=${vars%% *}
- for v in ${vars} ; do
- if [[ -n ${!v} ]] ; then
- export ${var}="${!v}"
- echo "${!v}"
- return 0
- fi
- done
-
- local search=
- [[ -n $4 ]] && search=$(type -p $4-${prog[0]})
- [[ -z ${search} && -n ${!tuple} ]] && search=$(type -p ${!tuple}-${prog[0]})
- [[ -n ${search} ]] && prog[0]=${search##*/}
-
- export ${var}="${prog[*]}"
- echo "${!var}"
-}
-tc-getBUILD_PROG() {
- local vars="BUILD_$1 $1_FOR_BUILD HOST$1"
- # respect host vars if not cross-compiling
- # https://bugs.gentoo.org/630282
- tc-is-cross-compiler || vars+=" $1"
- _tc-getPROG CBUILD "${vars}" "${@:2}"
-}
-tc-getPROG() { _tc-getPROG CHOST "$@"; }
-
-# @FUNCTION: tc-getAR
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the archiver
-tc-getAR() { tc-getPROG AR ar "$@"; }
-# @FUNCTION: tc-getAS
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the assembler
-tc-getAS() { tc-getPROG AS as "$@"; }
-# @FUNCTION: tc-getCC
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the C compiler
-tc-getCC() { tc-getPROG CC gcc "$@"; }
-# @FUNCTION: tc-getCPP
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the C preprocessor
-tc-getCPP() { tc-getPROG CPP "${CC:-gcc} -E" "$@"; }
-# @FUNCTION: tc-getCXX
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the C++ compiler
-tc-getCXX() { tc-getPROG CXX g++ "$@"; }
-# @FUNCTION: tc-getLD
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the linker
-tc-getLD() { tc-getPROG LD ld "$@"; }
-# @FUNCTION: tc-getSTRINGS
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the strings program
-tc-getSTRINGS() { tc-getPROG STRINGS strings "$@"; }
-# @FUNCTION: tc-getSTRIP
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the strip program
-tc-getSTRIP() { tc-getPROG STRIP strip "$@"; }
-# @FUNCTION: tc-getNM
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the symbol/object thingy
-tc-getNM() { tc-getPROG NM nm "$@"; }
-# @FUNCTION: tc-getRANLIB
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the archive indexer
-tc-getRANLIB() { tc-getPROG RANLIB ranlib "$@"; }
-# @FUNCTION: tc-getREADELF
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the ELF reader
-tc-getREADELF() { tc-getPROG READELF readelf "$@"; }
-# @FUNCTION: tc-getOBJCOPY
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the object copier
-tc-getOBJCOPY() { tc-getPROG OBJCOPY objcopy "$@"; }
-# @FUNCTION: tc-getOBJDUMP
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the object dumper
-tc-getOBJDUMP() { tc-getPROG OBJDUMP objdump "$@"; }
-# @FUNCTION: tc-getF77
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the Fortran 77 compiler
-tc-getF77() { tc-getPROG F77 gfortran "$@"; }
-# @FUNCTION: tc-getFC
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the Fortran 90 compiler
-tc-getFC() { tc-getPROG FC gfortran "$@"; }
-# @FUNCTION: tc-getGCJ
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the java compiler
-tc-getGCJ() { tc-getPROG GCJ gcj "$@"; }
-# @FUNCTION: tc-getGO
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the Go compiler
-tc-getGO() { tc-getPROG GO gccgo "$@"; }
-# @FUNCTION: tc-getPKG_CONFIG
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the pkg-config tool
-tc-getPKG_CONFIG() { tc-getPROG PKG_CONFIG pkg-config "$@"; }
-# @FUNCTION: tc-getRC
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the Windows resource compiler
-tc-getRC() { tc-getPROG RC windres "$@"; }
-# @FUNCTION: tc-getDLLWRAP
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the Windows dllwrap utility
-tc-getDLLWRAP() { tc-getPROG DLLWRAP dllwrap "$@"; }
-
-# @FUNCTION: tc-getBUILD_AR
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the archiver for building binaries to run on the build machine
-tc-getBUILD_AR() { tc-getBUILD_PROG AR ar "$@"; }
-# @FUNCTION: tc-getBUILD_AS
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the assembler for building binaries to run on the build machine
-tc-getBUILD_AS() { tc-getBUILD_PROG AS as "$@"; }
-# @FUNCTION: tc-getBUILD_CC
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the C compiler for building binaries to run on the build machine
-tc-getBUILD_CC() { tc-getBUILD_PROG CC gcc "$@"; }
-# @FUNCTION: tc-getBUILD_CPP
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the C preprocessor for building binaries to run on the build machine
-tc-getBUILD_CPP() { tc-getBUILD_PROG CPP "$(tc-getBUILD_CC) -E" "$@"; }
-# @FUNCTION: tc-getBUILD_CXX
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the C++ compiler for building binaries to run on the build machine
-tc-getBUILD_CXX() { tc-getBUILD_PROG CXX g++ "$@"; }
-# @FUNCTION: tc-getBUILD_LD
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the linker for building binaries to run on the build machine
-tc-getBUILD_LD() { tc-getBUILD_PROG LD ld "$@"; }
-# @FUNCTION: tc-getBUILD_STRINGS
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the strings program for building binaries to run on the build machine
-tc-getBUILD_STRINGS() { tc-getBUILD_PROG STRINGS strings "$@"; }
-# @FUNCTION: tc-getBUILD_STRIP
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the strip program for building binaries to run on the build machine
-tc-getBUILD_STRIP() { tc-getBUILD_PROG STRIP strip "$@"; }
-# @FUNCTION: tc-getBUILD_NM
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the symbol/object thingy for building binaries to run on the build machine
-tc-getBUILD_NM() { tc-getBUILD_PROG NM nm "$@"; }
-# @FUNCTION: tc-getBUILD_RANLIB
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the archive indexer for building binaries to run on the build machine
-tc-getBUILD_RANLIB() { tc-getBUILD_PROG RANLIB ranlib "$@"; }
-# @FUNCTION: tc-getBUILD_READELF
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the ELF reader for building binaries to run on the build machine
-tc-getBUILD_READELF() { tc-getBUILD_PROG READELF readelf "$@"; }
-# @FUNCTION: tc-getBUILD_OBJCOPY
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the object copier for building binaries to run on the build machine
-tc-getBUILD_OBJCOPY() { tc-getBUILD_PROG OBJCOPY objcopy "$@"; }
-# @FUNCTION: tc-getBUILD_PKG_CONFIG
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the pkg-config tool for building binaries to run on the build machine
-tc-getBUILD_PKG_CONFIG() { tc-getBUILD_PROG PKG_CONFIG pkg-config "$@"; }
-
-# @FUNCTION: tc-getTARGET_CPP
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the C preprocessor for the toolchain being built (or used)
-tc-getTARGET_CPP() {
- if [[ -n ${CTARGET} ]]; then
- _tc-getPROG CTARGET TARGET_CPP "gcc -E" "$@"
- else
- tc-getCPP "$@"
- fi
-}
-
-# @FUNCTION: tc-export
-# @USAGE: <list of toolchain variables>
-# @DESCRIPTION:
-# Quick way to export a bunch of compiler vars at once.
-tc-export() {
- local var
- for var in "$@" ; do
- [[ $(type -t "tc-get${var}") != "function" ]] && die "tc-export: invalid export variable '${var}'"
- "tc-get${var}" > /dev/null
- done
-}
-
-# @FUNCTION: tc-is-cross-compiler
-# @RETURN: Shell true if we are using a cross-compiler, shell false otherwise
-tc-is-cross-compiler() {
- [[ ${CBUILD:-${CHOST}} != ${CHOST} ]]
-}
-
-# @FUNCTION: tc-cpp-is-true
-# @USAGE: <condition> [cpp flags]
-# @RETURN: Shell true if the condition is true, shell false otherwise.
-# @DESCRIPTION:
-# Evaluate the given condition using the C preprocessor for CTARGET, if
-# defined, or CHOST. Additional arguments are passed through to the cpp
-# command. A typical condition would be in the form defined(__FOO__).
-tc-cpp-is-true() {
- local CONDITION=${1}
- shift
-
- $(tc-getTARGET_CPP) "${@}" -P - <<-EOF >/dev/null 2>&1
- #if ${CONDITION}
- true
- #else
- #error false
- #endif
- EOF
-}
-
-# @FUNCTION: tc-detect-is-softfloat
-# @RETURN: Shell true if detection was possible, shell false otherwise
-# @DESCRIPTION:
-# Detect whether the CTARGET (or CHOST) toolchain is a softfloat based
-# one by examining the toolchain's output, if possible. Outputs a value
-# alike tc-is-softfloat if detection was possible.
-tc-detect-is-softfloat() {
- # If fetching CPP falls back to the default (gcc -E) then fail
- # detection as this may not be the correct toolchain.
- [[ $(tc-getTARGET_CPP) == "gcc -E" ]] && return 1
-
- case ${CTARGET:-${CHOST}} in
- # Avoid autodetection for bare-metal targets. bug #666896
- *-newlib|*-elf|*-eabi|arm64-apple-darwin*)
- return 1 ;;
-
- # arm-unknown-linux-gnueabi is ambiguous. We used to treat it as
- # hardfloat but we now treat it as softfloat like most everyone
- # else. Check existing toolchains to respect existing systems.
- arm*)
- if tc-cpp-is-true "defined(__ARM_PCS_VFP)"; then
- echo "no"
- else
- # Confusingly __SOFTFP__ is defined only when
- # -mfloat-abi is soft, not softfp.
- if tc-cpp-is-true "defined(__SOFTFP__)"; then
- echo "yes"
- else
- echo "softfp"
- fi
- fi
-
- return 0 ;;
- *)
- return 1 ;;
- esac
-}
-
-# @FUNCTION: tc-tuple-is-softfloat
-# @RETURN: See tc-is-softfloat for the possible values.
-# @DESCRIPTION:
-# Determine whether the CTARGET (or CHOST) toolchain is a softfloat
-# based one solely from the tuple.
-tc-tuple-is-softfloat() {
- local CTARGET=${CTARGET:-${CHOST}}
- case ${CTARGET//_/-} in
- bfin*|h8300*)
- echo "only" ;;
- *-softfloat-*)
- echo "yes" ;;
- *-softfp-*)
- echo "softfp" ;;
- arm*-hardfloat-*|arm*eabihf)
- echo "no" ;;
- # bare-metal targets have their defaults. bug #666896
- *-newlib|*-elf|*-eabi)
- echo "no" ;;
- arm64-apple-darwin*)
- echo "no" ;;
- arm*)
- echo "yes" ;;
- *)
- echo "no" ;;
- esac
-}
-
-# @FUNCTION: tc-is-softfloat
-# @DESCRIPTION:
-# See if this toolchain is a softfloat based one.
-# @CODE
-# The possible return values:
-# - only: the target is always softfloat (never had fpu)
-# - yes: the target should support softfloat
-# - softfp: (arm specific) the target should use hardfloat insns, but softfloat calling convention
-# - no: the target doesn't support softfloat
-# @CODE
-# This allows us to react differently where packages accept
-# softfloat flags in the case where support is optional, but
-# rejects softfloat flags where the target always lacks an fpu.
-tc-is-softfloat() {
- tc-detect-is-softfloat || tc-tuple-is-softfloat
-}
-
-# @FUNCTION: tc-is-static-only
-# @DESCRIPTION:
-# Return shell true if the target does not support shared libs, shell false
-# otherwise.
-tc-is-static-only() {
- local host=${CTARGET:-${CHOST}}
-
- # *MiNT doesn't have shared libraries, only platform so far
- [[ ${host} == *-mint* ]]
-}
-
-# @FUNCTION: tc-stack-grows-down
-# @DESCRIPTION:
-# Return shell true if the stack grows down. This is the default behavior
-# for the vast majority of systems out there and usually projects shouldn't
-# care about such internal details.
-tc-stack-grows-down() {
- # List the few that grow up.
- case ${ARCH} in
- hppa|metag) return 1 ;;
- esac
-
- # Assume all others grow down.
- return 0
-}
-
-# @FUNCTION: tc-export_build_env
-# @USAGE: [compiler variables]
-# @DESCRIPTION:
-# Export common build related compiler settings.
-tc-export_build_env() {
- tc-export "$@"
- if tc-is-cross-compiler; then
- # Some build envs will initialize vars like:
- # : ${BUILD_LDFLAGS:-${LDFLAGS}}
- # So make sure all variables are non-empty. #526734
- : "${BUILD_CFLAGS:=-O1 -pipe}"
- : "${BUILD_CXXFLAGS:=-O1 -pipe}"
- : "${BUILD_CPPFLAGS:= }"
- : "${BUILD_LDFLAGS:= }"
- else
- # https://bugs.gentoo.org/654424
- : "${BUILD_CFLAGS:=${CFLAGS}}"
- : "${BUILD_CXXFLAGS:=${CXXFLAGS}}"
- : "${BUILD_CPPFLAGS:=${CPPFLAGS}}"
- : "${BUILD_LDFLAGS:=${LDFLAGS}}"
- fi
- export BUILD_{C,CXX,CPP,LD}FLAGS
-
- # Some packages use XXX_FOR_BUILD.
- local v
- for v in BUILD_{C,CXX,CPP,LD}FLAGS ; do
- export ${v#BUILD_}_FOR_BUILD="${!v}"
- done
-}
-
-# @FUNCTION: tc-env_build
-# @USAGE: <command> [command args]
-# @DESCRIPTION:
-# Setup the compile environment to the build tools and then execute the
-# specified command. We use tc-getBUILD_XX here so that we work with
-# all of the semi-[non-]standard env vars like $BUILD_CC which often
-# the target build system does not check.
-tc-env_build() {
- tc-export_build_env
- CFLAGS=${BUILD_CFLAGS} \
- CXXFLAGS=${BUILD_CXXFLAGS} \
- CPPFLAGS=${BUILD_CPPFLAGS} \
- LDFLAGS=${BUILD_LDFLAGS} \
- AR=$(tc-getBUILD_AR) \
- AS=$(tc-getBUILD_AS) \
- CC=$(tc-getBUILD_CC) \
- CPP=$(tc-getBUILD_CPP) \
- CXX=$(tc-getBUILD_CXX) \
- LD=$(tc-getBUILD_LD) \
- NM=$(tc-getBUILD_NM) \
- PKG_CONFIG=$(tc-getBUILD_PKG_CONFIG) \
- RANLIB=$(tc-getBUILD_RANLIB) \
- READELF=$(tc-getBUILD_READELF) \
- "$@"
-}
-
-# @FUNCTION: econf_build
-# @USAGE: [econf flags]
-# @DESCRIPTION:
-# Sometimes we need to locally build up some tools to run on CBUILD because
-# the package has helper utils which are compiled+executed when compiling.
-# This won't work when cross-compiling as the CHOST is set to a target which
-# we cannot natively execute.
-#
-# For example, the python package will build up a local python binary using
-# a portable build system (configure+make), but then use that binary to run
-# local python scripts to build up other components of the overall python.
-# We cannot rely on the python binary in $PATH as that often times will be
-# a different version, or not even installed in the first place. Instead,
-# we compile the code in a different directory to run on CBUILD, and then
-# use that binary when compiling the main package to run on CHOST.
-#
-# For example, with newer EAPIs, you'd do something like:
-# @CODE
-# src_configure() {
-# ECONF_SOURCE=${S}
-# if tc-is-cross-compiler ; then
-# mkdir "${WORKDIR}"/${CBUILD} || die
-# pushd "${WORKDIR}"/${CBUILD} >/dev/null || die
-# econf_build --disable-some-unused-stuff
-# popd >/dev/null || die
-# fi
-# ... normal build paths ...
-# }
-# src_compile() {
-# if tc-is-cross-compiler ; then
-# pushd "${WORKDIR}"/${CBUILD} >/dev/null || die
-# emake one-or-two-build-tools
-# ln/mv build-tools to normal build paths in ${S}/ || die
-# popd >/dev/null || die
-# fi
-# ... normal build paths ...
-# }
-# @CODE
-econf_build() {
- local CBUILD=${CBUILD:-${CHOST}}
- econf_env() { CHOST=${CBUILD} econf "$@"; }
- tc-env_build econf_env "$@"
-}
-
-# @FUNCTION: tc-ld-is-gold
-# @USAGE: [toolchain prefix]
-# @DESCRIPTION:
-# Return true if the current linker is set to gold.
-tc-ld-is-gold() {
- local out
-
- # Ensure ld output is in English.
- local -x LC_ALL=C
-
- # First check the linker directly.
- out=$($(tc-getLD "$@") --version 2>&1)
- if [[ ${out} == *"GNU gold"* ]] ; then
- return 0
- fi
-
- # Then see if they're selecting gold via compiler flags.
- # Note: We're assuming they're using LDFLAGS to hold the
- # options and not CFLAGS/CXXFLAGS.
- local base="${T}/test-tc-gold"
- cat <<-EOF > "${base}.c"
- int main(void) { return 0; }
- EOF
- out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1)
- rm -f "${base}"*
- if [[ ${out} == *"GNU gold"* ]] ; then
- return 0
- fi
-
- # No gold here!
- return 1
-}
-
-# @FUNCTION: tc-ld-is-lld
-# @USAGE: [toolchain prefix]
-# @DESCRIPTION:
-# Return true if the current linker is set to lld.
-tc-ld-is-lld() {
- local out
-
- # Ensure ld output is in English.
- local -x LC_ALL=C
-
- # First check the linker directly.
- out=$($(tc-getLD "$@") --version 2>&1)
- if [[ ${out} == *"LLD"* ]] ; then
- return 0
- fi
-
- # Then see if they're selecting lld via compiler flags.
- # Note: We're assuming they're using LDFLAGS to hold the
- # options and not CFLAGS/CXXFLAGS.
- local base="${T}/test-tc-lld"
- cat <<-EOF > "${base}.c"
- int main(void) { return 0; }
- EOF
- out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1)
- rm -f "${base}"*
- if [[ ${out} == *"LLD"* ]] ; then
- return 0
- fi
-
- # No lld here!
- return 1
-}
-
-# @FUNCTION: tc-ld-disable-gold
-# @USAGE: [toolchain prefix]
-# @DESCRIPTION:
-# If the gold linker is currently selected, configure the compilation
-# settings so that we use the older bfd linker instead.
-tc-ld-disable-gold() {
- tc-ld-is-gold "$@" && tc-ld-force-bfd "$@"
-}
-
-# @FUNCTION: tc-ld-force-bfd
-# @USAGE: [toolchain prefix]
-# @DESCRIPTION:
-# If the gold or lld linker is currently selected, configure the compilation
-# settings so that we use the bfd linker instead.
-tc-ld-force-bfd() {
- if ! tc-ld-is-gold "$@" && ! tc-ld-is-lld "$@" ; then
- # They aren't using gold or lld, so nothing to do!
- return
- fi
-
- ewarn "Forcing usage of the BFD linker"
-
- # Set up LD to point directly to bfd if it's available.
- # Unset LD first so we get the default value from tc-getLD.
- local ld=$(unset LD; tc-getLD "$@")
- local bfd_ld="${ld}.bfd"
- local path_ld=$(type -P "${bfd_ld}" 2>/dev/null)
- [[ -e ${path_ld} ]] && export LD=${bfd_ld}
-
- # Set up LDFLAGS to select bfd based on the gcc / clang version.
- if tc-is-gcc || tc-is-clang ; then
- export LDFLAGS="${LDFLAGS} -fuse-ld=bfd"
- fi
-}
-
-# @FUNCTION: _tc-has-openmp
-# @INTERNAL
-# @USAGE: [toolchain prefix]
-# @DESCRIPTION:
-# See if the toolchain supports OpenMP.
-_tc-has-openmp() {
- local base="${T}/test-tc-openmp"
- cat <<-EOF > "${base}.c"
- #include <omp.h>
- int main(void) {
- int nthreads, tid, ret = 0;
- #pragma omp parallel private(nthreads, tid)
- {
- tid = omp_get_thread_num();
- nthreads = omp_get_num_threads(); ret += tid + nthreads;
- }
- return ret;
- }
- EOF
- $(tc-getCC "$@") -fopenmp "${base}.c" -o "${base}" >&/dev/null
- local ret=$?
- rm -f "${base}"*
- return ${ret}
-}
-
-# @FUNCTION: tc-check-openmp
-# @DESCRIPTION:
-# Test for OpenMP support with the current compiler and error out with
-# a clear error message, telling the user how to rectify the missing
-# OpenMP support that has been requested by the ebuild.
-#
-# 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
- eerror "Your current compiler does not support OpenMP!"
-
- if tc-is-gcc; then
- eerror "Enable OpenMP support by building sys-devel/gcc with USE=\"openmp\"."
- elif tc-is-clang; then
- eerror "OpenMP support in sys-devel/clang is provided by sys-libs/libomp."
- fi
-
- die "Active compiler does not have required support for OpenMP"
- fi
-}
-
-# @FUNCTION: tc-has-tls
-# @USAGE: [-s|-c|-l] [toolchain prefix]
-# @DESCRIPTION:
-# See if the toolchain supports thread local storage (TLS). Use -s to test the
-# compiler, -c to also test the assembler, and -l to also test the C library
-# (the default).
-tc-has-tls() {
- local base="${T}/test-tc-tls"
- cat <<-EOF > "${base}.c"
- int foo(int *i) {
- static __thread int j = 0;
- return *i ? j : *i;
- }
- EOF
-
- local flags
- case $1 in
- -s) flags="-S";;
- -c) flags="-c";;
- -l) ;;
- -*) die "Usage: tc-has-tls [-c|-l] [toolchain prefix]";;
- esac
- case "${CHOST}" in
- *-darwin*)
- # bug #612370
- : ${flags:=-dynamiclib}
- ;;
- *)
- : ${flags:=-fPIC -shared -Wl,-z,defs}
- esac
- [[ $1 == -* ]] && shift
- $(tc-getCC "$@") ${flags} "${base}.c" -o "${base}" >&/dev/null
- local ret=$?
- rm -f "${base}"*
- return ${ret}
-}
-
-
-# Parse information from CBUILD/CHOST/CTARGET rather than
-# use external variables from the profile.
-tc-ninja_magic_to_arch() {
- _tc_echo_kernel_alias() { [[ ${type} == "kern" ]] && echo $1 || echo $2 ; }
-
- local type=$1
- local host=$2
- [[ -z ${host} ]] && host=${CTARGET:-${CHOST}}
-
- case ${host} in
- arm64*) echo arm64;;
- aarch64*) echo arm64;;
- alpha*) echo alpha;;
- arc*) echo arc;;
- arm*) echo arm;;
- avr*) _tc_echo_kernel_alias avr32 avr;;
- bfin*) _tc_echo_kernel_alias blackfin bfin;;
- c6x*) echo c6x;;
- cris*) echo cris;;
- frv*) echo frv;;
- hexagon*) echo hexagon;;
- hppa*) _tc_echo_kernel_alias parisc hppa;;
- i?86*) echo x86;;
- ia64*) echo ia64;;
- loongarch*) _tc_echo_kernel_alias loongarch loong;;
- m68*) echo m68k;;
- metag*) echo metag;;
- microblaze*) echo microblaze;;
- mips*) echo mips;;
- nios2*) echo nios2;;
- nios*) echo nios;;
- or1k*|or32*) echo openrisc;;
- powerpc*)
- # Starting with linux-2.6.15, the 'ppc' and 'ppc64' trees
- # have been unified into simply 'powerpc', but until 2.6.16,
- # ppc32 is still using ARCH="ppc" as default
- if [[ ${type} == "kern" ]] ; then
- echo powerpc
- elif [[ ${host} == powerpc64* ]] ; then
- echo ppc64
- else
- echo ppc
- fi
- ;;
- riscv*) echo riscv;;
- s390*) echo s390;;
- score*) echo score;;
- sh64*) _tc_echo_kernel_alias sh64 sh;;
- sh*) echo sh;;
- sparcv9*) echo sparc64;;
- sparc64*) _tc_echo_kernel_alias sparc64 sparc;;
- sparc*) [[ ${PROFILE_ARCH} == "sparc64" ]] \
- && _tc_echo_kernel_alias sparc64 sparc \
- || echo sparc
- ;;
- tile*) echo tile;;
- vax*) echo vax;;
- x86_64*)
- # Starting with linux-2.6.24, the 'x86_64' and 'i386'
- # trees have been unified into 'x86'.
- if [[ ${type} == "kern" ]] ; then
- echo x86
- else
- echo amd64
- fi
- ;;
- xtensa*) echo xtensa;;
-
- # since our usage of tc-arch is largely concerned with
- # normalizing inputs for testing ${CTARGET}, let's filter
- # other cross targets (mingw and such) into the unknown.
- *) echo unknown;;
- esac
-}
-# @FUNCTION: tc-arch-kernel
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the kernel arch according to the compiler target
-tc-arch-kernel() {
- tc-ninja_magic_to_arch kern "$@"
-}
-# @FUNCTION: tc-arch
-# @USAGE: [toolchain prefix]
-# @RETURN: name of the portage arch according to the compiler target
-tc-arch() {
- tc-ninja_magic_to_arch portage "$@"
-}
-
-# @FUNCTION: tc-endian
-# @USAGE: [toolchain prefix]
-# @RETURN: 'big' or 'little' corresponding to the passed (or host) endianness
-# @DESCRIPTION:
-# Accepts 'host' as an argument which defaults to CTARGET and falls back to CHOST
-# if unspecified. Returns 'big' or 'little' depending on whether 'host' is
-# big or little endian.
-tc-endian() {
- local host=$1
- [[ -z ${host} ]] && host=${CTARGET:-${CHOST}}
- host=${host%%-*}
-
- case ${host} in
- aarch64*be) echo big;;
- aarch64) echo little;;
- alpha*) echo little;;
- arc*b*) echo big;;
- arc*) echo little;;
- arm*b*) echo big;;
- arm*) echo little;;
- cris*) echo little;;
- hppa*) echo big;;
- i?86*) echo little;;
- ia64*) echo little;;
- loongarch*) echo little;;
- m68*) echo big;;
- mips*l*) echo little;;
- mips*) echo big;;
- powerpc*le) echo little;;
- powerpc*) echo big;;
- riscv*) echo little;;
- s390*) echo big;;
- sh*b*) echo big;;
- sh*) echo little;;
- sparc*) echo big;;
- x86_64*) echo little;;
- *) echo wtf;;
- esac
-}
-
-# @FUNCTION: tc-get-compiler-type
-# @RETURN: keyword identifying the compiler: gcc, clang, pathcc, unknown
-tc-get-compiler-type() {
- local code='
-#if defined(__PATHSCALE__)
- HAVE_PATHCC
-#elif defined(__clang__)
- HAVE_CLANG
-#elif defined(__GNUC__)
- HAVE_GCC
-#endif
-'
- local res=$($(tc-getCPP "$@") -E -P - <<<"${code}")
-
- case ${res} in
- *HAVE_PATHCC*) echo pathcc;;
- *HAVE_CLANG*) echo clang;;
- *HAVE_GCC*) echo gcc;;
- *) echo unknown;;
- esac
-}
-
-# @FUNCTION: tc-is-gcc
-# @RETURN: Shell true if the current compiler is GCC, false otherwise.
-tc-is-gcc() {
- [[ $(tc-get-compiler-type) == gcc ]]
-}
-
-# @FUNCTION: tc-is-clang
-# @RETURN: Shell true if the current compiler is clang, false otherwise.
-tc-is-clang() {
- [[ $(tc-get-compiler-type) == clang ]]
-}
-
-# Internal func. The first argument is the version info to expand.
-# Query the preprocessor to improve compatibility across different
-# compilers rather than maintaining a --version flag matrix, bug #335943.
-_gcc_fullversion() {
- local ver="$1"; shift
- set -- $($(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__")
- eval echo "${ver}"
-}
-
-# @FUNCTION: gcc-fullversion
-# @RETURN: compiler version (major.minor.micro: [3.4.6])
-gcc-fullversion() {
- _gcc_fullversion '$1.$2.$3' "$@"
-}
-# @FUNCTION: gcc-version
-# @RETURN: compiler version (major.minor: [3.4].6)
-gcc-version() {
- _gcc_fullversion '$1.$2' "$@"
-}
-# @FUNCTION: gcc-major-version
-# @RETURN: major compiler version (major: [3].4.6)
-gcc-major-version() {
- _gcc_fullversion '$1' "$@"
-}
-# @FUNCTION: gcc-minor-version
-# @RETURN: minor compiler version (minor: 3.[4].6)
-gcc-minor-version() {
- _gcc_fullversion '$2' "$@"
-}
-# @FUNCTION: gcc-micro-version
-# @RETURN: micro compiler version (micro: 3.4.[6])
-gcc-micro-version() {
- _gcc_fullversion '$3' "$@"
-}
-
-# Internal func. Based on _gcc_fullversion() above.
-_clang_fullversion() {
- local ver="$1"; shift
- set -- $($(tc-getCPP "$@") -E -P - <<<"__clang_major__ __clang_minor__ __clang_patchlevel__")
- eval echo "${ver}"
-}
-
-# @FUNCTION: clang-fullversion
-# @RETURN: compiler version (major.minor.micro: [3.4.6])
-clang-fullversion() {
- _clang_fullversion '$1.$2.$3' "$@"
-}
-# @FUNCTION: clang-version
-# @RETURN: compiler version (major.minor: [3.4].6)
-clang-version() {
- _clang_fullversion '$1.$2' "$@"
-}
-# @FUNCTION: clang-major-version
-# @RETURN: major compiler version (major: [3].4.6)
-clang-major-version() {
- _clang_fullversion '$1' "$@"
-}
-# @FUNCTION: clang-minor-version
-# @RETURN: minor compiler version (minor: 3.[4].6)
-clang-minor-version() {
- _clang_fullversion '$2' "$@"
-}
-# @FUNCTION: clang-micro-version
-# @RETURN: micro compiler version (micro: 3.4.[6])
-clang-micro-version() {
- _clang_fullversion '$3' "$@"
-}
-
-# Returns the installation directory - internal toolchain
-# function for use by _gcc-specs-exists (for flag-o-matic).
-_gcc-install-dir() {
- echo "$(LC_ALL=C $(tc-getCC) -print-search-dirs 2> /dev/null |\
- awk '$1=="install:" {print $2}')"
-}
-# Returns true if the indicated specs file exists - internal toolchain
-# function for use by flag-o-matic.
-_gcc-specs-exists() {
- [[ -f $(_gcc-install-dir)/$1 ]]
-}
-
-# Returns requested gcc specs directive unprocessed - for used by
-# gcc-specs-directive()
-# Note; later specs normally overwrite earlier ones; however if a later
-# spec starts with '+' then it appends.
-# gcc -dumpspecs is parsed first, followed by files listed by "gcc -v"
-# as "Reading <file>", in order. Strictly speaking, if there's a
-# $(gcc_install_dir)/specs, the built-in specs aren't read, however by
-# the same token anything from 'gcc -dumpspecs' is overridden by
-# the contents of $(gcc_install_dir)/specs so the result is the
-# same either way.
-_gcc-specs-directive_raw() {
- local cc=$(tc-getCC)
- local specfiles=$(LC_ALL=C ${cc} -v 2>&1 | awk '$1=="Reading" {print $NF}')
- ${cc} -dumpspecs 2> /dev/null | cat - ${specfiles} | awk -v directive=$1 \
-'BEGIN { pspec=""; spec=""; outside=1 }
-$1=="*"directive":" { pspec=spec; spec=""; outside=0; next }
- outside || NF==0 || ( substr($1,1,1)=="*" && substr($1,length($1),1)==":" ) { outside=1; next }
- spec=="" && substr($0,1,1)=="+" { spec=pspec " " substr($0,2); next }
- { spec=spec $0 }
-END { print spec }'
- return 0
-}
-
-# Return the requested gcc specs directive, with all included
-# specs expanded.
-# Note, it does not check for inclusion loops, which cause it
-# to never finish - but such loops are invalid for gcc and we're
-# assuming gcc is operational.
-gcc-specs-directive() {
- local directive subdname subdirective
- directive="$(_gcc-specs-directive_raw $1)"
- while [[ ${directive} == *%\(*\)* ]]; do
- subdname=${directive/*%\(}
- subdname=${subdname/\)*}
- subdirective="$(_gcc-specs-directive_raw ${subdname})"
- directive="${directive//\%(${subdname})/${subdirective}}"
- done
- echo "${directive}"
- return 0
-}
-
-# Returns true if gcc sets relro
-gcc-specs-relro() {
- local directive
- directive=$(gcc-specs-directive link_command)
- [[ "${directive/\{!norelro:}" != "${directive}" ]]
-}
-# Returns true if gcc sets now
-gcc-specs-now() {
- local directive
- directive=$(gcc-specs-directive link_command)
- [[ "${directive/\{!nonow:}" != "${directive}" ]]
-}
-# Returns true if gcc builds PIEs
-gcc-specs-pie() {
- local directive
- directive=$(gcc-specs-directive cc1)
- [[ "${directive/\{!nopie:}" != "${directive}" ]]
-}
-# Returns true if gcc builds with the stack protector
-gcc-specs-ssp() {
- local directive
- directive=$(gcc-specs-directive cc1)
- [[ "${directive/\{!fno-stack-protector:}" != "${directive}" ]]
-}
-# Returns true if gcc upgrades fstack-protector to fstack-protector-all
-gcc-specs-ssp-to-all() {
- local directive
- directive=$(gcc-specs-directive cc1)
- [[ "${directive/\{!fno-stack-protector-all:}" != "${directive}" ]]
-}
-# Returns true if gcc builds with fno-strict-overflow
-gcc-specs-nostrict() {
- local directive
- directive=$(gcc-specs-directive cc1)
- [[ "${directive/\{!fstrict-overflow:}" != "${directive}" ]]
-}
-# Returns true if gcc builds with fstack-check
-gcc-specs-stack-check() {
- local directive
- directive=$(gcc-specs-directive cc1)
- [[ "${directive/\{!fno-stack-check:}" != "${directive}" ]]
-}
-
-# @FUNCTION: tc-enables-cxx-assertions
-# @RETURN: Truth if the current compiler enables assertions in the C++ standard library
-# @DESCRIPTION:
-# Return truth if the current compiler enables assertions in the C++ standard
-# library. For libstdc++, this is -D_GLIBCXX_ASSERTIONS, and for libcxx/libc++,
-# this is -D_LIBCPP_ENABLE_ASSERTIONS (deprecated) or -D_LIBCPP_ENABLE_HARDENED_MODE.
-tc-enables-cxx-assertions() {
- tc-cpp-is-true "defined(_GLIBCXX_ASSERTIONS) || defined(_LIBCPP_ENABLE_ASSERTIONS) || defined(_LIBCPP_ENABLE_HARDENED_MODE)" ${CPPFLAGS} ${CXXFLAGS}
-}
-
-# @FUNCTION: tc-enables-pie
-# @RETURN: Truth if the current compiler generates position-independent code (PIC) which can be linked into executables
-# @DESCRIPTION:
-# Return truth if the current compiler generates position-independent code (PIC)
-# which can be linked into executables.
-tc-enables-pie() {
- tc-cpp-is-true "defined(__PIE__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
-}
-
-# @FUNCTION: tc-enables-fortify-source
-# @RETURN: Truth if the current compiler enables FORTIFY_SOURCE at any level
-# @DESCRIPTION:
-# Return truth if the current compiler enables fortification (FORTIFY_SOURCE)
-# at any level (-D_FORTIFY_SOURCE).
-tc-enables-fortify-source() {
- tc-cpp-is-true "defined(_FORTIFY_SOURCE)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
-}
-
-# @FUNCTION: tc-enables-ssp
-# @RETURN: Truth if the current compiler enables stack smashing protection (SSP) on at least minimal level
-# @DESCRIPTION:
-# Return truth if the current compiler enables stack smashing protection (SSP)
-# on level corresponding to any of the following options:
-# -fstack-protector
-# -fstack-protector-strong
-# -fstack-protector-all
-tc-enables-ssp() {
- tc-cpp-is-true "defined(__SSP__) || defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
-}
-
-# @FUNCTION: tc-enables-ssp-strong
-# @RETURN: Truth if the current compiler enables stack smashing protection (SSP) on at least middle level
-# @DESCRIPTION:
-# Return truth if the current compiler enables stack smashing protection (SSP)
-# on level corresponding to any of the following options:
-# -fstack-protector-strong
-# -fstack-protector-all
-tc-enables-ssp-strong() {
- tc-cpp-is-true "defined(__SSP_STRONG__) || defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
-}
-
-# @FUNCTION: tc-enables-ssp-all
-# @RETURN: Truth if the current compiler enables stack smashing protection (SSP) on maximal level
-# @DESCRIPTION:
-# Return truth if the current compiler enables stack smashing protection (SSP)
-# on level corresponding to any of the following options:
-# -fstack-protector-all
-tc-enables-ssp-all() {
- tc-cpp-is-true "defined(__SSP_ALL__)" ${CPPFLAGS} ${CFLAGS} ${CXXFLAGS}
-}
-
-
-# @FUNCTION: gen_usr_ldscript
-# @USAGE: [-a] <list of libs to create linker scripts for>
-# @DESCRIPTION:
-# This function is deprecated. Use the version from
-# usr-ldscript.eclass instead.
-gen_usr_ldscript() {
- ewarn "${FUNCNAME}: Please migrate to usr-ldscript.eclass"
-
- local lib libdir=$(get_libdir) output_format="" auto=false suffix=$(get_libname)
- [[ -z ${ED+set} ]] && local ED=${D%/}${EPREFIX}/
-
- tc-is-static-only && return
- use prefix && return
-
- # We only care about stuffing / for the native ABI, bug #479448
- if [[ $(type -t multilib_is_native_abi) == "function" ]] ; then
- multilib_is_native_abi || return 0
- fi
-
- # Eventually we'd like to get rid of this func completely, bug #417451
- case ${CTARGET:-${CHOST}} in
- *-darwin*) ;;
- *-android*) return 0 ;;
- *linux*) use prefix && return 0 ;;
- *) return 0 ;;
- esac
-
- # Just make sure it exists
- dodir /usr/${libdir}
-
- if [[ $1 == "-a" ]] ; then
- auto=true
- shift
- dodir /${libdir}
- fi
-
- # OUTPUT_FORMAT gives hints to the linker as to what binary format
- # is referenced ... makes multilib saner
- local flags=( ${CFLAGS} ${LDFLAGS} -Wl,--verbose )
- if $(tc-getLD) --version | grep -q 'GNU gold' ; then
- # If they're using gold, manually invoke the old bfd, bug #487696
- local d="${T}/bfd-linker"
- mkdir -p "${d}"
- ln -sf $(type -P ${CHOST}-ld.bfd) "${d}"/ld
- flags+=( -B"${d}" )
- fi
- output_format=$($(tc-getCC) "${flags[@]}" 2>&1 | sed -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')
- [[ -n ${output_format} ]] && output_format="OUTPUT_FORMAT ( ${output_format} )"
-
- for lib in "$@" ; do
- local tlib
- if ${auto} ; then
- lib="lib${lib}${suffix}"
- else
- # Ensure /lib/${lib} exists to avoid dangling scripts/symlinks.
- # This especially is for AIX where $(get_libname) can return ".a",
- # so /lib/${lib} might be moved to /usr/lib/${lib} (by accident).
- [[ -r ${ED}/${libdir}/${lib} ]] || continue
- #TODO: better die here?
- fi
-
- case ${CTARGET:-${CHOST}} in
- *-darwin*)
- if ${auto} ; then
- tlib=$(scanmacho -qF'%S#F' "${ED}"/usr/${libdir}/${lib})
- else
- tlib=$(scanmacho -qF'%S#F' "${ED}"/${libdir}/${lib})
- fi
- [[ -z ${tlib} ]] && die "unable to read install_name from ${lib}"
- tlib=${tlib##*/}
-
- if ${auto} ; then
- mv "${ED}"/usr/${libdir}/${lib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die
- # some install_names are funky: they encode a version
- if [[ ${tlib} != ${lib%${suffix}}.*${suffix#.} ]] ; then
- mv "${ED}"/usr/${libdir}/${tlib%${suffix}}.*${suffix#.} "${ED}"/${libdir}/ || die
- fi
- rm -f "${ED}"/${libdir}/${lib}
- fi
-
- # Mach-O files have an id, which is like a soname, it tells how
- # another object linking against this lib should reference it.
- # Since we moved the lib from usr/lib into lib this reference is
- # wrong. Hence, we update it here. We don't configure with
- # libdir=/lib because that messes up libtool files.
- # Make sure we don't lose the specific version, so just modify the
- # existing install_name
- if [[ ! -w "${ED}/${libdir}/${tlib}" ]] ; then
- chmod u+w "${ED}${libdir}/${tlib}" # needed to write to it
- local nowrite=yes
- fi
- install_name_tool \
- -id "${EPREFIX}"/${libdir}/${tlib} \
- "${ED}"/${libdir}/${tlib} || die "install_name_tool failed"
- [[ -n ${nowrite} ]] && chmod u-w "${ED}${libdir}/${tlib}"
- # Now as we don't use GNU binutils and our linker doesn't
- # understand linker scripts, just create a symlink.
- pushd "${ED}/usr/${libdir}" > /dev/null
- ln -snf "../../${libdir}/${tlib}" "${lib}"
- popd > /dev/null
- ;;
- *)
- if ${auto} ; then
- tlib=$(scanelf -qF'%S#F' "${ED}"/usr/${libdir}/${lib})
- [[ -z ${tlib} ]] && die "unable to read SONAME from ${lib}"
- mv "${ED}"/usr/${libdir}/${lib}* "${ED}"/${libdir}/ || die
- # some SONAMEs are funky: they encode a version before the .so
- if [[ ${tlib} != ${lib}* ]] ; then
- mv "${ED}"/usr/${libdir}/${tlib}* "${ED}"/${libdir}/ || die
- fi
- rm -f "${ED}"/${libdir}/${lib}
- else
- tlib=${lib}
- fi
- cat > "${ED}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
- /* GNU ld script
- Since Gentoo has critical dynamic libraries in /lib, and the static versions
- in /usr/lib, we need to have a "fake" dynamic lib in /usr/lib, otherwise we
- run into linking problems. This "fake" dynamic lib is a linker script that
- redirects the linker to the real lib. And yes, this works in the cross-
- compiling scenario as the sysroot-ed linker will prepend the real path.
-
- See bug https://bugs.gentoo.org/4411 for more info.
- */
- ${output_format}
- GROUP ( ${EPREFIX}/${libdir}/${tlib} )
- END_LDSCRIPT
- ;;
- esac
- fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}"
- done
-}
-
-# @FUNCTION: tc-get-cxx-stdlib
-# @DESCRIPTION:
-# Attempt to identify the C++ standard library used by the compiler.
-# If the library is identified, the function returns 0 and prints one
-# of the following:
-#
-# - ``libc++`` for ``sys-libs/libcxx``
-# - ``libstdc++`` for ``sys-devel/gcc``'s libstdc++
-#
-# If the library is not recognized, the function returns 1.
-tc-get-cxx-stdlib() {
- local code='#include <ciso646>
-
-#if defined(_LIBCPP_VERSION)
- HAVE_LIBCXX
-#elif defined(__GLIBCXX__)
- HAVE_LIBSTDCPP
-#endif
-'
- local res=$(
- $(tc-getCXX) ${CPPFLAGS} ${CXXFLAGS} -x c++ -E -P - \
- <<<"${code}" 2>/dev/null
- )
-
- case ${res} in
- *HAVE_LIBCXX*)
- echo libc++;;
- *HAVE_LIBSTDCPP*)
- echo libstdc++;;
- *)
- return 1;;
- esac
-
- return 0
-}
-
-# @FUNCTION: tc-get-c-rtlib
-# @DESCRIPTION:
-# Attempt to identify the runtime used by the C/C++ compiler.
-# If the runtime is identifed, the function returns 0 and prints one
-# of the following:
-#
-# - ``compiler-rt`` for ``sys-libs/compiler-rt``
-# - ``libgcc`` for ``sys-devel/gcc``'s libgcc
-#
-# If the runtime is not recognized, the function returns 1.
-tc-get-c-rtlib() {
- local res=$(
- $(tc-getCC) ${CPPFLAGS} ${CFLAGS} ${LDFLAGS} \
- -print-libgcc-file-name 2>/dev/null
- )
-
- case ${res} in
- *libclang_rt*)
- echo compiler-rt;;
- *libgcc*)
- echo libgcc;;
- *)
- return 1;;
- esac
-
- return 0
-}
-
-# @FUNCTION: tc-get-ptr-size
-# @RETURN: Size of a pointer in bytes for CHOST (e.g. 4 or 8).
-tc-get-ptr-size() {
- $(tc-getCPP) -P - <<< __SIZEOF_POINTER__ ||
- die "Could not determine CHOST pointer size"
-}
-
-# @FUNCTION: tc-get-build-ptr-size
-# @RETURN: Size of a pointer in bytes for CBUILD (e.g. 4 or 8).
-tc-get-build-ptr-size() {
- $(tc-getBUILD_CPP) -P - <<< __SIZEOF_POINTER__ ||
- die "Could not determine CBUILD pointer size"
-}
-
-# @FUNCTION: tc-is-lto
-# @RETURN: Shell true if we are using LTO, shell false otherwise
-tc-is-lto() {
- local f="${T}/test-lto.o"
- local ret=1
-
- case $(tc-get-compiler-type) in
- clang)
- $(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<<"" || die
- # If LTO is used, clang will output bytecode and llvm-bcanalyzer
- # will run successfully. Otherwise, it will output plain object
- # file and llvm-bcanalyzer will exit with error.
- llvm-bcanalyzer "${f}" &>/dev/null && ret=0
- ;;
- gcc)
- $(tc-getCC) ${CFLAGS} -c -o "${f}" -x c - <<<"" || die
- [[ $($(tc-getREADELF) -S "${f}") == *.gnu.lto* ]] && ret=0
- ;;
- esac
- rm -f "${f}" || die
- return "${ret}"
-}
-
-# @FUNCTION: tc-has-64bit-time_t
-# @RETURN: Shell true if time_t is at least 64 bits long, false otherwise
-tc-has-64bit-time_t() {
- $(tc-getCC) ${CFLAGS} ${CPPFLAGS} -c -x c - -o /dev/null <<-EOF &>/dev/null
- #include <sys/types.h>
- int test[sizeof(time_t) >= 8 ? 1 : -1];
- EOF
- return $?
-}
-
-fi
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-08-10 14:24 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-08-10 14:24 UTC (permalink / raw
To: gentoo-commits
commit: 67545fdfecd5ac5aed60706f6bb4ef7fa1fbd66e
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 10 14:23:52 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Aug 10 14:23:52 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=67545fdf
eclass/toolchain: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 468 +++++++++++++++++++++++++++++++++++++-----------
1 file changed, 362 insertions(+), 106 deletions(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index b8c75854cb..0f4ef79b15 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -22,7 +22,7 @@ _TOOLCHAIN_ECLASS=1
DESCRIPTION="The GNU Compiler Collection"
HOMEPAGE="https://gcc.gnu.org/"
-inherit edo flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
+inherit edo flag-o-matic gnuconfig libtool multilib pax-utils python-any-r1 toolchain-funcs prefix
tc_is_live() {
[[ ${PV} == *9999* ]]
@@ -87,6 +87,11 @@ tc_version_is_between() {
# Used to override GCC version. Useful for e.g. live ebuilds or snapshots.
# Defaults to ${PV}.
+# @ECLASS_VARIABLE: TOOLCHAIN_GCC_VALIDATE_FAILURES_VERSION
+# @DESCRIPTION:
+# Version of test comparison script (validate_failures.py) to use.
+: "${GCC_VALIDATE_FAILURES_VERSION:=a447cd6dee206facb66720bdacf0c765a8b09f33}"
+
# @ECLASS_VARIABLE: TOOLCHAIN_USE_GIT_PATCHES
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -96,6 +101,46 @@ tc_version_is_between() {
# for 13.0, we don't want to create new patchsets for every single 13.0 snapshot,
# so just grab patches from git each time if this variable is set).
+# @ECLASS_VARIABLE: GCC_TESTS_COMPARISON_DIR
+# @USER_VARIABLE
+# @DESCRIPTION:
+# Source of previous GCC test results and location to store new results.
+: "${GCC_TESTS_COMPARISON_DIR:=${BROOT}/var/cache/gcc/testresults/${CHOST}}"
+
+# @ECLASS_VARIABLE: GCC_TESTS_COMPARISON_SLOT
+# @USER_VARIABLE
+# @DESCRIPTION:
+# Slot to compare test results with. Defaults to current slot.
+: "${GCC_TESTS_COMPARISON_SLOT:=${SLOT}}"
+
+# @ECLASS_VARIABLE: GCC_TESTS_IGNORE_NO_BASELINE
+# @DEFAULT_UNSET
+# @USER_VARIABLE
+# @DESCRIPTION:
+# Ignore missing baseline/reference data and create new baseline.
+: "${GCC_TESTS_IGNORE_NO_BASELINE:=}"
+
+# @ECLASS_VARIABLE: GCC_TESTS_REGEN_BASELINE
+# @DEFAULT_UNSET
+# @USER_VARIABLE
+# @DESCRIPTION:
+# Ignore baseline/reference data and create new baseline.
+: "${GCC_TESTS_REGEN_BASELINE:=}"
+
+# @ECLASS_VARIABLE: GCC_TESTS_CHECK_TARGET
+# @USER_VARIABLE
+# @DESCRIPTION:
+# Defaults to 'check'. Allows choosing a different test target, e.g.
+# 'test-gcc' (https://gcc.gnu.org/install/test.html).
+: "${GCC_TESTS_CHECK_TARGET:=check}"
+
+# @ECLASS_VARIABLE: GCC_TESTS_RUNTESTFLAGS
+# @DEFAULT_UNSET
+# @USER_VARIABLE
+# @DESCRIPTION:
+# Extra options to pass to DejaGnu as RUNTESTFLAGS.
+: "${GCC_TESTS_RUNTESTFLAGS:=}"
+
# @ECLASS_VARIABLE: TOOLCHAIN_PATCH_DEV
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -143,6 +188,11 @@ GCCMINOR=$(ver_cut 2 ${GCC_PV})
# @DESCRIPTION:
# GCC micro version.
GCCMICRO=$(ver_cut 3 ${GCC_PV})
+# @ECLASS_VARIABLE: GCC_RUN_FIXINCLUDES
+# @INTERNAL
+# @DESCRIPTION:
+# Controls whether fixincludes should be used.
+GCC_RUN_FIXINCLUDES=0
tc_use_major_version_only() {
local use_major_version_only=0
@@ -255,7 +305,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ||
IUSE+=" go"
IUSE+=" +sanitize" TC_FEATURES+=( sanitize )
IUSE+=" graphite" TC_FEATURES+=( graphite )
- IUSE+=" ada"
+ IUSE+=" ada" TC_FEATURES+=( ada )
IUSE+=" vtv"
IUSE+=" jit"
IUSE+=" +pie +ssp pch"
@@ -275,7 +325,7 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ||
# See https://gcc.gnu.org/pipermail/gcc-patches/2023-April/615944.html
# and https://rust-gcc.github.io/2023/04/24/gccrs-and-gcc13-release.html for why
# it was disabled in 13.
- tc_version_is_at_least 14.0.0_pre20230423 ${PV} && IUSE+=" rust"
+ tc_version_is_at_least 14.0.0_pre20230423 ${PV} && IUSE+=" rust" TC_FEATURES+=( rust )
fi
if tc_version_is_at_least 10; then
@@ -311,6 +361,7 @@ BDEPEND="
>=sys-devel/flex-2.5.4
nls? ( sys-devel/gettext )
test? (
+ ${PYTHON_DEPS}
>=dev-util/dejagnu-1.4.4
>=sys-devel/autogen-5.5.4
)
@@ -320,7 +371,7 @@ DEPEND="${RDEPEND}"
if [[ ${PN} == gcc && ${PV} == *_p* ]] ; then
# Snapshots don't contain info pages.
# If they start to, adjust gcc_cv_prog_makeinfo_modern logic in toolchain_src_configure.
- # Needed unless/until https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106899 is fixed
+ # Needed unless/until https://gcc.gnu.org/PR106899 is fixed
BDEPEND+=" sys-apps/texinfo"
fi
@@ -347,7 +398,7 @@ fi
# TODO: Add a pkg_setup & pkg_pretend check for whether the active compiler
# supports Ada.
-if tc_has_feature ada ; then
+if [[ ${PN} != gnat-gpl ]] && tc_has_feature ada ; then
BDEPEND+=" ada? ( || ( sys-devel/gcc[ada] dev-lang/gnat-gpl[ada] ) )"
fi
@@ -360,6 +411,13 @@ if tc_has_feature d && tc_version_is_at_least 12.0 ; then
BDEPEND+=" d? ( || ( sys-devel/gcc[d(-)] <sys-devel/gcc-12[d(-)] ) )"
fi
+if tc_has_feature rust && tc_version_is_at_least 14.0.0_pre20230421 ; then
+ # This was added upstream in r14-9968-g3e1e73fc995844 as a temporary measure.
+ # See https://inbox.sourceware.org/gcc/34fec7ea-8762-4cac-a1c8-ff54e20e31ed@embecosm.com/
+ BDEPEND+=" rust? ( virtual/rust )"
+fi
+
+# PREFIX LOCAL: we don't have 2.11 (yet)
PDEPEND=">=sys-devel/gcc-config-2.3"
#---->> S + SRC_URI essentials <<----
@@ -474,7 +532,7 @@ get_gcc_src_uri() {
GCC_SRC_URI="mirror://gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz"
else
GCC_SRC_URI="
- mirror://gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz
+ mirror://gcc/releases/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz
mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz
"
fi
@@ -484,6 +542,8 @@ get_gcc_src_uri() {
[[ -n ${MUSL_VER} ]] && \
GCC_SRC_URI+=" $(gentoo_urls gcc-${MUSL_GCC_VER}-musl-patches-${MUSL_VER}.tar.${TOOLCHAIN_PATCH_SUFFIX})"
+ GCC_SRC_URI+=" test? ( https://gitweb.gentoo.org/proj/gcc-patches.git/plain/scripts/testsuite-management/validate_failures.py?id=${GCC_VALIDATE_FAILURES_VERSION} -> gcc-validate-failures-${GCC_VALIDATE_FAILURES_VERSION}.py )"
+
echo "${GCC_SRC_URI}"
}
@@ -513,6 +573,8 @@ toolchain_pkg_setup() {
# Avoid really confusing logs from subconfigure spam, makes logs far
# more legible.
MAKEOPTS="--output-sync=line ${MAKEOPTS}"
+
+ use test && python-any-r1_pkg_setup
}
#---->> src_unpack <<----
@@ -533,11 +595,12 @@ toolchain_fetch_git_patches() {
mkdir "${WORKDIR}"/patch || die
mv "${WORKDIR}"/patch.tmp/${PATCH_GCC_VER}/gentoo/* "${WORKDIR}"/patch || die
- if [[ -n ${MUSL_VER} || -d "${WORKDIR}"/musl ]] && [[ ${CTARGET} == *musl* ]] ; then
+ if [[ -z ${MUSL_VER} || -d "${WORKDIR}"/musl ]] && [[ ${CTARGET} == *musl* ]] ; then
mkdir "${WORKDIR}"/musl || die
mv "${WORKDIR}"/patch.tmp/${PATCH_GCC_VER}/musl/* "${WORKDIR}"/musl || die
fi
+ # PREFIX_LOCAL
# yuck, but how else to do it portable?
local realEPREFIX=$(python -c 'import os; print(os.path.realpath("'"${EPREFIX}"'"))')
if [[ -z ${I_KNOW_MY_GCC_WORKS_FINE_WITH_SYMLINKS} && ${EPREFIX} != ${realEPREFIX} ]] ; then
@@ -585,7 +648,8 @@ toolchain_src_prepare() {
tc_enable_hardened_gcc
fi
- # we use our libtool on Darwin (no longer applies since 12)
+ # PREFIX LOCAL
+ # we use our libtool on Darwin (no longer necessary since 12)
sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/${CTARGET}-libtool:" \
"${S}"/gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
# add prefixed Frameworks to default search paths (may want to
@@ -597,6 +661,11 @@ toolchain_src_prepare() {
sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/MacOSX.sdk/System/Library/Frameworks\"\, \"${EPREFIX}/Frameworks\"\, " \
"${S}"/gcc/config/${darwindriver} || die "sed gcc/config/${darwindriver} failed"
+ if use test ; then
+ cp "${DISTDIR}"/gcc-validate-failures-${GCC_VALIDATE_FAILURES_VERSION}.py "${T}"/validate_failures.py || die
+ chmod +x "${T}"/validate_failures.py || die
+ fi
+
# Make sure the pkg-config files install into multilib dirs.
# Since we configure with just one --libdir, we can't use that
# (as gcc itself takes care of building multilibs). bug #435728
@@ -606,7 +675,7 @@ toolchain_src_prepare() {
setup_multilib_osdirnames
local actual_version=$(< "${S}"/gcc/BASE-VER)
- if [[ "${GCC_RELEASE_VER}" != "${actual_version}" ]] ; then
+ if ! tc_is_live && [[ "${GCC_RELEASE_VER}" != "${actual_version}" ]] ; then
eerror "'${S}/gcc/BASE-VER' contains '${actual_version}', expected '${GCC_RELEASE_VER}'"
die "Please set 'TOOLCHAIN_GCC_PV' to '${actual_version}'"
fi
@@ -616,16 +685,6 @@ toolchain_src_prepare() {
gnuconfig_update
- # Update configure files
- local f
- einfo "Fixing misc issues in configure files"
- for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
- ebegin " Updating ${f/${S}\/} [LANG]"
- patch "${f}" "${FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
- || eerror "Please file a bug about this"
- eend $?
- done
-
if ! use prefix-guest && [[ -n ${EPREFIX} ]] ; then
einfo "Prefixifying dynamic linkers..."
for f in gcc/config/*/*linux*.h ; do
@@ -698,6 +757,11 @@ tc_enable_hardened_gcc() {
hardened_gcc_flags+=" -DDEF_GENTOO_ZNOW"
fi
+ if _tc_use_if_iuse cet && [[ ${CTARGET} == *x86_64*-linux-gnu* ]] ; then
+ einfo "Updating gcc to use x86-64 control flow protection by default ..."
+ hardened_gcc_flags+=" -DEXTRA_OPTIONS_CF"
+ fi
+
if _tc_use_if_iuse hardened ; then
# Will add some hardened options as default, e.g. for gcc-12
# * -fstack-clash-protection
@@ -709,10 +773,6 @@ tc_enable_hardened_gcc() {
# Add -D_GLIBCXX_ASSERTIONS
hardened_gcc_flags+=" -DDEF_GENTOO_GLIBCXX_ASSERTIONS"
- if _tc_use_if_iuse cet && [[ ${CTARGET} == *x86_64*-linux* ]] ; then
- hardened_gcc_flags+=" -DEXTRA_OPTIONS_CF"
- fi
-
# Rebrand to make bug reports easier
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
fi
@@ -785,7 +845,7 @@ toolchain_src_configure() {
gcc_do_filter_flags
if ! tc_version_is_at_least 11 && [[ $(gcc-major-version) -ge 12 ]] ; then
- # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105695
+ # https://gcc.gnu.org/PR105695
# bug #849359
export ac_cv_std_swap_in_utility=no
fi
@@ -927,7 +987,7 @@ toolchain_src_configure() {
BUILD_CONFIG_TARGETS+=( bootstrap-lto )
fi
- if tc_version_is_at_least 12 && _tc_use_if_iuse cet ; then
+ if tc_version_is_at_least 12 && _tc_use_if_iuse cet && [[ ${CTARGET} == x86_64-*-gnu* ]] ; then
BUILD_CONFIG_TARGETS+=( bootstrap-cet )
fi
@@ -991,6 +1051,7 @@ toolchain_src_configure() {
# "LTO is not supported for this target"
confgcc+=( --disable-lto )
;;
+ # PREFIX_LOCAL
# Prefix targets
*-apple-darwin*)
confgcc+=( --with-sysroot="${EPREFIX}${PREFIX}/${CTARGET}" )
@@ -1033,7 +1094,7 @@ toolchain_src_configure() {
fi
confgcc+=(
- # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100289
+ # https://gcc.gnu.org/PR100289
# TOOD: Find a way to disable this just for stage1 cross?
--disable-gcov
@@ -1067,6 +1128,7 @@ toolchain_src_configure() {
if [[ -n ${ESYSROOT} ]] ; then
confgcc+=( --with-build-sysroot="${ESYSROOT}" )
fi
+ # PREFIX_LOCAL
elif use prefix ; then
# should be /usr, because it's the path to search includes
# for, which is unrelated to TOOLCHAIN_PREFIX, a.k.a.
@@ -1202,7 +1264,14 @@ toolchain_src_configure() {
# - https://git.musl-libc.org/cgit/musl/tree/INSTALL
# - bug #704784
# - https://gcc.gnu.org/PR93157
- [[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=( --with-abi=elfv2 )
+ # musl additionally does not support libquadmath. See:
+ # - https://gcc.gnu.org/PR116007
+ [[ ${CTARGET} == powerpc64-*-musl ]] && confgcc+=(
+ --with-abi=elfv2
+ --disable-libquadmath
+ --disable-libquadmath-support
+ --with-long-double-128=no
+ )
if in_iuse ieee-long-double; then
# musl requires 64-bit long double, not IBM double-double or IEEE quad.
@@ -1280,7 +1349,8 @@ toolchain_src_configure() {
fi
if in_iuse cet ; then
- confgcc+=( $(use_enable cet) )
+ [[ ${CTARGET} == x86_64-*-gnu* ]] && confgcc+=( $(use_enable cet) )
+ [[ ${CTARGET} == aarch64-*-gnu* ]] && confgcc+=( $(use_enable cet standard-branch-protection) )
fi
if in_iuse systemtap ; then
@@ -1352,9 +1422,39 @@ toolchain_src_configure() {
)
fi
+ if tc_version_is_at_least 13.1 ; then
+ # Re-enable fixincludes for >= GCC 13 with older glibc
+ # https://gcc.gnu.org/PR107128
+ if ! is_crosscompile && use elibc_glibc && has_version "<sys-libs/glibc-2.38" ; then
+ GCC_RUN_FIXINCLUDES=1
+ fi
+
+ case ${CBUILD}-${CHOST}-${CTARGET} in
+ *i686-w64-mingw32*|*x86_64-w64-mingw32*)
+ # config/i386/t-cygming requires fixincludes (bug #925204)
+ GCC_RUN_FIXINCLUDES=1
+ ;;
+ *mips*-sde-elf*)
+ # config/mips/t-sdemtk needs fixincludes too (bug #925204)
+ # It maps to mips*-sde-elf*, but only with --without-newlib.
+ if [[ ${confgcc} != *with-newlib* ]] ; then
+ GCC_RUN_FIXINCLUDES=1
+ fi
+ ;;
+ *)
+ ;;
+ esac
+
+ if [[ ${GCC_RUN_FIXINCLUDES} == 1 ]] ; then
+ confgcc+=( --enable-fixincludes )
+ else
+ confgcc+=( --disable-fixincludes )
+ fi
+ fi
+
# TODO: Ignore RCs here (but TOOLCHAIN_IS_RC isn't yet an eclass var)
if [[ ${PV} == *_p* && -f "${S}"/gcc/doc/gcc.info ]] ; then
- # Safeguard against https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106899 being fixed
+ # Safeguard against https://gcc.gnu.org/PR106899 being fixed
# without corresponding ebuild changes.
eqawarn "Snapshot release with pre-generated info pages found!"
eqawarn "The BDEPEND in the ebuild should be updated to drop texinfo."
@@ -1366,7 +1466,8 @@ toolchain_src_configure() {
# killing the 32bit builds which want /usr/lib.
export ac_cv_have_x='have_x=yes ac_x_includes= ac_x_libraries='
- confgcc+=( "$@" ${EXTRA_ECONF} )
+ eval "local -a EXTRA_ECONF=(${EXTRA_ECONF})"
+ confgcc+=( "$@" "${EXTRA_ECONF[@]}" )
if ! is_crosscompile && ! tc-is-cross-compiler && [[ -n ${BUILD_CONFIG_TARGETS} ]] ; then
# e.g. ./configure --with-build-config='bootstrap-lto bootstrap-cet'
@@ -1403,6 +1504,7 @@ toolchain_src_configure() {
local confgcc_jit=(
"${confgcc[@]}"
+ --enable-lto
--disable-analyzer
--disable-bootstrap
--disable-cet
@@ -1418,7 +1520,6 @@ toolchain_src_configure() {
--disable-libssp
--disable-libstdcxx-pch
--disable-libvtv
- --disable-lto
--disable-nls
--disable-objc-gc
--disable-systemtap
@@ -1428,7 +1529,7 @@ toolchain_src_configure() {
# respect USE=graphite here in case the user passes some
# graphite flags rather than try strip them out.
$(use_with graphite isl)
- --without-zstd
+ $(use_with zstd)
--with-system-zlib
)
@@ -1584,6 +1685,32 @@ gcc_do_filter_flags() {
fi
fi
+ declare -A l1_cache_sizes=()
+ # Workaround for inconsistent cache sizes on hybrid P/E cores
+ # See PR111768 (and bug #904426, bug #908523, and bug #915389)
+ if [[ ${CBUILD} == @(x86_64|i?86)* ]] && [[ ${CFLAGS} == *-march=native* ]] && tc-is-gcc ; then
+ local x
+ local l1_cache_size
+ # Iterate over all cores and find their L1 cache size
+ for x in $(seq 0 $(($(nproc)-1))) ; do
+ [[ -z ${x} || ${x} -gt 64 ]] && break
+ l1_cache_size=$(taskset --cpu-list ${x} $(tc-getCC) -Q --help=params -O2 -march=native \
+ | awk '{ if ($1 ~ /^.*param.*l1-cache-size/) print $2; }' || die)
+ [[ -n ${l1_cache_size} && ${l1_cache_size} =~ ^[0-9]+$ ]] || break
+ l1_cache_sizes[${l1_cache_size}]=1
+ done
+ # If any of them are different, abort. We can't just pass one value of
+ # l1-cache-size because it doesn't cancel out the -march=native one.
+ if [[ ${#l1_cache_sizes[@]} -gt 1 ]] ; then
+ eerror "Different values of l1-cache-size detected!"
+ eerror "GCC will fail to bootstrap when comparing files with these flags."
+ eerror "This CPU is likely big.little/hybrid hardware with power/efficiency cores."
+ eerror "Please install app-misc/resolve-march-native and run 'resolve-march-native'"
+ eerror "to find a safe value of CFLAGS for this CPU. Note that this may vary"
+ eerror "depending on the core it ran on. taskset can be used to fix the cores used."
+ die "Varying l1-cache-size found, aborting (bug #915389, gcc PR#111768)"
+ fi
+ fi
if ver_test -lt 13.6 ; then
# These aren't supported by the just-built compiler either.
@@ -1594,9 +1721,6 @@ gcc_do_filter_flags() {
# New in GCC 14.
filter-flags -Walloc-size
- else
- # Makes things painfully slow and no real benefit for the compiler.
- append-flags $(test-flags-CC -fno-harden-control-flow-redundancy)
fi
# Please use USE=lto instead (bug #906007).
@@ -1767,7 +1891,7 @@ gcc_do_make() {
# The last known issues are with < GCC 4.9 or so, but it's easier
# to keep this bound somewhat fresh just to avoid problems. Ultimately,
# using not-O0 is just a build-time speed improvement anyway.
- if tc-is-gcc && ver_test $(gcc-fullversion) -lt 10 ; then
+ if ! tc-is-gcc || ver_test $(gcc-fullversion) -lt 10 ; then
STAGE1_CFLAGS="-O0"
fi
@@ -1797,11 +1921,10 @@ gcc_do_make() {
einfo "Compiling ${PN} (${GCC_MAKE_TARGET})..."
pushd "${WORKDIR}"/build >/dev/null || die
+ # PREFIX_LOCAL
# 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
- emake \
- T= \
- ${GCC_MAKE_TARGET}
+ emake T= "${emakeargs[@]}" ${GCC_MAKE_TARGET}
if is_ada; then
# Without these links, it is not getting the good compiler
@@ -1821,7 +1944,7 @@ gcc_do_make() {
emake doc-man-doxygen
# Clean bogus manpages. bug #113902
- find -name '*_build_*' -delete
+ find -name '*_build_*' -delete || die
# Blow away generated directory references. Newer versions of gcc
# have gotten better at this, but not perfect. This is easier than
@@ -1838,48 +1961,161 @@ gcc_do_make() {
#---->> src_test <<----
+# TODO: add JIT testing
toolchain_src_test() {
- cd "${WORKDIR}"/build || die
+ # GCC's testsuite is a special case.
+ #
+ # * Generally, people work off comparisons rather than a full set of
+ # passing tests.
+ #
+ # * The guality (sic) tests are for debug info quality and are especially
+ # unreliable.
+ #
+ # * The execute torture tests are hopefully a good way for us to smoketest
+ # and find critical regresions.
- # From opensuse's spec file:
- # "asan needs a whole shadow address space"
+ # 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.
- #
- # Nonfatal here as we die if compare_tests failed
- SANDBOX_ON=0 LD_PRELOAD= nonfatal emake -k check
- local success_tests=$?
+ # To make asan tests work, we disable sandbox for all of test suite.
+ # The 'backtrace' tests also do not like the presence of 'libsandbox.so'.
+ local -x SANDBOX_ON=0
+ local -x LD_PRELOAD=
+
+ # Controls running expensive tests in e.g. the torture testsuite.
+ local -x GCC_TEST_RUN_EXPENSIVE=1
+
+ # Use a subshell to allow meddling with flags just for the testsuite
+ (
+ # Unexpected warnings confuse the tests.
+ filter-flags -W*
+ # May break parsing.
+ filter-flags '-fdiagnostics-color=*' '-fdiagnostics-urls=*'
+ # Gentoo QA flags which don't belong in tests
+ filter-flags -frecord-gcc-switches
+ filter-flags '-Wl,--defsym=__gentoo_check_ldflags__=0'
+ # Go doesn't support this and causes noisy warnings
+ filter-flags -Wbuiltin-declaration-mismatch
+ # The ASAN tests at least need LD_PRELOAD and the contract
+ # tests.
+ filter-flags -fno-semantic-interposition
+
+ # Workaround our -Wformat-security default which breaks
+ # various tests as it adds unexpected warning output.
+ append-flags -Wno-format-security -Wno-format
+ # Workaround our -Wtrampolines default which breaks
+ # tests too.
+ append-flags -Wno-trampolines
+ # A handful of Ada (and objc++?) tests need an executable stack
+ append-ldflags -Wl,--no-warn-execstack
+ # Avoid confusing tests like Fortran/C interop ones where
+ # CFLAGS are used.
+ append-flags -Wno-complain-wrong-lang
+
+ # Issues with Ada tests:
+ # gnat.dg/align_max.adb
+ # gnat.dg/trampoline4.adb
+ #
+ # A handful of Ada tests use -fstack-check and conflict
+ # with -fstack-clash-protection.
+ #
+ # TODO: This isn't ideal given it obv. affects codegen
+ # and we want to be sure it works.
+ append-flags -fno-stack-clash-protection
- if [[ ! -d "${BROOT}"/var/cache/gcc/${SLOT} ]] && ! [[ ${success_tests} -eq 0 ]] ; then
- # We have no reference data saved from a previous run to know if
- # the failures are tolerable or not, so we bail out.
- eerror "Reference test data does NOT exist at ${BROOT}/var/cache/gcc/${SLOT}"
- eerror "Tests failed and nothing to compare with, so this is a fatal error."
- eerror "(Set GCC_TESTS_IGNORE_NO_BASELINE=1 to make this non-fatal for initial run.)"
+ # configure defaults to '-O2 -g' and some tests expect it
+ # accordingly.
+ append-flags -g
- if [[ -z ${GCC_TESTS_IGNORE_NO_BASELINE} ]] ; then
- die "Tests failed (failures occurred with no reference data)"
- fi
- fi
+ # TODO: Does this handle s390 (-m31) correctly?
+ # TODO: What if there are multiple ABIs like x32 too?
+ is_multilib && GCC_TESTS_RUNTESTFLAGS+=" --target_board=unix{,-m32}"
- einfo "Testing complete! Review the following output to check for success or failure."
- einfo "Please ignore any 'mail' lines in the summary output below (no mail is sent)."
- einfo "Summary:"
- "${S}"/contrib/test_summary
+ # nonfatal here as we die if the comparison below fails. Also, note that
+ # the exit code of targets other than 'check' may be unreliable.
+ #
+ # CFLAGS and so on are repeated here because of tests vs building test
+ # deps like libbacktrace.
+ nonfatal emake -C "${WORKDIR}"/build -k "${GCC_TESTS_CHECK_TARGET}" \
+ RUNTESTFLAGS=" \
+ ${GCC_TESTS_RUNTESTFLAGS} \
+ CFLAGS_FOR_TARGET='${CFLAGS_FOR_TARGET:-${CFLAGS}}' \
+ CXXFLAGS_FOR_TARGET='${CXXFLAGS_FOR_TARGET:-${CXXFLAGS}}' \
+ LDFLAGS_FOR_TARGET='${LDFLAGS_FOR_TARGET:-${LDFLAGS}}' \
+ CFLAGS='${CFLAGS}' \
+ CXXFLAGS='${CXXFLAGS}' \
+ FCFLAGS='${FCFLAGS}' \
+ FFLAGS='${FFLAGS}' \
+ LDFLAGS='${LDFLAGS}' \
+ " \
+ CFLAGS_FOR_TARGET="${CFLAGS_FOR_TARGET:-${CFLAGS}}" \
+ CXXFLAGS_FOR_TARGET="${CXXFLAGS_FOR_TARGET:-${CXXFLAGS}}" \
+ LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}" \
+ CFLAGS="${CFLAGS}" \
+ CXXFLAGS="${CXXFLAGS}" \
+ FCFLAGS="${FCFLAGS}" \
+ FFLAGS="${FFLAGS}" \
+ LDFLAGS="${LDFLAGS}"
+ )
- # If previous results exist on the system, compare with it
- # TODO: Distribute some baseline results in e.g. gcc-patches.git?
- if [[ -d "${BROOT}"/var/cache/gcc/${SLOT} ]] ; then
- einfo "Comparing with previous cached results at ${BROOT}/var/cache/gcc/${SLOT}"
+ # Produce an updated failure manifest.
+ # XXX: Manifests aren't ideal w/ multilib because of https://gcc.gnu.org/PR116260
+ einfo "Generating a new failure manifest ${T}/${CHOST}.xfail"
+ rm -f "${T}"/${CHOST}.xfail
+ edo "${T}"/validate_failures.py \
+ --srcpath="${S}" \
+ --build_dir="${WORKDIR}"/build \
+ --manifest="${T}"/${CHOST}.xfail \
+ --produce_manifest &> /dev/null
+
+ # If there's no manifest available, check older slots, as it's better
+ # than nothing. We start with 10 for the fallback as the first version
+ # we started using --with-major-version-only.
+ local possible_slot
+ for possible_slot in "${GCC_TESTS_COMPARISON_SLOT}" $(seq ${SLOT} -1 10) ; do
+ [[ -f "${GCC_TESTS_COMPARISON_DIR}/${possible_slot}/${CHOST}.xfail" ]] && break
+ done
+ if [[ ${possible_slot} != "${GCC_TESTS_COMPARISON_SLOT}" ]] ; then
+ ewarn "Couldn't find manifest for ${GCC_TESTS_COMPARISON_SLOT}; falling back to ${possible_slot}"
+ fi
+ local manifest="${GCC_TESTS_COMPARISON_DIR}/${possible_slot}/${CHOST}.xfail"
+
+ if [[ -f "${manifest}" ]] ; then
+ # TODO: Distribute some baseline results in e.g. gcc-patches.git?
+ # validate_failures.py manifest files support include directives.
+ einfo "Comparing with previous cached results at ${manifest}"
+
+ nonfatal edo "${T}"/validate_failures.py \
+ --srcpath="${S}" \
+ --build_dir="${WORKDIR}"/build \
+ --manifest="${manifest}"
+ ret=$?
+
+ if [[ -n ${GCC_TESTS_REGEN_BASELINE} ]] ; then
+ eerror "GCC_TESTS_REGEN_BASELINE is set, ignoring test result and creating a new baseline..."
+ elif [[ ${ret} != 0 ]]; then
+ die "Tests failed (failures not listed in the baseline data)"
+ fi
+ else
+ nonfatal edo "${T}"/validate_failures.py \
+ --srcpath="${S}" \
+ --build_dir="${WORKDIR}"/build
+ ret=$?
- # Exit with the following values:
- # 0 if there is nothing of interest
- # 1 if there are errors when comparing single test case files
- # N for the number of errors found when comparing directories
- "${S}"/contrib/compare_tests "${BROOT}"/var/cache/gcc/${SLOT}/ . || die "Comparison for tests results failed, error code: $?"
+ # We have no reference data saved from a previous run to know if
+ # the failures are tolerable or not, so we bail out.
+ eerror "No reference test data at ${manifest}!"
+ eerror "GCC's tests require a baseline to compare with for any reasonable interpretation of results."
+
+ if [[ -n ${GCC_TESTS_IGNORE_NO_BASELINE} ]] ; then
+ eerror "GCC_TESTS_IGNORE_NO_BASELINE is set, ignoring test result and creating a new baseline..."
+ elif [[ -n ${GCC_TESTS_REGEN_BASELINE} ]] ; then
+ eerror "GCC_TESTS_REGEN_BASELINE is set, ignoring test result and creating using a new baseline..."
+ elif [[ ${ret} != 0 ]]; then
+ eerror "(Set GCC_TESTS_IGNORE_NO_BASELINE=1 to make this non-fatal and generate a baseline.)"
+ die "Tests failed (failures occurred with no reference data)"
+ fi
fi
}
@@ -1891,9 +2127,7 @@ toolchain_src_install() {
# Don't allow symlinks in private gcc include dir as this can break the build
find gcc/include*/ -type l -delete || die
- # Re-enable fixincludes for >= GCC 13
- # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107128
- if [[ ${GCCMAJOR} -lt 13 ]] ; then
+ if [[ ${GCC_RUN_FIXINCLUDES} == 0 ]] ; then
# We remove the generated fixincludes, as they can cause things to break
# (ncurses, openssl, etc). We do not prevent them from being built, as
# in the following commit which we revert:
@@ -1910,7 +2144,7 @@ toolchain_src_install() {
# See https://gcc.gnu.org/onlinedocs/gcc-11.3.0/jit/internals/index.html#packaging-notes
# and bug #843341.
#
- # Both of the non-JIT and JIT builds are configured to install to $(DESTDIR)
+ # Both of the non-JIT and JIT builds are configured to install to $(DESTDIR)
# Install the configuration with --enable-host-shared first
# *then* the one without, so that the faster build
# of "cc1" et al overwrites the slower build.
@@ -1920,9 +2154,9 @@ toolchain_src_install() {
S="${WORKDIR}"/build-jit emake DESTDIR="${D}" -j1 install
# Punt some tools which are really only useful while building gcc
- find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
+ find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \; || die
# This one comes with binutils
- find "${ED}" -name libiberty.a -delete
+ find "${ED}" -name libiberty.a -delete || die
# Move the libraries to the proper location
gcc_movelibs
@@ -1937,16 +2171,16 @@ toolchain_src_install() {
# with it. Several reported bugs exist where the resulting image
# was wrong, rather than a simple compile/install failure:
# - bug #906155
- # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42980
- # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51814
- # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103656
- # - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109898
+ # - https://gcc.gnu.org/PR42980
+ # - https://gcc.gnu.org/PR51814
+ # - https://gcc.gnu.org/PR103656
+ # - https://gcc.gnu.org/PR109898
S="${WORKDIR}"/build emake DESTDIR="${D}" -j1 install
# Punt some tools which are really only useful while building gcc
- find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
+ find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \; || die
# This one comes with binutils
- find "${ED}" -name libiberty.a -delete
+ find "${ED}" -name libiberty.a -delete || die
# Move the libraries to the proper location
gcc_movelibs
@@ -2022,9 +2256,9 @@ toolchain_src_install() {
rm -rf "${ED}"/usr/share/{man,info}
rm -rf "${D}"${DATAPATH}/{man,info}
else
- local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man)
+ local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man || die)
if [[ -d ${cxx_mandir} ]] ; then
- cp -r "${cxx_mandir}"/man? "${D}${DATAPATH}"/man/
+ cp -r "${cxx_mandir}"/man? "${D}${DATAPATH}"/man/ || die
fi
fi
@@ -2035,7 +2269,10 @@ toolchain_src_install() {
rm "${D}${DATAPATH}"/info/dir || die
fi
- # Prune empty dirs left behind
+ docompress "${DATAPATH}"/{info,man}
+
+ # Prune empty dirs left behind. It's fine not to die here as we may
+ # really have no empty dirs left.
find "${ED}" -depth -type d -delete 2>/dev/null
# libstdc++.la: Delete as it doesn't add anything useful: g++ itself
@@ -2061,6 +2298,7 @@ toolchain_src_install() {
'(' \
-name libstdc++.la -o \
-name libstdc++fs.la -o \
+ -name libstdc++exp.la -o \
-name libsupc++.la -o \
-name libcc1.la -o \
-name libcc1plugin.la -o \
@@ -2072,17 +2310,17 @@ toolchain_src_install() {
-name libitm.la -o \
-name libvtv.la -o \
-name 'lib*san.la' \
- ')' -type f -delete
+ ')' -type f -delete || die
# Use gid of 0 because some stupid ports don't have
# the group 'root' set to gid 0. Send to /dev/null
# for people who are testing as non-root.
- chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${D}${LIBPATH}" 2>/dev/null
+ chown -R ${PORTAGE_INST_UID:-0}:${PORTAGE_INST_GID:-0} "${D}${LIBPATH}" 2>/dev/null || die
# Installing gdb pretty-printers into gdb-specific location.
local py gdbdir=/usr/share/gdb/auto-load${LIBPATH}
- pushd "${D}${LIBPATH}" >/dev/null
- for py in $(find . -name '*-gdb.py') ; do
+ pushd "${D}${LIBPATH}" >/dev/null || die
+ for py in $(find . -name '*-gdb.py' || die) ; do
local multidir=${py%/*}
insinto "${gdbdir}/${multidir}"
@@ -2092,7 +2330,7 @@ toolchain_src_install() {
rm "${py}" || die
done
- popd >/dev/null
+ popd >/dev/null || die
# Don't scan .gox files for executable stacks - false positives
export QA_EXECSTACK="usr/lib*/go/*/*.gox"
@@ -2103,16 +2341,9 @@ toolchain_src_install() {
pax-mark -r "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
if use test ; then
- # TODO: In future, install orphaned to allow comparison across
- # more versions even after unmerged? Also would be useful for
- # historical records and tracking down regressions a while
- # after they first appeared, but were only just reported.
- einfo "Copying test results to ${EPREFIX}/var/cache/gcc/${SLOT} for future comparison"
- (
- dodir /var/cache/gcc/${SLOT}
- cd "${WORKDIR}"/build || die
- find . -name \*.sum -exec cp --parents -v {} "${ED}"/var/cache/gcc/${SLOT} \;
- )
+ mkdir "${T}"/test-results || die
+ cd "${WORKDIR}"/build || die
+ find . -name \*.sum -exec cp --parents -v {} "${T}"/test-results \; || die
fi
}
@@ -2159,7 +2390,7 @@ gcc_movelibs() {
removedirs="${removedirs} ${FROMDIR}"
FROMDIR=${D}${FROMDIR}
if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
- local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
+ local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null || die)
if [[ -n ${files} ]] ; then
mv ${files} "${TODIR}" || die
fi
@@ -2175,7 +2406,7 @@ gcc_movelibs() {
for FROMDIR in ${removedirs} ; do
rmdir "${D}"${FROMDIR} >& /dev/null
done
-
+ # XXX: Intentionally no die, here to remove empty dirs
find -depth "${ED}" -type d -exec rmdir {} + >& /dev/null
}
@@ -2250,6 +2481,7 @@ create_gcc_env_entry() {
MULTIOSDIRS="${mosdirs}"
EOF
+ # PREFIX_LOCAL
# crude hack, but necessary :(
# Darwin9's libstdc++ is incompatible with later GCC's libstdc++
# causing ugly malloc warnings about non-aligned pointers, but in
@@ -2278,6 +2510,26 @@ create_revdep_rebuild_entry() {
EOF
}
+#---->> pkg_pre* <<----
+
+toolchain_pkg_preinst() {
+ if [[ ${MERGE_TYPE} != binary ]] && use test ; then
+ # Install as orphaned to allow comparison across more versions even
+ # after unmerged. Also useful for historical records and tracking
+ # down regressions a while after they first appeared, but were only
+ # just reported.
+ einfo "Copying test results to ${GCC_TESTS_COMPARISON_DIR}/${SLOT}/${CHOST}.xfail for future comparison"
+ (
+ mkdir -p "${GCC_TESTS_COMPARISON_DIR}/${SLOT}" || die
+ cd "${T}"/test-results || die
+ # May not exist with test-fail-continue
+ if [[ -f "${T}"/${CHOST}.xfail ]] ; then
+ cp -v "${T}"/${CHOST}.xfail "${GCC_TESTS_COMPARISON_DIR}/${SLOT}" || die
+ fi
+ )
+ fi
+}
+
#---->> pkg_post* <<----
toolchain_pkg_postinst() {
@@ -2321,12 +2573,14 @@ toolchain_pkg_postrm() {
do_gcc_config() {
if ! should_we_gcc_config ; then
+ # PREFIX_LOCAL: ensure we don't pick up noise from env like EPREFIX
env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config --use-old --force
return 0
fi
local current_gcc_config target
+ # PREFIX_LOCAL: ditto
current_gcc_config=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -c ${CTARGET} 2>/dev/null)
if [[ -n ${current_gcc_config} ]] ; then
local current_specs use_specs
@@ -2361,11 +2615,13 @@ should_we_gcc_config() {
# if the current config is invalid, we definitely want a new one
# Note: due to bash quirkiness, the following must not be 1 line
local curr_config
+ # PREFIX_LOCAL: ignore env, e.g EPREFIX
curr_config=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -c ${CTARGET} 2>&1) || return 0
# If the previously selected config has the same major.minor (branch) as
# the version we are installing, then it will probably be uninstalled
# for being in the same SLOT, so make sure we run gcc-config.
+ # PREFIX_LOCAL: ditto
local curr_config_ver=$(env -i ROOT="${ROOT}" "${EPREFIX}"/usr/bin/gcc-config -S ${curr_config} | awk '{print $2}')
local curr_branch_ver=$(ver_cut 1-2 ${curr_config_ver})
@@ -2418,7 +2674,7 @@ _tc_use_if_iuse() {
is_ada() {
gcc-lang-supported ada || return 1
- _tc_use_if_iuse ada
+ _tc_use_if_iuse cxx && _tc_use_if_iuse ada
}
is_cxx() {
@@ -2531,4 +2787,4 @@ fi
# enabled-by-default state:
# econf $(usex foo '' --disable-foo)
-EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_postinst pkg_postrm
+EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure src_compile src_test src_install pkg_preinst pkg_postinst pkg_postrm
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-08-10 14:43 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-08-10 14:43 UTC (permalink / raw
To: gentoo-commits
commit: 7f22b6f72d59eff006b910f3f52a13b7396b60fc
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 10 14:41:51 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Aug 10 14:41:51 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=7f22b6f7
eclass/toolchain: drop T variable hack from 2009
Drop hack to avoid T being defined due to interference with libgcc's
makefiles. It seems it still references @T, but it seems non-Prefix
should've picked up on that too, so I'm willing to try without this fix.
Bug: https://bugs.gentoo.org/286494
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 0f4ef79b15..5d031280e0 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1921,10 +1921,7 @@ gcc_do_make() {
einfo "Compiling ${PN} (${GCC_MAKE_TARGET})..."
pushd "${WORKDIR}"/build >/dev/null || die
- # PREFIX_LOCAL
- # 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
- emake T= "${emakeargs[@]}" ${GCC_MAKE_TARGET}
+ emake "${emakeargs[@]}" ${GCC_MAKE_TARGET}
if is_ada; then
# Without these links, it is not getting the good compiler
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-08-11 16:19 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-08-11 16:19 UTC (permalink / raw
To: gentoo-commits
commit: ad71d593cb1c2807cc494c905c33f0008050a95e
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Sat Aug 10 15:09:47 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Sat Aug 10 15:09:47 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=ad71d593
eclass/java-utils-2: sync with gx86
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/java-utils-2.eclass | 66 ++++++++++++++++++++++++++++++----------------
1 file changed, 44 insertions(+), 22 deletions(-)
diff --git a/eclass/java-utils-2.eclass b/eclass/java-utils-2.eclass
index a84f7c3002..d6def86b20 100644
--- a/eclass/java-utils-2.eclass
+++ b/eclass/java-utils-2.eclass
@@ -319,12 +319,15 @@ java-pkg_doexamples() {
# arguments are passed through to find.
#
# @CODE
+# Parameters:
+# $1 - jar file
+# $2 - resource tree directory
+# $* - arguments to pass to find
+#
+# Example:
# java-pkg_addres ${PN}.jar resources ! -name "*.html"
# @CODE
#
-# @param $1 - jar file
-# @param $2 - resource tree directory
-# @param $* - arguments to pass to find
java-pkg_addres() {
debug-print-function ${FUNCNAME} $*
@@ -1134,7 +1137,7 @@ java-pkg_jarfrom() {
}
# @FUNCTION: java-pkg_getjars
-# @USAGE: [--build-only] [--with-dependencies] <package1>[,<package2>...]
+# @USAGE: [--build-only] [--runtime-only] [--with-dependencies] <package1>[,<package2>...]
# @DESCRIPTION:
# Get the classpath provided by any number of packages
# Among other things, this can be passed to 'javac -classpath' or 'ant -lib'.
@@ -1154,6 +1157,7 @@ java-pkg_jarfrom() {
# Parameters:
# --build-only - makes the jar(s) not added into package.env DEPEND line.
# (assumed automatically when called inside src_test)
+# --runtime-only - marks the jar(s) not added into package.env RDEPEND line.
# --with-dependencies - get jars also from requested package's dependencies
# transitively.
# $1 - list of packages to get jars from
@@ -1162,6 +1166,7 @@ java-pkg_jarfrom() {
java-pkg_getjars() {
debug-print-function ${FUNCNAME} $*
+ local dep_constraint
local build_only=""
local deep=""
@@ -1170,6 +1175,9 @@ java-pkg_getjars() {
while [[ "${1}" == --* ]]; do
if [[ "${1}" = "--build-only" ]]; then
build_only="build"
+ dep_constraint="build"
+ elif [[ "${1}" = "--runtime-only" ]]; then
+ dep_constraint="runtime"
elif [[ "${1}" = "--with-dependencies" ]]; then
deep="--with-dependencies"
else
@@ -1188,7 +1196,7 @@ java-pkg_getjars() {
debug-print "${pkgs}:${jars}"
for pkg in ${pkgs//,/ }; do
- java-pkg_ensure-dep "${build_only}" "${pkg}"
+ java-pkg_ensure-dep "${dep_constraint}" "${pkg}"
done
for pkg in ${pkgs//,/ }; do
@@ -1637,10 +1645,6 @@ java-pkg_set-current-vm() {
export GENTOO_VM=${1}
}
-java-pkg_get-current-vm() {
- echo ${GENTOO_VM}
-}
-
java-pkg_current-vm-matches() {
has $(java-pkg_get-current-vm) ${@}
return $?
@@ -1816,7 +1820,6 @@ java-pkg_ant-tasks-depend() {
fi
}
-
# @FUNCTION: ejunit_
# @INTERNAL
# @DESCRIPTION:
@@ -1842,7 +1845,7 @@ ejunit_() {
local junit=${1}
shift 1
- local cp=$(java-pkg_getjars --with-dependencies ${junit}${pkgs})
+ local cp=$(java-pkg_getjars --build-only --with-dependencies ${junit}${pkgs})
if [[ ${1} = -cp || ${1} = -classpath ]]; then
cp="${2}:${cp}"
shift 2
@@ -1930,7 +1933,7 @@ etestng() {
local runner=org.testng.TestNG
if [[ ${PN} != testng ]]; then
- local cp=$(java-pkg_getjars --with-dependencies testng)
+ local cp=$(java-pkg_getjars --build-only --with-dependencies testng)
else
local cp=testng.jar
fi
@@ -2037,13 +2040,23 @@ java-utils-2_pkg_preinst() {
eant() {
debug-print-function ${FUNCNAME} $*
- if [[ ${EBUILD_PHASE} = compile ]]; then
- java-ant-2_src_configure
- fi
+ if [[ ${!JAVA_PKG_BSFIX*} ]] \
+ || [[ ${JAVA_ANT_BSFIX_EXTRA_ARGS} ]] \
+ || [[ ${JAVA_ANT_CLASSPATH_TAGS} ]] \
+ || [[ ${JAVA_ANT_JAVADOC_INPUT_DIRS} ]] \
+ || [[ ${JAVA_ANT_REWRITE_CLASSPATH} ]] \
+ || [[ ${EANT_BUILD_XML} ]] \
+ || [[ ${!EANT_GENTOO_CLASSPATH*} ]] \
+ || [[ ${EANT_TEST_GENTOO_CLASSPATH} ]]
+ then
+ if [[ ${EBUILD_PHASE} = compile ]]; then
+ java-ant-2_src_configure
+ fi
- if ! has java-ant-2 ${INHERITED}; then
- local msg="You should inherit java-ant-2 when using eant"
- java-pkg_announce-qa-violation "${msg}"
+ if ! has java-ant-2 ${INHERITED}; then
+ local msg="You should inherit java-ant-2 when using eant"
+ java-pkg_announce-qa-violation "${msg}"
+ fi
fi
local antflags="-Dnoget=true -Dmaven.mode.offline=true -Dbuild.sysclasspath=ignore"
@@ -2502,6 +2515,9 @@ java-pkg_do_write_() {
echo "SLOT=\"${SLOT}\""
echo "CATEGORY=\"${CATEGORY}\""
echo "PVR=\"${PVR}\""
+ # Record LIBDIR so that gjl can set java.library.path
+ # accordingly. Bug #917326.
+ echo "LIBDIR=\"$(get_libdir)\""
[[ -n "${JAVA_PKG_CLASSPATH}" ]] && echo "CLASSPATH=\"${JAVA_PKG_CLASSPATH}\""
[[ -n "${JAVA_PKG_LIBRARY}" ]] && echo "LIBRARY_PATH=\"${JAVA_PKG_LIBRARY}\""
@@ -2716,7 +2732,13 @@ java-pkg_build-vm-from-handle() {
fi
for vm in ${JAVA_PKG_WANT_BUILD_VM}; do
- if java-config-2 --select-vm=${vm} 2>/dev/null; then
+ local java_config
+ for java_config in java-config{,-2}; do
+ type -p ${java_config} >/dev/null && break
+ done
+ [[ -z ${java_config} ]] && die "No java-config binary in PATH"
+
+ if ${java_config} --select-vm=${vm} 2>/dev/null; then
echo ${vm}
return 0
fi
@@ -2819,7 +2841,7 @@ java-pkg_die() {
echo "!!! When you file a bug report, please include the following information:" >&2
echo "GENTOO_VM=${GENTOO_VM} CLASSPATH=\"${CLASSPATH}\" JAVA_HOME=\"${JAVA_HOME}\"" >&2
echo "JAVACFLAGS=\"${JAVACFLAGS}\" COMPILER=\"${GENTOO_COMPILER}\"" >&2
- echo "and of course, the output of emerge --info =${P}" >&2
+ echo "and of course, the output of emerge --info =${CATEGORY}/${PF}" >&2
}
@@ -2937,7 +2959,7 @@ java-pkg_ensure-dep() {
# if is-java-strict; then
# die "${dev_error}"
# else
- eqawarn "java-pkg_ensure-dep: ${dev_error}"
+ eqawarn "QA Notice: java-pkg_ensure-dep: ${dev_error}"
# eerror "Because you have ${target_pkg} installed,"
# eerror "the package will build without problems, but please"
# eerror "report this to https://bugs.gentoo.org."
@@ -2948,7 +2970,7 @@ java-pkg_ensure-dep() {
# if is-java-strict; then
# die "${dev_error}"
# else
- eqawarn "java-pkg_ensure-dep: ${dev_error}"
+ eqawarn "QA Notice: java-pkg_ensure-dep: ${dev_error}"
# eerror "The package will build without problems, but may fail to run"
# eerror "if you don't have ${target_pkg} installed,"
# eerror "so please report this to https://bugs.gentoo.org."
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-09-23 18:25 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-09-23 18:25 UTC (permalink / raw
To: gentoo-commits
commit: cdc0d0a0b1ead1a98ab409b9a4eea1fdc28799f9
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 23 18:24:41 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Sep 23 18:24:41 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=cdc0d0a0
eclass/toolchain: sync with gx86
Closes: https://bugs.gentoo.org/940173
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 121 +++++++++++++++++++++++-------------------------
1 file changed, 59 insertions(+), 62 deletions(-)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 5d031280e0..ba0cd7da5b 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -22,7 +22,9 @@ _TOOLCHAIN_ECLASS=1
DESCRIPTION="The GNU Compiler Collection"
HOMEPAGE="https://gcc.gnu.org/"
-inherit edo flag-o-matic gnuconfig libtool multilib pax-utils python-any-r1 toolchain-funcs prefix
+inherit edo flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
+
+[[ -n ${TOOLCHAIN_HAS_TESTS} ]] && inherit python-any-r1
tc_is_live() {
[[ ${PV} == *9999* ]]
@@ -60,9 +62,6 @@ is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
-# The target prefix defaults to the host prefix, except for cross compilers, which targets the empty prefix by default.
-: ${TPREFIX:=$(is_crosscompile || echo "${EPREFIX}")}
-
# @FUNCTION: tc_version_is_at_least
# @USAGE: ver1 [ver2]
# @DESCRIPTION:
@@ -146,6 +145,12 @@ tc_version_is_between() {
# @DESCRIPTION:
# Indicate the developer who hosts the patchset for an ebuild.
+# @ECLASS_VARIABLE: TOOLCHAIN_HAS_TESTS
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Controls whether python-any-r1 is inherited and validate_failures.py
+# is used.
+
# @ECLASS_VARIABLE: GCC_PV
# @INTERNAL
# @DESCRIPTION:
@@ -276,6 +281,7 @@ STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${LIBPATH}/include/g++-v${GCC_BRANCH_VE
LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.3+"
IUSE="test vanilla +nls"
RESTRICT="!test? ( test )"
+[[ -z ${TOOLCHAIN_HAS_TESTS} ]] && RESTRICT+=" test"
TC_FEATURES=()
@@ -283,7 +289,7 @@ tc_has_feature() {
has "$1" "${TC_FEATURES[@]}"
}
-# Prefix: allow gcc-apple post 4.2.1
+# PREFIX_LOCAL: allow gcc-apple post 4.2.1
if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ||
[[ ${PN} == "gcc-apple" && $(tc_version_is_at_least 12.1) == 0 ]] ; then
IUSE+=" debug +cxx +nptl" TC_FEATURES+=( nptl )
@@ -358,6 +364,7 @@ fi
BDEPEND="
app-alternatives/yacc
+ !elibc_Darwin? ( sys-devel/binutils:* )
>=sys-devel/flex-2.5.4
nls? ( sys-devel/gettext )
test? (
@@ -418,7 +425,7 @@ if tc_has_feature rust && tc_version_is_at_least 14.0.0_pre20230421 ; then
fi
# PREFIX LOCAL: we don't have 2.11 (yet)
-PDEPEND=">=sys-devel/gcc-config-2.3"
+PDEPEND=">=sys-devel/gcc-config-2.7"
#---->> S + SRC_URI essentials <<----
@@ -542,7 +549,8 @@ get_gcc_src_uri() {
[[ -n ${MUSL_VER} ]] && \
GCC_SRC_URI+=" $(gentoo_urls gcc-${MUSL_GCC_VER}-musl-patches-${MUSL_VER}.tar.${TOOLCHAIN_PATCH_SUFFIX})"
- GCC_SRC_URI+=" test? ( https://gitweb.gentoo.org/proj/gcc-patches.git/plain/scripts/testsuite-management/validate_failures.py?id=${GCC_VALIDATE_FAILURES_VERSION} -> gcc-validate-failures-${GCC_VALIDATE_FAILURES_VERSION}.py )"
+ [[ -n ${TOOLCHAIN_HAS_TESTS} ]] && \
+ GCC_SRC_URI+=" test? ( https://gitweb.gentoo.org/proj/gcc-patches.git/plain/scripts/testsuite-management/validate_failures.py?id=${GCC_VALIDATE_FAILURES_VERSION} -> gcc-validate-failures-${GCC_VALIDATE_FAILURES_VERSION}.py )"
echo "${GCC_SRC_URI}"
}
@@ -574,7 +582,7 @@ toolchain_pkg_setup() {
# more legible.
MAKEOPTS="--output-sync=line ${MAKEOPTS}"
- use test && python-any-r1_pkg_setup
+ [[ -n ${TOOLCHAIN_HAS_TESTS} ]] && use test && python-any-r1_pkg_setup
}
#---->> src_unpack <<----
@@ -599,16 +607,6 @@ toolchain_fetch_git_patches() {
mkdir "${WORKDIR}"/musl || die
mv "${WORKDIR}"/patch.tmp/${PATCH_GCC_VER}/musl/* "${WORKDIR}"/musl || die
fi
-
- # PREFIX_LOCAL
- # yuck, but how else to do it portable?
- local realEPREFIX=$(python -c 'import os; print(os.path.realpath("'"${EPREFIX}"'"))')
- if [[ -z ${I_KNOW_MY_GCC_WORKS_FINE_WITH_SYMLINKS} && ${EPREFIX} != ${realEPREFIX} ]] ; then
- ewarn "Your \${EPREFIX} contains one or more symlinks. GCC has a"
- ewarn "bug which prevents it from working properly when there are"
- ewarn "symlinks in your \${EPREFIX}."
- ewarn "See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29831"
- fi
}
toolchain_src_unpack() {
@@ -661,7 +659,7 @@ toolchain_src_prepare() {
sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/MacOSX.sdk/System/Library/Frameworks\"\, \"${EPREFIX}/Frameworks\"\, " \
"${S}"/gcc/config/${darwindriver} || die "sed gcc/config/${darwindriver} failed"
- if use test ; then
+ if [[ -n ${TOOLCHAIN_HAS_TESTS} ]] && use test ; then
cp "${DISTDIR}"/gcc-validate-failures-${GCC_VALIDATE_FAILURES_VERSION}.py "${T}"/validate_failures.py || die
chmod +x "${T}"/validate_failures.py || die
fi
@@ -1133,7 +1131,7 @@ toolchain_src_configure() {
# should be /usr, because it's the path to search includes
# for, which is unrelated to TOOLCHAIN_PREFIX, a.k.a.
# PREFIX
- confgcc+=( --with-local-prefix="${TPREFIX}/usr" )
+ confgcc+=( --with-local-prefix="${EPREFIX}/usr" )
# enable the configured SDK, Apple no longer installs stuff
# into /usr
@@ -1349,7 +1347,9 @@ toolchain_src_configure() {
fi
if in_iuse cet ; then
- [[ ${CTARGET} == x86_64-*-gnu* ]] && confgcc+=( $(use_enable cet) )
+ if [[ ${CTARGET} == i[[34567]]86-*-linux* || ${CTARGET} == x86_64-*-gnu* ]] ; then
+ confgcc+=( $(use_enable cet) )
+ fi
[[ ${CTARGET} == aarch64-*-gnu* ]] && confgcc+=( $(use_enable cet standard-branch-protection) )
fi
@@ -1920,7 +1920,6 @@ gcc_do_make() {
einfo "Compiling ${PN} (${GCC_MAKE_TARGET})..."
pushd "${WORKDIR}"/build >/dev/null || die
-
emake "${emakeargs[@]}" ${GCC_MAKE_TARGET}
if is_ada; then
@@ -1981,34 +1980,27 @@ toolchain_src_test() {
local -x LD_PRELOAD=
# Controls running expensive tests in e.g. the torture testsuite.
+ # Note that 'TEST', not 'TESTS', is correct here as it's a GCC
+ # testsuite variable, not ours.
local -x GCC_TEST_RUN_EXPENSIVE=1
# Use a subshell to allow meddling with flags just for the testsuite
(
- # Unexpected warnings confuse the tests.
- filter-flags -W*
- # May break parsing.
- filter-flags '-fdiagnostics-color=*' '-fdiagnostics-urls=*'
- # Gentoo QA flags which don't belong in tests
- filter-flags -frecord-gcc-switches
- filter-flags '-Wl,--defsym=__gentoo_check_ldflags__=0'
- # Go doesn't support this and causes noisy warnings
- filter-flags -Wbuiltin-declaration-mismatch
- # The ASAN tests at least need LD_PRELOAD and the contract
- # tests.
- filter-flags -fno-semantic-interposition
-
# Workaround our -Wformat-security default which breaks
# various tests as it adds unexpected warning output.
- append-flags -Wno-format-security -Wno-format
+ GCC_TESTS_CFLAGS+=" -Wno-format-security -Wno-format"
+ GCC_TESTS_CXXFLAGS+=" -Wno-format-security -Wno-format"
+
# Workaround our -Wtrampolines default which breaks
# tests too.
- append-flags -Wno-trampolines
+ GCC_TESTS_CFLAGS+=" -Wno-trampolines"
+ GCC_TESTS_CXXFLAGS+=" -Wno-trampolines"
# A handful of Ada (and objc++?) tests need an executable stack
- append-ldflags -Wl,--no-warn-execstack
+ GCC_TESTS_LDFLAGS+=" -Wl,--no-warn-execstack"
# Avoid confusing tests like Fortran/C interop ones where
# CFLAGS are used.
- append-flags -Wno-complain-wrong-lang
+ GCC_TESTS_CFLAGS+=" -Wno-complain-wrong-lang"
+ GCC_TESTS_CXXFLAGS+=" -Wno-complain-wrong-lang"
# Issues with Ada tests:
# gnat.dg/align_max.adb
@@ -2019,45 +2011,50 @@ toolchain_src_test() {
#
# TODO: This isn't ideal given it obv. affects codegen
# and we want to be sure it works.
- append-flags -fno-stack-clash-protection
+ GCC_TESTS_CFLAGS+=" -fno-stack-clash-protection"
+ GCC_TESTS_CXXFLAGS+=" -fno-stack-clash-protection"
# configure defaults to '-O2 -g' and some tests expect it
# accordingly.
- append-flags -g
+ GCC_TESTS_CFLAGS+=" -g"
# TODO: Does this handle s390 (-m31) correctly?
# TODO: What if there are multiple ABIs like x32 too?
- is_multilib && GCC_TESTS_RUNTESTFLAGS+=" --target_board=unix{,-m32}"
+ # XXX: Disabled until validate_failures.py can handle 'variants'
+ # XXX: https://gcc.gnu.org/PR116260
+ #is_multilib && GCC_TESTS_RUNTESTFLAGS+=" --target_board=unix{,-m32}"
# nonfatal here as we die if the comparison below fails. Also, note that
# the exit code of targets other than 'check' may be unreliable.
#
# CFLAGS and so on are repeated here because of tests vs building test
# deps like libbacktrace.
+ #
+ # TODO: Should we try pass in the regular user flags for the non-RUNTESTFLAGS
+ # instances below for building e.g. libbacktrace?
nonfatal emake -C "${WORKDIR}"/build -k "${GCC_TESTS_CHECK_TARGET}" \
RUNTESTFLAGS=" \
${GCC_TESTS_RUNTESTFLAGS} \
- CFLAGS_FOR_TARGET='${CFLAGS_FOR_TARGET:-${CFLAGS}}' \
- CXXFLAGS_FOR_TARGET='${CXXFLAGS_FOR_TARGET:-${CXXFLAGS}}' \
- LDFLAGS_FOR_TARGET='${LDFLAGS_FOR_TARGET:-${LDFLAGS}}' \
- CFLAGS='${CFLAGS}' \
- CXXFLAGS='${CXXFLAGS}' \
- FCFLAGS='${FCFLAGS}' \
- FFLAGS='${FFLAGS}' \
- LDFLAGS='${LDFLAGS}' \
+ CFLAGS_FOR_TARGET='${GCC_TESTS_CFLAGS_FOR_TARGET:-${GCC_TESTS_CFLAGS}}' \
+ CXXFLAGS_FOR_TARGET='${GCC_TESTS_CXXFLAGS_FOR_TARGET:-${GCC_TESTS_CXXFLAGS}}' \
+ LDFLAGS_FOR_TARGET='${TEST_LDFLAGS_FOR_TARGET:-${GCC_TESTS_LDFLAGS}}' \
+ CFLAGS='${GCC_TESTS_CFLAGS}' \
+ CXXFLAGS='${GCC_TESTS_CXXFLAGS}' \
+ FCFLAGS='${GCC_TESTS_FCFLAGS}' \
+ FFLAGS='${GCC_TESTS_FFLAGS}' \
+ LDFLAGS='${GCC_TESTS_LDFLAGS}' \
" \
- CFLAGS_FOR_TARGET="${CFLAGS_FOR_TARGET:-${CFLAGS}}" \
- CXXFLAGS_FOR_TARGET="${CXXFLAGS_FOR_TARGET:-${CXXFLAGS}}" \
- LDFLAGS_FOR_TARGET="${LDFLAGS_FOR_TARGET:-${LDFLAGS}}" \
- CFLAGS="${CFLAGS}" \
- CXXFLAGS="${CXXFLAGS}" \
- FCFLAGS="${FCFLAGS}" \
- FFLAGS="${FFLAGS}" \
- LDFLAGS="${LDFLAGS}"
+ CFLAGS_FOR_TARGET="${GCC_TESTS_CFLAGS_FOR_TARGET:-${GCC_TESTS_CFLAGS}}" \
+ CXXFLAGS_FOR_TARGET="${GCC_TESTS_CXXFLAGS_FOR_TARGET:-${GCC_TESTS_CXXFLAGS}}" \
+ LDFLAGS_FOR_TARGET="${GCC_TESTS_LDFLAGS_FOR_TARGET:-${GCC_TESTS_LDFLAGS}}" \
+ CFLAGS="${GCC_TESTS_CFLAGS}" \
+ CXXFLAGS="${GCC_TESTS_CXXFLAGS}" \
+ FCFLAGS="${GCC_TESTS_FCFLAGS}" \
+ FFLAGS="${GCC_TESTS_FFLAGS}" \
+ LDFLAGS="${GCC_TESTS_LDFLAGS}"
)
# Produce an updated failure manifest.
- # XXX: Manifests aren't ideal w/ multilib because of https://gcc.gnu.org/PR116260
einfo "Generating a new failure manifest ${T}/${CHOST}.xfail"
rm -f "${T}"/${CHOST}.xfail
edo "${T}"/validate_failures.py \
@@ -2109,7 +2106,7 @@ toolchain_src_test() {
eerror "GCC_TESTS_IGNORE_NO_BASELINE is set, ignoring test result and creating a new baseline..."
elif [[ -n ${GCC_TESTS_REGEN_BASELINE} ]] ; then
eerror "GCC_TESTS_REGEN_BASELINE is set, ignoring test result and creating using a new baseline..."
- elif [[ ${ret} != 0 ]]; then
+ elif [[ ${ret} != 0 ]] ; then
eerror "(Set GCC_TESTS_IGNORE_NO_BASELINE=1 to make this non-fatal and generate a baseline.)"
die "Tests failed (failures occurred with no reference data)"
fi
@@ -2337,7 +2334,7 @@ toolchain_src_install() {
pax-mark -r "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
pax-mark -r "${ED}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
- if use test ; then
+ if [[ -n ${TOOLCHAIN_HAS_TESTS} ]] && use test ; then
mkdir "${T}"/test-results || die
cd "${WORKDIR}"/build || die
find . -name \*.sum -exec cp --parents -v {} "${T}"/test-results \; || die
@@ -2510,7 +2507,7 @@ create_revdep_rebuild_entry() {
#---->> pkg_pre* <<----
toolchain_pkg_preinst() {
- if [[ ${MERGE_TYPE} != binary ]] && use test ; then
+ if [[ -n ${TOOLCHAIN_HAS_TESTS} && ${MERGE_TYPE} != binary ]] && use test ; then
# Install as orphaned to allow comparison across more versions even
# after unmerged. Also useful for historical records and tracking
# down regressions a while after they first appeared, but were only
^ permalink raw reply related [flat|nested] 89+ messages in thread
* [gentoo-commits] repo/proj/prefix:master commit in: eclass/
@ 2024-09-30 9:08 Fabian Groffen
0 siblings, 0 replies; 89+ messages in thread
From: Fabian Groffen @ 2024-09-30 9:08 UTC (permalink / raw
To: gentoo-commits
commit: 244cd0c852d76ed8339f0155bbb0560467e1f0bf
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 30 07:16:10 2024 +0000
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Sep 30 07:16:10 2024 +0000
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=244cd0c8
eclass/toolchain: ensure fix-includes are used on Prefix guest platforms
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>
eclass/toolchain.eclass | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index ba0cd7da5b..66f8d117b7 100644
--- a/eclass/toolchain.eclass
+++ b/eclass/toolchain.eclass
@@ -1445,6 +1445,11 @@ toolchain_src_configure() {
;;
esac
+ # PREFIX_LOCAL: host OS very likely needs tweaks, so install
+ # these in order to allow compiling GCC itself and packages
+ # afterwards
+ use prefix-guest && GCC_RUN_FIXINCLUDES=1
+
if [[ ${GCC_RUN_FIXINCLUDES} == 1 ]] ; then
confgcc+=( --enable-fixincludes )
else
^ permalink raw reply related [flat|nested] 89+ messages in thread
end of thread, other threads:[~2024-09-30 9:08 UTC | newest]
Thread overview: 89+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-04 17:20 [gentoo-commits] repo/proj/prefix:master commit in: eclass/ Fabian Groffen
-- strict thread matches above, loose matches on Subject: below --
2024-09-30 9:08 Fabian Groffen
2024-09-23 18:25 Fabian Groffen
2024-08-11 16:19 Fabian Groffen
2024-08-10 14:43 Fabian Groffen
2024-08-10 14:24 Fabian Groffen
2024-08-10 14:24 Fabian Groffen
2024-08-10 10:48 Fabian Groffen
2024-08-09 9:25 Fabian Groffen
2024-08-07 17:08 Fabian Groffen
2024-08-07 17:03 Fabian Groffen
2024-07-25 6:25 Fabian Groffen
2024-07-17 12:01 Fabian Groffen
2024-05-09 7:14 Fabian Groffen
2024-01-21 13:47 Fabian Groffen
2024-01-21 13:43 Fabian Groffen
2024-01-21 13:40 Fabian Groffen
2023-12-16 15:36 Fabian Groffen
2023-09-11 23:33 Sam James
2023-09-04 6:36 Fabian Groffen
2023-09-03 19:39 Fabian Groffen
2023-05-24 7:55 Fabian Groffen
2023-05-24 6:19 Fabian Groffen
2022-06-29 14:53 Sam James
2022-06-29 14:05 Sam James
2022-06-07 17:01 Fabian Groffen
2022-06-07 12:35 Fabian Groffen
2022-06-06 16:51 Fabian Groffen
2022-06-06 9:07 Fabian Groffen
2022-06-06 8:42 Fabian Groffen
2022-05-10 6:22 Fabian Groffen
2022-02-17 0:12 Sam James
2022-02-10 8:54 Fabian Groffen
2022-01-31 1:07 Sam James
2022-01-23 2:27 Sam James
2022-01-23 1:21 Sam James
2021-12-03 10:03 Fabian Groffen
2021-10-21 6:39 Fabian Groffen
2021-10-14 6:15 Sam James
2021-10-14 6:15 Sam James
2021-10-13 4:05 Sam James
2021-07-13 9:02 Fabian Groffen
2021-06-29 6:48 Fabian Groffen
2021-06-29 6:23 Fabian Groffen
2021-05-04 17:20 Fabian Groffen
2021-05-04 17:20 Fabian Groffen
2021-05-04 17:20 Fabian Groffen
2021-05-04 17:20 Fabian Groffen
2021-05-04 17:09 Fabian Groffen
2021-04-10 7:15 Sam James
2021-04-10 7:15 Sam James
2021-04-10 7:15 Sam James
2021-04-10 7:09 Sam James
2021-03-13 9:54 Fabian Groffen
2021-02-07 19:23 Fabian Groffen
2021-01-24 9:47 Fabian Groffen
2021-01-14 8:02 Fabian Groffen
2021-01-12 13:32 Fabian Groffen
2021-01-11 19:53 Fabian Groffen
2020-12-15 7:48 Fabian Groffen
2020-11-29 14:24 Fabian Groffen
2020-11-29 13:41 Fabian Groffen
2020-08-09 8:14 Fabian Groffen
2020-06-22 18:28 Fabian Groffen
2020-06-22 13:56 Fabian Groffen
2020-05-26 6:44 Fabian Groffen
2020-03-26 7:56 Fabian Groffen
2020-03-22 9:25 Fabian Groffen
2020-03-16 17:23 Michael Haubenwallner
2020-03-13 7:51 Fabian Groffen
2019-12-11 9:47 Fabian Groffen
2019-11-14 6:36 Fabian Groffen
2019-05-30 8:25 Fabian Groffen
2019-03-25 14:20 Michael Haubenwallner
2018-12-17 9:55 Fabian Groffen
2018-07-17 8:45 Fabian Groffen
2018-07-03 8:52 Michael Haubenwallner
2018-06-22 13:16 Michael Haubenwallner
2018-06-20 7:32 Fabian Groffen
2018-06-06 12:48 Fabian Groffen
2017-12-12 18:53 Fabian Groffen
2017-12-12 18:53 Fabian Groffen
2017-10-17 8:39 Fabian Groffen
2017-10-16 13:54 Fabian Groffen
2017-10-03 7:38 Michael Haubenwallner
2016-07-08 11:17 Fabian Groffen
2016-06-15 11:32 [gentoo-commits] repo/proj/prefix:rap0 " Benda XU
2016-06-15 11:05 ` [gentoo-commits] repo/proj/prefix:master " Benda XU
2016-04-18 8:07 Michael Haubenwallner
2016-03-20 18:22 Fabian Groffen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox