nixpkgs/pkgs/development/libraries/science/math/suitesparse/default.nix
Thomas Tuegel b02f300c44 suitesparse_4_4_1: build with openblas
Compared to ATLAS, OpenBLAS offers better performance, faster builds,
and dynamic architecture detection.
2015-06-04 17:42:01 -05:00

67 lines
1.8 KiB
Nix

{ stdenv, fetchurl, gfortran, openblas }:
let
version = "4.4.1";
name = "suitesparse-${version}";
int_t = if openblas.blas64 then "int64_t" else "int32_t";
in
stdenv.mkDerivation {
inherit name;
src = fetchurl {
url = "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-${version}.tar.gz";
sha256 = "0y8i6dizrr556xggpjyc7wijjv4jbizhssmjj4jv8n1s7zxy2z0n";
};
preConfigure = ''
substituteAllInPlace SuiteSparse_config/SuiteSparse_config.mk
mkdir -p $out/lib
mkdir -p $out/include
sed -i "SuiteSparse_config/SuiteSparse_config.mk" \
-e 's/METIS .*$/METIS =/' \
-e 's/METIS_PATH .*$/METIS_PATH =/' \
-e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION -DLONGBLAS=${int_t}/' \
-e '/UMFPACK_CONFIG/ s/$/-DLONGBLAS=${int_t}/'
'';
makeFlags = [
"PREFIX=\"$(out)\""
"INSTALL_LIB=$(out)/lib"
"INSTALL_INCLUDE=$(out)/include"
"BLAS=-lopenblas"
"LAPACK="
];
NIX_CFLAGS = "-fPIC";
postInstall = ''
# Install documentation
outdoc=$out/share/doc/${name}
mkdir -p $outdoc
cp -r AMD/Doc $outdoc/amd
cp -r BTF/Doc $outdoc/bft
cp -r CAMD/Doc $outdoc/camd
cp -r CCOLAMD/Doc $outdoc/ccolamd
cp -r CHOLMOD/Doc $outdoc/cholmod
cp -r COLAMD/Doc $outdoc/colamd
cp -r CXSparse/Doc $outdoc/cxsparse
cp -r KLU/Doc $outdoc/klu
cp -r LDL/Doc $outdoc/ldl
cp -r RBio/Doc $outdoc/rbio
cp -r SPQR/Doc $outdoc/spqr
cp -r UMFPACK/Doc $outdoc/umfpack
'';
nativeBuildInputs = [ gfortran ];
buildInputs = [ openblas ];
meta = with stdenv.lib; {
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 ];
};
}