1{ stdenv
2, lib
3, fetchurl
4, gfortran
5, blas
6, lapack
7, which
8}:
9
10stdenv.mkDerivation rec {
11 pname = "qrupdate";
12 version = "1.1.2";
13 src = fetchurl {
14 url = "mirror://sourceforge/qrupdate/${pname}-${version}.tar.gz";
15 sha256 = "024f601685phcm1pg8lhif3lpy5j9j0k6n0r46743g4fvh8wg8g2";
16 };
17
18 preBuild =
19 # Check that blas and lapack are compatible
20 assert (blas.isILP64 == lapack.isILP64);
21 # We don't have structuredAttrs yet implemented, and we need to use space
22 # seprated values in makeFlags, so only this works.
23 ''
24 makeFlagsArray+=(
25 "LAPACK=-L${lapack}/lib -llapack"
26 "BLAS=-L${blas}/lib -lblas"
27 "PREFIX=${placeholder "out"}"
28 "FFLAGS=${toString ([
29 "-std=legacy"
30 ] ++ lib.optionals blas.isILP64 [
31 # If another application intends to use qrupdate compiled with blas with
32 # 64 bit support, it should add this to it's FFLAGS as well. See (e.g):
33 # https://savannah.gnu.org/bugs/?50339
34 "-fdefault-integer-8"
35 ])}"
36 )
37 '';
38
39 doCheck = true;
40
41 checkTarget = "test";
42
43 buildFlags = [ "lib" "solib" ];
44
45 installTargets = lib.optionals stdenv.isDarwin [ "install-staticlib" "install-shlib" ];
46
47 nativeBuildInputs = [ which gfortran ];
48
49 meta = with lib; {
50 description = "Library for fast updating of qr and cholesky decompositions";
51 homepage = "https://sourceforge.net/projects/qrupdate/";
52 license = licenses.gpl3Plus;
53 maintainers = with maintainers; [ doronbehar ];
54 platforms = platforms.unix;
55 };
56}