Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

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"

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.