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

153.3. khard-0.21.0

Terminal address book over a vdir

Version 0.21.0, release 1
Shelf pim — Personal information: calendars, contacts, tasks, time tracking, notes and genealogy
Phase 41_system (System), 848 of 1047 in build order
Licence GPL-3.0-or-later AND Apache-2.0
Homepage https://github.com/lucc/khard
Build time 0.1 SBU
Installed size 962.9 KiB in 76 files
Recipe ports/core/pim/khard/kpkgbuild

About

khard is an address book for the terminal over a vdir of .vcf files, one contact to a file: it lists, searches, adds and edits contacts, and answers address queries for mail clients. vdirsyncer keeps the vdir equal to a CardDAV address book.

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-configobj, python3-dateutil, python3-pytz, python3-six, python3-ruamel-yaml.

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 khard'

What kpkg does

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

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/khard
echo '67a99a4655ceec9520ec4bb282845f83cc6c6efd29daf9b3208e5ed50270affb  khard-0.21.0.tar.gz' | sha256sum -c -
echo 'f922cce30989a64267d6e5d25ea2869a83ab54c57e89e6f22563ad5466f34e0c  khard-vendor-0.21.0.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/khard
SRC=$SRC_ROOT/khard-0.21.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf khard-0.21.0.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 \
	vobject .

_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.autosectionlabel,sphinx.ext.todo,sphinxarg.ext \
	-d "$SRC_ROOT/khard-doctrees" . "$SRC_ROOT/khard-man")
install -Dm644 "$SRC_ROOT"/khard-man/*.1 -t "$PKG/usr/share/man/man1"
install -Dm644 "$SRC_ROOT"/khard-man/*.5 -t "$PKG/usr/share/man/man5"

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

Contents

Installed programs: change_tz, ics_diff, khard.

Installed directories: /usr/lib/python3.14/site-packages/khard, /usr/lib/python3.14/site-packages/khard-0.21.0.dist-info, /usr/lib/python3.14/site-packages/vobject, /usr/lib/python3.14/site-packages/vobject-0.9.8.dist-info, /usr/share/licenses/khard.

Short descriptions

khard Console address book manager

Notes

The manual pages are built against the site-packages in $PKG (PYTHONPATH=$_site), where khard and vobject are installed, because autodoc and sphinx-argparse import them. The build writes khard.1, khard-subcommands.1 and khard.conf.5, installed by glob into sections 1 and 5.