about summary refs log tree commit diff
path: root/pkgs/development/compilers/ghc
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2017-12-25 17:19:43 +0000
committerDomen Kožar <domen@dev.si>2017-12-25 17:19:43 +0000
commit398061dfc593e97e7ea57321d4e97ed843ef449f (patch)
tree2b7afadd8319ccc21b8d186ffe375e983a2f4eda /pkgs/development/compilers/ghc
parented93d2d6454eb1c903a0f99197ba0d25d3513445 (diff)
downloadnixlib-398061dfc593e97e7ea57321d4e97ed843ef449f.tar
nixlib-398061dfc593e97e7ea57321d4e97ed843ef449f.tar.gz
nixlib-398061dfc593e97e7ea57321d4e97ed843ef449f.tar.bz2
nixlib-398061dfc593e97e7ea57321d4e97ed843ef449f.tar.lz
nixlib-398061dfc593e97e7ea57321d4e97ed843ef449f.tar.xz
nixlib-398061dfc593e97e7ea57321d4e97ed843ef449f.tar.zst
nixlib-398061dfc593e97e7ea57321d4e97ed843ef449f.zip
prebuilt ghcs: correctly handle rpaths
Diffstat (limited to 'pkgs/development/compilers/ghc')
-rw-r--r--pkgs/development/compilers/ghc/7.10.3-binary.nix12
-rw-r--r--pkgs/development/compilers/ghc/7.8.4-binary.nix12
-rw-r--r--pkgs/development/compilers/ghc/8.2.1-binary.nix12
3 files changed, 21 insertions, 15 deletions
diff --git a/pkgs/development/compilers/ghc/7.10.3-binary.nix b/pkgs/development/compilers/ghc/7.10.3-binary.nix
index 1711531fae1d..881e41708623 100644
--- a/pkgs/development/compilers/ghc/7.10.3-binary.nix
+++ b/pkgs/development/compilers/ghc/7.10.3-binary.nix
@@ -87,9 +87,6 @@ stdenv.mkDerivation rec {
 
       sed -i "s|/usr/bin/perl|perl\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
       sed -i "s|/usr/bin/gcc|gcc\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
-      for prog in ld ar gcc strip ranlib; do
-        find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
-      done
     '';
 
   configurePlatforms = [ ];
@@ -109,8 +106,12 @@ stdenv.mkDerivation rec {
   # On Linux, use patchelf to modify the executables so that they can
   # find editline/gmp.
   preFixup = stdenv.lib.optionalString stdenv.isLinux ''
-    find "$out" -type f -executable \
-        -exec patchelf --set-rpath "${libPath}" {} \;
+    for p in $(find "$out" -type f -executable); do
+      if isELF "$p"; then
+        echo "Patchelfing $p"
+        patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p
+      fi
+    done
   '' + stdenv.lib.optionalString stdenv.isDarwin ''
     # not enough room in the object files for the full path to libiconv :(
     for exe in $(find "$out" -type f -executable); do
@@ -126,6 +127,7 @@ stdenv.mkDerivation rec {
 
   doInstallCheck = true;
   installCheckPhase = ''
+    unset ${libEnvVar}
     # Sanity check, can ghc create executables?
     cd $TMP
     mkdir test-ghc; cd test-ghc
diff --git a/pkgs/development/compilers/ghc/7.8.4-binary.nix b/pkgs/development/compilers/ghc/7.8.4-binary.nix
index f9809d705739..81fc1dc49ce8 100644
--- a/pkgs/development/compilers/ghc/7.8.4-binary.nix
+++ b/pkgs/development/compilers/ghc/7.8.4-binary.nix
@@ -83,9 +83,6 @@ stdenv.mkDerivation rec {
 
       sed -i "s|/usr/bin/perl|perl\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
       sed -i "s|/usr/bin/gcc|gcc\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
-      for prog in ld ar gcc strip ranlib; do
-        find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
-      done
     '';
 
   configurePlatforms = [ ];
@@ -105,8 +102,12 @@ stdenv.mkDerivation rec {
   # On Linux, use patchelf to modify the executables so that they can
   # find editline/gmp.
   preFixup = stdenv.lib.optionalString stdenv.isLinux ''
-    find "$out" -type f -executable \
-        -exec patchelf --set-rpath "${libPath}" {} \;
+    for p in $(find "$out" -type f -executable); do
+      if isELF "$p"; then
+        echo "Patchelfing $p"
+        patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p
+      fi
+    done
   '' + stdenv.lib.optionalString stdenv.isDarwin ''
     # not enough room in the object files for the full path to libiconv :(
     for exe in $(find "$out" -type f -executable); do
@@ -122,6 +123,7 @@ stdenv.mkDerivation rec {
 
   doInstallCheck = true;
   installCheckPhase = ''
+    unset ${libEnvVar}
     # Sanity check, can ghc create executables?
     cd $TMP
     mkdir test-ghc; cd test-ghc
diff --git a/pkgs/development/compilers/ghc/8.2.1-binary.nix b/pkgs/development/compilers/ghc/8.2.1-binary.nix
index 2f48d29b0b41..5f18e6543e1c 100644
--- a/pkgs/development/compilers/ghc/8.2.1-binary.nix
+++ b/pkgs/development/compilers/ghc/8.2.1-binary.nix
@@ -91,9 +91,6 @@ stdenv.mkDerivation rec {
 
       sed -i "s|/usr/bin/perl|perl\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
       sed -i "s|/usr/bin/gcc|gcc\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
-      for prog in ld ar gcc strip ranlib; do
-        find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
-      done
     '';
 
   configurePlatforms = [ ];
@@ -113,8 +110,12 @@ stdenv.mkDerivation rec {
   # On Linux, use patchelf to modify the executables so that they can
   # find editline/gmp.
   preFixup = stdenv.lib.optionalString stdenv.isLinux ''
-    find "$out" -type f -executable \
-        -exec patchelf --set-rpath "${libPath}" {} \;
+    for p in $(find "$out" -type f -executable); do
+      if isELF "$p"; then
+        echo "Patchelfing $p"
+        patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p
+      fi
+    done
   '' + stdenv.lib.optionalString stdenv.isDarwin ''
     # not enough room in the object files for the full path to libiconv :(
     for exe in $(find "$out" -type f -executable); do
@@ -130,6 +131,7 @@ stdenv.mkDerivation rec {
 
   doInstallCheck = true;
   installCheckPhase = ''
+    unset ${libEnvVar}
     # Sanity check, can ghc create executables?
     cd $TMP
     mkdir test-ghc; cd test-ghc