diff --git a/pkgs/stdenv/darwin/prehook.sh b/pkgs/stdenv/darwin/prehook.sh index d2f00c59257..0232ee2bb6f 100644 --- a/pkgs/stdenv/darwin/prehook.sh +++ b/pkgs/stdenv/darwin/prehook.sh @@ -2,4 +2,5 @@ export NIX_ENFORCE_PURITY= export NIX_DONT_SET_RPATH=1 export NIX_NO_SELF_RPATH=1 dontFixLibtool=1 -NIX_STRIP_DEBUG=0 \ No newline at end of file +NIX_STRIP_DEBUG=0 +stripAllFlags=" " # the Darwin "strip" command doesn't know "-s" diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh index 395de988e4c..9f4bfc635d0 100644 --- a/pkgs/stdenv/generic/setup.sh +++ b/pkgs/stdenv/generic/setup.sh @@ -232,7 +232,7 @@ stripDirs() { dirs=${dirsNew} if test -n "${dirs}"; then - echo $dirs + echo "stripping (with flags $stripFlags) in $dirs" find $dirs -type f -print0 | xargs -0 strip $stripFlags || true fi } @@ -715,12 +715,15 @@ fixupPhase() { # TODO: strip _only_ ELF executables, and return || fail here... if test -z "$dontStrip"; then - stripDebugList=${stripDebugList:-lib} - echo "stripping debuging symbols from files in $stripDebugList" - stripDirs "$stripDebugList" -S - stripAllList=${stripAllList:-bin sbin} - echo "stripping all symbols from files in $stripAllList" - stripDirs "$stripAllList" -s + stripDebugList=${stripDebugList:-lib bin sbin} + if test -n "$stripDebugList"; then + stripDirs "$stripDebugList" "${stripDebugFlags:--S}" + fi + + stripAllList=${stripAllList:-} + if test -n "$stripAllList"; then + stripDirs "$stripAllList" "${stripAllFlags:--s}" + fi fi if test "$havePatchELF" = 1 -a -z "$dontPatchELF"; then