summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-08-22 16:18:45 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-08-23 10:01:30 +0200
commitb40a562c9c0b7898aab393d50c51a16769bb1f68 (patch)
tree12d612c5f0e3385e5f3115030eedeb73cedd06e0 /pkgs
parentbfa20c96ccae60a8b1c1f622cc85fbfe66b2b33f (diff)
downloadnixlib-b40a562c9c0b7898aab393d50c51a16769bb1f68.tar
nixlib-b40a562c9c0b7898aab393d50c51a16769bb1f68.tar.gz
nixlib-b40a562c9c0b7898aab393d50c51a16769bb1f68.tar.bz2
nixlib-b40a562c9c0b7898aab393d50c51a16769bb1f68.tar.lz
nixlib-b40a562c9c0b7898aab393d50c51a16769bb1f68.tar.xz
nixlib-b40a562c9c0b7898aab393d50c51a16769bb1f68.tar.zst
nixlib-b40a562c9c0b7898aab393d50c51a16769bb1f68.zip
Provide a function "stripDir" to strip a single directory tree
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/stdenv/generic/setup.sh33
1 files changed, 19 insertions, 14 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index cee63ae8fa88..331ec8dc5dcd 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -275,23 +275,28 @@ export NIX_BUILD_CORES
 # Misc. helper functions.
 
 
-stripDirs() {
-    local dirs="$1"
+stripDir() {
+    local dir="$1"
     local stripFlags="$2"
-    local dirsNew=
 
-    for d in ${dirs}; do
+    if [ -e "$dir" ]; then
+        header "stripping (with flags $stripFlags) in $dir"
+        find "$dir" -type f -print0 | xargs -0 ${xargsFlags:--r} strip $stripFlags || true
+        stopNest
+    fi
+}
+
+
+stripDirs() {
+    local prefix="$1"
+    local subdirs="$2"
+    local stripFlags="$3"
+
+    for d in $subdirs; do
         if [ -d "$prefix/$d" ]; then
-            dirsNew="${dirsNew} $prefix/$d "
+            stripDir "$prefix/$d" "$stripFlags"
         fi
     done
-    dirs=${dirsNew}
-
-    if [ -n "${dirs}" ]; then
-        header "stripping (with flags $stripFlags) in $dirs"
-        find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} strip $stripFlags || true
-        stopNest
-    fi
 }
 
 
@@ -806,12 +811,12 @@ fixupPrefix() {
     if [ -z "$dontStrip" ]; then
         stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
         if [ -n "$stripDebugList" ]; then
-            stripDirs "$stripDebugList" "${stripDebugFlags:--S}"
+            stripDirs "$prefix" "$stripDebugList" "${stripDebugFlags:--S}"
         fi
 
         stripAllList=${stripAllList:-}
         if [ -n "$stripAllList" ]; then
-            stripDirs "$stripAllList" "${stripAllFlags:--s}"
+            stripDirs "$prefix" "$stripAllList" "${stripAllFlags:--s}"
         fi
     fi