From ed16fb06cef1fbcf055d7877fa129c8e08b27cae Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 21 Sep 2020 13:24:04 +0300 Subject: [PATCH 1/3] qrupdate: Add @doronbehar as maintainer --- pkgs/development/libraries/qrupdate/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/pkgs/development/libraries/qrupdate/default.nix b/pkgs/development/libraries/qrupdate/default.nix index 424502dce0d4..33d98a492cd8 100644 --- a/pkgs/development/libraries/qrupdate/default.nix +++ b/pkgs/development/libraries/qrupdate/default.nix @@ -37,6 +37,7 @@ stdenv.mkDerivation { description = "Library for fast updating of qr and cholesky decompositions"; homepage = "https://sourceforge.net/projects/qrupdate/"; license = licenses.gpl3; + maintainers = with maintainers; [ doronbehar ]; platforms = platforms.unix; }; } From 9c3f7ad85bf9f823a11d69c41c188135b2ebe7a8 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Mon, 21 Sep 2020 13:21:13 +0300 Subject: [PATCH 2/3] qrupdate: Add `which` to native build inputs The build won't fail without it, but it's needed according to: https://sourceforge.net/p/qrupdate/code/HEAD/tree/test/report_results --- pkgs/development/libraries/qrupdate/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/libraries/qrupdate/default.nix b/pkgs/development/libraries/qrupdate/default.nix index 33d98a492cd8..99fe1289eae5 100644 --- a/pkgs/development/libraries/qrupdate/default.nix +++ b/pkgs/development/libraries/qrupdate/default.nix @@ -3,6 +3,7 @@ , gfortran , blas , lapack +, which }: stdenv.mkDerivation { name = "qrupdate-1.1.2"; @@ -33,6 +34,8 @@ stdenv.mkDerivation { buildInputs = [ gfortran blas lapack ]; + nativeBuildInputs = [ which ]; + meta = with stdenv.lib; { description = "Library for fast updating of qr and cholesky decompositions"; homepage = "https://sourceforge.net/projects/qrupdate/"; From 81093774683e63f82c63f05784cd39bc4d3f53ab Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Wed, 23 Sep 2020 00:20:47 +0300 Subject: [PATCH 3/3] qrupdate: refactor & assert compatible blas && lapack Use `pname` and `version`. Use my preferred indentation style. Use makeFlagsArray in preBuild instead of overriding configurePhase, per: https://github.com/jtojnar/nixpkgs-hammering/blob/master/explanations/explicit-phases.md Assert that lapack and blas are compatible regarding 64 bit indexing, do it near evaluation of preBuild, per jtojnar's explanation: https://github.com/NixOS/nixpkgs/pull/94892#discussion_r471110250 Use gpl3Plus, as gpl3 is unclear and deprecated. --- .../libraries/qrupdate/default.nix | 41 +++++++++++-------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/pkgs/development/libraries/qrupdate/default.nix b/pkgs/development/libraries/qrupdate/default.nix index 99fe1289eae5..90d4cb45ce2a 100644 --- a/pkgs/development/libraries/qrupdate/default.nix +++ b/pkgs/development/libraries/qrupdate/default.nix @@ -5,24 +5,33 @@ , 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"}" + ${stdenv.lib.optionalString blas.isILP64 + # Use their FFLAGS along with `-fdefault-integer-8`. If another + # application intends to use arpack, it should add this to it's FFLAGS as + # well. Otherwise (e.g): https://savannah.gnu.org/bugs/?50339 + "FFLAGS=-fimplicit-none -O3 -funroll-loops -fdefault-integer-8" + } + ) + ''; doCheck = true; @@ -32,14 +41,14 @@ stdenv.mkDerivation { installTargets = stdenv.lib.optionals stdenv.isDarwin [ "install-staticlib" "install-shlib" ]; - buildInputs = [ gfortran blas lapack ]; + buildInputs = [ gfortran ]; nativeBuildInputs = [ which ]; meta = with stdenv.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; };