hdf5: enable szip with libaec (#509836)

This commit is contained in:
Doron Behar
2026-04-24 10:11:40 +00:00
committed by GitHub
3 changed files with 38 additions and 40 deletions
@@ -41,13 +41,14 @@
# Unfree optional dependency for hdf4 and hdf5 # Unfree optional dependency for hdf4 and hdf5
enableSzip ? false, enableSzip ? false,
szip, szip,
libaec,
enableHDF4 ? true, enableHDF4 ? true,
hdf4, hdf4,
hdf4-forced ? null, hdf4-forced ? null,
enableHDF5 ? true, enableHDF5 ? true,
# HDF5 format version (API version) 1.10 and 1.12 is not fully compatible # HDF5 format version (API version) 1.10 and 1.12 is not fully compatible
# Specify if the API version should default to 1.10 # Specify if the API version should default to 1.10
# netcdf currently depends on hdf5 with `usev110Api=true` # netcdf currently depends on hdf5 with `apiVersion = "v110"`
# If you wish to use HDF5 API version 1.12 (`useHdf5v110Api=false`), # If you wish to use HDF5 API version 1.12 (`useHdf5v110Api=false`),
# you will need to turn NetCDF off. # you will need to turn NetCDF off.
useHdf5v110Api ? true, useHdf5v110Api ? true,
@@ -81,15 +82,17 @@ let
else else
hdf5.override ( hdf5.override (
{ {
usev110Api = useHdf5v110Api;
mpiSupport = enableMPI; mpiSupport = enableMPI;
inherit mpi; inherit mpi;
szipSupport = enableSzip; szipSupport = enableSzip;
inherit szip; inherit libaec;
} }
// lib.optionalAttrs enableMPI { // lib.optionalAttrs enableMPI {
cppSupport = false; cppSupport = false;
} }
// lib.optionalAttrs useHdf5v110Api {
apiVersion = "v110";
}
); );
netcdf-custom = netcdf-custom =
if netcdf-forced != null then if netcdf-forced != null then
+29 -34
View File
@@ -10,15 +10,15 @@
fortran, fortran,
zlibSupport ? true, zlibSupport ? true,
zlib, zlib,
szipSupport ? false, szipSupport ? true,
szip, libaec,
mpiSupport ? false, mpiSupport ? false,
mpi, mpi,
enableShared ? !stdenv.hostPlatform.isStatic, enableShared ? !stdenv.hostPlatform.isStatic,
enableStatic ? stdenv.hostPlatform.isStatic, enableStatic ? stdenv.hostPlatform.isStatic,
javaSupport ? false, javaSupport ? false,
jdk, jdk,
usev110Api ? false, apiVersion ? null,
threadsafe ? false, threadsafe ? false,
python3, python3,
}: }:
@@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
zlibSupport zlibSupport
zlib zlib
szipSupport szipSupport
szip libaec
mpiSupport mpiSupport
mpi mpi
; ;
@@ -82,31 +82,28 @@ stdenv.mkDerivation rec {
++ optional fortranSupport fortran; ++ optional fortranSupport fortran;
buildInputs = buildInputs =
optional fortranSupport fortran ++ optional szipSupport szip ++ optional javaSupport jdk; optional fortranSupport fortran ++ optional szipSupport libaec ++ optional javaSupport jdk;
propagatedBuildInputs = optional zlibSupport zlib ++ optional mpiSupport mpi; propagatedBuildInputs = optional zlibSupport zlib ++ optional mpiSupport mpi;
cmakeFlags = [ cmakeFlags = [
"-DHDF5_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake" "-DHDF5_INSTALL_CMAKE_DIR=${placeholder "dev"}/lib/cmake"
"-DBUILD_STATIC_LIBS=${lib.boolToString enableStatic}" (lib.cmakeBool "BUILD_STATIC_LIBS" enableStatic)
(lib.cmakeBool "BUILD_SHARED_LIBS" enableShared)
(lib.cmakeBool "HDF5_BUILD_CPP_LIB" cppSupport)
(lib.cmakeBool "HDF5_BUILD_FORTRAN" fortranSupport)
(lib.cmakeBool "HDF5_ENABLE_SZIP_SUPPORT" szipSupport)
(lib.cmakeBool "HDF5_ENABLE_PARALLEL" mpiSupport)
(lib.cmakeBool "HDF5_BUILD_JAVA" javaSupport)
(lib.cmakeBool "HDF5_ENABLE_THREADSAFE" threadsafe)
(lib.cmakeBool "HDF5_BUILD_HL_LIB" (!threadsafe))
# broken in nixpkgs since around 1.14.3 -> 1.14.4.3
# https://github.com/HDFGroup/hdf5/issues/4208#issuecomment-2098698567
(lib.cmakeBool "HDF5_ENABLE_NONSTANDARD_FEATURE_FLOAT16" (
with stdenv.hostPlatform; !(isDarwin && isx86_64)
))
] ]
++ lib.optional stdenv.hostPlatform.isDarwin "-DHDF5_BUILD_WITH_INSTALL_NAME=ON" ++ lib.optional (apiVersion != null) (lib.cmakeFeature "HDF5_DEFAULT_API_VERSION" apiVersion);
++ 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" ]
++ lib.optional enableShared "-DBUILD_SHARED_LIBS=ON"
++ lib.optional javaSupport "-DHDF5_BUILD_JAVA=ON"
++ lib.optional usev110Api "-DDEFAULT_API_VERSION=v110"
++ lib.optionals threadsafe [
"-DHDF5_ENABLE_THREADSAFE:BOOL=ON"
"-DHDF5_BUILD_HL_LIB=OFF"
]
# broken in nixpkgs since around 1.14.3 -> 1.14.4.3
# https://github.com/HDFGroup/hdf5/issues/4208#issuecomment-2098698567
++ lib.optional (
stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64
) "-DHDF5_ENABLE_NONSTANDARD_FEATURE_FLOAT16=OFF";
postInstall = '' postInstall = ''
find "$out" -type f -exec remove-references-to -t ${stdenv.cc} '{}' + find "$out" -type f -exec remove-references-to -t ${stdenv.cc} '{}' +
@@ -118,17 +115,15 @@ stdenv.mkDerivation rec {
moveToOutput 'bin/h5hlcc' "''${!outputDev}" moveToOutput 'bin/h5hlcc' "''${!outputDev}"
moveToOutput 'bin/h5hlc++' "''${!outputDev}" moveToOutput 'bin/h5hlc++' "''${!outputDev}"
'' ''
+ # The shared build creates binaries with -shared suffixes,
lib.optionalString enableShared # so we remove these suffixes.
# The shared build creates binaries with -shared suffixes, + lib.optionalString enableShared ''
# so we remove these suffixes. pushd ''${!outputBin}/bin
'' for file in *-shared; do
pushd ''${!outputBin}/bin mv "$file" "''${file%%-shared}"
for file in *-shared; do done
mv "$file" "''${file%%-shared}" popd
done ''
popd
''
+ lib.optionalString fortranSupport '' + lib.optionalString fortranSupport ''
mv $out/mod/shared $dev/include mv $out/mod/shared $dev/include
rm -r $out/mod rm -r $out/mod
+3 -3
View File
@@ -2721,7 +2721,7 @@ with pkgs;
}; };
medfile = callPackage ../development/libraries/medfile { medfile = callPackage ../development/libraries/medfile {
hdf5 = hdf5.override { usev110Api = true; }; hdf5 = hdf5.override { apiVersion = "v110"; };
}; };
mhonarc = perlPackages.MHonArc; mhonarc = perlPackages.MHonArc;
@@ -2923,7 +2923,7 @@ with pkgs;
maple-mono = recurseIntoAttrs (callPackage ../data/fonts/maple-font { }); maple-mono = recurseIntoAttrs (callPackage ../data/fonts/maple-font { });
netcdf-mpi = netcdf.override { netcdf-mpi = netcdf.override {
hdf5 = hdf5-mpi.override { usev110Api = true; }; hdf5 = hdf5-mpi.override { apiVersion = "v110"; };
}; };
ioskeley-mono = recurseIntoAttrs (callPackage ../data/fonts/ioskeley-mono { }); ioskeley-mono = recurseIntoAttrs (callPackage ../data/fonts/ioskeley-mono { });
@@ -7461,7 +7461,7 @@ with pkgs;
}; };
vigra = callPackage ../development/libraries/vigra { vigra = callPackage ../development/libraries/vigra {
hdf5 = hdf5.override { usev110Api = true; }; hdf5 = hdf5.override { apiVersion = "v110"; };
}; };
vte-gtk4 = vte.override { vte-gtk4 = vte.override {