···937937938938Flags passed to the `strip` command applied to the files in the directories listed in `stripDebugList`. Defaults to `-S` (i.e. `--strip-debug`).
939939940940+##### `stripExclude` {#var-stdenv-stripExclude}
941941+942942+A list of filenames or path patterns to avoid stripping. A file is excluded if its name _or_ path (from the derivation root) matches.
943943+944944+This example prevents all `*.rlib` files from being stripped:
945945+946946+```nix
947947+stdenv.mkDerivation {
948948+ # ...
949949+ stripExclude = [ "*.rlib" ]
950950+}
951951+```
952952+953953+This example prevents files within certain paths from being stripped:
954954+955955+```nix
956956+stdenv.mkDerivation {
957957+ # ...
958958+ stripExclude = [ "lib/modules/*/build/* ]
959959+}
960960+```
961961+940962##### `dontPatchELF` {#var-stdenv-dontPatchELF}
941963942964If set, the `patchelf` command is not used to remove unnecessary `RPATH` entries. Only applies to Linux.
+9-1
pkgs/build-support/setup-hooks/strip.sh
···4949 local ranlibCmd="$2"
5050 local paths="$3"
5151 local stripFlags="$4"
5252+ local excludeFlags=()
5253 local pathsNew=
53545455 [ -z "$cmd" ] && echo "stripDirs: Strip command is empty" 1>&2 && exit 1
5556 [ -z "$ranlibCmd" ] && echo "stripDirs: Ranlib command is empty" 1>&2 && exit 1
5757+5858+ local pattern
5959+ if [ -n "${stripExclude:-}" ]; then
6060+ for pattern in "${stripExclude[@]}"; do
6161+ excludeFlags+=(-a '!' '(' -name "$pattern" -o -wholename "$prefix/$pattern" ')' )
6262+ done
6363+ fi
56645765 local p
5866 for p in ${paths}; do
···6775 local striperr
6876 striperr="$(mktemp --tmpdir="$TMPDIR" 'striperr.XXXXXX')"
6977 # Do not strip lib/debug. This is a directory used by setup-hooks/separate-debug-info.sh.
7070- find $paths -type f -a '!' -path "$prefix/lib/debug/*" -print0 |
7878+ find $paths -type f "${excludeFlags[@]}" -a '!' -path "$prefix/lib/debug/*" -print0 |
7179 # Make sure we process files under symlinks only once. Otherwise
7280 # 'strip` can corrupt files when writes to them in parallel:
7381 # https://github.com/NixOS/nixpkgs/issues/246147#issuecomment-1657072039