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

123.5. woff2-1.0.2

Web Open Font Format 2 reference implementation: the WOFF2 codec libraries and tools

Version 1.0.2, release 1
Shelf fonts — Font packages, and font libraries and tooling
Phase 41_system (System), 527 of 1047 in build order
Licence MIT
Homepage https://github.com/google/woff2
Build time 0.1 SBU
Installed size 253.4 KiB in 16 files
Recipe ports/core/fonts/woff2/kpkgbuild

About

woff2 is Google’s reference implementation of WOFF2, the Brotli-compressed font format of the web: the libwoff2dec and libwoff2enc libraries, the libwoff2common that both link, and the woff2_compress, woff2_decompress and woff2_info tools. fontforge links libwoff2dec and libwoff2enc to open and save WOFF2 fonts. FreeType reads WOFF2 by itself, through brotli, and WebKitGTK is built with -DUSE_WOFF2=OFF, so neither needs this port.

Sources

Dependencies

Depends on: brotli, cmake, ninja.

Required by (1): fontforge.

Patches

build.sh applies these; kpkg applies nothing by itself.

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

What kpkg does

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

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/woff2
echo 'add272bb09e6384a4833ffca4896350fdb16e0ca22df68c0384773c67a175594  woff2-1.0.2.tar.gz' | 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/woff2
SRC=$SRC_ROOT/woff2-1.0.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf woff2-1.0.2.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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

patch -p1 -i "$PORT_SRC/gcc15.patch"
patch -p1 -i "$PORT_SRC/install-executables.patch"

cmake -S . -B build -G Ninja \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_SKIP_RPATH=ON \
	-DBUILD_SHARED_LIBS=ON
cmake --build build
DESTDIR=$PKG cmake --install build

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

Contents

Installed programs: woff2_compress, woff2_decompress, woff2_info.

Installed libraries: libwoff2common.so, libwoff2dec.so, libwoff2enc.so.

Installed directories: /usr/include/woff2, /usr/share/licenses/woff2.

Short descriptions

libwoff2common.pc Shared data used by libwoff2 and libwoff2dec libraries
libwoff2dec.pc WOFF2 decoder library
libwoff2enc.pc WOFF2 encoder library

Notes

In a shared build upstream installs only the libraries, not the three tools; install-executables.patch installs them in every build.