python3Packages.hdf5plugin: build ZFP filter against system zfp

H5Z-ZFP needs an 8-bit bitstream word for byte-portable data, so use a
zfp built with bitStreamWordSize=8. zfp ships only a CMake config, so
synthesise the pkg-config module hdf5plugin probes for.

Assisted-by: claude-code with claude-opus-4-8[1m]-high
This commit is contained in:
Aliaksandr
2026-06-08 00:46:14 +03:00
parent 42629f0943
commit 65a8685443
@@ -11,6 +11,7 @@
bzip2,
charls,
lz4,
zfp,
zlib,
zstd,
stdenv,
@@ -22,6 +23,8 @@
let
c-blosc' = c-blosc.override { snappySupport = true; };
# H5Z-ZFP needs an 8-bit bitstream word so the compressed HDF5 data is byte-portable
zfp' = zfp.override { bitStreamWordSize = 8; };
in
buildPythonPackage (finalAttrs: {
pname = "hdf5plugin";
@@ -49,7 +52,7 @@ buildPythonPackage (finalAttrs: {
bzip2
charls
lz4
# zfp
zfp'
zlib
zstd
];
@@ -62,7 +65,7 @@ buildPythonPackage (finalAttrs: {
"charls"
"lz4"
# "sperr" # not packaged?
# "zfp" # pkgconfig: (lib)zfp not found
"zfp"
"zlib"
"zstd"
];
@@ -86,9 +89,18 @@ buildPythonPackage (finalAttrs: {
preBuild = ''
mkdir src/hdf5plugin/plugins
mkdir -p pkg-config-bz2
ln -s ${lib.getDev bzip2}/lib/pkgconfig/bzip2.pc pkg-config-bz2/bz2.pc
export PKG_CONFIG_PATH="$PWD/pkg-config-bz2''${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
mkdir -p pkg-config
ln -s ${lib.getDev bzip2}/lib/pkgconfig/bzip2.pc pkg-config/bz2.pc
# zfp ships only a CMake config; synthesise the pkg-config module hdf5plugin probes for
{
echo "includedir=${lib.getDev zfp'}/include"
echo "Name: zfp"
echo "Version: ${zfp'.version}"
echo "Description: zfp"
echo "Libs: -L${lib.getLib zfp'}/lib -lzfp"
echo "Cflags: -I${lib.getDev zfp'}/include"
} > pkg-config/zfp.pc
export PKG_CONFIG_PATH="$PWD/pkg-config''${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}"
'';
meta = {