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

117.5. resvg-0.48.1

SVG rendering library and SVG-to-PNG converter

Version 0.48.1, release 1
Shelf graphics-libs — 2D rendering, vector and SVG, text layout, colour management and graph drawing libraries
Phase 41_system (System), 607 of 1047 in build order
Licence Apache-2.0 OR MIT
Homepage https://github.com/linebender/resvg
Build time 1.6 SBU
Installed size 5.4 MiB in 3 files
Recipe ports/core/graphics-libs/resvg/kpkgbuild

About

resvg is an SVG renderer written in Rust, with no browser engine behind it. The port installs its command, resvg, which renders an SVG file to a PNG; the Rust library and its C API are not installed. yazi, the terminal file manager, names it as the program it previews SVG files with.

Why it is in KDOS

The comment above it in script/phases/41_system/packages.d/graphics-libs.txt:

SVG to PNG with no browser engine behind it. resvg is what the desktop's own artwork pipeline would reach for; the atlas is rasterised on the host, but a machine that has the file should be able to render it too.

Sources

Dependencies

Depends on: rust.

Required by (1): yazi.

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/41_system/phase.env && kpkg install resvg'

What kpkg does

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

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/resvg
echo '40dafea6b4b9d01e9d28b6d49f1e912daf3e9055676ad9179a5a2db6e7386945  resvg-0.48.1.tar.gz' | sha256sum -c -
echo '0472d414b119cd0c9f79194b757dafe40eff783590d7e32b43e71247d98c257d  resvg-vendor-0.48.1.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/resvg
SRC=$SRC_ROOT/resvg-0.48.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf resvg-0.48.1.tar.gz -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 RUSTFLAGS="-C target-feature=-crt-static"
export CARGO_NET_OFFLINE=true
cargo build --release --frozen --offline -p resvg
install -Dm755 target/release/resvg $PKG/usr/bin/resvg

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

Contents

Installed programs: resvg.

Installed directories: /usr/share/licenses/resvg.

Notes

The crates are not downloaded at build time. ports/fetch runs cargo vendor against the release and packs the result into resvg-vendor-<version>.tar.xz, whose sha256 = line in the recipe holds it like any other source; build.sh unpacks it and builds with --frozen --offline (see Vendoring). The rest of the build is the plain Rust shape of writing-ports.md.