lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 16.09-beta 83 lines 2.5 kB view raw
1{ stdenv, fetchurl, gfortran, openblas }: 2 3let 4 version = "4.4.4"; 5 name = "suitesparse-${version}"; 6 7 int_t = if openblas.blas64 then "int64_t" else "int32_t"; 8 SHLIB_EXT = if stdenv.isDarwin then "dylib" else "so"; 9in 10stdenv.mkDerivation { 11 inherit name; 12 13 src = fetchurl { 14 url = "http://faculty.cse.tamu.edu/davis/SuiteSparse/SuiteSparse-${version}.tar.gz"; 15 sha256 = "1zdn1y0ij6amj7smmcslkqgbqv9yy5cwmbyzqc9v6drzdzllgbpj"; 16 }; 17 18 preConfigure = '' 19 mkdir -p $out/lib 20 mkdir -p $out/include 21 22 sed -i "SuiteSparse_config/SuiteSparse_config.mk" \ 23 -e 's/METIS .*$/METIS =/' \ 24 -e 's/METIS_PATH .*$/METIS_PATH =/' \ 25 -e '/CHOLMOD_CONFIG/ s/$/-DNPARTITION -DLONGBLAS=${int_t}/' \ 26 -e '/UMFPACK_CONFIG/ s/$/-DLONGBLAS=${int_t}/' 27 '' 28 + stdenv.lib.optionalString stdenv.isDarwin '' 29 sed -i "SuiteSparse_config/SuiteSparse_config.mk" \ 30 -e 's/^[[:space:]]*\(LIB = -lm\) -lrt/\1/' 31 ''; 32 33 makeFlags = [ 34 "PREFIX=\"$(out)\"" 35 "INSTALL_LIB=$(out)/lib" 36 "INSTALL_INCLUDE=$(out)/include" 37 "BLAS=-lopenblas" 38 "LAPACK=" 39 ]; 40 41 NIX_CFLAGS = stdenv.lib.optionalString stdenv.isDarwin " -DNTIMER"; 42 43 postInstall = '' 44 # Build and install shared library 45 ( 46 cd "$(mktemp -d)" 47 for i in "$out"/lib/lib*.a; do 48 ar -x $i 49 done 50 ''${CC} *.o ${if stdenv.isDarwin then "-dynamiclib" else "--shared"} -o "$out/lib/libsuitesparse.${SHLIB_EXT}" -lopenblas 51 ) 52 for i in umfpack cholmod amd camd colamd spqr; do 53 ln -s libsuitesparse.${SHLIB_EXT} "$out"/lib/lib$i.${SHLIB_EXT} 54 done 55 56 # Install documentation 57 outdoc=$out/share/doc/${name} 58 mkdir -p $outdoc 59 cp -r AMD/Doc $outdoc/amd 60 cp -r BTF/Doc $outdoc/bft 61 cp -r CAMD/Doc $outdoc/camd 62 cp -r CCOLAMD/Doc $outdoc/ccolamd 63 cp -r CHOLMOD/Doc $outdoc/cholmod 64 cp -r COLAMD/Doc $outdoc/colamd 65 cp -r CXSparse/Doc $outdoc/cxsparse 66 cp -r KLU/Doc $outdoc/klu 67 cp -r LDL/Doc $outdoc/ldl 68 cp -r RBio/Doc $outdoc/rbio 69 cp -r SPQR/Doc $outdoc/spqr 70 cp -r UMFPACK/Doc $outdoc/umfpack 71 ''; 72 73 nativeBuildInputs = [ gfortran ]; 74 buildInputs = [ openblas ]; 75 76 meta = with stdenv.lib; { 77 homepage = http://faculty.cse.tamu.edu/davis/suitesparse.html; 78 description = "A suite of sparse matrix algorithms"; 79 license = with licenses; [ bsd2 gpl2Plus lgpl21Plus ]; 80 maintainers = with maintainers; [ ttuegel ]; 81 platforms = with platforms; unix; 82 }; 83}