summary refs log tree commit diff
path: root/pkgs/development/libraries/qrupdate
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/qrupdate')
-rw-r--r--pkgs/development/libraries/qrupdate/default.nix50
1 files changed, 32 insertions, 18 deletions
diff --git a/pkgs/development/libraries/qrupdate/default.nix b/pkgs/development/libraries/qrupdate/default.nix
index 424502dce0d..ad7e88d4647 100644
--- a/pkgs/development/libraries/qrupdate/default.nix
+++ b/pkgs/development/libraries/qrupdate/default.nix
@@ -1,27 +1,38 @@
 { stdenv
+, lib
 , fetchurl
 , gfortran
 , blas
 , lapack
+, which
 }:
-stdenv.mkDerivation {
-  name = "qrupdate-1.1.2";
+
+stdenv.mkDerivation rec {
+  pname = "qrupdate";
+  version = "1.1.2";
   src = fetchurl {
-    url = "mirror://sourceforge/qrupdate/qrupdate-1.1.2.tar.gz";
+    url = "mirror://sourceforge/qrupdate/${pname}-${version}.tar.gz";
     sha256 = "024f601685phcm1pg8lhif3lpy5j9j0k6n0r46743g4fvh8wg8g2";
   };
 
-  configurePhase =
-    ''
-      export PREFIX=$out
-      sed -i -e 's,^BLAS=.*,BLAS=-L${blas}/lib -lblas,' \
-          -e 's,^LAPACK=.*,LAPACK=-L${lapack}/lib -llapack,' \
-          Makeconf
-    ''
-    + stdenv.lib.optionalString blas.isILP64
-    ''
-      sed -i Makeconf -e '/^FFLAGS=.*/ s/$/-fdefault-integer-8/'
-    '';
+  preBuild =
+    # Check that blas and lapack are compatible
+    assert (blas.isILP64 == lapack.isILP64);
+  # We don't have structuredAttrs yet implemented, and we need to use space
+  # seprated values in makeFlags, so only this works.
+  ''
+    makeFlagsArray+=(
+      "LAPACK=-L${lapack}/lib -llapack"
+      "BLAS=-L${blas}/lib -lblas"
+      "PREFIX=${placeholder "out"}"
+      ${lib.optionalString blas.isILP64
+      # If another application intends to use qrupdate compiled with blas with
+      # 64 bit support, it should add this to it's FFLAGS as well. See (e.g):
+      # https://savannah.gnu.org/bugs/?50339
+      "FFLAGS=-fdefault-integer-8"
+      }
+    )
+  '';
 
   doCheck = true;
 
@@ -29,14 +40,17 @@ stdenv.mkDerivation {
 
   buildFlags = [ "lib" "solib" ];
 
-  installTargets = stdenv.lib.optionals stdenv.isDarwin [ "install-staticlib" "install-shlib" ];
+  installTargets = lib.optionals stdenv.isDarwin [ "install-staticlib" "install-shlib" ];
+
+  buildInputs = [ gfortran ];
 
-  buildInputs = [ gfortran blas lapack ];
+  nativeBuildInputs = [ which ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Library for fast updating of qr and cholesky decompositions";
     homepage = "https://sourceforge.net/projects/qrupdate/";
-    license = licenses.gpl3;
+    license = licenses.gpl3Plus;
+    maintainers = with maintainers; [ doronbehar ];
     platforms = platforms.unix;
   };
 }