scripts/build/internals.sh
branchgcc-4.4
changeset 1402 146c62142e1b
parent 1401 604c5c80e24a
child 1408 f334df41f069
     1.1 --- a/scripts/build/internals.sh	Tue Jun 02 17:33:04 2009 +0000
     1.2 +++ b/scripts/build/internals.sh	Tue Jun 02 21:01:19 2009 +0000
     1.3 @@ -47,14 +47,24 @@
     1.4           -o "${CT_PPL_CLOOG_MPC}" = "y" ]; then
     1.5          CT_DoLog EXTRA "Installing toolchain wrappers"
     1.6          CT_Pushd "${CT_PREFIX_DIR}/bin"
     1.7 -        sed -r -e 's|@@CT_bash@@|'"${bash}"'|g;'    \
     1.8 -            "${CT_LIB_DIR}/scripts/wrapper.in"      \
     1.9 -            >".${CT_TARGET}-wrapper"
    1.10 -        CT_DoExecLog ALL chmod 755 ".${CT_TARGET}-wrapper"
    1.11 +
    1.12 +        # Copy the wrapper
    1.13 +        CT_DoExecLog DEBUG install -m 0755 "${CT_LIB_DIR}/scripts/wrapper.in"   \
    1.14 +                                           ".${CT_TARGET}-wrapper"
    1.15 +
    1.16 +        # Replace every tools with the wrapper
    1.17 +        # Do it unconditionally, even for those tools that happen to be shell
    1.18 +        # scripts, we don't know if they would in the end spawn a binary...
    1.19 +        # Just skip symlinks
    1.20          for t in "${CT_TARGET}-"*; do
    1.21 -            CT_DoExecLog ALL mv "${t}" ".${t}"
    1.22 -            CT_DoExecLog ALL ln ".${CT_TARGET}-wrapper" "${t}"
    1.23 +            if [ "$( LANG=C stat -c '%F' "${t}" )" != "symbolic link" ]; then
    1.24 +                CT_DoExecLog ALL mv "${t}" ".${t}"
    1.25 +                CT_DoExecLog ALL ln ".${CT_TARGET}-wrapper" "${t}"
    1.26 +            fi
    1.27          done
    1.28 +
    1.29 +        # Get rid of the wrapper, we're using hardlinks
    1.30 +        CT_DoExecLog DEBUG rm -f ".${CT_TARGET}-wrapper"
    1.31          CT_Popd
    1.32      fi
    1.33