194.2. harfbuzz-14.6.0
OpenType text shaping engine
| Version | 14.6.0, release 1 |
| Shelf | graphics-libs — 2D rendering, vector and SVG, text layout, colour management and graph drawing libraries |
| Phase | 42_graphics (Graphics Stack), 30 of 189 in build order |
| Licence | MIT-Modern-Variant |
| Homepage | https://harfbuzz.github.io/ |
| Build time | 5.9 SBU |
| Installed size | 6.1 MiB in 89 files |
| Recipe | ports/core/graphics-libs/harfbuzz/kpkgbuild |
About
HarfBuzz is the OpenType text shaping engine: given a run of Unicode text and a font, it chooses the glyphs and their positions, applying ligatures, kerning, mark placement and the rules of complex scripts such as Arabic, Devanagari and Thai. pango (and through it GTK and the compositor’s window titles), Qt, LibreOffice, Chromium, libass, SDL_ttf and FreeType’s autohinter, which loads it at run time, all shape through it. Besides libharfbuzz this build installs libharfbuzz-icu, libharfbuzz-gobject, libharfbuzz-cairo, the subsetter, the raster, vector and GPU glyph libraries, the hb-view, hb-shape, hb-info, hb-subset, hb-raster and hb-vector tools, and the introspection data.
Sources
harfbuzz-14.6.0.tar.xz(19.4 MiB)
sha256d07a007327277708a2a73ae437887cdbaf282937f6d03ca5467723e9099af586
upstream: https://github.com/harfbuzz/harfbuzz/releases/download/14.6.0/harfbuzz-14.6.0.tar.xz
archive copy: sources-2/graphics-libs--harfbuzz-14.6.0.tar.xz
Dependencies
Depends on: meson, glib, cairo, freetype2, libpng, zlib, icu, graphite2, gobject-introspection, glib-introspection.
Required by (44): audacity, chromium, ffmpeg, font-manager, fontforge, gimp, gtk3, gtk4, handbrake, inkscape, kicad, kodi, krita, lagrange, libass, libraqm, libreoffice, librsvg, matplotlib, mupdf, musescore, openjdk, openscad, openttd, organicmaps, pango, pdfium, poppler, python3-pillow, python3-uharfbuzz, qt5-qtbase, qt6-qtbase, qt6-qtwebengine, R, sdl2-pango, sdl2-ttf, sdl3-ttf, supertuxkart, texlive, vlc, warzone2100, webkitgtk, webkitgtk6, wxwidgets.
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/42_graphics/phase.env && kpkg install harfbuzz'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/graphics-libs/harfbuzz.
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/graphics-libs/harfbuzz
echo 'd07a007327277708a2a73ae437887cdbaf282937f6d03ca5467723e9099af586 harfbuzz-14.6.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/harfbuzz
SRC=$SRC_ROOT/harfbuzz-14.6.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf harfbuzz-14.6.0.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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
export CFLAGS="$CFLAGS -frandom-seed=harfbuzz" CXXFLAGS="$CXXFLAGS -frandom-seed=harfbuzz"
meson setup build --buildtype=release -D b_lto=true \
--prefix=/usr --sysconfdir=/etc --libdir=lib \
-D glib=enabled \
-D gobject=enabled \
-D freetype=enabled \
-D cairo=enabled \
-D png=enabled \
-D zlib=enabled \
-D chafa=disabled \
-D graphite2=enabled \
-D icu=enabled \
-D gpu_demo=disabled \
-D docs=disabled \
-D tests=disabled \
-D benchmark=disabled \
-D introspection=enabled
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build
The switches, and why each is set:
-frandom-seed=harfbuzz— With LTO, fixes the name GCC gives each object’s.gnu.lto_*sections, which is otherwise random on every build. HarfBuzz is one of the hot libraries the tree builds with link-time optimisation, and every one of them carries the seed inCFLAGSand, for C++,CXXFLAGS(see Every port).-D b_lto=true— Link-time optimisation, through meson’s own switch.-D glib=enabled,-D gobject=enabled— GLib’s Unicode functions as a Unicode backend, andlibharfbuzz-gobject, the GObject types introspection is generated from.-D freetype=enabled— The FreeType font functions (hb-ft), through which pango and FreeType’s own users hand HarfBuzz their faces.-D cairo=enabled— Buildslibharfbuzz-cairo, which draws shaped text with cairo, and thehb-viewtool built on it.-D png=enabled,-D zlib=enabled— Let the raster glyph library write PNG and the vector one compress its output.-D chafa=disabled— Buildshb-viewwithout chafa’s terminal output. chafa reaches librsvg, which depends on harfbuzz, so linking it here would be a dependency cycle.-D graphite2=enabled— The Graphite shaper, for fonts that carry SIL Graphite tables, through graphite2. Upstream’s default is off.-D icu=enabled— Buildslibharfbuzz-icu, the ICU Unicode functions as a separate module, which WebKitGTK requires.-D gpu_demo=disabled— Builds nohb-gpudemo. It needs GLEW, GLFW and GL, which are ports built in the same phase, so onautothe result would follow build order.-D docs=disabled,-D tests=disabled,-D benchmark=disabled— No API reference, no test suite and no benchmarks.-D introspection=enabled— GeneratesHarfBuzz-0.0.girand its typelib. pango’s GIR includes HarfBuzz’s, so pango’s introspection, and every binding built on it, needs this one.
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/harfbuzz, 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 harfbuzz-14.6.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/harfbuzz, and runs the triggers its paths call for.
Contents
Installed programs: hb-info, hb-raster, hb-shape, hb-subset, hb-vector, hb-view.
Installed libraries: libharfbuzz-cairo.so, libharfbuzz-gobject.so, libharfbuzz-gpu.so, libharfbuzz-icu.so, libharfbuzz-raster.so, libharfbuzz-subset.so, libharfbuzz-vector.so, libharfbuzz.so.
Installed directories: /usr/include/harfbuzz, /usr/lib/cmake/harfbuzz, /usr/share/licenses/harfbuzz.
Short descriptions
harfbuzz.pc |
HarfBuzz text shaping library |
harfbuzz-cairo.pc |
HarfBuzz cairo support |
harfbuzz-gobject.pc |
HarfBuzz text shaping library GObject integration |
harfbuzz-gpu.pc |
HarfBuzz GPU rasterization library |
harfbuzz-icu.pc |
HarfBuzz text shaping library ICU integration |
harfbuzz-raster.pc |
HarfBuzz CPU rasterizer |
harfbuzz-subset.pc |
HarfBuzz font subsetter |
harfbuzz-vector.pc |
HarfBuzz vector converter |