at release-16.03-start 20 lines 606 B view raw
1# This setup hook calls patchelf to automatically remove unneeded 2# directories from the RPATH of every library or executable in every 3# output. 4 5fixupOutputHooks+=('if [ -z "$dontPatchELF" ]; then patchELF "$prefix"; fi') 6 7patchELF() { 8 local dir="$1" 9 header "shrinking RPATHs of ELF executables and libraries in $dir" 10 11 local i 12 while IFS= read -r -d $'\0' i; do 13 if [[ "$i" =~ .build-id ]]; then continue; fi 14 if ! isELF "$i"; then continue; fi 15 echo "shrinking $i" 16 patchelf --shrink-rpath "$i" || true 17 done < <(find "$dir" -type f -print0) 18 19 stopNest 20}