p4est-sc: refactor mpi and pthread support

On aarch64, the tests won't run with MPI, hence disabling MPI there.
Add -pthread to CFLAGS unconditionally via --enable-pthread.
Check for "openmpi" pname and not package equality with mpi.
This commit is contained in:
Carsten Burstedde 2021-07-01 10:59:23 +02:00
parent 8cfb74be5b
commit 6c00893063
No known key found for this signature in database
GPG Key ID: 94563D7C039E3390

View File

@ -1,13 +1,14 @@
{ lib, stdenv, fetchFromGitHub
, autoreconfHook, pkg-config
, p4est-sc-debugEnable ? true, p4est-sc-mpiSupport ? true
, mpi, openmpi, openssh, zlib
, mpi, openssh, zlib
}:
let
dbg = if debugEnable then "-dbg" else "";
debugEnable = p4est-sc-debugEnable;
mpiSupport = p4est-sc-mpiSupport;
isOpenmpi = mpiSupport && mpi.pname == "openmpi";
in
stdenv.mkDerivation {
pname = "p4est-sc${dbg}";
@ -24,7 +25,7 @@ stdenv.mkDerivation {
nativeBuildInputs = [ autoreconfHook pkg-config ];
propagatedBuildInputs = [ zlib ]
++ lib.optional mpiSupport mpi
++ lib.optional (mpiSupport && mpi == openmpi) openssh
++ lib.optional isOpenmpi openssh
;
inherit debugEnable mpiSupport;
@ -36,15 +37,17 @@ stdenv.mkDerivation {
${if mpiSupport then "unset CC" else ""}
'';
configureFlags = lib.optional debugEnable "--enable-debug"
configureFlags = [ "--enable-pthread=-pthread" ]
++ lib.optional debugEnable "--enable-debug"
++ lib.optional mpiSupport "--enable-mpi"
;
makeFlags = [ "V=0" ];
checkFlags = lib.optional isOpenmpi "-j1";
dontDisableStatic = true;
enableParallelBuilding = true;
doCheck = stdenv.hostPlatform == stdenv.buildPlatform;
doCheck = !stdenv.isAarch64 && stdenv.hostPlatform == stdenv.buildPlatform;
meta = {
branch = "prev3-develop";