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

194.4. librsvg-2.63.2

SVG rendering library (Rust-based; used by imv for SVG support)

Version 2.63.2, release 2
Shelf graphics-libs — 2D rendering, vector and SVG, text layout, colour management and graph drawing libraries
Phase 42_graphics (Graphics Stack), 36 of 189 in build order
Licence LGPL-2.1-or-later
Homepage https://gitlab.gnome.org/GNOME/librsvg
Build time 7.7 SBU
Installed size 15.4 MiB in 18 files
Recipe ports/core/graphics-libs/librsvg/kpkgbuild

About

librsvg renders SVG images. It is written in Rust and keeps its C API, librsvg-2, drawing through cairo and laying out text with pango; rsvg-convert turns SVG into PNG, PDF, PS or SVG from the command line. Its gdk-pixbuf loader is what lets every gdk-pixbuf consumer on the host open an SVG: the portal’s icon validation, img2sixel, fcitx5’s theme images and every GTK program’s icons. ffmpeg’s SVG decoder and imv’s SVG support are built on it too.

Sources

Dependencies

Depends on: meson, rust, cargo-c, gdk-pixbuf, cairo, pango, harfbuzz, fontconfig, freetype2, glib, libxml2, python3-docutils, dav1d, gobject-introspection, glib-introspection, vala.

Required by (84): abiword, aisleriot, blender, cataclysm-dda, celluloid, chafa, chirp, darktable, deja-dup, deluge, dino, djvulibre, dolphin, dosbox-x, dsda-doom, fcitx5, ffmpeg, font-manager, gegl, gimp, git-cola, glabels, glaxnimate, gmsh, gnome-disk-utility, gnome-mahjongg, gnome-mines, gnome-sudoku, goffice, gpredict, gqrx, grafx2, gramps, graphviz, gst-plugins-bad, gthumb, gtk3, gtk4, horizon-eda, hydrogen, imagemagick, imhex, impression, imv, ioquake3, js8call, jupyterlab, kdeconnect, klog, koreader, kwave, libvips, lite-xl, love, lxi-tools, marble, mkvtoolnix, netsurf, qdirstat, qt5ct, rawtherapee, resources, retroarch, rhythmbox, scummvm, sdrangel, skanlite, spyder, stlink-gui, supertux, swayimg, syncthingtray, texstudio, timg, translatelocally, transmission, tryton, tuxpaint, urh, vlc, wine, xastir, xfburn, xnec2c.

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

What kpkg does

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

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/librsvg
echo '852b18e1a00b8605528825a27dc7748bff2a5dd254028f59dc22a34ea57e81b6  librsvg-2.63.2.tar.xz' | sha256sum -c -
echo '308b647074bb5ab1289edd13a281c3ef6d26da0a16491a52b0b2ff751856581c  librsvg-vendor-2.63.2.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/librsvg
SRC=$SRC_ROOT/librsvg-2.63.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf librsvg-2.63.2.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:

tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
export CARGO_HOME="$SRC_ROOT/.cargo"
export CARGO_NET_OFFLINE=true
export RUSTFLAGS="-C target-feature=-crt-static"
meson setup build \
	--prefix=/usr --sysconfdir=/etc --libdir=lib \
	--buildtype=release \
	-Dintrospection=enabled \
	-Dvala=enabled \
	-Ddocs=enabled \
	-Dtests=false \
	-Dpixbuf=enabled \
	-Dpixbuf-loader=enabled \
	-Davif=enabled \
	-Dtriplet=x86_64-unknown-linux-musl
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C 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/librsvg, 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 librsvg-2.63.2-2.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/librsvg, and runs the triggers its paths call for.

Contents

Installed programs: rsvg-convert.

Installed libraries: librsvg-2.so.

Installed directories: /usr/include/librsvg-2.0, /usr/share/licenses/librsvg.

Short descriptions

rsvg-convert Render SVG documents to PNG images, or convert them to PDF or PS.
librsvg-2.0.pc library that renders svg files

Notes

The Rust crates come from librsvg-vendor-<version>.tar.xz, which ports/fetch makes with cargo vendor and the recipe pins by its sha256 like any other source (see Vendoring). build.sh unpacks it at the top of the source tree, where it puts vendor/, Cargo.lock and a .cargo/config.toml that replaces crates.io with the vendored directory. Cargo finds that configuration by walking up from the directory meson runs it in, so the bundle must stay at the top of the tree. CARGO_HOME points at the work directory, so cargo keeps its own files there and not in root’s home.

Under DESTDIR the install only prints a note instead of writing gdk-pixbuf’s loaders.cache; kpkg’s pixbuf trigger rebuilds the cache when the package lands (see Shared indexes).