diff options
author | 2016-06-15 19:56:21 +0900 | |
---|---|---|
committer | 2016-06-15 20:48:27 +0900 | |
commit | 6add7b7321aab0f6797dcf4b472fbedd0b12ab85 (patch) | |
tree | 7dd9780cdfb6b16140bfd01b728cbc112a08b34f | |
parent | kernel-2.eclass, toolchain-funcs.eclass: merged. (diff) | |
download | heroxbd-6add7b7321aab0f6797dcf4b472fbedd0b12ab85.tar.gz heroxbd-6add7b7321aab0f6797dcf4b472fbedd0b12ab85.tar.bz2 heroxbd-6add7b7321aab0f6797dcf4b472fbedd0b12ab85.zip |
app-shells/bash: introduce fprefixify.
-rw-r--r-- | app-shells/bash/Manifest | 2 | ||||
-rw-r--r-- | app-shells/bash/bash-4.3_p42-r2.ebuild | 8 | ||||
-rw-r--r-- | eclass/prefix.eclass | 73 | ||||
-rw-r--r-- | eclass/toolchain.eclass | 337 |
4 files changed, 265 insertions, 155 deletions
diff --git a/app-shells/bash/Manifest b/app-shells/bash/Manifest index 95012e3..ce1bf27 100644 --- a/app-shells/bash/Manifest +++ b/app-shells/bash/Manifest @@ -55,6 +55,6 @@ DIST bash43-039 1531 SHA256 ab94dced2215541097691f60c3eb323cc28ef2549463e6a5334b DIST bash43-040 1532 SHA256 84bb396b9262992ca5424feab6ed3ec39f193ef5c76dfe4a62b551bd8dd9d76b SHA512 25a0696f1f0e78cb971afa404e0b7fe634b70d49d6a5a9d6ff5506c42063968e8ede83ad80bd0b79601363676fe3abfedc3b76984f6f9ad2e7798790682e21d0 WHIRLPOOL a435f25ae432161f676b4965cc20cc096fa18af8a191dca7cb311a41e3504e5d27c668fb3430fece1de45e0eed9cb34357dc887e83ace9819f24d585eddf6720 DIST bash43-041 2362 SHA256 4ec432966e4198524a7e0cd685fe222e96043769c9613e66742ac475db132c1a SHA512 d75cdd6a1fb8aeb1a4e88f046cfea3ec493b994b96f60f27d5577b59408422bb7c51cc4525cadab821fd8c57f44fb07f811b087d077359242caff3b54cfc6819 WHIRLPOOL c88e754d694b69bcb3ce390ab3e29932b30a74f8f15b75b570cc46699c072b0f872824766c45bc2a98627529896bdf5aaf6493a493ffd33932d9ed6a362defb3 DIST bash43-042 1535 SHA256 ac219322db2791da87a496ee6e8e5544846494bdaaea2626270c2f73c1044919 SHA512 01a6601029c0a55c9bf1a4ace3f387f9d094a9b9ee3511e2113c000123d85b1d5813c369e62d5a6dd329f515ef0d67d11394a6c0e4516956387556c13d13009a WHIRLPOOL 790b15282a81f5717fb675ea4ae752382ddb1b101766e32c68deb1ec1d64fcf8841b3da556b87ac685e18b528a1de31bc4b94900369f6386f8e3991ed76232c1 -EBUILD bash-4.3_p42-r2.ebuild 7456 SHA256 2c3e289168f86fccadfc98a3d12ecc2e455c380fb0bf9bbaeda8e743a7b243f7 SHA512 f1795707bc2889992b3ce2b3da9ac7c3c8128694dee7ee3a3119404ea714ee3359460bc26697d70eddb1b4af740530871959b833b518ce1d214e885f3f1271af WHIRLPOOL edc9669b7f0aa214a743cd9feb719255cd4e8e5de925df05227406790e8b7c1f6084655d2b8bb918cdede7e92e1b23e7a1d9a0c8da4a54bb9e55b2fcd2a76753 +EBUILD bash-4.3_p42-r2.ebuild 7355 SHA256 9e3e57dd0af1f66e27493a1e2f31d404084846ddc82dbbef6c67e25d6b4e2280 SHA512 58a5931cfcd89c2587ab336ad87b334127df65f5818cec1b6a3b7871e3b8173a7a46dd0c0956104b9d270351dd873e10c1e3666a37df168725f039edea1b32e0 WHIRLPOOL 72d9a680334722fd0a326c388495cbf77b9776d6ad3497117cffc075ad3acfca2d6677e1fe735ec70b96a6acf2318075be3a91f00ea9278db056cc5c215fd2e0 EBUILD bash-4.4_rc1.ebuild 6959 SHA256 d92507283358f9f797f7e125e7a58a650d8b53c24af2d99adcd61c73f359da9e SHA512 c180b33b87da6ddedec29dd064c97524e02fd0d44b4e848a0a5cfb36cfbc5efdb68f1c256bee25bbbc4c8588fbbd284fc3cef8d314686a2dc27aa5375e8298cb WHIRLPOOL b9617eab24f0a7ecfeb532019c09579cd5517ed914a4aa751e8b67cf1248e3b7ee7dc326943d3ea6667a88d7d194ad529a23586096c6397081e31da7d2dc0c4a MISC metadata.xml 734 SHA256 7850abd55e656b9360deafb278c98598922eb3b6f884d024d199110afdcf6ff0 SHA512 a9301e8d2347e0cf90a97325d9a705076150c00609d28338e5d7d72c135468e4f0531b2a4077b69679ae6ccf89eee691e0e5f0748caab60689f5f017afb544f1 WHIRLPOOL ce0e36bc0ae83b73aee7abee391d1b0a384f0277dfb7f7282043624a523699685d866ef3291a02e9ad1bde3abf196b47e1351f646e0149f942a40ed4dc940a37 diff --git a/app-shells/bash/bash-4.3_p42-r2.ebuild b/app-shells/bash/bash-4.3_p42-r2.ebuild index 80d2094..5e590c6 100644 --- a/app-shells/bash/bash-4.3_p42-r2.ebuild +++ b/app-shells/bash/bash-4.3_p42-r2.ebuild @@ -88,11 +88,7 @@ src_prepare() { epatch "${FILESDIR}"/${PN}-4.3-mapfile-improper-array-name-validation.patch epatch "${FILESDIR}"/${PN}-4.3-arrayfunc.patch - epatch "${FILESDIR}"/${PN}-4.0-configs-prefix.patch - eprefixify pathnames.h.in - # modify the bashrc file for prefix - cp "${FILESDIR}"/bashrc "${T}"/ || die - eprefixify "${T}"/bashrc + fprefixify epatch "${FILESDIR}"/${PN}-4.0-configs-prefix.patch epatch_user } @@ -183,7 +179,7 @@ src_install() { insinto /etc/bash doins "${FILESDIR}"/bash_logout - doins "${T}"/bashrc + fprefixify doins "${FILESDIR}"/bashrc keepdir /etc/bash/bashrc.d insinto /etc/skel for f in bash{_logout,_profile,rc} ; do diff --git a/eclass/prefix.eclass b/eclass/prefix.eclass index 101cce2..40e5097 100644 --- a/eclass/prefix.eclass +++ b/eclass/prefix.eclass @@ -12,8 +12,6 @@ # located somewhere in the filesystem. Prefix ebuilds require # additional functions and variables which are defined by this eclass. -inherit eutils - # @ECLASS-VARIABLE: EPREFIX # @DESCRIPTION: # The offset prefix of a Gentoo Prefix installation. When Gentoo Prefix @@ -30,6 +28,7 @@ fi # @USAGE: <list of to be eprefixified files> # @DESCRIPTION: # replaces @GENTOO_PORTAGE_EPREFIX@ with ${EPREFIX} for the given files, +# tries a set of heuristics if @GENTOO_PORTAGE_EPREFIX@ is not found, # dies if no arguments are given, a file does not exist, or changing a # file failed. eprefixify() { @@ -40,7 +39,13 @@ eprefixify() { for x in "$@" ; do if [[ -e ${x} ]] ; then ebegin " ${x##*/}" - sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" "${x}" + if grep -q @GENTOO_PORTAGE_EPREFIX@ "${x}" ; then + sed -i -e "s|@GENTOO_PORTAGE_EPREFIX@|${EPREFIX}|g" "${x}" + else + sed -r \ + -e "s,([^[:alnum:]}])/(usr|etc|bin|sbin|var|opt)/,\1${EPREFIX}/\2/,g" \ + -i "${x}" + fi eend $? || die "failed to eprefixify ${x}" else die "${x} does not exist" @@ -50,26 +55,52 @@ eprefixify() { return 0 } -# @FUNCTION: eprefixify_patch -# @USAGE: <list of patch files to be eprefixified> +# @FUNCTION: __temp_prefixify +# @USAGE: on a single file # @DESCRIPTION: -# copies the patch files to ${T} and eprefixify before applying. -# dies if no arguments are given, a file does not exist, or changing a -# file failed. -eprefixity_patch() { - [[ $# -lt 1 ]] && die "at least one argument required" +# copies the files to ${T}, calls eprefixify, echos the new file. +__temp_prefixify() { + if [[ -e $1 ]] ; then + local f=${1##*/} + cp "$1" "${T}" || die "failed to copy file" + eprefixify "${T}"/${f} > /dev/null + echo "${T}"/${f} + else + die "$1 does not exist" + fi +} - local x f - for x in "$@" ; do - if [[ -e ${x} ]] ; then - f=${x##*/} - cp "${x}" "${T}" || die "failed to copy patch" - eprefixify "${T}"/${f} - epatch "${T}"/${f} - else - die "${x} does not exist" - fi - done +# @FUNCTION: fprefixify +# @USAGE: fprefixfy function files +# @DESCRIPTION: +# prefixify a function call. +# copies the files to ${T}, calls eprefixify, and calls the function. +# +# For example: +# fprefixify doexe ${FILESDIR}/fix_libtool_files.sh +# fprefixify epatch ${FILESDIR}/${PN}-4.0.2-path.patch +fprefixify() { + [[ $# -lt 2 ]] && die "at least two arguments required" + + local func=$1 f + einfo "Adjusting ${func} to prefix ${EPREFIX:-/}" + shift + case ${func} in + new*) + [[ $# -ne 2 ]] && die "${func} takes two arguments" + ebegin " ${1##*/}" + f=$(__temp_prefixify "$1") + ${func} "${f}" "$2" + eend $? || die "failed to execute ${func}" + ;; + *) + for x in "$@" ; do + ebegin " ${x##*/}" + f=$(__temp_prefixify "${x}") + ${func} "${f}" + eend $? || die "failed to execute ${func}" + done + esac return 0 } diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index 81bc4fb..44ec160 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -1,11 +1,11 @@ -# 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.eclass,v 1.647 2014/11/15 08:45:33 vapier Exp $ +# $Id$ # Maintainer: Toolchain Ninjas <toolchain@gentoo.org> DESCRIPTION="The GNU Compiler Collection" -HOMEPAGE="http://gcc.gnu.org/" +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 @@ -26,7 +26,7 @@ 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) ;; + 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}." @@ -37,8 +37,8 @@ EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} export CTARGET=${CTARGET:-${CHOST}} if [[ ${CTARGET} = ${CHOST} ]] ; then - if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then - export CTARGET=${CATEGORY/cross-} + if [[ ${CATEGORY} == cross-* ]] ; then + export CTARGET=${CATEGORY#cross-} fi fi : ${TARGET_ABI:=${ABI}} @@ -91,9 +91,9 @@ elif [[ ${GCC_PV} == *_rc* ]] ; then SNAPSHOT=${GCC_PV%_rc*}-RC-${GCC_PV##*_rc} fi -if [[ ${SNAPSHOT} == 5.0-* ]] ; then - # The gcc-5 release has dropped the .0 for some reason. - SNAPSHOT=${SNAPSHOT/5.0/5} +if [[ ${SNAPSHOT} == [56789].0-* ]] ; then + # The gcc-5+ releases have dropped the .0 for some reason. + SNAPSHOT=${SNAPSHOT/.0} fi export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}} @@ -109,6 +109,7 @@ INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${LIBPATH}/include} if is_crosscompile ; then BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CHOST}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}} + HOSTLIBPATH=${PREFIX}/${CHOST}/${CTARGET}/lib/${GCC_CONFIG_VER} else BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}} fi @@ -139,7 +140,7 @@ IUSE="multislot regression-test vanilla" IUSE_DEF=( nls nptl ) if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then - IUSE+=" altivec" + IUSE+=" altivec debug" IUSE_DEF+=( cxx fortran ) [[ -n ${PIE_VER} ]] && IUSE+=" nopie" [[ -n ${HTB_VER} ]] && IUSE+=" boundschecking" @@ -151,20 +152,19 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then 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.3 && IUSE+=" fixed-point" - tc_version_is_at_least 4.6 && IUSE+=" graphite" tc_version_is_at_least 4.7 && IUSE+=" go" - tc_version_is_at_least 4.8 && IUSE_DEF+=( sanitize ) + # 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.9 && IUSE+=" cilk +vtv" + tc_version_is_at_least 5.0 && IUSE+=" jit mpx" + tc_version_is_at_least 6.0 && IUSE+=" pie +ssp" fi -[[ ${EAPI:-0} != 0 ]] && IUSE_DEF=( "${IUSE_DEF[@]/#/+}" ) -IUSE+=" ${IUSE_DEF[*]}" +IUSE+=" ${IUSE_DEF[*]/#/+}" -# Support upgrade paths here or people get pissed -if use multislot ; then - SLOT="${GCC_CONFIG_VER}" -else - SLOT="${GCC_BRANCH_VER}" -fi +SLOT="${GCC_CONFIG_VER}" #---->> DEPEND <<---- @@ -174,7 +174,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 >=dev-libs/mpfr-2.4.2" + 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 @@ -182,21 +182,17 @@ if tc_version_is_at_least 4 ; then fi fi -tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1" +tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0" if in_iuse graphite ; then - if tc_version_is_at_least 4.8 ; then + if tc_version_is_at_least 5.0 ; then + RDEPEND+=" graphite? ( >=dev-libs/isl-0.14 )" + elif tc_version_is_at_least 4.8 ; then RDEPEND+=" graphite? ( >=dev-libs/cloog-0.18.0 >=dev-libs/isl-0.11.1 )" - else - RDEPEND+=" - graphite? ( - >=dev-libs/cloog-ppl-0.15.10 - >=dev-libs/ppl-0.11 - )" fi fi @@ -219,10 +215,6 @@ if in_iuse gcj ; then x11-proto/xextproto =x11-libs/gtk+-2* virtual/pkgconfig - amd64? ( multilib? ( - app-emulation/emul-linux-x86-gtklibs - app-emulation/emul-linux-x86-xlibs - ) ) " 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" @@ -247,8 +239,8 @@ S=$( gentoo_urls() { local devspace="HTTP~vapier/dist/URI HTTP~rhill/dist/URI - HTTP~halcy0n/patches/URI HTTP~zorry/patches/gcc/URI" - devspace=${devspace//HTTP/http:\/\/dev.gentoo.org\/} + HTTP~zorry/patches/gcc/URI HTTP~blueness/dist/URI" + devspace=${devspace//HTTP/https:\/\/dev.gentoo.org\/} echo mirror://gentoo/$1 ${devspace//URI/$1} } @@ -397,8 +389,8 @@ toolchain_pkg_pretend() { #---->> pkg_setup <<---- toolchain_pkg_setup() { - case "${EAPI:-0}" in - 0|1|2|3) toolchain_pkg_pretend ;; + case ${EAPI} in + 2|3) toolchain_pkg_pretend ;; esac # we dont want to use the installed compiler's specs to build gcc @@ -414,10 +406,6 @@ toolchain_src_unpack() { else gcc_quick_unpack fi - - case ${EAPI:-0} in - 0|1) toolchain_src_prepare ;; - esac } gcc_quick_unpack() { @@ -670,7 +658,7 @@ make_gcc_hard() { ewarn "PIE has not been enabled by default" gcc_hard_flags+=" -DEFAULT_SSP" else - # do nothing if hardened is'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 @@ -852,6 +840,7 @@ 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 @@ -891,10 +880,10 @@ 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 4 || [[ -n ${GCC_CHECKS_LIST} ]] ; then - confgcc+=( --enable-checking=${GCC_CHECKS_LIST:-release} ) - else - confgcc+=( --disable-checking ) + if tc_version_is_at_least 3.4 ; 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})}" ) fi # Branding @@ -915,6 +904,9 @@ toolchain_src_configure() { confgcc+=( --enable-libstdcxx-time ) fi + # The jit language requires this. + is_jit && confgcc+=( --enable-host-shared ) + # # Turn on the -Wl,--build-id flag by default for ELF targets. #525942 # # This helps with locating debug files. # case ${CTARGET} in @@ -989,7 +981,6 @@ toolchain_src_configure() { else confgcc+=( --enable-shared ) fi - case ${CHOST} in mingw*|*-mingw*|*-cygwin) confgcc+=( --enable-threads=win32 ) ;; @@ -1094,7 +1085,7 @@ toolchain_src_configure() { amd64) # drop the older/ABI checks once this get's merged into some # version of gcc upstream - if tc_version_is_at_least 4.7 && has x32 $(get_all_abis TARGET) ; then + 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 ;; @@ -1173,7 +1164,21 @@ toolchain_src_configure() { fi confgcc+=( --disable-libssp ) fi + 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 vtv ; then + confgcc+=( + $(use_enable vtv vtable-verify) + $(use_enable vtv libvtv) + ) fi # newer gcc's come with libquadmath, but only fortran uses @@ -1188,27 +1193,30 @@ toolchain_src_configure() { confgcc+=( --disable-lto ) fi - # graphite was added in 4.4 but we only support it in 4.6+ due to external - # library issues. 4.6/4.7 uses cloog-ppl which is a fork of CLooG with a - # PPL backend. 4.8+ uses upstream CLooG with the ISL backend. We install - # cloog-ppl into a non-standard location to prevent collisions. - if tc_version_is_at_least 4.8 ; then - confgcc+=( $(use_with graphite cloog) ) + # 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 + confgcc+=( $(use_with graphite isl) ) use graphite && confgcc+=( --disable-isl-version-check ) - elif tc_version_is_at_least 4.6 ; then + elif tc_version_is_at_least 4.8 ; then confgcc+=( $(use_with graphite cloog) ) - confgcc+=( $(use_with graphite ppl) ) - use graphite && confgcc+=( --with-cloog-include=/usr/include/cloog-ppl ) - use graphite && confgcc+=( --disable-ppl-version-check ) + use graphite && confgcc+=( --disable-isl-version-check ) elif tc_version_is_at_least 4.4 ; then - confgcc+=( --without-cloog ) - confgcc+=( --without-ppl ) + confgcc+=( --without-{cloog,ppl} ) fi if tc_version_is_at_least 4.8 ; then confgcc+=( $(use_enable sanitize libsanitizer) ) fi + if tc_version_is_at_least 6.0 ; then + confgcc+=( + $(use_enable pie default-pie) + # 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. #464008 export gcc_cv_prog_makeinfo_modern=no @@ -1241,7 +1249,10 @@ toolchain_src_configure() { # and now to do the actual configuration addwrite /dev/zero echo "${S}"/configure "${confgcc[@]}" - "${S}"/configure "${confgcc[@]}" || die "failed to run configure" + # 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. + CONFIG_SHELL="/bin/bash" \ + bash "${S}"/configure "${confgcc[@]}" || die "failed to run configure" # return to whatever directory we were in before popd > /dev/null @@ -1480,7 +1491,7 @@ gcc-multilib-configure() { if [[ -n ${list} ]] ; then case ${CTARGET} in x86_64*) - tc_version_is_at_least 4.7 && confgcc+=( --with-multilib-list=${list:1} ) + tc_version_is_at_least 4.8 && confgcc+=( --with-multilib-list=${list:1} ) ;; esac fi @@ -1504,15 +1515,11 @@ gcc-abi-map() { #----> src_compile <---- toolchain_src_compile() { - case ${EAPI:-0} in - 0|1) toolchain_src_configure ;; - esac - touch "${S}"/gcc/c-gperf.h # Do not make manpages if we do not have perl ... [[ ! -x /usr/bin/perl ]] \ - && find "${WORKDIR}"/build -name '*.[17]' | xargs touch + && find "${WORKDIR}"/build -name '*.[17]' -exec touch {} + gcc_do_make ${GCC_MAKE_TARGET} } @@ -1582,6 +1589,13 @@ gcc_do_make() { cd "${CTARGET}"/libstdc++-v3 emake doxygen-man || ewarn "failed to make docs" fi + # Clean bogus manpages. #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 + find -name '*_.3' -exec grep -l ' Directory Reference ' {} + | \ + xargs rm -f else ewarn "Skipping libstdc++ manpage generation since you don't have doxygen installed" fi @@ -1617,8 +1631,12 @@ toolchain_src_install() { fi done - # Remove generated headers, as they can cause things to break - # (ncurses, openssl, etc). + # 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}" @@ -1639,7 +1657,7 @@ toolchain_src_install() { if ! is_crosscompile ; then local EXEEXT eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log) - [[ -r "${D}${BINPATH}"/gcc${EXEEXT} ]] || die "gcc not found in ${D}" + [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${D}" fi dodir /etc/env.d/gcc @@ -1653,13 +1671,18 @@ toolchain_src_install() { gcc_slot_java dodir /usr/bin - cd "${D}${BINPATH}" + 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 some reason, g77 gets made instead of ${CTARGET}-g77... # this should take care of that - [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x} + if [[ -f ${x} ]] ; then + # In case they're hardlinks, clear out the target first + # otherwise the mv below will complain. + rm -f ${CTARGET}-${x} + mv ${x} ${CTARGET}-${x} + fi if [[ -f ${CTARGET}-${x} ]] ; then if ! is_crosscompile ; then @@ -1677,9 +1700,18 @@ 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 + 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 ]] && \ @@ -1688,13 +1720,11 @@ toolchain_src_install() { cd "${S}" if is_crosscompile; then rm -rf "${D}"/usr/share/{man,info} - rm -rf "${D}${DATAPATH}"/{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 - # clean bogus manpages #113902 - find "${cxx_mandir}" -name '*_build_*' -exec rm {} \; cp -r "${cxx_mandir}"/man? "${D}/${DATAPATH}"/man/ fi fi @@ -1711,35 +1741,58 @@ toolchain_src_install() { # install testsuite results if use regression-test; then docinto testsuite - find "${WORKDIR}"/build -type f -name "*.sum" -print0 | xargs -0 dodoc - find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -print0 \ - | xargs -0 dodoc + 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 ; then - cp "${GCC_FILESDIR}"/fix_libtool_files.sh "${T}" - cp "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la "${T}" - cp "${GCC_FILESDIR}"/awk/fixlafiles.awk "${T}" - eprefixify \ - "${T}"/fix_libtool_files.sh \ - "${T}"/fixlafiles.awk-no_gcc_la \ - "${T}"/fixlafiles.awk - insinto "${DATAPATH#${EPREFIX}}" - if tc_version_is_at_least 4.0 ; then - newins "${T}"/fixlafiles.awk-no_gcc_la fixlafiles.awk || die - find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \; - find "${D}/${LIBPATH}" -name "lib?san.la" -type f -exec rm "{}" \; # 487550 - else - doins "${T}"/fixlafiles.awk || die - fi + fprefixify newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die exeinto "${DATAPATH#${EPREFIX}}" - doexe "${T}"/fix_libtool_files.sh || die + fprefixify doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die doexe "${GCC_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 + # reference to the full libstdc++.la file which is gcc version specific. + # libstdc++fs.la: It doesn't link against anything useful. + # 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. + # libgomp.la: gcc itself handles linkage (libgomp.spec). + # 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 + # 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 + find "${D}/${LIBPATH}" \ + '(' \ + -name libstdc++.la -o \ + -name libstdc++fs.la -o \ + -name libsupc++.la -o \ + -name libcc1.la -o \ + -name libcc1plugin.la -o \ + -name 'libgomp.la' -o \ + -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' \ + ')' -type f -delete + # 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. @@ -1775,6 +1828,17 @@ 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 + # code to run on the target. + if tc_version_is_at_least 5 && is_crosscompile ; then + dodir "${HOSTLIBPATH}" + mv "${D}"/usr/$(get_libdir)/libcc1* "${D}${HOSTLIBPATH}" || die + fi + + # For all the libs that are built for CTARGET, move them into the + # compiler-specific CTARGET internal dir. local x multiarg removedirs="" for multiarg in $($(XGCC) -print-multi-lib) ; do multiarg=${multiarg#*;} @@ -1808,7 +1872,7 @@ gcc_movelibs() { FROMDIR="${PREFIX}/lib/${OS_MULTIDIR}" for x in "${D}${FROMDIR}"/pkgconfig/libgcj*.pc ; do [[ -f ${x} ]] || continue - sed -i "/^libdir=/s:=.*:=${LIBPATH}/${MULTIDIR}:" "${x}" + sed -i "/^libdir=/s:=.*:=${LIBPATH}/${MULTIDIR}:" "${x}" || die mv "${x}" "${D}${FROMDIR}"/pkgconfig/libgcj-${GCC_PV}.pc || die done done @@ -1820,28 +1884,32 @@ gcc_movelibs() { for FROMDIR in ${removedirs} ; do rmdir "${D}"${FROMDIR} >& /dev/null done - find "${D}" -type d | xargs rmdir >& /dev/null + find -depth "${D}" -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 # on our own .la files need to be updated. fix_libtool_libdir_paths() { + local libpath="$1" + pushd "${D}" >/dev/null - pushd "./${1}" >/dev/null + pushd "./${libpath}" >/dev/null local dir="${PWD#${D%/}}" local allarchives=$(echo *.la) allarchives="\(${allarchives// /\\|}\)" popd >/dev/null - sed -i \ - -e "/^libdir=/s:=.*:='${dir}':" \ - ./${dir}/*.la - sed -i \ - -e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${LIBPATH}/\1:g" \ - $(find ./"${PREFIX}"/lib* -maxdepth 3 -name '*.la') \ - ./${dir}/*.la + # The libdir might not have any .la files. #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 + # on sub-expressions. + find "./${PREFIX}"/lib* -maxdepth 3 -name '*.la' \ + -exec sed -i -e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${libpath}/\1:g" {} + || die + find "./${dir}/" -maxdepth 1 -name '*.la' \ + -exec sed -i -e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${libpath}/\1:g" {} + || die popd >/dev/null } @@ -1966,21 +2034,21 @@ toolchain_pkg_postinst() { echo ewarn "You might want to review the GCC upgrade guide when moving between" ewarn "major versions (like 4.2 to 4.3):" - ewarn "http://www.gentoo.org/doc/en/gcc-upgrading.xml" + 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 + 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 @@ -2003,10 +2071,10 @@ 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 @@ -2035,26 +2103,36 @@ do_gcc_config() { return 0 fi - local current_gcc_config="" current_specs="" use_specs="" + local current_gcc_config target current_gcc_config=$(env -i PATH="${PATH}" ROOT="${ROOT}" 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 current_specs=$(gcc-config -S ${current_gcc_config} | awk '{print $3}') [[ -n ${current_specs} ]] && use_specs=-${current_specs} - fi - if [[ -n ${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" - ewarn "due to enabling/disabling hardened or switching to a version" - ewarn "of gcc that doesnt create multiple specs files. The default" - ewarn "config will be used, and the previous preference forgotten." - use_specs="" + + if [[ -n ${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" + ewarn "due to enabling/disabling hardened or switching to a version" + ewarn "of gcc that doesnt 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. + # Blindly pick the latest version. #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}') fi - gcc-config ${CTARGET}-${GCC_CONFIG_VER}${use_specs} + gcc-config "${target}" } should_we_gcc_config() { @@ -2153,6 +2231,11 @@ is_go() { use cxx && use_if_iuse go } +is_jit() { + gcc-lang-supported jit || return 1 + use_if_iuse jit +} + is_multilib() { tc_version_is_at_least 3 || return 1 use multilib |