hdf5: switch to cmake build

This commit is contained in:
Phillip Seeber 2023-09-11 11:03:46 +02:00
parent 65bc8eea63
commit cbd4d659e3
2 changed files with 17 additions and 36 deletions

View File

@ -1,6 +1,7 @@
{ lib
, stdenv
, fetchurl
, cmake
, removeReferencesTo
, cppSupport ? false
, fortranSupport ? false
@ -34,10 +35,12 @@ stdenv.mkDerivation rec {
+ lib.optionalString threadsafe "-threadsafe";
src = fetchurl {
url = let
url =
let
majorMinor = lib.versions.majorMinor version;
majorMinorPatch = with lib.versions; "${major version}.${minor version}.${patch version}";
in "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${majorMinor}/hdf5-${majorMinorPatch}/src/hdf5-${version}.tar.bz2";
in
"https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-${majorMinor}/hdf5-${majorMinorPatch}/src/hdf5-${version}.tar.bz2";
sha256 = "sha256-6jxeJX7zIq9ed/weUurTrWvzu0rAZIDdF+45ANeiTPs=";
};
@ -57,7 +60,7 @@ stdenv.mkDerivation rec {
outputs = [ "out" "dev" ];
nativeBuildInputs = [ removeReferencesTo ]
nativeBuildInputs = [ removeReferencesTo cmake ]
++ optional fortranSupport fortran;
buildInputs = optional fortranSupport fortran
@ -67,24 +70,17 @@ stdenv.mkDerivation rec {
propagatedBuildInputs = optional zlibSupport zlib
++ optional mpiSupport mpi;
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"
# hdf5 hl (High Level) library is not considered stable with thread safety and should be disabled.
++ optionals threadsafe [ "--enable-threadsafe" "--disable-hl" ];
patches = [
# Avoid non-determinism in autoconf build system:
# - build time
# - build user
# - uname -a (kernel version)
# Can be dropped once/if we switch to cmake.
./hdf5-more-determinism.patch
];
cmakeFlags = [
"-DHDF5_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake"
] ++ 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" ]
;
postInstall = ''
find "$out" -type f -exec remove-references-to -t ${stdenv.cc} '{}' +

View File

@ -1,15 +0,0 @@
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index a4d4af6..70f1909 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -4,10 +4,7 @@
General Information:
-------------------
HDF5 Version: @H5_VERSION@
- Configured on: @CONFIG_DATE@
- Configured by: @CONFIG_USER@
Host system: @host_cpu@-@host_vendor@-@host_os@
- Uname information: @UNAME_INFO@
Byte sex: @BYTESEX@
Installation point: @prefix@