sundials: cleanup

This commit is contained in:
Gaetan Lepage
2025-10-17 22:08:38 +00:00
parent b49a4c98cf
commit 60c4a999ba

View File

@@ -1,18 +1,19 @@
{ {
lib, lib,
stdenv, stdenv,
fetchFromGitHub,
cmake, cmake,
fetchurl, gfortran,
python3, python3,
blas, blas,
lapack, lapack,
gfortran,
suitesparse, suitesparse,
nix-update-script,
lapackSupport ? true, lapackSupport ? true,
kluSupport ? true, kluSupport ? true,
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation (finalAttrs: {
pname = "sundials"; pname = "sundials";
version = "7.5.0"; version = "7.5.0";
@@ -21,9 +22,11 @@ stdenv.mkDerivation rec {
"examples" "examples"
]; ];
src = fetchurl { src = fetchFromGitHub {
url = "https://github.com/LLNL/sundials/releases/download/v${version}/sundials-${version}.tar.gz"; owner = "LLNL";
hash = "sha256-CJrGWVB973OLemW1dP/jqQDThWnjMj2XCevtPkRa3sw="; repo = "sundials";
tag = "v${finalAttrs.version}";
hash = "sha256-ZyUTFaMEbfNtR9oGIy0fQ+qQwb3hQ7CxTv9IevkeidE=";
}; };
nativeBuildInputs = [ nativeBuildInputs = [
@@ -51,34 +54,36 @@ stdenv.mkDerivation rec {
]; ];
cmakeFlags = [ cmakeFlags = [
"-DEXAMPLES_INSTALL_PATH=${placeholder "examples"}/share/examples" (lib.cmakeFeature "EXAMPLES_INSTALL_PATH" "${placeholder "examples"}/share/examples")
] ]
++ lib.optionals lapackSupport [ ++ lib.optionals lapackSupport [
"-DENABLE_LAPACK=ON" (lib.cmakeBool "ENABLE_LAPACK" true)
"-DLAPACK_LIBRARIES=${lapack}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}" (lib.cmakeFeature "LAPACK_LIBRARIES" "${lapack}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}")
] ]
++ lib.optionals kluSupport [ ++ lib.optionals kluSupport [
"-DENABLE_KLU=ON" (lib.cmakeBool "ENABLE_KLU" true)
"-DKLU_INCLUDE_DIR=${suitesparse.dev}/include" (lib.cmakeFeature "KLU_INCLUDE_DIR" "${lib.getDev suitesparse}/include")
"-DKLU_LIBRARY_DIR=${suitesparse}/lib" (lib.cmakeFeature "KLU_LIBRARY_DIR" "${suitesparse}/lib")
] ]
++ [ ++ [
( # Use the correct index type according to lapack and blas used. They are
# Use the correct index type according to lapack and blas used. They are # already supposed to be compatible but we check both for extra safety. 64
# already supposed to be compatible but we check both for extra safety. 64 # should be the default but we prefer to be explicit, for extra safety.
# should be the default but we prefer to be explicit, for extra safety. (lib.cmakeFeature "SUNDIALS_INDEX_SIZE" (toString (if blas.isILP64 then 64 else 32)))
if blas.isILP64 then "-DSUNDIALS_INDEX_SIZE=64" else "-DSUNDIALS_INDEX_SIZE=32"
)
]; ];
doCheck = true; doCheck = true;
checkTarget = "test"; checkTarget = "test";
meta = with lib; { passthru.updateScript = nix-update-script { };
meta = {
description = "Suite of nonlinear differential/algebraic equation solvers"; description = "Suite of nonlinear differential/algebraic equation solvers";
homepage = "https://computing.llnl.gov/projects/sundials"; homepage = "https://computing.llnl.gov/projects/sundials";
platforms = platforms.all; downloadPage = "https://github.com/LLNL/sundials";
maintainers = with maintainers; [ idontgetoutmuch ]; changelog = "https://github.com/LLNL/sundials/releases/tag/v${finalAttrs.version}";
license = licenses.bsd3; platforms = lib.platforms.all;
maintainers = with lib.maintainers; [ idontgetoutmuch ];
license = lib.licenses.bsd3;
}; };
} })