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
woff2-1.0.2.tar.gz(38.0 KiB)
sha256add272bb09e6384a4833ffca4896350fdb16e0ca22df68c0384773c67a175594
upstream: https://github.com/google/woff2/archive/v1.0.2.tar.gz
archive copy: sources-2/fonts--woff2-1.0.2.tar.gz
Dependencies
Depends on: brotli, cmake, ninja.
Required by (1): fontforge.
Patches
build.sh applies these; kpkg applies nothing by itself.
gcc15.patch— include/woff2/output.h: add missing <stdint.h> includeWithout the change `woff2` build fails on upcoming `gcc-15` as:
In file included from src/woff2_out.cc:9: include/woff2/output.h:73:25: error: expected ')' before '*' token 73 | WOFF2MemoryOut(uint8_t* buf, size_t buf_size); | ~ ^ | ) include/woff2/output.h:79:3: error: 'uint8_t' does not name a type 79 | uint8_t* buf_; | ^~~~~~~ include/woff2/output.h:16:1: note: 'uint8_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>' 15 | #include <string> +++ |+#include <cstdint> 16 |
install-executables.patch— Always install executableshttps://github.com/google/woff2/pull/106
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:
-DCMAKE_POLICY_VERSION_MINIMUM=3.5— Upstream’sCMakeLists.txtdeclarescmake_minimum_required(VERSION 2.8.6), and the tree’s CMake 4 refuses a floor below 3.5; the flag raises it without a patch (see An old CMake policy floor).-DCMAKE_SKIP_RPATH=ON— Write noRPATHinto any library or tool. Upstream’sCMakeLists.txtsets the installRPATHtoCMAKE_INSTALL_LIBDIRwhenever that is not one of the compiler’s implicit directories, and with the relativelibthe comparison never matches, so every binary would carry the relative entrylib, searched from the caller’s working directory, which the package lint fails (see What the package lint refuses).-DBUILD_SHARED_LIBS=ON— Build the three libraries shared. On is upstream’s default.
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.