···33fixupOutputHooks+=(_doStrip)
4455_doStrip() {
66- if [ -z "$dontStrip" ]; then
66+ # We don't bother to strip build platform code because it shouldn't make it
77+ # to $out anyways---if it does, that's a bigger problem that a lack of
88+ # stripping will help catch.
99+ local -ra flags=(dontStripHost dontStripTarget)
1010+ local -ra stripCmds=(STRIP TARGET_STRIP)
1111+1212+ # Optimization
1313+ if [[ "$STRIP" == "$TARGET_STRIP" ]]; then
1414+ dontStripTarget+=1
1515+ fi
1616+1717+ local i
1818+ for i in ${!stripCmds[@]}; do
1919+ local -n flag="${flags[$i]}"
2020+ local -n stripCmd="${stripCmds[$i]}"
2121+2222+ # `dontStrip` disables them all
2323+ if [[ "$dontStrip" || "$flag" ]] || ! type -f "$stripCmd" 2>/dev/null
2424+ then continue; fi
2525+726 stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
827 if [ -n "$stripDebugList" ]; then
99- stripDirs "$stripDebugList" "${stripDebugFlags:--S}"
2828+ stripDirs "$stripCmd" "$stripDebugList" "${stripDebugFlags:--S}"
1029 fi
11301231 stripAllList=${stripAllList:-}
1332 if [ -n "$stripAllList" ]; then
1414- stripDirs "$stripAllList" "${stripAllFlags:--s}"
3333+ stripDirs "$stripCmd" "$stripAllList" "${stripAllFlags:--s}"
1534 fi
1616- fi
3535+ done
1736}
18371938stripDirs() {
2020- local dirs="$1"
2121- local stripFlags="$2"
3939+ local cmd="$1"
4040+ local dirs="$2"
4141+ local stripFlags="$3"
2242 local dirsNew=
23434444+ local d
2445 for d in ${dirs}; do
2546 if [ -d "$prefix/$d" ]; then
2647 dirsNew="${dirsNew} $prefix/$d "
···2950 dirs=${dirsNew}
30513152 if [ -n "${dirs}" ]; then
3232- header "stripping (with flags $stripFlags) in$dirs"
3333- find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} $STRIP $commonStripFlags $stripFlags 2>/dev/null || true
5353+ header "stripping (with command $cmd and flags $stripFlags) in$dirs"
5454+ find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} $cmd $commonStripFlags $stripFlags 2>/dev/null || true
3455 stopNest
3556 fi
3657}