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

123.2. fontconfig-2.18.3

A library and support programs used for configuring and customizing font access

Version 2.18.3, release 1
Shelf fonts — Font packages, and font libraries and tooling
Phase 41_system (System), 97 of 1047 in build order
Licence HPND-sell-variant AND MIT AND MIT-Modern-Variant AND Unicode-DFS-2016
Homepage https://www.freedesktop.org/wiki/Software/fontconfig/
Build time 0.6 SBU
Installed size 1.2 MiB in 332 files
Recipe ports/core/fonts/fontconfig/kpkgbuild

About

fontconfig is how programs find fonts: it indexes every face under the font directories into a cache, and answers a request such as “monospace, bold, able to draw this character” with an ordered list of matching faces, following the rules in /etc/fonts/conf.d. Almost every program that draws text asks it, cairo, Pango and Qt among them. The font ports install their own rules beside upstream’s, and the numbers in their file names fix the order in which faces are preferred; see noto-fonts and nerd-fonts-symbols.

Sources

Dependencies

Depends on: freetype2, expat, gperf, python3.

Required by (81): appstream, ardour, avidemux, cairo, calibre, calligra, chromium, coin, ffmpeg, firefox-esr, fltk, font-caladea, font-carlito, font-liberation, font-manager, ghostscript, gimp, gmsh, grafx2, graphviz, gtk3, gtk4, gtksourceview5, handbrake, imagemagick, imhex, imv, inkscape, kdos-sddm-theme, kicad, krita, libass, libbluray, libcupsfilters, libgd, libreoffice, librepcb, librewolf, librsvg, libvips, libXft, mlt, motif, nerd-fonts-symbols, noto-fonts, noto-fonts-extra, obs-studio, octave, opencascade, openjdk, openrct2, openscad, openttd, orcaslicer, pango, plasma-workspace, podofo, poppler, ppsspp, qt5-qtbase, qt6-qtbase, qt6-qtwebengine, R, sdl2-pango, solvespace, swayimg, terminus-font, terminus-ttf, texlive, thunderbird, tk, ttf-dejavu, ttf-jetbrains-mono, tuxpaint, vlc, webkitgtk, webkitgtk6, wesnoth, wine, wxwidgets, xdg-desktop-portal-gtk.

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

What kpkg does

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

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/fonts/fontconfig
echo '4f7b554a38cdf78c033f666c8871f3749e14a094f65a07f630c91ed0b43d35e3  fontconfig-2.18.3.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/fontconfig
SRC=$SRC_ROOT/fontconfig-2.18.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf fontconfig-2.18.3.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 recipe’s helpers watch and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

./configure --prefix=/usr        \
            --sysconfdir=/etc    \
            --localstatedir=/var \
            --with-cache-dir=/usr/lib/fontconfig/cache \
            --with-default-fonts=/usr/share/fonts \
            --disable-nls \
            --disable-docbook
make
make DESTDIR=$PKG install

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

Contents

Installed programs: fc-cache, fc-cat, fc-conflist, fc-list, fc-match, fc-pattern, fc-query, fc-scan, fc-validate.

Installed libraries: libfontconfig.so.

Installed directories: /usr/include/fontconfig, /usr/lib/fontconfig, /usr/share/doc/fontconfig, /usr/share/licenses/fontconfig, /usr/share/xml/fontconfig.

Short descriptions

fc-cache build font information cache files
fc-cat read font information cache files
fc-conflist list the configuration files processed by Fontconfig
fc-list list available fonts
fc-match match available fonts
fc-pattern parse and show pattern
fc-query query font files
fc-scan scan font files or directories
fc-validate validate font files
fontconfig.pc Font configuration and customization library

Notes

make install with DESTDIR set does not run fc-cache, so the package carries an empty /usr/lib/fontconfig/cache/, and the cache is written on the target by kpkg’s font index. The cache the image ships is written once more by 70_image, after every font directory’s time has been set to SOURCE_DATE_EPOCH: fontconfig records each directory’s time in the cache and discards an entry whose directory time differs. See Databases stamped into the image.

fontconfig installs no font itself, which is why its font index also watches /etc/fonts: a system whose fonts were all installed before fontconfig would otherwise have no cache.