nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 89 lines 2.4 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cmake, 6 gfortran, 7 python3, 8 blas, 9 lapack, 10 suitesparse, 11 nix-update-script, 12 lapackSupport ? true, 13 kluSupport ? true, 14}: 15 16stdenv.mkDerivation (finalAttrs: { 17 pname = "sundials"; 18 version = "7.5.0"; 19 20 outputs = [ 21 "out" 22 "examples" 23 ]; 24 25 src = fetchFromGitHub { 26 owner = "LLNL"; 27 repo = "sundials"; 28 tag = "v${finalAttrs.version}"; 29 hash = "sha256-ZyUTFaMEbfNtR9oGIy0fQ+qQwb3hQ7CxTv9IevkeidE="; 30 }; 31 32 nativeBuildInputs = [ 33 cmake 34 gfortran 35 ]; 36 37 buildInputs = [ 38 python3 39 ] 40 ++ 41 lib.optionals lapackSupport 42 # Check that the same index size is used for both libraries 43 ( 44 assert (blas.isILP64 == lapack.isILP64); 45 [ 46 blas 47 lapack 48 ] 49 ) 50 # KLU support is based on Suitesparse. It is tested upstream according to the 51 # section 1.1.4.2 of INSTALL_GUIDE.pdf found in the source tarball. 52 ++ lib.optionals kluSupport [ 53 suitesparse 54 ]; 55 56 cmakeFlags = [ 57 (lib.cmakeFeature "EXAMPLES_INSTALL_PATH" "${placeholder "examples"}/share/examples") 58 ] 59 ++ lib.optionals lapackSupport [ 60 (lib.cmakeBool "ENABLE_LAPACK" true) 61 (lib.cmakeFeature "LAPACK_LIBRARIES" "${lapack}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}") 62 ] 63 ++ lib.optionals kluSupport [ 64 (lib.cmakeBool "ENABLE_KLU" true) 65 (lib.cmakeFeature "KLU_INCLUDE_DIR" "${lib.getDev suitesparse}/include") 66 (lib.cmakeFeature "KLU_LIBRARY_DIR" "${suitesparse}/lib") 67 ] 68 ++ [ 69 # Use the correct index type according to lapack and blas used. They are 70 # already supposed to be compatible but we check both for extra safety. 64 71 # should be the default but we prefer to be explicit, for extra safety. 72 (lib.cmakeFeature "SUNDIALS_INDEX_SIZE" (toString (if blas.isILP64 then 64 else 32))) 73 ]; 74 75 doCheck = true; 76 checkTarget = "test"; 77 78 passthru.updateScript = nix-update-script { }; 79 80 meta = { 81 description = "Suite of nonlinear differential/algebraic equation solvers"; 82 homepage = "https://computing.llnl.gov/projects/sundials"; 83 downloadPage = "https://github.com/LLNL/sundials"; 84 changelog = "https://github.com/LLNL/sundials/releases/tag/v${finalAttrs.version}"; 85 platforms = lib.platforms.all; 86 maintainers = with lib.maintainers; [ idontgetoutmuch ]; 87 license = lib.licenses.bsd3; 88 }; 89})