156.9. hdf5-2.2.0
Hierarchical Data Format library for scientific data
2.2.0-1 · BSD-3-Clause · 0.6 SBU · 13.6 MiB, 228 files · 41_system, 883 of 1047 · ports/core/sci-libs/hdf5
Homepage: https://www.hdfgroup.org/
Why it is in KDOS. The comment above it in script/phases/41_system/packages.d/sci-libs.txt:
The 1.14 line, not 2.x — netcdf, octave and the python wheels here are built against it, and a data format library is the wrong place to be first.
HDF5 is a file format and C library for large, structured scientific data: groups of typed, chunked, optionally compressed n-dimensional datasets in one file. In KDOS it is the storage layer under netcdf-c, libmed, matio and python3-h5py, and octave, gdal, qgis, freecad, gmsh, labplot and satdump read and write it. The package also carries the command-line tools, h5dump, h5ls, h5repack and the rest.
Depends on: cmake, ninja, zlib, libaec.
Required by (14): freecad, gdal, gmsh, ifcopenshell, labplot, libmed, matio, nco, netcdf-c, octave, pdal, python3-h5py, qgis, satdump.
Sources: hdf5-2.2.0.tar.gz (40.2 MiB). Every step kpkg takes applies to this port.
Install: script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install hdf5'
build.sh:
cd "$name-$version"
mkdir -p build && cd build
cmake .. -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DHDF5_INSTALL_DATA_DIR=share/hdf5 \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_STATIC_LIBS=OFF \
-DBUILD_TESTING=OFF \
-DHDF5_BUILD_CPP_LIB=ON \
-DHDF5_BUILD_FORTRAN=ON \
-DHDF5_BUILD_HL_LIB=ON \
-DHDF5_BUILD_TOOLS=ON \
-DHDF5_BUILD_EXAMPLES=OFF \
-DHDF5_ENABLE_ZLIB_SUPPORT=ON \
-DHDF5_ENABLE_SZIP_SUPPORT=ON
ninja
DESTDIR=$PKG ninja install
install -Dm644 "$SRC/$name-$version/LICENSE" "$PKG/usr/share/licenses/$name/LICENSE"
-DHDF5_INSTALL_DATA_DIR=share/hdf5— Where HDF5 installs its loose data files, itsLICENSEamong them. Upstream’s default on Linux isshare, which would put them straight into/usr/share; here they land in/usr/share/hdf5/.-DBUILD_SHARED_LIBS=ON,-DBUILD_STATIC_LIBS=OFF— Build only the shared libraries. HDF5 builds static ones as well by default.-DHDF5_BUILD_CPP_LIB=ON— Also build the C++ wrapper interface,libhdf5_cpp, which upstream leaves off.-DHDF5_BUILD_FORTRAN=ON— Also build the Fortran wrapper interface,libhdf5_fortranand its.modfiles, which upstream leaves off. Much of the code that writes HDF5 files is Fortran, and without the interface such code cannot be built here. gfortran comes with gcc.-DHDF5_BUILD_HL_LIB=ON— Build the high-level library,libhdf5_hl(images, tables, packet tables and dimension scales), on top of the core one. Upstream’s default.-DHDF5_BUILD_TOOLS=ON— Build the tool programs. Upstream’s default.-DHDF5_BUILD_EXAMPLES=OFF— Build none of the C example programs, which upstream builds by default.-DHDF5_ENABLE_ZLIB_SUPPORT=ON— Build the deflate filter against zlib, so files with gzip-compressed datasets can be read and written. Off upstream; with it on, configure fails if zlib is not found.-DHDF5_ENABLE_SZIP_SUPPORT=ON— Build the szip filter. HDF5 links libaec, whoselibszis a free replacement for the SZIP library, and fails at configure time if it is not found. Satellite and climate data files are often written with the szip filter, and a library without it cannot read those datasets.
Programs: h5c++, h5cc, h5clear, h5copy, h5debug, h5delete, h5diff, h5dump, h5fc, h5format_convert, h5import, h5jam, h5ls, h5mkgrp, h5perf_serial, h5repack, h5repart, h5stat, h5unjam, h5watch.
Libraries: libhdf5.so, libhdf5_cpp.so, libhdf5_f90cstub.so, libhdf5_fortran.so, libhdf5_hl.so, libhdf5_hl_cpp.so, libhdf5_hl_f90cstub.so, libhdf5_hl_fortran.so, libhdf5_tools.so.
Directories: /usr/include/mod, /usr/lib/cmake/hdf5, /usr/share/doc/HDF5, /usr/share/hdf5, /usr/share/licenses/hdf5.
The release tarball’s entries start with ./hdf5-<version>/. kpkg strips one component, the ., so the source lands one level down and build.sh begins with cd "$name-$version"; see Sources, and what each one becomes.
The Fortran .mod files are installed twice: in /usr/include/mod/shared, which the exported CMake targets in /usr/lib/cmake/hdf5 put on a consumer’s include path, and in /usr/include itself. The second copy comes from upstream’s HDF5_INSTALL_MOD_FORTRAN, whose default SHARED copies the shared library’s modules into the include directory. With it set, hdf5_fortran.pc gives moddir=${prefix}/include, and h5fc takes its flags from that file, so a Fortran program compiled through CMake, h5fc or pkg-config hdf5_fortran finds the modules without a flag of its own.