diff options
author | Tristan Konolige <tristan.konolige@gmail.com> | 2018-12-18 18:05:33 -0700 |
---|---|---|
committer | Tristan Konolige <tristan.konolige@gmail.com> | 2018-12-18 18:08:17 -0700 |
commit | 00005ce0bdbc3c13804adc9a7fd71a02cc0b8db2 (patch) | |
tree | 816b2d7f40d2c48db72ef8952249258ef08b39ce /pkgs/development/libraries/science/math/suitesparse | |
parent | 43dd779a8d019a0667e3eed1346f83ffe2004e05 (diff) |
suitesparse: Fix darwin support
Suitesparse libraries would end up containing references to the build
directory. fixDarwinDylibNames appears to not fix this problem. We
manually use intall_name_tool to set the library paths correctly.
Diffstat (limited to 'pkgs/development/libraries/science/math/suitesparse')
-rw-r--r-- | pkgs/development/libraries/science/math/suitesparse/default.nix | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index 528fe5ed0739..ce3b048e764d 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -87,14 +87,37 @@ stdenv.mkDerivation rec { cp -r lib $out/ cp -r include $out/ cp -r share $out/ + '' + + stdenv.lib.optionalString stdenv.isDarwin '' + # The fixDarwinDylibNames in nixpkgs can't seem to fix all the libraries. + # We manually fix them up here. + fixDarwinDylibNames() { + local flags=() + local old_id + + for fn in "$@"; do + flags+=(-change "$PWD/lib/$(basename "$fn")" "$fn") + done + + for fn in "$@"; do + if [ -L "$fn" ]; then continue; fi + echo "$fn: fixing dylib" + install_name_tool -id "$fn" "''${flags[@]}" "$fn" + done + } + fixDarwinDylibNames $(find "$out" -name "*.dylib") + '' + + stdenv.lib.optionalString (!stdenv.isDarwin) '' # Fix rpaths cd $out find -name \*.so\* -type f -exec \ patchelf --set-rpath "$out/lib:${stdenv.lib.makeLibraryPath buildInputs}" {} \; - + '' + + + '' runHook postInstall - ''; + ''; nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; |