From 2362891dc815160e343e52458f25db22508ac487 Mon Sep 17 00:00:00 2001 From: Guillaume Maudoux Date: Thu, 28 Apr 2016 23:48:13 +0200 Subject: [PATCH] Just strip everything by default Run strip of each file and discard expected failure types. Also default to stripping the entire output. --- pkgs/build-support/setup-hooks/strip.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/pkgs/build-support/setup-hooks/strip.sh b/pkgs/build-support/setup-hooks/strip.sh index 6860c9b9cb9a..33ef85e436e2 100644 --- a/pkgs/build-support/setup-hooks/strip.sh +++ b/pkgs/build-support/setup-hooks/strip.sh @@ -4,7 +4,7 @@ fixupOutputHooks+=(_doStrip) _doStrip() { if [ -z "$dontStrip" ]; then - stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin} + stripDebugList=${stripDebugList:-.} if [ -n "$stripDebugList" ]; then stripDirs "$stripDebugList" "${stripDebugFlags:--S}" fi @@ -29,8 +29,20 @@ stripDirs() { dirs=${dirsNew} if [ -n "${dirs}" ]; then - header "stripping (with flags $stripFlags) in$dirs" - find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} strip $commonStripFlags $stripFlags || true + header "Stripping (with flags $stripFlags) in$dirs" + while IFS= read -r -d $'\0' f; do + if out=$(strip $commonStripFlags $stripFlags "$f" 2>&1); then + echo "Stripped $f" + else + # Ignore failures on files that cannot be stripped. + if [ "$out" = "strip:$f: File format not recognized" ]; then + continue + fi + + echo "Strip failed on file $f: $out" + false # fail ! + fi + done < <(find $dirs -type f -print0) stopNest fi }