From b40a562c9c0b7898aab393d50c51a16769bb1f68 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 22 Aug 2013 16:18:45 +0200 Subject: Provide a function "stripDir" to strip a single directory tree --- pkgs/stdenv/generic/setup.sh | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'pkgs') 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 -- cgit 1.4.1