diff --git a/pkgs/tools/misc/hdf5/1.10.nix b/pkgs/tools/misc/hdf5/1.10.nix index 4e57a1c8e48a..74d8fce599a8 100644 --- a/pkgs/tools/misc/hdf5/1.10.nix +++ b/pkgs/tools/misc/hdf5/1.10.nix @@ -1,7 +1,9 @@ -{ lib, stdenv +{ lib +, stdenv , fetchurl , removeReferencesTo -, zlib ? null +, zlibSupport ? true +, zlib , enableShared ? !stdenv.hostPlatform.isStatic , javaSupport ? false , jdk @@ -24,10 +26,9 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ removeReferencesTo ]; - propagatedBuildInputs = optional (zlib != null) zlib; + propagatedBuildInputs = optional zlibSupport zlib; - configureFlags = [] - ++ optional enableShared "--enable-shared" + configureFlags = optional enableShared "--enable-shared" ++ optional javaSupport "--enable-java"; patches = [ diff --git a/pkgs/tools/misc/hdf5/default.nix b/pkgs/tools/misc/hdf5/default.nix index c5485a5b3fb1..43c156de419e 100644 --- a/pkgs/tools/misc/hdf5/default.nix +++ b/pkgs/tools/misc/hdf5/default.nix @@ -1,10 +1,14 @@ -{ lib, stdenv +{ lib +, stdenv , fetchurl , removeReferencesTo -, cpp ? false -, gfortran ? null -, zlib ? null -, szip ? null +, cppSupport ? false +, fortranSupport ? false +, fortran +, zlibSupport ? true +, zlib +, szipSupport ? false +, szip , mpiSupport ? false , mpi , enableShared ? !stdenv.hostPlatform.isStatic @@ -15,7 +19,7 @@ # cpp and mpi options are mutually exclusive # (--enable-unsupported could be used to force the build) -assert !cpp || !mpiSupport; +assert !cppSupport || !mpiSupport; let inherit (lib) optional optionals; in @@ -28,28 +32,35 @@ stdenv.mkDerivation rec { }; passthru = { - inherit mpiSupport; - inherit mpi; + inherit + cppSupport + fortranSupport + fortran + zlibSupport + zlib + szipSupport + szip + mpiSupport + mpi + ; }; outputs = [ "out" "dev" ]; nativeBuildInputs = [ removeReferencesTo ] - ++ optional (gfortran != null) gfortran; + ++ optional fortranSupport fortran; - buildInputs = [] - ++ optional (szip != null) szip + buildInputs = optional fortranSupport fortran + ++ optional szipSupport szip ++ optional javaSupport jdk; - propagatedBuildInputs = [] - ++ optional (zlib != null) zlib + propagatedBuildInputs = optional zlibSupport zlib ++ optional mpiSupport mpi; - configureFlags = [] - ++ optional cpp "--enable-cxx" - ++ optional (gfortran != null) "--enable-fortran" - ++ optional (szip != null) "--with-szlib=${szip}" - ++ optionals mpiSupport ["--enable-parallel" "CC=${mpi}/bin/mpicc"] + configureFlags = optional cppSupport "--enable-cxx" + ++ optional fortranSupport "--enable-fortran" + ++ optional szipSupport "--with-szlib=${szip}" + ++ optionals mpiSupport [ "--enable-parallel" "CC=${mpi}/bin/mpicc" ] ++ optional enableShared "--enable-shared" ++ optional javaSupport "--enable-java" ++ optional usev110Api "--with-default-api-version=v110"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 672c80ea17c2..97b1ee0721fc 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5972,23 +5972,22 @@ with pkgs; hdf4 = callPackage ../tools/misc/hdf4 { }; hdf5 = callPackage ../tools/misc/hdf5 { - gfortran = null; - szip = null; + fortranSupport = false; + fortran = gfortran; }; hdf5_1_10 = callPackage ../tools/misc/hdf5/1.10.nix { }; hdf5-mpi = appendToName "mpi" (hdf5.override { - szip = null; mpiSupport = true; }); hdf5-cpp = appendToName "cpp" (hdf5.override { - cpp = true; + cppSupport = true; }); hdf5-fortran = appendToName "fortran" (hdf5.override { - inherit gfortran; + fortranSupport = true; }); hdf5-threadsafe = appendToName "threadsafe" (hdf5.overrideAttrs (oldAttrs: {