From 40ae28791f6336132918f50261175d1ab41d09e0 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 11 Feb 2020 20:02:43 +0100 Subject: [PATCH 1/7] suitesparse: clean up * Split to multiple outputs * Fetch source from GitLab (the only source for future releases) * Re-order attrset to be more idiomatic * Format with nixpkgs-fmt --- .../science/math/suitesparse/default.nix | 81 ++++++++++--------- .../python-modules/cvxopt/default.nix | 4 +- 2 files changed, 44 insertions(+), 41 deletions(-) diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index f72574cff583..b3b0d444bdcc 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -1,33 +1,46 @@ -{ stdenv, fetchurl, gfortran, openblas, cmake, fixDarwinDylibNames +{ stdenv +, fetchFromGitHub +, gfortran +, openblas +, cmake +, fixDarwinDylibNames , gnum4 -, enableCuda ? false, cudatoolkit +, enableCuda ? false +, cudatoolkit }: -let - version = "5.4.0"; - name = "suitesparse-${version}"; - - SHLIB_EXT = stdenv.hostPlatform.extensions.sharedLibrary; -in stdenv.mkDerivation rec { - inherit name; + pname = "suitesparse"; + version = "5.4.0"; - src = fetchurl { - url = "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-${version}.tar.gz"; - sha256 = "1lfvjj787yqyhk25w7brlrkrl7dnnn5dq4ijxws3wrbcd4vd2k9p"; + outputs = [ "out" "dev" "doc" ]; + + src = fetchFromGitHub { + owner = "DrTimothyAldenDavis"; + repo = "SuiteSparse"; + rev = "v${version}"; + sha256 = "sha256:1jwqn86z9xxcj6gsiymmws40zfvdcclprffsmdasdjnjax00z9sk"; }; + nativeBuildInputs = [ + cmake + gnum4 + ] ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; + + buildInputs = [ + openblas + gfortran.cc.lib + ] ++ stdenv.lib.optional enableCuda cudatoolkit; + dontUseCmakeConfigure = true; preConfigure = '' mkdir -p $out/lib - mkdir -p $out/include - mkdir -p $out/share/doc/${name} + mkdir -p $dev/include + mkdir -p $doc/share/doc/${pname}-${version} sed -i "SuiteSparse_config/SuiteSparse_config.mk" \ - -e 's/METIS .*$/METIS =/' \ - -e 's/METIS_PATH .*$/METIS_PATH =/' \ - -e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION/' + -e '/CHOLMOD_CONFIG ?=/ s/$/ -DNPARTITION/' '' + stdenv.lib.optionalString stdenv.isDarwin '' sed -i "SuiteSparse_config/SuiteSparse_config.mk" \ @@ -49,7 +62,7 @@ stdenv.mkDerivation rec { -e 's|^[[:space:]]*\(NVCCFLAGS =\)|NVCCFLAGS = $(NV20) -O3 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_60,code=sm_60|' ''; - NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin " -DNTIMER"; + NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-DNTIMER"; buildPhase = '' runHook preBuild @@ -75,7 +88,7 @@ stdenv.mkDerivation rec { ${if enableCuda then "${cudatoolkit}/bin/nvcc" else "${stdenv.cc.outPath}/bin/cc"} \ static/*.o \ ${if stdenv.isDarwin then "-dynamiclib" else "--shared"} \ - -o "lib/libsuitesparse${SHLIB_EXT}" \ + -o "lib/libsuitesparse${stdenv.hostPlatform.extensions.sharedLibrary}" \ -lopenblas \ ${stdenv.lib.optionalString enableCuda "-lcublas"} @@ -85,12 +98,11 @@ stdenv.mkDerivation rec { installPhase = '' runHook preInstall - mkdir -p $out cp -r lib $out/ - cp -r include $out/ - cp -r share $out/ - '' - + stdenv.lib.optionalString stdenv.isDarwin '' + cp -r include $dev/ + cp -r share $doc/ + '' + + stdenv.lib.optionalString stdenv.isDarwin '' # The fixDarwinDylibNames in nixpkgs can't seem to fix all the libraries. # We manually fix them up here. fixDarwinDylibNames() { @@ -109,28 +121,19 @@ stdenv.mkDerivation rec { } fixDarwinDylibNames $(find "$out" -name "*.dylib") - '' - + stdenv.lib.optionalString (!stdenv.isDarwin) '' + '' + + 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 - gnum4 - ] ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; - - buildInputs = [ openblas gfortran.cc.lib ] - ++ stdenv.lib.optional enableCuda cudatoolkit; + ''; meta = with stdenv.lib; { - homepage = http://faculty.cse.tamu.edu/davis/suitesparse.html; + homepage = "http://faculty.cse.tamu.edu/davis/suitesparse.html"; description = "A suite of sparse matrix algorithms"; license = with licenses; [ bsd2 gpl2Plus lgpl21Plus ]; maintainers = with maintainers; [ ttuegel ]; diff --git a/pkgs/development/python-modules/cvxopt/default.nix b/pkgs/development/python-modules/cvxopt/default.nix index a842baca2289..fd44f49b53c9 100644 --- a/pkgs/development/python-modules/cvxopt/default.nix +++ b/pkgs/development/python-modules/cvxopt/default.nix @@ -31,8 +31,8 @@ buildPythonPackage rec { export CVXOPT_BLAS_LIB_DIR=${openblasCompat}/lib export CVXOPT_BLAS_LIB=openblas export CVXOPT_LAPACK_LIB=openblas - export CVXOPT_SUITESPARSE_LIB_DIR=${suitesparse}/lib - export CVXOPT_SUITESPARSE_INC_DIR=${suitesparse}/include + export CVXOPT_SUITESPARSE_LIB_DIR=${lib.getLib suitesparse}/lib + export CVXOPT_SUITESPARSE_INC_DIR=${lib.getDev suitesparse}/include '' + lib.optionalString withGsl '' export CVXOPT_BUILD_GSL=1 export CVXOPT_GSL_LIB_DIR=${gsl}/lib From b4e6293a8d14d82a6e48466788845ac8bfc51356 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 11 Feb 2020 20:40:00 +0100 Subject: [PATCH 2/7] mongoose: init at 2.0.4 --- .../science/math/mongoose/default.nix | 30 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/development/libraries/science/math/mongoose/default.nix diff --git a/pkgs/development/libraries/science/math/mongoose/default.nix b/pkgs/development/libraries/science/math/mongoose/default.nix new file mode 100644 index 000000000000..36c53b2994f5 --- /dev/null +++ b/pkgs/development/libraries/science/math/mongoose/default.nix @@ -0,0 +1,30 @@ +{ stdenv +, fetchFromGitHub +, cmake +}: + +stdenv.mkDerivation rec { + pname = "mongoose"; + version = "2.0.4"; + + outputs = [ "bin" "out" "dev" ]; + + src = fetchFromGitHub { + owner = "ScottKolo"; + repo = "Mongoose"; + rev = "v${version}"; + sha256 = "0ymwd4n8p8s0ndh1vcbmjcsm0x2cc2b7v3baww5y6as12873bcrh"; + }; + + nativeBuildInputs = [ + cmake + ]; + + meta = with stdenv.lib; { + description = "Graph Coarsening and Partitioning Library"; + homepage = "https://github.com/ScottKolo/Mongoose"; + license = licenses.gpl3; + maintainers = with maintainers; []; + platforms = with platforms; unix; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index c915833ba01f..94bf821c3620 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -25152,6 +25152,8 @@ in mongoc = callPackage ../development/libraries/mongoc { }; + mongoose = callPackage ../development/libraries/science/math/mongoose {}; + morph = callPackage ../tools/package-management/morph { }; mupen64plus = callPackage ../misc/emulators/mupen64plus { }; From 559f02e2088a1934d9cca16ad1efcea481487d2d Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 12 Feb 2020 06:33:35 +0100 Subject: [PATCH 3/7] suitesparse-graphblas: init at 3.1.2 --- .../math/suitesparse-graphblas/default.nix | 32 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 2 files changed, 34 insertions(+) create mode 100644 pkgs/development/libraries/science/math/suitesparse-graphblas/default.nix diff --git a/pkgs/development/libraries/science/math/suitesparse-graphblas/default.nix b/pkgs/development/libraries/science/math/suitesparse-graphblas/default.nix new file mode 100644 index 000000000000..599c1be66461 --- /dev/null +++ b/pkgs/development/libraries/science/math/suitesparse-graphblas/default.nix @@ -0,0 +1,32 @@ +{ stdenv +, fetchFromGitHub +, cmake +, gnum4 +}: + +stdenv.mkDerivation rec { + pname = "suitesparse-graphblas"; + version = "3.2.1"; + + outputs = [ "out" "dev" ]; + + src = fetchFromGitHub { + owner = "DrTimothyAldenDavis"; + repo = "GraphBLAS"; + rev = "v${version}"; + sha256 = "AAwwzrpKFHy40Ldm6hTO6L0FWPYwi3kJj3zrshFwYas="; + }; + + nativeBuildInputs = [ + cmake + gnum4 + ]; + + meta = with stdenv.lib; { + description = "Graph algorithms in the language of linear algebra"; + homepage = "http://faculty.cse.tamu.edu/davis/GraphBLAS.html"; + license = licenses.asl20; + maintainers = with maintainers; []; + platforms = with platforms; unix; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 94bf821c3620..79533f825f59 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24308,6 +24308,8 @@ in suitesparse_5_3 = callPackage ../development/libraries/science/math/suitesparse {}; suitesparse = suitesparse_5_3; + suitesparse-graphblas = callPackage ../development/libraries/science/math/suitesparse-graphblas {}; + superlu = callPackage ../development/libraries/science/math/superlu {}; symmetrica = callPackage ../applications/science/math/symmetrica {}; From e9d7774b7b466a3d4e19e850d42d80d47df8fa03 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 12 Feb 2020 07:23:00 +0100 Subject: [PATCH 4/7] =?UTF-8?q?suitesparse:=205.4.0=20=E2=86=92=205.7.1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../libraries/science/math/suitesparse/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index b3b0d444bdcc..686efc6baf48 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -11,7 +11,7 @@ stdenv.mkDerivation rec { pname = "suitesparse"; - version = "5.4.0"; + version = "5.7.1"; outputs = [ "out" "dev" "doc" ]; @@ -19,7 +19,7 @@ stdenv.mkDerivation rec { owner = "DrTimothyAldenDavis"; repo = "SuiteSparse"; rev = "v${version}"; - sha256 = "sha256:1jwqn86z9xxcj6gsiymmws40zfvdcclprffsmdasdjnjax00z9sk"; + sha256 = "SA9SQKRDKUI1GilNMuCXljcvovLUwRKBUi/tiQ4dl5w="; }; nativeBuildInputs = [ From 306cf6091ff25523e8df31154ac6d82cb7747ce3 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 10 Mar 2020 20:07:26 +0100 Subject: [PATCH 5/7] suitesparse: link against system metis --- .../libraries/science/math/suitesparse/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index 686efc6baf48..5786ae49ee57 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -2,6 +2,7 @@ , fetchFromGitHub , gfortran , openblas +, metis , cmake , fixDarwinDylibNames , gnum4 @@ -29,6 +30,7 @@ stdenv.mkDerivation rec { buildInputs = [ openblas + metis gfortran.cc.lib ] ++ stdenv.lib.optional enableCuda cudatoolkit; @@ -71,6 +73,7 @@ stdenv.mkDerivation rec { make library \ JOBS=$NIX_BUILD_CORES \ BLAS=-lopenblas \ + MY_METIS_LIB=-lmetis \ LAPACK="" \ ${stdenv.lib.optionalString openblas.blas64 "CFLAGS=-DBLAS64"} @@ -78,7 +81,9 @@ stdenv.mkDerivation rec { # Bundling is done by building the static libraries, extracting objects from # them and combining the objects into one shared library. mkdir -p static - make static JOBS=$NIX_BUILD_CORES AR_TARGET=$(pwd)/static/'$(LIBRARY).a' + make static JOBS=$NIX_BUILD_CORES \ + MY_METIS_LIB=-lmetis \ + AR_TARGET=$(pwd)/static/'$(LIBRARY).a' ( cd static for i in lib*.a; do From c16d5b6534321ee0495e1e42fcc1b7e0baa06b62 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Tue, 10 Mar 2020 20:19:24 +0100 Subject: [PATCH 6/7] suitesparse: do not build Mongoose & GraphBLAS We already have package for them --- .../libraries/science/math/suitesparse/default.nix | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index 5786ae49ee57..4eb3264b2af2 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -3,7 +3,6 @@ , gfortran , openblas , metis -, cmake , fixDarwinDylibNames , gnum4 , enableCuda ? false @@ -24,7 +23,6 @@ stdenv.mkDerivation rec { }; nativeBuildInputs = [ - cmake gnum4 ] ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames; @@ -34,13 +32,14 @@ stdenv.mkDerivation rec { gfortran.cc.lib ] ++ stdenv.lib.optional enableCuda cudatoolkit; - dontUseCmakeConfigure = true; - preConfigure = '' mkdir -p $out/lib mkdir -p $dev/include mkdir -p $doc/share/doc/${pname}-${version} + # Mongoose and GraphBLAS are packaged separately + sed -i "Makefile" -e '/GraphBLAS\|Mongoose/d' + sed -i "SuiteSparse_config/SuiteSparse_config.mk" \ -e '/CHOLMOD_CONFIG ?=/ s/$/ -DNPARTITION/' '' From b552b84ae29628b2574da116b9736e90f12485df Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 11 Mar 2020 03:24:33 +0100 Subject: [PATCH 7/7] suitesparse: ultimate clean-up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Switch to default buildPhase & installPhase * In preConfigure * Do not add -DNPARTITION to CHOLMOD_CONFIG. That would disable the use of Metis but we already have that. * Do not remove -lrt on Darwin, Darwin compiler can handle that and the code no longer exists anyway. * With CUDA enabled * Do not replace CUDA_ROOT. It does not exist any more. Instead we are setting CUDA_PATH in makeFlags. * Do not replace GPU_BLAS_PATH, it defaults to CUDA_PATH so it will end up with the same value. * Do not add -DCHOLMOD_OMP_NUM_THREADS to GPU_CONFIG. Why would be having the library use the same number of threads as the builder a good idea? * Do not replace CUDA_PATH, we are setting it in makeFlags now. * Do not replace CUDART_LIB and CUBLAS_LIB. They were being replaced incorrectly (cuda libs are located in lib directory, not lib64). Instead set the correct paths in makeFlags. * Do not replace CUDA_INC_PATH. Its default looks like it will end up with the same value. * Do not replace NV20, NV30, NV35 – not used any more. * Do not replace NVCC, defaults to the same. * Do not replace NVCCFLAGS, we just used the default from SourceSparse 4.4.7 with -gencode=arch=compute_60,code=compute_60 tacked on top. Current upstream default looks much better. * Stop adding -DNTIMER to CFLAGS on Darwin – clock_gettime is supported by macOS 10.12 SDK. * In buildPhase * Move the make arguments to makeFlags and library to buildFlags, allowing us to drop the manual make call. I did not verify all of these are still needed. * Remove the creation of libsuitesparse.so. As far as I could tell it is some kind of remnant of our old expression – perhaps due to past deficiencies of the build scripts, we created the individual libraries as symlinks to libsuitesparse.so: https://github.com/NixOS/nixpkgs/commit/e36b3ec0a56c3b06152a205a46804733b88695d6 But since the build script can now build individual .so libraries, there should be no need for this abomination. No other distros do this either. * In installPhase * No need to copy things manually, there is an install target. We just need to pass INSTALL=$out flag to make to let it know where to install the files. * I do not have means of verifying the darwin dylib name fix but it looks like it might be fixed in an upcoming release. * I dropped the rpath fixup as it does not seem to be needed any more (ldd does not report any unresolved libraries). --- .../science/math/suitesparse/default.nix | 98 ++++--------------- 1 file changed, 21 insertions(+), 77 deletions(-) diff --git a/pkgs/development/libraries/science/math/suitesparse/default.nix b/pkgs/development/libraries/science/math/suitesparse/default.nix index 4eb3264b2af2..f4adafd0f387 100644 --- a/pkgs/development/libraries/science/math/suitesparse/default.nix +++ b/pkgs/development/libraries/science/math/suitesparse/default.nix @@ -33,80 +33,33 @@ stdenv.mkDerivation rec { ] ++ stdenv.lib.optional enableCuda cudatoolkit; preConfigure = '' - mkdir -p $out/lib - mkdir -p $dev/include - mkdir -p $doc/share/doc/${pname}-${version} - # Mongoose and GraphBLAS are packaged separately sed -i "Makefile" -e '/GraphBLAS\|Mongoose/d' - - sed -i "SuiteSparse_config/SuiteSparse_config.mk" \ - -e '/CHOLMOD_CONFIG ?=/ s/$/ -DNPARTITION/' - '' - + stdenv.lib.optionalString stdenv.isDarwin '' - sed -i "SuiteSparse_config/SuiteSparse_config.mk" \ - -e 's/^[[:space:]]*\(LIB = -lm\) -lrt/\1/' - '' - + stdenv.lib.optionalString enableCuda '' - sed -i "SuiteSparse_config/SuiteSparse_config.mk" \ - -e 's|^[[:space:]]*\(CUDA_ROOT =\)|CUDA_ROOT = ${cudatoolkit}|' \ - -e 's|^[[:space:]]*\(GPU_BLAS_PATH =\)|GPU_BLAS_PATH = $(CUDA_ROOT)|' \ - -e 's|^[[:space:]]*\(GPU_CONFIG =\)|GPU_CONFIG = -I$(CUDA_ROOT)/include -DGPU_BLAS -DCHOLMOD_OMP_NUM_THREADS=$(NIX_BUILD_CORES) |' \ - -e 's|^[[:space:]]*\(CUDA_PATH =\)|CUDA_PATH = $(CUDA_ROOT)|' \ - -e 's|^[[:space:]]*\(CUDART_LIB =\)|CUDART_LIB = $(CUDA_ROOT)/lib64/libcudart.so|' \ - -e 's|^[[:space:]]*\(CUBLAS_LIB =\)|CUBLAS_LIB = $(CUDA_ROOT)/lib64/libcublas.so|' \ - -e 's|^[[:space:]]*\(CUDA_INC_PATH =\)|CUDA_INC_PATH = $(CUDA_ROOT)/include/|' \ - -e 's|^[[:space:]]*\(NV20 =\)|NV20 = -arch=sm_20 -Xcompiler -fPIC|' \ - -e 's|^[[:space:]]*\(NV30 =\)|NV30 = -arch=sm_30 -Xcompiler -fPIC|' \ - -e 's|^[[:space:]]*\(NV35 =\)|NV35 = -arch=sm_35 -Xcompiler -fPIC|' \ - -e 's|^[[:space:]]*\(NVCC =\) echo|NVCC = $(CUDA_ROOT)/bin/nvcc|' \ - -e 's|^[[:space:]]*\(NVCCFLAGS =\)|NVCCFLAGS = $(NV20) -O3 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_60,code=sm_60|' ''; - NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-DNTIMER"; + makeFlags = [ + "INSTALL=${placeholder "out"}" + "INSTALL_INCLUDE=${placeholder "dev"}/include" + "JOBS=$(NIX_BUILD_CORES)" + "BLAS=-lopenblas" + "MY_METIS_LIB=-lmetis" + "LAPACK=" + ] ++ stdenv.lib.optionals openblas.blas64 [ + "CFLAGS=-DBLAS64" + ] ++ stdenv.lib.optionals enableCuda [ + "CUDA_PATH=${cudatoolkit}" + "CUDART_LIB=${cudatoolkit.lib}/lib/libcudart.so" + "CUBLAS_LIB=${cudatoolkit}/lib/libcublas.so" + ]; - buildPhase = '' - runHook preBuild + buildFlags = [ + # Build individual shared libraries, not demos + "library" + ]; - # Build individual shared libraries - make library \ - JOBS=$NIX_BUILD_CORES \ - BLAS=-lopenblas \ - MY_METIS_LIB=-lmetis \ - LAPACK="" \ - ${stdenv.lib.optionalString openblas.blas64 "CFLAGS=-DBLAS64"} - - # Build libsuitesparse.so which bundles all the individual libraries. - # Bundling is done by building the static libraries, extracting objects from - # them and combining the objects into one shared library. - mkdir -p static - make static JOBS=$NIX_BUILD_CORES \ - MY_METIS_LIB=-lmetis \ - AR_TARGET=$(pwd)/static/'$(LIBRARY).a' - ( - cd static - for i in lib*.a; do - ar -x $i - done - ) - ${if enableCuda then "${cudatoolkit}/bin/nvcc" else "${stdenv.cc.outPath}/bin/cc"} \ - static/*.o \ - ${if stdenv.isDarwin then "-dynamiclib" else "--shared"} \ - -o "lib/libsuitesparse${stdenv.hostPlatform.extensions.sharedLibrary}" \ - -lopenblas \ - ${stdenv.lib.optionalString enableCuda "-lcublas"} - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - cp -r lib $out/ - cp -r include $dev/ - cp -r share $doc/ - '' - + stdenv.lib.optionalString stdenv.isDarwin '' + # Likely fixed after 5.7.1 + # https://github.com/DrTimothyAldenDavis/SuiteSparse/commit/f6daae26ee391e475e2295e77c839aa7c1a8b784 + postInstall = stdenv.lib.optionalString stdenv.isDarwin '' # The fixDarwinDylibNames in nixpkgs can't seem to fix all the libraries. # We manually fix them up here. fixDarwinDylibNames() { @@ -125,15 +78,6 @@ stdenv.mkDerivation rec { } 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 ''; meta = with stdenv.lib; {