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

330.10. kalzium-26.08.2

KDE periodic table of the elements — properties, isotopes, spectra and a molar mass calculator

Version 26.08.2, release 1
Shelf education — Learning software, offline encyclopedias and reference dictionaries
Phase 44_apps (Applications), 95 of 422 in build order
Licence GPL-2.0-or-later
Homepage https://apps.kde.org/kalzium/
Build time 2.8 SBU
Installed size 15.5 MiB in 401 files
Recipe ports/core/education/kalzium/kpkgbuild

About

Kalzium is KDE’s periodic table of the elements: each element’s properties, isotopes and spectrum, a molar mass calculator, a chemical equation solver, and a 3D molecule viewer and editor. The viewer is built on openbabel and avogadrolibs; the equation solver is OCaml code using the ocaml-facile constraint library.

Sources

Dependencies

Depends on: cmake, ninja, extra-cmake-modules, qt6-qtbase, qt6-qtsvg, qt6-qt5compat, qt6-qtscxml, qt6-qtdeclarative, karchive, kconfig, kconfigwidgets, kcoreaddons, kcrash, kdoctools, ki18n, kitemviews, kio, kplotting, kunitconversion, kwidgetsaddons, ktextwidgets, kxmlgui, knewstuff, openbabel, avogadrolibs, eigen, ocaml, ocaml-facile, gettext, chemical-mime-data.

Required by (1): kde-gear-education.

Patches

build.sh applies these; kpkg applies nothing by itself.

avogadro2-layers.patch makes the Molecular Editor draw. avogadrolibs 2 keeps whether a scene plugin (Ball and Stick, Licorice, Van der Waals, Wireframe) is enabled per molecule in its layer manager, and a molecule the manager was never given enables none, so the view stays empty. With the patch, KalziumGLWidget hands every molecule it shows to an Avogadro::QtGui::LayerModel, enables the plugin whose name the Style box shows, and reapplies it on each new molecule. It also gives the view the palette’s opaque Base colour as its background, read again on a palette change; the scene’s default is transparent, which a Wayland surface shows as a hole through to the window behind. It is to be offered upstream at education/kalzium.

kiosk-get-new.patch hides the molecule viewer’s “Download New Molecules” button when KNewStuff is not allowed. KNewStuff is off on KDOS ([KDE Action Restrictions][$i] ghns=false in /usr/share/kdos/xdg/kdeglobals), but the button is a plain one that opens the KNewStuff dialog, which the key does not reach: it would stay on the viewer and open a page that only says downloading is not allowed. The patch hides it under the same check KNewStuff’s own buttons make.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/44_apps/phase.env && kpkg install kalzium'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/education/kalzium.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/education/kalzium
echo 'cc1cb37ef27e8e2bc3e11eb51260b87e05cf0dc37754cf98b2cbb59ed07e65af  kalzium-26.08.2.tar.xz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/kalzium
SRC=$SRC_ROOT/kalzium-26.08.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf kalzium-26.08.2.tar.xz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/kiosk-get-new.patch"
patch -p1 -i "$PORT_SRC/avogadro2-layers.patch"

export LDFLAGS="$LDFLAGS -Wl,--strip-debug"

cmake -S . -B build -G Ninja \
	-D CMAKE_INSTALL_PREFIX=/usr \
	-D KDE_INSTALL_LIBDIR=lib \
	-D CMAKE_BUILD_TYPE=Release \
	-D KDE_INSTALL_USE_QT_SYS_PATHS=ON \
	-D BUILD_TESTING=OFF \
	-D KF_SKIP_PO_PROCESSING=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_OpenBabel3=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_AvogadroLibs=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_Eigen3=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_OCaml=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_Libfacile=ON \
	-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build

cat > "$PKG/usr/share/applications/org.kde.kalzium.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Kalzium
GenericName=Periodic Table of Elements
Comment=Periodic table of the elements
TryExec=kalzium
Exec=kalzium
Icon=kalzium
Terminal=false
StartupWMClass=org.kde.kalzium
X-DocPath=kalzium/index.html
Categories=Qt;KDE;Education;Science;Chemistry;
Keywords=periodic;table;element;chemistry;molar;mass;isotope;kalzium;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.kde.kalzium.desktop"
cat > "$PKG/usr/share/applications/org.kde.kalzium_cml.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Kalzium
Exec=kalzium --molecule %f
Icon=kalzium
Terminal=false
NoDisplay=true
StartupWMClass=org.kde.kalzium
MimeType=chemical/x-cml;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.kde.kalzium_cml.desktop"

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/kalzium, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf kalzium-26.08.2-1.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/kalzium, and runs the triggers its paths call for.

Contents

Installed programs: kalzium.

Installed libraries: libcompoundviewer.so, libscience.so.

Installed directories: /usr/include/libkdeedu, /usr/share/doc/HTML/en/kalzium, /usr/share/kalzium, /usr/share/libkdeedu, /usr/share/licenses/kalzium.

Short descriptions

kalzium A KDE based chemistry teaching tool

Notes

The equation solver and facile are compiled by ocamlopt -output-obj into one object, solver.o, which goes into the kalzium executable itself. The link adds the OCaml runtime archive, libasmrun.a, from the directory ocamlc -where reports, which is also where FindLibfacile looks for facile.

Translations are not built (KF_SKIP_PO_PROCESSING), and the package prune removes the translated handbooks; see Size and language policy.

Both menu entries are replaced. The main one gives StartupWMClass=org.kde.kalzium, the Wayland app_id KAboutData sets. The chemical/x-cml handler opens a file in the molecule editor, and upstream’s writes -molecule %f: QCommandLineParser reads that as -m with the value olecule, and the file is never opened. The replacement writes --molecule %f.