sys-devel/binutils-config: detect broken cross-compiler rpaths #562460
authorMike Frysinger <vapier@gentoo.org>
Mon, 23 Nov 2015 10:19:00 +0000 (05:19 -0500)
committerMike Frysinger <vapier@gentoo.org>
Mon, 23 Nov 2015 10:21:58 +0000 (05:21 -0500)
We've fixed newer cross-binutils builds to use the correct rpaths to find
their internal libs, but existing builds remain broken.  Add some logic to
detect & warn users, but also create the old symlinks so they keep working.

sys-devel/binutils-config/binutils-config-5-r2.ebuild [moved from sys-devel/binutils-config/binutils-config-5-r1.ebuild with 100% similarity]
sys-devel/binutils-config/files/binutils-config-5

index 86f6abc8b273b7a729929cf6e396beaefc5e336f..2bdd07e1fcc04da0365628490603ad79b2f159fa 100755 (executable)
@@ -149,7 +149,16 @@ switch_profile() {
        mkdir -p "${dstlib}"
        rm -rf "${ROOT}/${BINPATH_LINKS}"/ldscripts
        atomic_ln "${LIBPATH}/ldscripts" "${dstlib}" "ldscripts"
-       find -L "${dstlib}" -xtype l -name 'lib*' -exec rm -f {} +
+       find -L "${dstlib}" -xtype l -name 'lib*' -delete
+       # Detect older binutils w/broken rpaths. #562460
+       # We can hardcode the "/lib" part since that's what the binutils
+       # configure scripts have.  They did not include any other path.
+       if [[ $(scanelf -qF '%r#F' "${ROOT}/${BINPATH}/as") == */lib ]] ; then
+               ewarn "Old cross-binutils detected; please re-emerge to fix (see bug #562460)."
+               for x in lib* ; do
+                       atomic_ln "${LIBPATH}/${x}" "${dstlib}" "${x}"
+               done
+       fi
 
        #
        # Clean out old generated include symlinks