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
librsvg-2.63.2.tar.xz(6.5 MiB)
sha256852b18e1a00b8605528825a27dc7748bff2a5dd254028f59dc22a34ea57e81b6
upstream: https://download.gnome.org/sources/librsvg/2.63/librsvg-2.63.2.tar.xz
archive copy: sources-2/graphics-libs--librsvg-2.63.2.tar.xzlibrsvg-vendor-2.63.2.tar.xz(19.0 MiB)
sha256308b647074bb5ab1289edd13a281c3ef6d26da0a16491a52b0b2ff751856581c
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-2/graphics-libs--librsvg-vendor-2.63.2.tar.xz
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:
-C target-feature=-crt-static— Links the Rust code dynamically against musl. The musl target links statically unless told otherwise, and a crate that binds a system library then fails to link or carries a private copy of it (see rust).CARGO_NET_OFFLINE— Forbids cargo the network; every crate comes from the vendor bundle.-Dtriplet=x86_64-unknown-linux-musl— Passes--target x86_64-unknown-linux-muslto cargo, naming the musl target rather than leaving cargo to its host default.-Dintrospection=enabled— InstallsRsvg-2.0.girand its typelib, which PyGObject programs load; the GIR includesGdkPixbuf-2.0.-Dvala=enabled— Installs the Vala binding,librsvg-2.0.vapi, which Vala programs such as gnome-mines compile against; without it their build stops atvalac. It needsvapigenfrom vala.-Ddocs=enabled— Builds thersvg-convert(1)manual page withrst2man, from python3-docutils. The HTML API reference needs gi-docgen, which is not a port, and meson skips it without failing.-Dtests=false— Builds no test suite; upstream’s default is on.-Dpixbuf=enabled— Builds the library’sGdkPixbuffunctions, through gdk-pixbuf.-Dpixbuf-loader=enabled— Installs the SVG loader into gdk-pixbuf’s module directory. Upstream’s default is off.-Davif=enabled— Decodes AVIF images embedded in an SVG through dav1d.
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).