diff options
author | Artturi <Artturin@artturin.com> | 2023-09-05 00:37:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-05 00:37:17 +0300 |
commit | 31c9deb4f72b5cf63af4f60a700816e2c293ce8d (patch) | |
tree | cb7e699c56dc17ce01101dfeddcf50cddc0de20f /pkgs/build-support/setup-hooks | |
parent | d5139e30179237517e09174561b82bdacc1c2a03 (diff) | |
parent | 0bffcc3f3cef71004f130a62432cf8615eb7731b (diff) |
Merge pull request #218783 from timbertson/stripExcludeExtensions
Diffstat (limited to 'pkgs/build-support/setup-hooks')
-rw-r--r-- | pkgs/build-support/setup-hooks/strip.sh | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pkgs/build-support/setup-hooks/strip.sh b/pkgs/build-support/setup-hooks/strip.sh index d2422bb84234f..ce41e6ea0562a 100644 --- a/pkgs/build-support/setup-hooks/strip.sh +++ b/pkgs/build-support/setup-hooks/strip.sh @@ -49,11 +49,19 @@ stripDirs() { local ranlibCmd="$2" local paths="$3" local stripFlags="$4" + local excludeFlags=() local pathsNew= [ -z "$cmd" ] && echo "stripDirs: Strip command is empty" 1>&2 && exit 1 [ -z "$ranlibCmd" ] && echo "stripDirs: Ranlib command is empty" 1>&2 && exit 1 + local pattern + if [ -n "${stripExclude:-}" ]; then + for pattern in "${stripExclude[@]}"; do + excludeFlags+=(-a '!' '(' -name "$pattern" -o -wholename "$prefix/$pattern" ')' ) + done + fi + local p for p in ${paths}; do if [ -e "$prefix/$p" ]; then @@ -67,7 +75,7 @@ stripDirs() { local striperr striperr="$(mktemp --tmpdir="$TMPDIR" 'striperr.XXXXXX')" # Do not strip lib/debug. This is a directory used by setup-hooks/separate-debug-info.sh. - find $paths -type f -a '!' -path "$prefix/lib/debug/*" -print0 | + find $paths -type f "${excludeFlags[@]}" -a '!' -path "$prefix/lib/debug/*" -print0 | # Make sure we process files under symlinks only once. Otherwise # 'strip` can corrupt files when writes to them in parallel: # https://github.com/NixOS/nixpkgs/issues/246147#issuecomment-1657072039 |