biglybt: 3.5.0.0 -> 3.6.0.0
[NixPkgs.git] / pkgs / development / tools / misc / patchelf / setup-hook.sh
blob8f010a3f4d0b17863461e0666622ffd78fcf326a
1 # This setup hook calls patchelf to automatically remove unneeded
2 # directories from the RPATH of every library or executable in every
3 # output.
5 fixupOutputHooks+=('if [ -z "${dontPatchELF-}" ]; then patchELF "$prefix"; fi')
7 patchELF() {
8 local dir="$1"
9 [ -e "$dir" ] || return 0
11 echo "shrinking RPATHs of ELF executables and libraries in $dir"
13 local i
14 while IFS= read -r -d $'\0' i; do
15 if [[ "$i" =~ .build-id ]]; then continue; fi
16 if ! isELF "$i"; then continue; fi
17 echo "shrinking $i"
18 patchelf --shrink-rpath "$i" || true
19 done < <(find "$dir" -type f -print0)