summary refs log tree commit diff
path: root/pkgs/development/tools/misc/patchelf/setup-hook.sh
blob: a76fbfbd509ca7b96265d7ed2b5ec733e27d7c29 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# 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
}