cc/gcc: fix cc symlink when executables have an extension 1.6
authorRemy Bohmer <linux@bohmer.net>
Tue Apr 20 11:39:13 2010 +0200 (2010-04-20)
branch1.6
changeset 1931875abab986ac
parent 1923 37613068818d
child 1932 e73cee842741
cc/gcc: fix cc symlink when executables have an extension

When building a cross-compiler for a host which depends
on file extensions the symlink for cc was not installed correctly

Signed-off-by: Bart vdr. Meulen <bartvdrmeulen@gmail.com>
[Yann E. MORIN: style fixes, enhancements, code prettying]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
(transplanted from 214c64ba8b21db15f610eca886fb194a6675e40c)
scripts/build/cc/gcc.sh
     1.1 --- a/scripts/build/cc/gcc.sh	Fri Apr 09 21:04:38 2010 +0200
     1.2 +++ b/scripts/build/cc/gcc.sh	Tue Apr 20 11:39:13 2010 +0200
     1.3 @@ -246,7 +246,10 @@
     1.4  
     1.5      # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able
     1.6      # to call the C compiler with the same, somewhat canonical name.
     1.7 -    CT_DoExecLog ALL ln -sv "${CT_TARGET}"-gcc "${core_prefix_dir}/bin/${CT_TARGET}"-cc
     1.8 +    # check whether compiler has an extension
     1.9 +    file="$( ls -1 "${core_prefix_dir}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )"
    1.10 +    [ -z "${file}" ] || ext=".${file##*.}"
    1.11 +    CT_DoExecLog ALL ln -sv "${CT_TARGET}-gcc${ext}" "${core_prefix_dir}/bin/${CT_TARGET}-cc${ext}"
    1.12  
    1.13      CT_EndStep
    1.14  }
    1.15 @@ -354,7 +357,10 @@
    1.16  
    1.17      # Create a symlink ${CT_TARGET}-cc to ${CT_TARGET}-gcc to always be able
    1.18      # to call the C compiler with the same, somewhat canonical name.
    1.19 -    CT_DoExecLog ALL ln -sv "${CT_TARGET}"-gcc "${CT_PREFIX_DIR}/bin/${CT_TARGET}"-cc
    1.20 +    # check whether compiler has an extension
    1.21 +    file="$( ls -1 "${CT_TARGET}/bin/${CT_TARGET}-gcc."* 2>/dev/null || true )"
    1.22 +    [ -z "${file}" ] || ext=".${file##*.}"
    1.23 +    CT_DoExecLog ALL ln -sv "${CT_TARGET}-gcc${ext}" "${CT_PREFIX_DIR}/bin/${CT_TARGET}-cc${ext}"
    1.24  
    1.25      CT_EndStep
    1.26  }