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

194.1. cairo-1.18.6

2D graphics library, with its Xlib and XCB surfaces

Version 1.18.6, release 1
Shelf graphics-libs — 2D rendering, vector and SVG, text layout, colour management and graph drawing libraries
Phase 42_graphics (Graphics Stack), 13 of 189 in build order
Licence LGPL-2.1-only OR MPL-1.1
Homepage https://www.cairographics.org/
Build time 0.4 SBU
Installed size 2.0 MiB in 46 files
Recipe ports/core/graphics-libs/cairo/kpkgbuild

About

cairo is the 2D vector graphics library: paths, fills, strokes, gradients, text and images, rendered through pixman to memory or written out as PNG, PDF, PostScript and SVG. GTK, pango, librsvg, poppler, WebKitGTK, Inkscape and GStreamer’s overlays draw with it. This build carries its image, PDF, PS, SVG and script surfaces, the FreeType and fontconfig font backend, cairo-gobject, and the Xlib and XCB surfaces that the X11 backends of GTK 3 and 4 need.

Sources

Dependencies

Depends on: pixman, fontconfig, freetype2, libpng, lzo, zlib, glib, libX11, libxcb, libXext, libXrender.

Required by (59): abiword, aisleriot, appstream, ardour, cairomm, cairomm1.14, darktable, dasher, fcitx5, fltk, frei0r-plugins, gegl, gimp, glabels, gmsh, gnuplot, goffice, goocanvas, graphviz, gst-plugins-bad, gst-plugins-base, gst-plugins-good, gtk-vnc, gtk3, gtk4, harfbuzz, hwloc, imv, inkscape, kicad, lasem, lib2geom, libdecor, libreoffice, librsvg, libvips, lmms, lxi-tools, noto-emoji, openbabel, openscad, osm-gps-map, pango, poppler, python3-cairo, python3-gobject, R, remmina, rhythmbox, solvespace, texlive, thunderbird, timg, tuxpaint, vte3, webkitgtk, webkitgtk6, wesnoth, 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 cairo'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/graphics-libs/cairo.

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/cairo
echo '1c767308174337a74694da0f3ec069c271452163a1ef4540964c50c301f157d4  cairo-1.18.6.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/cairo
SRC=$SRC_ROOT/cairo-1.18.6
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf cairo-1.18.6.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 XML_CATALOG_FILES=/etc/xml/catalog

export CFLAGS="$CFLAGS -frandom-seed=cairo"
meson setup build --buildtype=release -D b_lto=true \
	--prefix=/usr --sysconfdir=/etc --libdir=lib \
	-D fontconfig=enabled \
	-D freetype=enabled \
	-D png=enabled \
	-D zlib=enabled \
	-D lzo=enabled \
	-D glib=enabled \
	-D tee=enabled \
	-D xlib=enabled \
	-D xcb=enabled \
	-D xlib-xcb=enabled \
	-D dwrite=disabled \
	-D quartz=disabled \
	-D spectre=disabled \
	-D symbol-lookup=disabled \
	-D gtk2-utils=disabled \
	-D gtk_doc=false \
	-D tests=disabled
meson compile -C build
meson install --no-rebuild -C build --destdir $PKG

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

Contents

Installed programs: cairo-trace.

Installed libraries: libcairo-gobject.so, libcairo-script-interpreter.so, libcairo.so.

Installed directories: /usr/include/cairo, /usr/lib/cairo, /usr/share/licenses/cairo.

Short descriptions

cairo.pc Multi-platform 2D graphics library
cairo-fc.pc Fontconfig font backend for cairo graphics library
cairo-ft.pc FreeType font backend for cairo graphics library
cairo-gobject.pc cairo-gobject for cairo graphics library
cairo-pdf.pc PDF surface backend for cairo graphics library
cairo-png.pc PNG functions for cairo graphics library
cairo-ps.pc PostScript surface backend for cairo graphics library
cairo-script.pc script surface backend for cairo graphics library
cairo-script-interpreter.pc script surface backend for cairo graphics library
cairo-svg.pc SVG surface backend for cairo graphics library
cairo-tee.pc Tee surface backend for cairo graphics library
cairo-xcb.pc XCB surface backend for cairo graphics library
cairo-xcb-shm.pc XCB/SHM functions for cairo graphics library
cairo-xlib.pc Xlib surface backend for cairo graphics library
cairo-xlib-xcb.pc Xlib/XCB functions for cairo graphics library
cairo-xlib-xrender.pc Xlib Xrender surface backend for cairo graphics library