···3fixupOutputHooks+=(_doStrip)
45_doStrip() {
6- if [ -z "$dontStrip" ]; then
00000000000000000007 stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
8 if [ -n "$stripDebugList" ]; then
9- stripDirs "$stripDebugList" "${stripDebugFlags:--S}"
10 fi
1112 stripAllList=${stripAllList:-}
13 if [ -n "$stripAllList" ]; then
14- stripDirs "$stripAllList" "${stripAllFlags:--s}"
15 fi
16- fi
17}
1819stripDirs() {
20- local dirs="$1"
21- local stripFlags="$2"
022 local dirsNew=
23024 for d in ${dirs}; do
25 if [ -d "$prefix/$d" ]; then
26 dirsNew="${dirsNew} $prefix/$d "
···29 dirs=${dirsNew}
3031 if [ -n "${dirs}" ]; then
32- header "stripping (with flags $stripFlags) in$dirs"
33- find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} $STRIP $commonStripFlags $stripFlags 2>/dev/null || true
34 stopNest
35 fi
36}
···3fixupOutputHooks+=(_doStrip)
45_doStrip() {
6+ # We don't bother to strip build platform code because it shouldn't make it
7+ # to $out anyways---if it does, that's a bigger problem that a lack of
8+ # stripping will help catch.
9+ local -ra flags=(dontStripHost dontStripTarget)
10+ local -ra stripCmds=(STRIP TARGET_STRIP)
11+12+ # Optimization
13+ if [[ "$STRIP" == "$TARGET_STRIP" ]]; then
14+ dontStripTarget+=1
15+ fi
16+17+ local i
18+ for i in ${!stripCmds[@]}; do
19+ local -n flag="${flags[$i]}"
20+ local -n stripCmd="${stripCmds[$i]}"
21+22+ # `dontStrip` disables them all
23+ if [[ "$dontStrip" || "$flag" ]] || ! type -f "$stripCmd" 2>/dev/null
24+ then continue; fi
25+26 stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
27 if [ -n "$stripDebugList" ]; then
28+ stripDirs "$stripCmd" "$stripDebugList" "${stripDebugFlags:--S}"
29 fi
3031 stripAllList=${stripAllList:-}
32 if [ -n "$stripAllList" ]; then
33+ stripDirs "$stripCmd" "$stripAllList" "${stripAllFlags:--s}"
34 fi
35+ done
36}
3738stripDirs() {
39+ local cmd="$1"
40+ local dirs="$2"
41+ local stripFlags="$3"
42 local dirsNew=
4344+ local d
45 for d in ${dirs}; do
46 if [ -d "$prefix/$d" ]; then
47 dirsNew="${dirsNew} $prefix/$d "
···50 dirs=${dirsNew}
5152 if [ -n "${dirs}" ]; then
53+ header "stripping (with command $cmd and flags $stripFlags) in$dirs"
54+ find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} $cmd $commonStripFlags $stripFlags 2>/dev/null || true
55 stopNest
56 fi
57}