Skip to content

Commit 2d8560b

Browse files
authored
superlu_dist: add support for darwin platform (NixOS#390328)
2 parents 620dfa7 + 1ff0d16 commit 2d8560b

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

pkgs/by-name/su/superlu_dist/package.nix

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
lib,
33
stdenv,
44
fetchFromGitHub,
5+
fetchurl,
6+
llvmPackages,
57
cmake,
68
gfortran,
79
blas,
@@ -10,7 +12,9 @@
1012
mpiCheckPhaseHook,
1113
metis,
1214
parmetis,
13-
15+
withExamples ? false,
16+
fortranSupport ? stdenv.hostPlatform.isLinux,
17+
enableOpenMP ? true,
1418
# Todo: ask for permission of unfree parmetis
1519
withParmetis ? false,
1620
}:
@@ -34,20 +38,31 @@ stdenv.mkDerivation (finalAttrs: {
3438

3539
patches = [
3640
./mc64ad_dist-stub.patch
41+
(fetchurl {
42+
url = "https://github.com/xiaoyeli/superlu_dist/commit/8ef3f7fda091529d7e7f16087864fee66c4834c9.patch";
43+
hash = "sha256-kCSqojYKpk75m+FwhS0hXHSybm+GZzOYikePcf2U3Fw=";
44+
})
3745
];
3846

3947
postPatch = ''
4048
substituteInPlace SRC/prec-independent/util.c \
4149
--replace-fail "LargeDiag_MC64" "NOROWPERM"
4250
'';
4351

44-
nativeBuildInputs = [
45-
cmake
46-
gfortran
47-
];
52+
nativeBuildInputs =
53+
[
54+
cmake
55+
]
56+
++ lib.optionals fortranSupport [
57+
gfortran
58+
];
4859

4960
buildInputs =
50-
[
61+
lib.optionals (enableOpenMP && stdenv.cc.isClang) [
62+
# cmake can not find mpi if openmp is placed after mpi
63+
llvmPackages.openmp
64+
]
65+
++ [
5166
mpi
5267
lapack
5368
]
@@ -60,9 +75,11 @@ stdenv.mkDerivation (finalAttrs: {
6075

6176
cmakeFlags =
6277
[
78+
(lib.cmakeBool "enable_examples" withExamples)
79+
(lib.cmakeBool "enable_openmp" enableOpenMP)
6380
(lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
64-
(lib.cmakeBool "enable_fortran" true)
65-
(lib.cmakeBool "enable_complex16" true)
81+
(lib.cmakeBool "BUILD_STATIC_LIBS" stdenv.hostPlatform.isStatic)
82+
(lib.cmakeBool "XSDK_ENABLE_Fortran" fortranSupport)
6683
(lib.cmakeBool "TPL_ENABLE_INTERNAL_BLASLIB" false)
6784
(lib.cmakeBool "TPL_ENABLE_LAPACKLIB" true)
6885
(lib.cmakeBool "TPL_ENABLE_PARMETISLIB" withParmetis)
@@ -96,7 +113,7 @@ stdenv.mkDerivation (finalAttrs: {
96113
asl20
97114
];
98115
description = "Library for the solution of large, sparse, nonsymmetric systems of linear equations";
99-
platforms = lib.platforms.linux;
116+
platforms = lib.platforms.unix;
100117
maintainers = with lib.maintainers; [ qbisi ];
101118
};
102119
})

0 commit comments

Comments
 (0)