at 24.11-pre 74 lines 2.0 kB view raw
1{ lib, stdenv 2, cmake 3, fetchurl 4, python 5, blas 6, lapack 7, gfortran 8, suitesparse 9, lapackSupport ? true 10, kluSupport ? true 11}: 12 13stdenv.mkDerivation rec { 14 pname = "sundials"; 15 version = "6.7.0"; 16 17 outputs = [ "out" "examples" ]; 18 19 src = fetchurl { 20 url = "https://github.com/LLNL/sundials/releases/download/v${version}/sundials-${version}.tar.gz"; 21 hash = "sha256-XxE6FWSp0tmP+VJJ9IcaTIFaBdu5uIZqgrE6sVjDets="; 22 }; 23 24 nativeBuildInputs = [ 25 cmake 26 gfortran 27 ]; 28 29 buildInputs = [ 30 python 31 ] 32 ++ lib.optionals (lapackSupport) 33 # Check that the same index size is used for both libraries 34 (assert (blas.isILP64 == lapack.isILP64); [ 35 blas 36 lapack 37 ]) 38 # KLU support is based on Suitesparse. It is tested upstream according to the 39 # section 1.1.4.2 of INSTALL_GUIDE.pdf found in the source tarball. 40 ++ lib.optionals (kluSupport) [ 41 suitesparse 42 ]; 43 44 cmakeFlags = [ 45 "-DEXAMPLES_INSTALL_PATH=${placeholder "examples"}/share/examples" 46 ] ++ lib.optionals (lapackSupport) [ 47 "-DENABLE_LAPACK=ON" 48 "-DLAPACK_LIBRARIES=${lapack}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}" 49 ] ++ lib.optionals (kluSupport) [ 50 "-DENABLE_KLU=ON" 51 "-DKLU_INCLUDE_DIR=${suitesparse.dev}/include" 52 "-DKLU_LIBRARY_DIR=${suitesparse}/lib" 53 ] ++ [( 54 # Use the correct index type according to lapack and blas used. They are 55 # already supposed to be compatible but we check both for extra safety. 64 56 # should be the default but we prefer to be explicit, for extra safety. 57 if blas.isILP64 then 58 "-DSUNDIALS_INDEX_SIZE=64" 59 else 60 "-DSUNDIALS_INDEX_SIZE=32" 61 )] 62 ; 63 64 doCheck = true; 65 checkTarget = "test"; 66 67 meta = with lib; { 68 description = "Suite of nonlinear differential/algebraic equation solvers"; 69 homepage = "https://computing.llnl.gov/projects/sundials"; 70 platforms = platforms.all; 71 maintainers = with maintainers; [ idontgetoutmuch ]; 72 license = licenses.bsd3; 73 }; 74}