scripts/internals: strip all executables
author"Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sun Dec 05 16:27:06 2010 +0100 (2010-12-05)
changeset 22136aa057745dbd
parent 2212 a2f4986779bf
child 2214 10d4f2bc227b
scripts/internals: strip all executables

Using a list of files to strip misses a few of them.
Now, scan appropriate directories, and strip all ELF
executables and shared objects.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
scripts/build/internals.sh
     1.1 --- a/scripts/build/internals.sh	Thu Dec 09 18:55:59 2010 +0100
     1.2 +++ b/scripts/build/internals.sh	Sun Dec 05 16:27:06 2010 +0100
     1.3 @@ -5,6 +5,7 @@
     1.4  # crosstool-NG-provided files.
     1.5  do_finish() {
     1.6      local _t
     1.7 +    local _type
     1.8      local strip_args
     1.9  
    1.10      CT_DoStep INFO "Cleaning-up the toolchain's directory"
    1.11 @@ -20,14 +21,19 @@
    1.12          esac
    1.13          CT_DoLog INFO "Stripping all toolchain executables"
    1.14          CT_Pushd "${CT_PREFIX_DIR}"
    1.15 -        for t in ar as c++ c++filt cpp dlltool dllwrap g++ gcc gcc-${CT_CC_VERSION} gcov gprof ld nm objcopy objdump ranlib readelf size strings strip addr2line windmc windres; do
    1.16 -            [ -x bin/${CT_TARGET}-${t}${CT_HOST_SUFFIX} ] && ${CT_HOST}-strip ${strip_args} bin/${CT_TARGET}-${t}${CT_HOST_SUFFIX}
    1.17 -            [ -x ${CT_TARGET}/bin/${t}${CT_HOST_SUFFIX} ] && ${CT_HOST}-strip ${strip_args} ${CT_TARGET}/bin/${t}${CT_HOST_SUFFIX}
    1.18 -        done
    1.19 -        CT_Popd
    1.20 -        CT_Pushd "${CT_PREFIX_DIR}/libexec/gcc/${CT_TARGET}/${CT_CC_VERSION}"
    1.21 -        for t in cc1 cc1plus collect2; do
    1.22 -            [ -x ${t}${CT_HOST_SUFFIX} ] && ${CT_HOST}-strip ${strip_args} ${t}${CT_HOST_SUFFIX}
    1.23 +        for _t in "bin/${CT_TARGET}-"*                                          \
    1.24 +                  "${CT_TARGET}/bin/"*                                          \
    1.25 +                  "libexec/gcc/${CT_TARGET}/${CT_CC_VERSION}/"*                 \
    1.26 +                  "libexec/gcc/${CT_TARGET}/${CT_CC_VERSION}/install-tools/"*   \
    1.27 +        ; do
    1.28 +            _type="$( file "${_t}" |cut -d ' ' -f 2- )"
    1.29 +            case "${_type}" in
    1.30 +                *"shell script text executable")
    1.31 +                    ;;
    1.32 +                *executable*)
    1.33 +                    CT_DoExecLog ALL ${CT_HOST}-strip ${strip_args} "${_t}"
    1.34 +                    ;;
    1.35 +            esac
    1.36          done
    1.37          CT_Popd
    1.38      fi