mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 03:17:13 +00:00
8f33b8cc93
Fixes #9044, close #9667. Thanks to @taku0 for suggesting this solution. Now we have no modes starting with `/` or `+`. Rewrite the `-perm` parameters of find: - completely safe: rewrite `/0100` and `+100` to `-0100`, - slightly semantics-changing: rewrite `+111` to `-0100`. I cross-verified the `find` manual pages for Linux, Darwin, FreeBSD.
17 lines
531 B
Bash
17 lines
531 B
Bash
# This setup hook calls patchelf to automatically remove unneeded
|
|
# directories from the RPATH of every library or executable in every
|
|
# output.
|
|
|
|
fixupOutputHooks+=('if [ -z "$dontPatchELF" ]; then patchELF "$prefix"; fi')
|
|
|
|
patchELF() {
|
|
header "patching ELF executables and libraries in $prefix"
|
|
if [ -e "$prefix" ]; then
|
|
find "$prefix" \( \
|
|
\( -type f -a -name "*.so*" \) -o \
|
|
\( -type f -a -perm -0100 \) \
|
|
\) -print -exec patchelf --shrink-rpath '{}' \;
|
|
fi
|
|
stopNest
|
|
}
|