toolchain.eclass: fix warnings when progs are linked
authorMike Frysinger <vapier@gentoo.org>
Sun, 13 Dec 2015 04:41:18 +0000 (23:41 -0500)
committerMike Frysinger <vapier@gentoo.org>
Sun, 13 Dec 2015 04:45:46 +0000 (23:45 -0500)
When gcc installs programs into BINPATH, it sometimes links them so that
the $CHOST-xxx and xxx progs are the same.  The logic to standardize the
naming in BINPATH then triggers a warning as they're the same file.

Manually delete the target before running the mv to avoid that business.

eclass/toolchain.eclass

index 82b77adb4ab5e2b589c05a43f027666993f36d03..eb6c4a19fe1a40e2683f0cc8e23b8f539d64907a 100644 (file)
@@ -1663,7 +1663,12 @@ toolchain_src_install() {
        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