lol
1{ lib, stdenv, fetchurl, gfortran, blas, lapack }:
2
3let
4 int_t = if blas.isILP64 then "int64_t" else "int32_t";
5in
6stdenv.mkDerivation rec {
7 version = "4.2.1";
8 pname = "suitesparse";
9 src = fetchurl {
10 url = "http://www.cise.ufl.edu/research/sparse/SuiteSparse/SuiteSparse-${version}.tar.gz" ;
11 sha256 = "1ga69637x7kdkiy3w3lq9dvva7220bdangv2lch2wx1hpi83h0p8";
12 };
13
14 nativeBuildInputs = [ gfortran ];
15 buildInputs = [ blas lapack ];
16
17 preConfigure = ''
18 mkdir -p $out/lib
19 mkdir -p $out/include
20
21 sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
22 -e 's/METIS .*$/METIS =/' \
23 -e 's/METIS_PATH .*$/METIS_PATH =/' \
24 -e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION -DLONGBLAS=${int_t}/' \
25 -e '/UMFPACK_CONFIG/ s/$/-DLONGBLAS=${int_t}/'
26 '';
27
28 makeFlags = [
29 "PREFIX=\"$(out)\""
30 "INSTALL_LIB=$(out)/lib"
31 "INSTALL_INCLUDE=$(out)/include"
32 "BLAS=-lblas"
33 "LAPACK=-llapack"
34 ];
35
36 meta = with lib; {
37 homepage = "http://faculty.cse.tamu.edu/davis/suitesparse.html";
38 description = "A suite of sparse matrix algorithms";
39 license = with licenses; [ bsd2 gpl2Plus lgpl21Plus ];
40 maintainers = with maintainers; [ ttuegel ];
41 platforms = with platforms; unix;
42 };
43}