summary refs log tree commit diff
path: root/pkgs/stdenv/generic
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2004-10-02 18:27:50 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2004-10-02 18:27:50 +0000
commitb6001eed67e4136c5f3a655712134851b582045a (patch)
treeabe1f1172cdc54b4674c70998e8ab4eb238ebdb0 /pkgs/stdenv/generic
parent8cb8bdd418cec8e9f95f93a2169327f2d16927cb (diff)
downloadnixlib-b6001eed67e4136c5f3a655712134851b582045a.tar
nixlib-b6001eed67e4136c5f3a655712134851b582045a.tar.gz
nixlib-b6001eed67e4136c5f3a655712134851b582045a.tar.bz2
nixlib-b6001eed67e4136c5f3a655712134851b582045a.tar.lz
nixlib-b6001eed67e4136c5f3a655712134851b582045a.tar.xz
nixlib-b6001eed67e4136c5f3a655712134851b582045a.tar.zst
nixlib-b6001eed67e4136c5f3a655712134851b582045a.zip
* Use patchelf to remove unnecessary directories automatically (in the
  installation phase) from the rpaths of ELF executables and
  libraries.  This results in smaller closures.

svn path=/nixpkgs/trunk/; revision=1534
Diffstat (limited to 'pkgs/stdenv/generic')
-rw-r--r--pkgs/stdenv/generic/setup.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 0e2dac944e3c..901c461ee2bf 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -527,6 +527,16 @@ checkPhase() {
 }
 
 
+patchELF() {
+    # Patch all ELF executables and shared libraries.
+    header "patching ELF executables and libraries"
+    find "$prefix" \( -name "*.so*" -o \
+        \( -type f -a -perm +0100 \) \
+        \) -exec patchelf --shrink-rpath {} \;
+    stopNest
+}
+
+
 installW() {
     if test -n "$installPhase"; then
         $installPhase
@@ -549,6 +559,10 @@ installW() {
             -exec strip -S {} \; || fail
     fi
 
+    if test "$havePatchELF" = 1 -a -z "$dontPatchELF"; then
+        patchELF "$prefix"
+    fi
+
     if test -n "$propagatedBuildInputs"; then
         ensureDir "$out/nix-support"
         echo "$propagatedBuildInputs" > "$out/nix-support/propagated-build-inputs"