summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/tools/misc/patchelf/default.nix6
-rw-r--r--pkgs/stdenv/generic/setup.sh14
-rw-r--r--pkgs/stdenv/nix-linux/default.nix5
-rw-r--r--pkgs/stdenv/nix-linux/prehook.sh1
4 files changed, 22 insertions, 4 deletions
diff --git a/pkgs/development/tools/misc/patchelf/default.nix b/pkgs/development/tools/misc/patchelf/default.nix
index 3e06271e93f..5a8b220f634 100644
--- a/pkgs/development/tools/misc/patchelf/default.nix
+++ b/pkgs/development/tools/misc/patchelf/default.nix
@@ -1,10 +1,10 @@
 {stdenv, fetchurl}:
 
 stdenv.mkDerivation {
-  name = "patchelf-0.1pre1514";
+  name = "patchelf-0.1pre1513";
   src = fetchurl {
-    url = http://catamaran.labs.cs.uu.nl/dist/nix/patchelf-0.1pre1514/patchelf-0.1pre1514.tar.gz;
-    md5 = "b3d82ce1dc68304770fe5411ed718e3a";
+    url = http://losser.st-lab.cs.uu.nl/~eelco/dist/patchelf-0.1pre1513.tar.gz;
+    md5 = "874928f46117828c1d8019986aa2eaac";
   };
 #  src = /home/eelco/Dev/patchelf/patchelf-0.1.tar.gz;
 }
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 0e2dac944e3..901c461ee2b 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"
diff --git a/pkgs/stdenv/nix-linux/default.nix b/pkgs/stdenv/nix-linux/default.nix
index c06f2cf815a..9c48b9ef0a4 100644
--- a/pkgs/stdenv/nix-linux/default.nix
+++ b/pkgs/stdenv/nix-linux/default.nix
@@ -3,7 +3,10 @@
 genericStdenv {
   name = "stdenv-nix-linux";
   preHook = ./prehook.sh;
-  initialPath = (import ../nix/path.nix) {pkgs = pkgs;};
+  initialPath = [
+    ((import ../nix/path.nix) {pkgs = pkgs;})
+    pkgs.patchelf
+  ];
 
   inherit stdenv;
 
diff --git a/pkgs/stdenv/nix-linux/prehook.sh b/pkgs/stdenv/nix-linux/prehook.sh
index 08bb6c0332c..5b9c6f87879 100644
--- a/pkgs/stdenv/nix-linux/prehook.sh
+++ b/pkgs/stdenv/nix-linux/prehook.sh
@@ -1 +1,2 @@
 export NIX_ENFORCE_PURITY=1
+havePatchELF=1
\ No newline at end of file