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

153.2. khal-0.14.1

Terminal calendar over a vdir

Version 0.14.1, release 1
Shelf pim — Personal information: calendars, contacts, tasks, time tracking, notes and genealogy
Phase 41_system (System), 847 of 1047 in build order
Licence MIT AND BSD-2-Clause AND Apache-2.0
Homepage https://lostpackets.de/khal/
Build time 0.3 SBU
Installed size 5.4 MiB in 1446 files
Recipe ports/core/pim/khal/kpkgbuild

About

khal is a calendar for the terminal over a vdir: a directory of .ics files, one event to a file. khal lists and adds events from the command line and ikhal is its interactive view; the package adds a desktop entry, “Calendar”, for ikhal. vdirsyncer keeps the vdir equal to a CalDAV calendar.

Why it is in KDOS

The comment above khal and khard in script/phases/41_system/packages.d/pim.txt:

A CALENDAR AND AN ADDRESS BOOK OVER A vdir — one directory of .ics or .vcf files, which is greppable, diffable and backed up by copying it.

Sources

Dependencies

Depends on: python3, python3-setuptools, python3-pip, python3-sphinx, python3-setuptools-scm, python3-hatchling, python3-hatch-vcs, python3-click, python3-click-log, python3-configobj, python3-dateutil, python3-pytz, python3-pyxdg, python3-six, python3-typing-extensions, python3-urwid, python3-wcwidth.

Required by: no port names it.

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/41_system/phase.env && kpkg install khal'

What kpkg does

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

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/pim/khal
echo '2b51679d80662b2d65e757c509813bd72b496043d789839bfd970f0026da687d  khal-0.14.1.tar.gz' | sha256sum -c -
echo '5673875a0d6424c45c3c75af6d8530b11fbbc878b5b51566fd1064056976580d  khal-vendor-0.14.1.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/khal
SRC=$SRC_ROOT/khal-0.14.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf khal-0.14.1.tar.gz -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 recipe’s helpers pyrequirements, pyruntime and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

mkdir -p vendor
tar -xf $PORT_SRC/$name-vendor-$version.tar.xz --strip-components=1 -C vendor

pip3 install --ignore-installed --no-deps --no-index --find-links=vendor --no-build-isolation \
	--root=$PKG --prefix=/usr \
	icalendar tzdata tzlocal .

_site=$(python3 -c 'import sys, sysconfig; print(sysconfig.get_path("purelib", vars={"base": sys.argv[1]}))' "$PKG/usr")
(cd doc/source && PYTHONPATH=$_site sphinx-build -b man -q \
	-D extensions=sphinx.ext.autodoc,sphinx.ext.todo \
	-d "$SRC_ROOT/khal-doctrees" . "$SRC_ROOT/khal-man")
install -Dm644 "$SRC_ROOT/khal-man/khal.1" -t "$PKG/usr/share/man/man1"

install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/ikhal.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=Calendar
GenericName=Calendar
Comment=Appointments, over a local vdir
Exec=ikhal
Icon=x-office-calendar
Terminal=true
Categories=Office;Calendar;
Keywords=calendar;appointment;event;ical;khal;
EOF
chmod 644 "$PKG/usr/share/applications/ikhal.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/khal, 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 khal-0.14.1-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/khal, and runs the triggers its paths call for.

Contents

Installed programs: icalendar, ikhal, khal.

Installed directories: /usr/lib/python3.14/site-packages/icalendar, /usr/lib/python3.14/site-packages/icalendar-7.3.0.dist-info, /usr/lib/python3.14/site-packages/khal, /usr/lib/python3.14/site-packages/khal-0.14.1.dist-info, /usr/lib/python3.14/site-packages/tzdata, /usr/lib/python3.14/site-packages/tzdata-2026.5.dist-info, /usr/lib/python3.14/site-packages/tzlocal, /usr/lib/python3.14/site-packages/tzlocal-5.4.4.dist-info, /usr/share/licenses/khal.

Short descriptions

khal khal Documentation Khal is a calendar program for the terminal for viewing, adding and editing events and calendars. Khal is build on the iCalendar and vdir (allowing the use of vdirsyncer(1) for CalDAV compatibility) standards.

Notes

sphinx-build runs with PYTHONPATH set to the site-packages inside $PKG, because autodoc imports khal and its bundled modules, and those are installed only there.

A module in the bundle belongs to this package. A second program that needs icalendar, tzdata or tzlocal cannot bundle its own copy, because two packages owning one path is refused at install; such a module becomes a python3-* port of its own.