summary refs log tree commit diff
path: root/pkgs/development/tools/misc/patchelf
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2016-03-08 09:57:58 +0100
committerVladimír Čunát <vcunat@gmail.com>2016-03-08 09:58:19 +0100
commit09af15654f0c8091f1b9e0bbb2e523cdee194442 (patch)
treee648edef1ce4c64c533f2593aa22b8015cf0e506 /pkgs/development/tools/misc/patchelf
parentf306e67e15bdbe9a8358c9f81319fc4fcbadc2eb (diff)
parent0ee75214f336474e127c2e3546c0406a0c4d5fa7 (diff)
downloadnixpkgs-09af15654f0c8091f1b9e0bbb2e523cdee194442.tar
nixpkgs-09af15654f0c8091f1b9e0bbb2e523cdee194442.tar.gz
nixpkgs-09af15654f0c8091f1b9e0bbb2e523cdee194442.tar.bz2
nixpkgs-09af15654f0c8091f1b9e0bbb2e523cdee194442.tar.lz
nixpkgs-09af15654f0c8091f1b9e0bbb2e523cdee194442.tar.xz
nixpkgs-09af15654f0c8091f1b9e0bbb2e523cdee194442.tar.zst
nixpkgs-09af15654f0c8091f1b9e0bbb2e523cdee194442.zip
Merge master into closure-size
The kde-5 stuff still didn't merge well.
I hand-fixed what I saw, but there may be more problems.
Diffstat (limited to 'pkgs/development/tools/misc/patchelf')
-rw-r--r--pkgs/development/tools/misc/patchelf/setup-hook.sh18
1 files changed, 11 insertions, 7 deletions
diff --git a/pkgs/development/tools/misc/patchelf/setup-hook.sh b/pkgs/development/tools/misc/patchelf/setup-hook.sh
index a76fbfbd509..563ef57fce1 100644
--- a/pkgs/development/tools/misc/patchelf/setup-hook.sh
+++ b/pkgs/development/tools/misc/patchelf/setup-hook.sh
@@ -5,12 +5,16 @@
 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
+    local dir="$1"
+    header "shrinking RPATHs of ELF executables and libraries in $dir"
+
+    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
+    done < <(find "$dir" -type f -print0)
+
     stopNest
 }