summaryrefslogtreecommitdiffstats
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2014-05-31 17:01:42 -0500
committerJohn Wiegley <johnw@newartisans.com>2014-05-31 17:01:42 -0500
commit0df8ca2b52c07647b210f5bb243fe82dda7ae85f (patch)
tree15198cfe24df0c23e6770acf5cedf5ad24fd6482 /pkgs/build-support
parent421e8539ecbc0050d3b72e4cb3f91ef12d48a49c (diff)
parentb09a788e13712f694f12ea1d0fdbf630395effd2 (diff)
Merge pull request #2743 from jwiegley/rpath
Correctly patch the rpath for GHC-built executables on Darwin
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/cabal/default.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix
index 70fb72f99fb9..7605d863c213 100644
--- a/pkgs/build-support/cabal/default.nix
+++ b/pkgs/build-support/cabal/default.nix
@@ -197,6 +197,9 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
${optionalString (self.enableSharedExecutables && self.stdenv.isLinux) ''
configureFlags+=" --ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.ghc.name}/${self.pname}-${self.version}";
''}
+ ${optionalString (self.enableSharedExecutables && self.stdenv.isDarwin) ''
+ configureFlags+=" --ghc-option=-optl=-Wl,-headerpad_max_install_names";
+ ''}
echo "configure flags: $extraConfigureFlags $configureFlags"
./Setup configure --verbose --prefix="$out" --libdir='$prefix/lib/$compiler' \
@@ -256,6 +259,13 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
ln -s $out/nix-support/propagated-native-build-inputs $out/nix-support/propagated-user-env-packages
fi
+ ${optionalString (self.enableSharedExecutables && self.isExecutable && self.stdenv.isDarwin) ''
+ for exe in $out/bin/* ; do
+ install_name_tool -add_rpath \
+ $out/lib/${ghc.ghc.name}/${self.pname}-${self.version} $exe
+ done
+ ''}
+
eval "$postInstall"
'';