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 }