2014-06-27 11:15:28 +02:00
|
|
|
# This setup hook calls patchelf to automatically remove unneeded
|
|
|
|
# directories from the RPATH of every library or executable in every
|
|
|
|
# output.
|
|
|
|
|
2014-07-08 13:47:09 +02:00
|
|
|
fixupOutputHooks+=('if [ -z "$dontPatchELF" ]; then patchELF "$prefix"; fi')
|
2014-06-27 11:15:28 +02:00
|
|
|
|
|
|
|
patchELF() {
|
2016-02-24 11:13:36 +01:00
|
|
|
local dir="$1"
|
|
|
|
header "shrinking RPATHs of ELF executables and libraries in $dir"
|
2016-02-18 22:52:44 +01:00
|
|
|
|
|
|
|
local i
|
|
|
|
while IFS= read -r -d $'\0' i; do
|
|
|
|
if [[ "$i" =~ .build-id ]]; then continue; fi
|
|
|
|
if ! isELF "$i"; then continue; fi
|
|
|
|
echo "shrinking $i"
|
|
|
|
patchelf --shrink-rpath "$i" || true
|
2016-02-24 11:13:36 +01:00
|
|
|
done < <(find "$dir" -type f -print0)
|
2016-02-18 22:52:44 +01:00
|
|
|
|
2014-06-27 11:15:28 +02:00
|
|
|
stopNest
|
|
|
|
}
|