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

271.3. cantor-26.08.2

Worksheet front end for Python, R, Octave, Lua, Qalculate and KAlgebra

Version 26.08.2, release 1
Shelf math — Mathematics applications and libraries: computer algebra, arbitrary precision, solvers, calculators, statistics and plotting apps
Phase 43_toolkits (Toolkits), 234 of 344 in build order
Licence GPL-2.0-or-later
Homepage https://apps.kde.org/cantor/
Build time 4.6 SBU
Installed size 7.2 MiB in 135 files
Recipe ports/core/math/cantor/kpkgbuild

About

Cantor is KDE’s mathematical worksheet: a document of input cells and their results, rendered with formulas and plots, run against a backend chosen per worksheet. Python, R, Qalculate, KAlgebra and Lua are built in as plugins that link their libraries; Maxima, Octave, Sage and Scilab backends are always built and drive the program itself, so each works once that program is installed. octave is a port; Maxima, Sage and Scilab are not, so a worksheet offers those three and cannot start them.

Sources

Dependencies

Depends on: cmake, ninja, extra-cmake-modules, shared-mime-info, qt6-qtbase, qt6-qtsvg, qt6-qttools, qt6-qtwebengine, karchive, kcompletion, kconfig, kcoreaddons, kcrash, kdoctools, ki18n, kiconthemes, kio, knewstuff, kparts, ktexteditor, ktextwidgets, kxmlgui, syntax-highlighting, libxml2, libxslt, poppler, analitza, libqalculate, R, python3, luajit.

Required by (2): kde-gear-education, labplot.

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/43_toolkits/phase.env && kpkg install cantor'

What kpkg does

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

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/math/cantor
echo 'bb56336175e90870290e7432f35049ac50563a4dbbb9102efe7696af807b4377  cantor-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/cantor
SRC=$SRC_ROOT/cantor-26.08.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf cantor-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:

cmake -S . -B build -G Ninja \
	-D CMAKE_INSTALL_PREFIX=/usr \
	-D KDE_INSTALL_LIBDIR=lib \
	-D CMAKE_BUILD_TYPE=Release \
	-D BUILD_TESTING=OFF \
	-D KDE_INSTALL_USE_QT_SYS_PATHS=ON \
	-D KF_SKIP_PO_PROCESSING=ON \
	-D BUILD_DOC=ON \
	-D ENABLE_EMBEDDED_DOCUMENTATION=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_Poppler=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_Analitza6=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_R=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_Qalculate=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_Python3=ON \
	-D CMAKE_REQUIRE_FIND_PACKAGE_LuaJIT=ON \
	-D CMAKE_DISABLE_FIND_PACKAGE_Julia=ON \
	-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
test -x "$PKG/usr/bin/cantor"

cat > "$PKG/usr/share/applications/org.kde.cantor.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Cantor
GenericName=Mathematical Worksheet
Comment=Worksheets for Python, R, Octave, Lua, Qalculate and KAlgebra
TryExec=cantor
Exec=cantor %U
Icon=cantor
Terminal=false
StartupWMClass=org.kde.cantor
X-DocPath=cantor/index.html
MimeType=application/x-cantor;
Categories=Qt;KDE;Education;Math;Science;
Keywords=math;worksheet;notebook;python;r;octave;lua;calculator;cantor;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.kde.cantor.desktop"
test -e "$PKG"/usr/share/icons/hicolor/48x48/apps/cantor.png
test -e "$PKG"/usr/share/mime/packages/cantor.xml

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/cantor, 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 cantor-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/cantor, and runs the triggers its paths call for.

Contents

Installed programs: cantor, cantor_pythonserver, cantor_rserver, cantor_scripteditor.

Installed libraries: libcantor_config.so, libcantorlibs.so.

Installed directories: /usr/include/cantor, /usr/lib/cmake/Cantor, /usr/lib/qt6/plugins/cantor_plugins, /usr/share/cantor, /usr/share/doc/HTML/en/cantor, /usr/share/licenses/cantor.

Notes

build.sh replaces upstream’s desktop entry. Upstream’s runs cantor -qwindowicon cantor -qwindowtitle %c %U; the replacement runs cantor %U and sets StartupWMClass=org.kde.cantor. application/x-cantor is the type defined by the cantor.xml the port installs, and build.sh checks afterwards that it and the 48-pixel cantor.png icon the entry names are in the package.

The Markdown cells are rendered by a patched copy of Discount that upstream carries in thirdparty/ and builds from the source tarball.