@@ -1,28 +1,58 @@
1−{ cmake, fetchurl, python, stdenv }:
1+{ stdenv
2+, cmake
3+, fetchurl
4+, python
5+, liblapack
6+, gfortran
7+, lapackSupport ? true }:
28
3−stdenv.mkDerivation rec {
9+let liblapackShared = liblapack.override {
10+ shared = true;
11+};
412
13+in stdenv.mkDerivation rec {
514 pname = "sundials";
615 version = "4.1.0";
716
17+ buildInputs = [ python ] ++ stdenv.lib.optionals (lapackSupport) [ gfortran ];
18+ nativeBuildInputs = [ cmake ];
19+
820 src = fetchurl {
921 url = "https://computation.llnl.gov/projects/${pname}/download/${pname}-${version}.tar.gz";
1022 sha256 = "19ca4nmlf6i9ijqcibyvpprxzsdfnackgjs6dw51fq13gg1f2398";
1123 };
1224
13− preConfigure = ''
14− export cmakeFlags="-DCMAKE_INSTALL_PREFIX=$out -DEXAMPLES_INSTALL_PATH=$out/share/examples $cmakeFlags"
15− '';
25+ patches = [
26+ (fetchurl {
27+ # https://github.com/LLNL/sundials/pull/19
28+ url = "https://github.com/LLNL/sundials/commit/1350421eab6c5ab479de5eccf6af2dcad1eddf30.patch";
29+ sha256 = "0g67lixp9m85fqpb9rzz1hl1z8ibdg0ldwq5z6flj5zl8a7cw52l";
30+ })
31+ (fetchurl {
32+ # https://github.com/LLNL/sundials/pull/20
33+ url = "https://github.com/LLNL/sundials/pull/20/commits/2d951bbe1ff7842fcd0dafa28c61b0aa94015f66.patch";
34+ sha256 = "0lcr6m4lk14yqrxah4rdscpczny5l7m1zpfsjh8bgspadfsgk512";
35+ })
36+ # https://github.com/LLNL/sundials/pull/21
37+ ./tests-parallel.patch
38+ ];
1639
17− nativeBuildInputs = [ cmake ];
18− buildInputs = [ python ];
40+ cmakeFlags = [
41+ "-DEXAMPLES_INSTALL_PATH=${placeholder "out"}/share/examples"
42+ ] ++ stdenv.lib.optionals (lapackSupport) [
43+ "-DSUNDIALS_INDEX_TYPE=int32_t"
44+ "-DLAPACK_ENABLE=ON"
45+ "-DLAPACK_LIBRARIES=${liblapackShared}/lib/liblapack${stdenv.hostPlatform.extensions.sharedLibrary};${liblapackShared}/lib/libblas${stdenv.hostPlatform.extensions.sharedLibrary}"
46+ ];
47+
48+ doCheck = true;
49+ checkPhase = "make test";
1950
2051 meta = with stdenv.lib; {
2152 description = "Suite of nonlinear differential/algebraic equation solvers";
2253 homepage = https://computation.llnl.gov/projects/sundials;
2354 platforms = platforms.all;
24− maintainers = [ maintainers.idontgetoutmuch ];
55+ maintainers = with maintainers; [ flokli idontgetoutmuch ];
2556 license = licenses.bsd3;
2657 };
27−
2858}