hdf5: consistently use *Support arguments

This commit is contained in:
Doron Behar 2021-09-26 16:33:31 +03:00 committed by Shamrock Lee
parent 499eb1b56a
commit 72a4341129
3 changed files with 39 additions and 28 deletions

View File

@ -1,7 +1,9 @@
{ lib, stdenv { lib
, stdenv
, fetchurl , fetchurl
, removeReferencesTo , removeReferencesTo
, zlib ? null , zlibSupport ? true
, zlib
, enableShared ? !stdenv.hostPlatform.isStatic , enableShared ? !stdenv.hostPlatform.isStatic
, javaSupport ? false , javaSupport ? false
, jdk , jdk
@ -24,10 +26,9 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ removeReferencesTo ]; nativeBuildInputs = [ removeReferencesTo ];
propagatedBuildInputs = optional (zlib != null) zlib; propagatedBuildInputs = optional zlibSupport zlib;
configureFlags = [] configureFlags = optional enableShared "--enable-shared"
++ optional enableShared "--enable-shared"
++ optional javaSupport "--enable-java"; ++ optional javaSupport "--enable-java";
patches = [ patches = [

View File

@ -1,10 +1,14 @@
{ lib, stdenv { lib
, stdenv
, fetchurl , fetchurl
, removeReferencesTo , removeReferencesTo
, cpp ? false , cppSupport ? false
, gfortran ? null , fortranSupport ? false
, zlib ? null , fortran
, szip ? null , zlibSupport ? true
, zlib
, szipSupport ? false
, szip
, mpiSupport ? false , mpiSupport ? false
, mpi , mpi
, enableShared ? !stdenv.hostPlatform.isStatic , enableShared ? !stdenv.hostPlatform.isStatic
@ -15,7 +19,7 @@
# cpp and mpi options are mutually exclusive # cpp and mpi options are mutually exclusive
# (--enable-unsupported could be used to force the build) # (--enable-unsupported could be used to force the build)
assert !cpp || !mpiSupport; assert !cppSupport || !mpiSupport;
let inherit (lib) optional optionals; in let inherit (lib) optional optionals; in
@ -28,28 +32,35 @@ stdenv.mkDerivation rec {
}; };
passthru = { passthru = {
inherit mpiSupport; inherit
inherit mpi; cppSupport
fortranSupport
fortran
zlibSupport
zlib
szipSupport
szip
mpiSupport
mpi
;
}; };
outputs = [ "out" "dev" ]; outputs = [ "out" "dev" ];
nativeBuildInputs = [ removeReferencesTo ] nativeBuildInputs = [ removeReferencesTo ]
++ optional (gfortran != null) gfortran; ++ optional fortranSupport fortran;
buildInputs = [] buildInputs = optional fortranSupport fortran
++ optional (szip != null) szip ++ optional szipSupport szip
++ optional javaSupport jdk; ++ optional javaSupport jdk;
propagatedBuildInputs = [] propagatedBuildInputs = optional zlibSupport zlib
++ optional (zlib != null) zlib
++ optional mpiSupport mpi; ++ optional mpiSupport mpi;
configureFlags = [] configureFlags = optional cppSupport "--enable-cxx"
++ optional cpp "--enable-cxx" ++ optional fortranSupport "--enable-fortran"
++ optional (gfortran != null) "--enable-fortran" ++ optional szipSupport "--with-szlib=${szip}"
++ optional (szip != null) "--with-szlib=${szip}" ++ optionals mpiSupport [ "--enable-parallel" "CC=${mpi}/bin/mpicc" ]
++ optionals mpiSupport ["--enable-parallel" "CC=${mpi}/bin/mpicc"]
++ optional enableShared "--enable-shared" ++ optional enableShared "--enable-shared"
++ optional javaSupport "--enable-java" ++ optional javaSupport "--enable-java"
++ optional usev110Api "--with-default-api-version=v110"; ++ optional usev110Api "--with-default-api-version=v110";

View File

@ -5972,23 +5972,22 @@ with pkgs;
hdf4 = callPackage ../tools/misc/hdf4 { }; hdf4 = callPackage ../tools/misc/hdf4 { };
hdf5 = callPackage ../tools/misc/hdf5 { hdf5 = callPackage ../tools/misc/hdf5 {
gfortran = null; fortranSupport = false;
szip = null; fortran = gfortran;
}; };
hdf5_1_10 = callPackage ../tools/misc/hdf5/1.10.nix { }; hdf5_1_10 = callPackage ../tools/misc/hdf5/1.10.nix { };
hdf5-mpi = appendToName "mpi" (hdf5.override { hdf5-mpi = appendToName "mpi" (hdf5.override {
szip = null;
mpiSupport = true; mpiSupport = true;
}); });
hdf5-cpp = appendToName "cpp" (hdf5.override { hdf5-cpp = appendToName "cpp" (hdf5.override {
cpp = true; cppSupport = true;
}); });
hdf5-fortran = appendToName "fortran" (hdf5.override { hdf5-fortran = appendToName "fortran" (hdf5.override {
inherit gfortran; fortranSupport = true;
}); });
hdf5-threadsafe = appendToName "threadsafe" (hdf5.overrideAttrs (oldAttrs: { hdf5-threadsafe = appendToName "threadsafe" (hdf5.overrideAttrs (oldAttrs: {