about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/sundials
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-01-26 18:06:19 +0000
committerAlyssa Ross <hi@alyssa.is>2021-01-26 18:21:18 +0000
commit7ac6743433dd45ceaead2ca96f6356dc0d064ce6 (patch)
treeb68ec89d7d2a8d2b6e6b1ff94ba26d6af4096350 /nixpkgs/pkgs/development/libraries/sundials
parentc5c7451dbef37b51f52792d6395a670ef5183d27 (diff)
parent891f607d5301d6730cb1f9dcf3618bcb1ab7f10e (diff)
downloadnixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar
nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.gz
nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.bz2
nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.lz
nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.xz
nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.tar.zst
nixlib-7ac6743433dd45ceaead2ca96f6356dc0d064ce6.zip
Merge commit '891f607d5301d6730cb1f9dcf3618bcb1ab7f10e'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/sundials')
-rw-r--r--nixpkgs/pkgs/development/libraries/sundials/default.nix69
1 files changed, 38 insertions, 31 deletions
diff --git a/nixpkgs/pkgs/development/libraries/sundials/default.nix b/nixpkgs/pkgs/development/libraries/sundials/default.nix
index 2e1fd527e9a7..f8db8f3c379a 100644
--- a/nixpkgs/pkgs/development/libraries/sundials/default.nix
+++ b/nixpkgs/pkgs/development/libraries/sundials/default.nix
@@ -1,6 +1,7 @@
-{ stdenv
+{ lib, stdenv
 , cmake
 , fetchurl
+, fetchpatch
 , python
 , blas
 , lapack
@@ -12,12 +13,30 @@
 
 stdenv.mkDerivation rec {
   pname = "sundials";
-  version = "5.3.0";
+  version = "5.6.1";
+
+  outputs = [ "out" "examples" ];
+
+  src = fetchurl {
+    url = "https://computation.llnl.gov/projects/${pname}/download/${pname}-${version}.tar.gz";
+    sha256 = "Frd5mex+fyFXqh0Eyh3kojccqBUOBW0klR0MWJZvKoM=";
+  };
+
+  patches = [
+    # Fixing an upstream regression in treating cmake prefix directories:
+    # https://github.com/LLNL/sundials/pull/58
+    (fetchpatch {
+      url = "https://github.com/LLNL/sundials/commit/dd32ff9baa05618f36e44aadb420bbae4236ea1e.patch";
+      sha256 = "kToAuma+2iHFyL1v/l29F3+nug4AdK5cPG6IcXv2afc=";
+    })
+  ];
+
+  nativeBuildInputs = [ cmake ];
 
   buildInputs = [
     python
   ]
-    ++ stdenv.lib.optionals (lapackSupport)
+    ++ lib.optionals (lapackSupport)
     # Check that the same index size is used for both libraries
     (assert (blas.isILP64 == lapack.isILP64); [
       gfortran
@@ -27,46 +46,34 @@ stdenv.mkDerivation rec {
   # KLU support is based on Suitesparse.
   # It is tested upstream according to the section 1.1.4 of
   # [INSTALL_GUIDE.pdf](https://raw.githubusercontent.com/LLNL/sundials/master/INSTALL_GUIDE.pdf)
-  ++ stdenv.lib.optionals (kluSupport) [
+  ++ lib.optionals (kluSupport) [
     suitesparse
   ];
 
-  nativeBuildInputs = [ cmake ];
-
-  src = fetchurl {
-    url = "https://computation.llnl.gov/projects/${pname}/download/${pname}-${version}.tar.gz";
-    sha256 = "19xwi7pz35s2nqgldm6r0jl2k0bs36zhbpnmmzc56s1n3bhzgpw8";
-  };
-
-  patches = [
-    (fetchurl {
-      # https://github.com/LLNL/sundials/pull/19
-      url = "https://github.com/LLNL/sundials/commit/1350421eab6c5ab479de5eccf6af2dcad1eddf30.patch";
-      sha256 = "0g67lixp9m85fqpb9rzz1hl1z8ibdg0ldwq5z6flj5zl8a7cw52l";
-    })
-  ];
-
   cmakeFlags = [
-    "-DEXAMPLES_INSTALL_PATH=${placeholder "out"}/share/examples"
-  ] ++ stdenv.lib.optionals (lapackSupport) [
-    "-DLAPACK_ENABLE=ON"
+    "-DEXAMPLES_INSTALL_PATH=${placeholder "examples"}/share/examples"
+  ] ++ lib.optionals (lapackSupport) [
+    "-DENABLE_LAPACK=ON"
     "-DLAPACK_LIBRARIES=${lapack}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary}"
-  ] ++ stdenv.lib.optionals (kluSupport) [
-    "-DKLU_ENABLE=ON"
+  ] ++ lib.optionals (kluSupport) [
+    "-DENABLE_KLU=ON"
     "-DKLU_INCLUDE_DIR=${suitesparse.dev}/include"
     "-DKLU_LIBRARY_DIR=${suitesparse}/lib"
-  ] ++ stdenv.lib.optionals (lapackSupport && !lapack.isILP64) [
-    # Use the correct index type according to lapack which is supposed to be
-    # the same index type compatible with blas, thanks to the assertion of
-    # buildInputs
-    "-DSUNDIALS_INDEX_TYPE=int32_t"
-  ]
+  ] ++ [(
+    # 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
+    # should be the default but we prefer to be explicit, for extra safety.
+    if blas.isILP64 then
+      "-DSUNDIALS_INDEX_SIZE=64"
+    else
+      "-DSUNDIALS_INDEX_SIZE=32"
+  )]
   ;
 
   doCheck = true;
   checkTarget = "test";
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Suite of nonlinear differential/algebraic equation solvers";
     homepage    = "https://computation.llnl.gov/projects/sundials";
     platforms   = platforms.all;