Merge pull request #52508 from tkonolige/fix_suitesparse_darwin

suitesparse: Fix darwin support
This commit is contained in:
Silvan Mosberger 2018-12-31 03:24:48 +01:00 committed by GitHub
commit eb864397a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;