diff options
author | Sergei Trofimovich <slyich@gmail.com> | 2022-07-22 21:22:50 +0100 |
---|---|---|
committer | Sergei Trofimovich <slyich@gmail.com> | 2022-07-25 11:06:45 +0100 |
commit | 0f45ce6e777e2cca2ade01176c19bc66cfe4b5c7 (patch) | |
tree | 74dd232826aeb32200449dac6f6f8702819d220d /pkgs/build-support | |
parent | 17f413f2930f90d0f5de1121f310693c31a7cd0e (diff) |
setup-hooks/strip.sh: add strip{All,Debug}ListTarget variables
This change mimics existing strip{All,Debug}List variables to allow special stripping directories just for Target. The primary use case in mind is gcc where package has to install both host and target ELFs. They have to be stripped by their own strip tools accordingly. Co-authored-by: Rick van Schijndel <Mindavi@users.noreply.github.com> Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/setup-hooks/strip.sh | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/pkgs/build-support/setup-hooks/strip.sh b/pkgs/build-support/setup-hooks/strip.sh index a23b203aff56f..9d0b163f4c46f 100644 --- a/pkgs/build-support/setup-hooks/strip.sh +++ b/pkgs/build-support/setup-hooks/strip.sh @@ -7,31 +7,29 @@ _doStrip() { # to $out anyways---if it does, that's a bigger problem that a lack of # stripping will help catch. local -ra flags=(dontStripHost dontStripTarget) + local -ra debugDirs=(stripDebugList stripDebugListTarget) + local -ra allDirs=(stripAllList stripAllListTarget) local -ra stripCmds=(STRIP STRIP_FOR_TARGET) - # Optimization - if [[ "${STRIP-}" == "${STRIP_FOR_TARGET-}" ]]; then - dontStripTarget+=1 - fi + # Strip only host paths by default. Leave targets as is. + stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin} + stripDebugListTarget=${stripDebugListTarget:-} + stripAllList=${stripAllList:-} + stripAllListTarget=${stripAllListTarget:-} local i for i in ${!stripCmds[@]}; do local -n flag="${flags[$i]}" + local -n debugDirList="${debugDirs[$i]}" + local -n allDirList="${allDirs[$i]}" local -n stripCmd="${stripCmds[$i]}" # `dontStrip` disables them all if [[ "${dontStrip-}" || "${flag-}" ]] || ! type -f "${stripCmd-}" 2>/dev/null then continue; fi - stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin} - if [ -n "$stripDebugList" ]; then - stripDirs "$stripCmd" "$stripDebugList" "${stripDebugFlags:--S}" - fi - - stripAllList=${stripAllList:-} - if [ -n "$stripAllList" ]; then - stripDirs "$stripCmd" "$stripAllList" "${stripAllFlags:--s}" - fi + stripDirs "$stripCmd" "$debugDirList" "${stripDebugFlags:--S}" + stripDirs "$stripCmd" "$allDirList" "${stripAllFlags:--s}" done } @@ -50,8 +48,7 @@ stripDirs() { dirs=${dirsNew} if [ -n "${dirs}" ]; then - header "stripping (with command $cmd and flags $stripFlags) in$dirs" + echo "stripping (with command $cmd and flags $stripFlags) in$dirs" find $dirs -type f -exec $cmd $stripFlags '{}' \; 2>/dev/null - stopNest fi } |