summaryrefslogtreecommitdiff
path: root/eclass/toolchain.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
committerV3n3RiX <venerix@redcorelinux.org>2020-08-25 10:45:55 +0100
commit3cf7c3ef441822c889356fd1812ebf2944a59851 (patch)
treec513fe68548b40365c1c2ebfe35c58ad431cdd77 /eclass/toolchain.eclass
parent05b8b0e0af1d72e51a3ee61522941bf7605cd01c (diff)
gentoo resync : 25.08.2020
Diffstat (limited to 'eclass/toolchain.eclass')
-rw-r--r--eclass/toolchain.eclass201
1 files changed, 36 insertions, 165 deletions
diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass
index 8384e565d867..5bbf46ecd3d5 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* ]]
@@ -99,11 +99,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
@@ -121,20 +117,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 )"
@@ -163,8 +146,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)
@@ -173,7 +154,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"
@@ -200,6 +180,7 @@ 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)
fi
if tc_version_is_at_least 10; then
@@ -272,11 +253,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
-PDEPEND=">=sys-devel/gcc-config-1.7"
+PDEPEND=">=sys-devel/gcc-config-2.3"
#---->> S + SRC_URI essentials <<----
@@ -348,13 +333,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,
@@ -399,19 +377,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 )"
@@ -482,20 +447,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
@@ -513,38 +465,19 @@ toolchain_src_prepare() {
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
-
# 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
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
@@ -558,19 +491,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
@@ -620,14 +540,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
@@ -793,41 +705,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() {
@@ -1025,6 +902,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+=(
@@ -1032,6 +912,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[@]}"
@@ -1236,12 +1124,6 @@ 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
confgcc+=( --enable-libssp )
else
@@ -1278,6 +1160,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)
@@ -1290,12 +1176,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
@@ -1698,8 +1578,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
@@ -1914,11 +1793,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
@@ -2008,6 +1882,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.
@@ -2223,12 +2103,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
}
@@ -2238,11 +2114,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