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
cairo-1.18.6.tar.xz(31.2 MiB)
sha2561c767308174337a74694da0f3ec069c271452163a1ef4540964c50c301f157d4
upstream: https://cairographics.org/releases/cairo-1.18.6.tar.xz
archive copy: sources-2/graphics-libs--cairo-1.18.6.tar.xz
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:
-frandom-seed=cairo— With LTO, fixes the name GCC gives each object’s.gnu.lto_*sections, which is otherwise random on every build. cairo is one of the hot libraries the tree builds with link-time optimisation, and every one of them carries the seed (see Every port).-D b_lto=true— Link-time optimisation, through meson’s own switch.-D fontconfig=enabled,-D freetype=enabled— The FreeType font backend (cairo-ft), with fontconfig to find fonts; pango and every GTK program render their text through it.-D png=enabled,-D zlib=enabled— libpng gives the PNG functions and the SVG surface; zlib gives the script, PostScript and PDF surfaces, which compress their output with it, and the cairo-script interpreter.-D lzo=enabled— Lets the cairo-script interpreter compress and expand the string data of a script trace with LZO, through lzo.-D glib=enabled— Buildscairo-gobject, the GObject types for cairo’s structures that pango, GTK and the introspection data are built on.-D tee=enabled— Builds the tee surface, which sends every drawing operation to several surfaces at once, and installscairo-tee.pc.-D xlib=enabled,-D xcb=enabled,-D xlib-xcb=enabled— The Xlib and XCB surfaces. They installcairo-xlib.pcandcairo-xcb.pc, and GTK 3 and 4 stop at setup without them when their X11 backend is built; FLTK, cairomm and Ardour draw on Xlib surfaces under Xwayland.xlib-xcb, which upstream leaves disabled, adds the Xlib/XCB functions andcairo-xlib-xcb.pc.-D dwrite=disabled,-D quartz=disabled— The Windows DirectWrite and macOS Quartz backends; neither can build on Linux.-D spectre=disabled— Only cairo’s test suite uses libspectre, to rasterise PostScript output for comparison; with the tests off, the switch spares the probe and nothing else.-D symbol-lookup=disabled— Onauto, configure finds binutils’libbfdin the root and links it intolibcairoitself, for symbol names in the backtracescairo-tracerecords; every program that draws with cairo would then load libbfd.-D gtk2-utils=disabled— Builds no GTK 2 debugging utilities; GTK 2 is not a port.-D gtk_doc=false,-D tests=disabled— No API reference and no test suite.XML_CATALOG_FILES— Points libxml2 at/etc/xml/catalog. Withgtk_doc=falseno step of this build runs an XML tool, so it has no effect here.
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 |