2021-10-17 09:34:42 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchurl
|
2023-11-16 04:20:00 +00:00
|
|
|
, cmake
|
2020-04-24 23:36:52 +00:00
|
|
|
, removeReferencesTo
|
2021-10-17 09:34:42 +00:00
|
|
|
, cppSupport ? false
|
|
|
|
, fortranSupport ? false
|
|
|
|
, fortran
|
|
|
|
, zlibSupport ? true
|
|
|
|
, zlib
|
|
|
|
, szipSupport ? false
|
|
|
|
, szip
|
2021-02-05 17:12:51 +00:00
|
|
|
, mpiSupport ? false
|
|
|
|
, mpi
|
2021-01-05 17:05:55 +00:00
|
|
|
, enableShared ? !stdenv.hostPlatform.isStatic
|
2021-03-09 03:18:52 +00:00
|
|
|
, javaSupport ? false
|
|
|
|
, jdk
|
2021-04-12 18:23:04 +00:00
|
|
|
, usev110Api ? false
|
2022-03-05 16:20:37 +00:00
|
|
|
, threadsafe ? false
|
2023-03-04 12:14:45 +00:00
|
|
|
, python3
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
# cpp and mpi options are mutually exclusive
|
|
|
|
# (--enable-unsupported could be used to force the build)
|
2021-10-17 09:34:42 +00:00
|
|
|
assert !cppSupport || !mpiSupport;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
let inherit (lib) optional optionals; in
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "1.14.3";
|
2022-03-05 16:20:37 +00:00
|
|
|
pname = "hdf5"
|
|
|
|
+ lib.optionalString cppSupport "-cpp"
|
|
|
|
+ lib.optionalString fortranSupport "-fortran"
|
|
|
|
+ lib.optionalString mpiSupport "-mpi"
|
|
|
|
+ lib.optionalString threadsafe "-threadsafe";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
src = fetchurl {
|
2023-11-16 04:20:00 +00:00
|
|
|
url =
|
|
|
|
let
|
2023-07-15 17:15:38 +00:00
|
|
|
majorMinor = lib.versions.majorMinor version;
|
|
|
|
majorMinorPatch = with lib.versions; "${major version}.${minor version}.${patch version}";
|
2023-11-16 04:20:00 +00:00
|
|
|
in
|
|
|
|
"https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${majorMinor}/hdf5-${majorMinorPatch}/src/hdf5-${version}.tar.bz2";
|
|
|
|
sha256 = "sha256-lCXyJO110SgLtG1vJpI92Tj5BA5+rr9X5m7HNXwI+Rc=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
passthru = {
|
2021-10-17 09:34:42 +00:00
|
|
|
inherit
|
|
|
|
cppSupport
|
|
|
|
fortranSupport
|
|
|
|
fortran
|
|
|
|
zlibSupport
|
|
|
|
zlib
|
|
|
|
szipSupport
|
|
|
|
szip
|
|
|
|
mpiSupport
|
|
|
|
mpi
|
|
|
|
;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
nativeBuildInputs = [ removeReferencesTo cmake ]
|
2021-10-17 09:34:42 +00:00
|
|
|
++ optional fortranSupport fortran;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-17 09:34:42 +00:00
|
|
|
buildInputs = optional fortranSupport fortran
|
|
|
|
++ optional szipSupport szip
|
2021-03-09 03:18:52 +00:00
|
|
|
++ optional javaSupport jdk;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-10-17 09:34:42 +00:00
|
|
|
propagatedBuildInputs = optional zlibSupport zlib
|
2021-02-05 17:12:51 +00:00
|
|
|
++ optional mpiSupport mpi;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DHDF5_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake"
|
|
|
|
] ++ lib.optional stdenv.isDarwin "-DHDF5_BUILD_WITH_INSTALL_NAME=ON"
|
|
|
|
++ lib.optional cppSupport "-DHDF5_BUILD_CPP_LIB=ON"
|
|
|
|
++ lib.optional fortranSupport "-DHDF5_BUILD_FORTRAN=ON"
|
|
|
|
++ lib.optional szipSupport "-DHDF5_ENABLE_SZIP_SUPPORT=ON"
|
|
|
|
++ lib.optionals mpiSupport [ "-DHDF5_ENABLE_PARALLEL=ON" "CC=${mpi}/bin/mpicc" ]
|
|
|
|
++ lib.optional enableShared "-DBUILD_SHARED_LIBS=ON"
|
|
|
|
++ lib.optional javaSupport "-DHDF5_BUILD_JAVA=ON"
|
|
|
|
++ lib.optional usev110Api "-DDEFAULT_API_VERSION=v110"
|
|
|
|
++ lib.optionals threadsafe [ "-DDHDF5_ENABLE_THREADSAFE:BOOL=ON" "-DHDF5_BUILD_HL_LIB=OFF" ]
|
|
|
|
;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
find "$out" -type f -exec remove-references-to -t ${stdenv.cc} '{}' +
|
|
|
|
moveToOutput 'bin/h5cc' "''${!outputDev}"
|
|
|
|
moveToOutput 'bin/h5c++' "''${!outputDev}"
|
|
|
|
moveToOutput 'bin/h5fc' "''${!outputDev}"
|
|
|
|
moveToOutput 'bin/h5pcc' "''${!outputDev}"
|
|
|
|
'';
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
passthru.tests = {
|
|
|
|
inherit (python3.pkgs) h5py;
|
|
|
|
};
|
|
|
|
|
2023-04-29 16:46:19 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Data model, library, and file format for storing and managing data";
|
|
|
|
longDescription = ''
|
|
|
|
HDF5 supports an unlimited variety of datatypes, and is designed for flexible and efficient
|
|
|
|
I/O and for high volume and complex data. HDF5 is portable and is extensible, allowing
|
|
|
|
applications to evolve in their use of HDF5. The HDF5 Technology suite includes tools and
|
|
|
|
applications for managing, manipulating, viewing, and analyzing data in the HDF5 format.
|
|
|
|
'';
|
2023-04-29 16:46:19 +00:00
|
|
|
license = licenses.bsd3; # Lawrence Berkeley National Labs BSD 3-Clause variant
|
|
|
|
maintainers = [ maintainers.markuskowa ];
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://www.hdfgroup.org/HDF5/";
|
2023-04-29 16:46:19 +00:00
|
|
|
platforms = platforms.unix;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|