commit: 8ea456d072e46530ea53f04fe8935693fab59093 Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> AuthorDate: Sun Jun 12 19:43:40 2022 +0000 Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org> CommitDate: Sun Jun 12 19:46:30 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8ea456d0
sys-devel/binutils: Prevent relinking on install, try 1 The tooldir hack introduced to solve bug 147155 makes libtool relink libraries during the installation phase. This fails in enough cases to be an annoyance. Use the hack only for cross installations. *Untested*, needs some careful observation before regaining keywords. Bug: https://bugs.gentoo.org/147155 Bug: https://bugs.gentoo.org/834720 Bug: https://bugs.gentoo.org/838925 Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org> ...tils-9999.ebuild => binutils-2.37_p1-r3.ebuild} | 123 ++++++++++----------- ...inutils-9999.ebuild => binutils-2.38-r3.ebuild} | 117 ++++++++++---------- sys-devel/binutils/binutils-9999.ebuild | 21 +++- 3 files changed, 137 insertions(+), 124 deletions(-) diff --git a/sys-devel/binutils/binutils-9999.ebuild b/sys-devel/binutils/binutils-2.37_p1-r3.ebuild similarity index 84% copy from sys-devel/binutils/binutils-9999.ebuild copy to sys-devel/binutils/binutils-2.37_p1-r3.ebuild index ec3589ae100a..b6100c1d6a22 100644 --- a/sys-devel/binutils/binutils-9999.ebuild +++ b/sys-devel/binutils/binutils-2.37_p1-r3.ebuild @@ -19,7 +19,7 @@ REQUIRED_USE="default-gold? ( gold )" # PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/... # for the patchsets -PATCH_VER=0 +PATCH_VER=2 PATCH_DEV=dilfridge if [[ ${PV} == 9999* ]]; then @@ -32,8 +32,7 @@ else [[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI} https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" SLOT=$(ver_cut 1-2) - # live ebuild - #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" + #KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86" fi # @@ -114,13 +113,13 @@ src_prepare() { fi fi - # Make sure our explicit libdir paths don't get clobbered, bug #562460 + # 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 - # Fix locale issues if possible, bug #122216 + # 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 @@ -131,6 +130,11 @@ src_prepare() { 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 + # Apply things from PATCHES and user dirs default @@ -148,24 +152,21 @@ toolchain-binutils_pkgversion() { } src_configure() { - # 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}" - # Setup some paths LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} INCPATH=${LIBPATH}/include DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} + + # see Note [tooldir hack for ldscripts] if is_cross ; then TOOLPATH=/usr/${CHOST}/${CTARGET} + BINPATH=${TOOLPATH}/binutils-bin/${PV} else - TOOLPATH=/usr/${CTARGET} + BINPATH=/usr/${CTARGET}/binutils-bin/${PV} fi - BINPATH=${TOOLPATH}/binutils-bin/${PV} # Make sure we filter $LINGUAS so that only ones that - # actually work make it through, bug #42033 + # actually work make it through #42033 strip-linguas -u */po # Keep things sane @@ -180,7 +181,7 @@ src_configure() { done echo - cd "${MY_BUILDDIR}" || die + cd "${MY_BUILDDIR}" local myconf=() if use plugins ; then @@ -202,10 +203,9 @@ src_configure() { myconf+=( --with-system-zlib ) - # For bi-arch systems, enable a 64bit bfd. This matches the bi-arch - # logic in toolchain.eclass. bug #446946 - # - # We used to do it for everyone, but it's slow on 32bit arches. bug #438522 + # 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 @@ -219,7 +219,10 @@ src_configure() { --enable-poison-system-directories ) - myconf+=( --enable-secureplt ) + # 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 ) # mips can't do hash-style=gnu ... if [[ $(tc-arch) != mips ]] ; then @@ -243,37 +246,24 @@ src_configure() { --enable-threads # Newer versions (>=2.27) offer a configure flag now. --enable-relro - # Newer versions (>=2.24) make this an explicit option, bug #497268 + # Newer versions (>=2.24) make this an explicit option. #497268 --enable-install-libiberty # Available from 2.35 on --enable-textrel-check=warning - - # Available from 2.39 on - --enable-warn-execstack - --enable-warn-rwx-segments - # TODO: Available from 2.39+ on but let's try the warning on for a bit - # first... (--enable-warn-execstack) - # Could put it under USE=hardened? - #--enable-default-execstack - - # Things to think about - #--enable-deterministic-archives - - # Works better than vapier's patch, bug #808787 + # Works better than vapier's patch... #808787 --enable-new-dtags - - --disable-jansson --disable-werror --with-bugurl="$(toolchain-binutils_bugurl)" --with-pkgversion="$(toolchain-binutils_pkgversion)" $(use_enable static-libs static) - # Disable modules that are in a combined binutils/gdb tree, bug #490566 + ${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 # Change SONAME to avoid conflict across - # {native,cross}/binutils, binutils-libs. bug #666100 + # {native,cross}/binutils, binutils-libs. #666100 --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st) # avoid automagic dependency on (currently prefix) systems @@ -294,7 +284,8 @@ src_configure() { fi fi - ECONF_SOURCE="${S}" econf "${myconf[@]}" || die + echo ./configure "${myconf[@]}" + "${S}"/configure "${myconf[@]}" || die # Prevent makeinfo from running if doc is unset. if ! use doc ; then @@ -305,14 +296,17 @@ src_configure() { } src_compile() { - cd "${MY_BUILDDIR}" || die - + cd "${MY_BUILDDIR}" # see Note [tooldir hack for ldscripts] - emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all + if is_cross ; then + emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all + else + emake V=1 all + fi # only build info pages if the user wants them if use doc ; then - emake V=1 info + emake info fi # we nuke the manpages when we're left with junk @@ -321,26 +315,27 @@ src_compile() { } src_test() { - cd "${MY_BUILDDIR}" || die + cd "${MY_BUILDDIR}" - # bug #637066 + # bug 637066 filter-flags -Wall -Wreturn-type - emake -k V=1 check + emake -k check } src_install() { local x d - cd "${MY_BUILDDIR}" || die + cd "${MY_BUILDDIR}" # see Note [tooldir hack for ldscripts] emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install - rm -rf "${ED}"/${LIBPATH}/bin || die + + rm -rf "${ED}"/${LIBPATH}/bin use static-libs || find "${ED}" -name '*.la' -delete - # Newer versions of binutils get fancy with ${LIBPATH}, bug #171905 - cd "${ED}"/${LIBPATH} || die + # Newer versions of binutils get fancy with ${LIBPATH} #171905 + cd "${ED}"/${LIBPATH} for d in ../* ; do [[ ${d} == ../${PV} ]] && continue mv ${d}/* . || die @@ -351,9 +346,9 @@ src_install() { # 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} || die + cd "${ED}"/${BINPATH} for x in * ; do - mv ${x} ${x/${CTARGET}-} || die + mv ${x} ${x/${CTARGET}-} done if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then @@ -362,7 +357,6 @@ src_install() { 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. @@ -376,8 +370,8 @@ src_install() { ) doins "${libiberty_headers[@]/#/${S}/include/}" if [[ -d ${ED}/${LIBPATH}/lib ]] ; then - mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ || die - rm -r "${ED}"/${LIBPATH}/lib || die + mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ + rm -r "${ED}"/${LIBPATH}/lib fi # Generate an env.d entry for this binutils @@ -391,36 +385,29 @@ src_install() { # Handle documentation if ! is_cross ; then - cd "${S}" || die + 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} || die + rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info} # Trim all empty dirs - find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null || die + find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null } pkg_postinst() { @@ -479,3 +466,11 @@ pkg_postrm() { # ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case) # - at install-time set scriptdir to point to slotted location: # ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV} +# +# Now, this would all be very nice except for the fact that the changed +# directory makes libtool re-link libraries during the install phase. +# It uses libraries from the system installation to do that (bad) +# and fails if it cant handle these (e.g. newer LTO version than in +# current gcc, see bugs 834720 and 838925). +# +# So, we apply this whole hack only for cross builds. diff --git a/sys-devel/binutils/binutils-9999.ebuild b/sys-devel/binutils/binutils-2.38-r3.ebuild similarity index 83% copy from sys-devel/binutils/binutils-9999.ebuild copy to sys-devel/binutils/binutils-2.38-r3.ebuild index ec3589ae100a..3fd587616c36 100644 --- a/sys-devel/binutils/binutils-9999.ebuild +++ b/sys-devel/binutils/binutils-2.38-r3.ebuild @@ -19,7 +19,7 @@ REQUIRED_USE="default-gold? ( gold )" # PATCH_DEV - Use download URI https://dev.gentoo.org/~{PATCH_DEV}/distfiles/... # for the patchsets -PATCH_VER=0 +PATCH_VER=4 PATCH_DEV=dilfridge if [[ ${PV} == 9999* ]]; then @@ -32,8 +32,7 @@ else [[ -z ${PATCH_VER} ]] || SRC_URI="${SRC_URI} https://dev.gentoo.org/~${PATCH_DEV}/distfiles/binutils-${PATCH_BINUTILS_VER}-patches-${PATCH_VER}.tar.xz" SLOT=$(ver_cut 1-2) - # live ebuild - #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" + #KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" fi # @@ -114,13 +113,13 @@ src_prepare() { fi fi - # Make sure our explicit libdir paths don't get clobbered, bug #562460 + # 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 - # Fix locale issues if possible, bug #122216 + # 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 @@ -131,6 +130,11 @@ src_prepare() { 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 + # Apply things from PATCHES and user dirs default @@ -157,15 +161,17 @@ src_configure() { LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} INCPATH=${LIBPATH}/include DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} + + # see Note [tooldir hack for ldscripts] if is_cross ; then TOOLPATH=/usr/${CHOST}/${CTARGET} + BINPATH=${TOOLPATH}/binutils-bin/${PV} else - TOOLPATH=/usr/${CTARGET} + BINPATH=/usr/${CTARGET}/binutils-bin/${PV} fi - BINPATH=${TOOLPATH}/binutils-bin/${PV} # Make sure we filter $LINGUAS so that only ones that - # actually work make it through, bug #42033 + # actually work make it through #42033 strip-linguas -u */po # Keep things sane @@ -180,7 +186,7 @@ src_configure() { done echo - cd "${MY_BUILDDIR}" || die + cd "${MY_BUILDDIR}" local myconf=() if use plugins ; then @@ -202,10 +208,9 @@ src_configure() { myconf+=( --with-system-zlib ) - # For bi-arch systems, enable a 64bit bfd. This matches the bi-arch - # logic in toolchain.eclass. bug #446946 - # - # We used to do it for everyone, but it's slow on 32bit arches. bug #438522 + # 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 @@ -219,7 +224,10 @@ src_configure() { --enable-poison-system-directories ) - myconf+=( --enable-secureplt ) + # 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 ) # mips can't do hash-style=gnu ... if [[ $(tc-arch) != mips ]] ; then @@ -227,6 +235,9 @@ src_configure() { fi myconf+=( + # (--disable-silent-rules should get passed automatically w/ econf which we use + # in >= 2.39, so can drop it then.) + --disable-silent-rules --prefix="${EPREFIX}"/usr --host=${CHOST} --target=${CTARGET} @@ -243,37 +254,24 @@ src_configure() { --enable-threads # Newer versions (>=2.27) offer a configure flag now. --enable-relro - # Newer versions (>=2.24) make this an explicit option, bug #497268 + # Newer versions (>=2.24) make this an explicit option. #497268 --enable-install-libiberty # Available from 2.35 on --enable-textrel-check=warning - - # Available from 2.39 on - --enable-warn-execstack - --enable-warn-rwx-segments - # TODO: Available from 2.39+ on but let's try the warning on for a bit - # first... (--enable-warn-execstack) - # Could put it under USE=hardened? - #--enable-default-execstack - - # Things to think about - #--enable-deterministic-archives - - # Works better than vapier's patch, bug #808787 + # Works better than vapier's patch... #808787 --enable-new-dtags - - --disable-jansson --disable-werror --with-bugurl="$(toolchain-binutils_bugurl)" --with-pkgversion="$(toolchain-binutils_pkgversion)" $(use_enable static-libs static) - # Disable modules that are in a combined binutils/gdb tree, bug #490566 + ${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 # Change SONAME to avoid conflict across - # {native,cross}/binutils, binutils-libs. bug #666100 + # {native,cross}/binutils, binutils-libs. #666100 --with-extra-soversion-suffix=gentoo-${CATEGORY}-${PN}-$(usex multitarget mt st) # avoid automagic dependency on (currently prefix) systems @@ -294,7 +292,8 @@ src_configure() { fi fi - ECONF_SOURCE="${S}" econf "${myconf[@]}" || die + echo ./configure "${myconf[@]}" + "${S}"/configure "${myconf[@]}" || die # Prevent makeinfo from running if doc is unset. if ! use doc ; then @@ -305,10 +304,13 @@ src_configure() { } src_compile() { - cd "${MY_BUILDDIR}" || die - + cd "${MY_BUILDDIR}" # see Note [tooldir hack for ldscripts] - emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all + if is_cross ; then + emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all + else + emake V=1 all + fi # only build info pages if the user wants them if use doc ; then @@ -321,9 +323,9 @@ src_compile() { } src_test() { - cd "${MY_BUILDDIR}" || die + cd "${MY_BUILDDIR}" - # bug #637066 + # bug 637066 filter-flags -Wall -Wreturn-type emake -k V=1 check @@ -332,15 +334,16 @@ src_test() { src_install() { local x d - cd "${MY_BUILDDIR}" || die + cd "${MY_BUILDDIR}" # see Note [tooldir hack for ldscripts] emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install - rm -rf "${ED}"/${LIBPATH}/bin || die + + rm -rf "${ED}"/${LIBPATH}/bin use static-libs || find "${ED}" -name '*.la' -delete - # Newer versions of binutils get fancy with ${LIBPATH}, bug #171905 - cd "${ED}"/${LIBPATH} || die + # Newer versions of binutils get fancy with ${LIBPATH} #171905 + cd "${ED}"/${LIBPATH} for d in ../* ; do [[ ${d} == ../${PV} ]] && continue mv ${d}/* . || die @@ -351,9 +354,9 @@ src_install() { # 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} || die + cd "${ED}"/${BINPATH} for x in * ; do - mv ${x} ${x/${CTARGET}-} || die + mv ${x} ${x/${CTARGET}-} done if [[ -d ${ED}/usr/${CHOST}/${CTARGET} ]] ; then @@ -362,7 +365,6 @@ src_install() { 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. @@ -376,8 +378,8 @@ src_install() { ) doins "${libiberty_headers[@]/#/${S}/include/}" if [[ -d ${ED}/${LIBPATH}/lib ]] ; then - mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ || die - rm -r "${ED}"/${LIBPATH}/lib || die + mv "${ED}"/${LIBPATH}/lib/* "${ED}"/${LIBPATH}/ + rm -r "${ED}"/${LIBPATH}/lib fi # Generate an env.d entry for this binutils @@ -391,36 +393,29 @@ src_install() { # Handle documentation if ! is_cross ; then - cd "${S}" || die + 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} || die + rm -f "${ED}"/${DATAPATH}/info/{dir,configure.info,standards.info} # Trim all empty dirs - find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null || die + find "${ED}" -depth -type d -exec rmdir {} + 2>/dev/null } pkg_postinst() { @@ -479,3 +474,11 @@ pkg_postrm() { # ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case) # - at install-time set scriptdir to point to slotted location: # ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV} +# +# Now, this would all be very nice except for the fact that the changed +# directory makes libtool re-link libraries during the install phase. +# It uses libraries from the system installation to do that (bad) +# and fails if it cant handle these (e.g. newer LTO version than in +# current gcc, see bugs 834720 and 838925). +# +# So, we apply this whole hack only for cross builds. diff --git a/sys-devel/binutils/binutils-9999.ebuild b/sys-devel/binutils/binutils-9999.ebuild index ec3589ae100a..ae887224952e 100644 --- a/sys-devel/binutils/binutils-9999.ebuild +++ b/sys-devel/binutils/binutils-9999.ebuild @@ -157,12 +157,14 @@ src_configure() { LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} INCPATH=${LIBPATH}/include DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} + + # see Note [tooldir hack for ldscripts] if is_cross ; then TOOLPATH=/usr/${CHOST}/${CTARGET} + BINPATH=${TOOLPATH}/binutils-bin/${PV} else - TOOLPATH=/usr/${CTARGET} + BINPATH=/usr/${CTARGET}/binutils-bin/${PV} fi - BINPATH=${TOOLPATH}/binutils-bin/${PV} # Make sure we filter $LINGUAS so that only ones that # actually work make it through, bug #42033 @@ -308,7 +310,11 @@ src_compile() { cd "${MY_BUILDDIR}" || die # see Note [tooldir hack for ldscripts] - emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all + if is_cross ; then + emake V=1 tooldir="${EPREFIX}${TOOLPATH}" all + else + emake V=1 all + fi # only build info pages if the user wants them if use doc ; then @@ -336,6 +342,7 @@ src_install() { # see Note [tooldir hack for ldscripts] emake V=1 DESTDIR="${D}" tooldir="${EPREFIX}${LIBPATH}" install + rm -rf "${ED}"/${LIBPATH}/bin || die use static-libs || find "${ED}" -name '*.la' -delete @@ -479,3 +486,11 @@ pkg_postrm() { # ${TOOLPATH}: /usr/${CHOST} (or /usr/${CHOST}/${CTARGET} for cross-case) # - at install-time set scriptdir to point to slotted location: # ${LIBPATH}: /usr/$(get_libdir)/binutils/${CTARGET}/${PV} +# +# Now, this would all be very nice except for the fact that the changed +# directory makes libtool re-link libraries during the install phase. +# It uses libraries from the system installation to do that (bad) +# and fails if it cant handle these (e.g. newer LTO version than in +# current gcc, see bugs 834720 and 838925). +# +# So, we apply this whole hack only for cross builds.