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.
This commit is contained in:
parent
43dd779a8d
commit
00005ce0bd
pkgs/development/libraries/science/math/suitesparse
|
@ -87,14 +87,37 @@ stdenv.mkDerivation rec {
|
||||||
cp -r lib $out/
|
cp -r lib $out/
|
||||||
cp -r include $out/
|
cp -r include $out/
|
||||||
cp -r share $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
|
# Fix rpaths
|
||||||
cd $out
|
cd $out
|
||||||
find -name \*.so\* -type f -exec \
|
find -name \*.so\* -type f -exec \
|
||||||
patchelf --set-rpath "$out/lib:${stdenv.lib.makeLibraryPath buildInputs}" {} \;
|
patchelf --set-rpath "$out/lib:${stdenv.lib.makeLibraryPath buildInputs}" {} \;
|
||||||
|
''
|
||||||
|
+
|
||||||
|
''
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
nativeBuildInputs = [ cmake ]
|
nativeBuildInputs = [ cmake ]
|
||||||
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
||||||
|
|
Loading…
Reference in New Issue