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
kalzium-26.08.2.tar.xz(21.7 MiB)
sha256cc1cb37ef27e8e2bc3e11eb51260b87e05cf0dc37754cf98b2cbb59ed07e65af
upstream: https://download.kde.org/stable/release-service/26.08.2/src/kalzium-26.08.2.tar.xz
archive copy: sources-2/education--kalzium-26.08.2.tar.xz
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.
avogadro2-layers.patch— Register molecules with the avogadrolibs 2 layer manager so the viewer draws themavogadrolibs 2 keeps whether a scene plugin is enabled per molecule in its layer manager, and only a molecule handed to RWLayerManager::addMolecule becomes the active one. KalziumGLWidget never did that, so every setEnabled() was a no-op, activeScenePlugins() stayed empty and the Molecular Editor drew nothing. The widget now registers each molecule it is given, enables the style the dialog chose by the plugin's name() and reapplies it on every new molecule. The view also takes an opaque background from the palette's Base colour, since the scene default is transparent and shows the window behind it on Wayland.
kiosk-get-new.patch— Hide "Download New Molecules" when KNewStuff is not allowedThe molecule viewer's button opens a KNSWidgets::Dialog directly, so it stays visible under [KDE Action Restrictions] ghns=false and opens a dialog that only says it is not allowed. The button now takes the visibility KNewStuff's own buttons take from the same kiosk check.
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:
-D KF_SKIP_PO_PROCESSING=ON— Builds none of the interface translations inpo/; the image is English only (see Size and language policy).-Wl,--strip-debug— Drop debug sections at the link. The OCaml runtime that the equation solver links intokalziumis a static archive compiled with debug information, which no compile flag of this build reaches (see What kpkg does around build.sh).-D CMAKE_REQUIRE_FIND_PACKAGE_OpenBabel3=ON— With-D CMAKE_REQUIRE_FIND_PACKAGE_AvogadroLibs=ON,-D CMAKE_REQUIRE_FIND_PACKAGE_Eigen3=ON,-D CMAKE_REQUIRE_FIND_PACKAGE_OCaml=ONand-D CMAKE_REQUIRE_FIND_PACKAGE_Libfacile=ON: make each of thosefind_packagecalls fail configure when its package is missing. All five are optional upstream: the molecule editor (compoundviewer) is built only when Open Babel, AvogadroLibs and eigen are all found, and the equation solver only when OCaml and facile are, and either is otherwise left out with only a status line.
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.