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

338.8. librepcb-2.1.1

Schematic and PCB design with managed libraries, STEP 3D export and Gerber output (Qt 6, Slint)

Version 2.1.1, release 2
Shelf eda — Electronics: schematic and PCB, circuit simulation, antenna modelling, FPGA synthesis and simulation, logic analysers and bench instruments
Phase 44_apps (Applications), 75 of 422 in build order
Licence GPL-3.0-or-later
Homepage https://librepcb.org/
Build time 9.7 SBU
Installed size 86.0 MiB in 63 files
Recipe ports/core/eda/librepcb/kpkgbuild

About

LibrePCB draws schematics and lays out printed circuit boards around managed libraries: every symbol, package and component is a versioned library element with a unique identity. It exports Gerber and Excellon for fabrication and STEP for 3D. The interface is Qt 6; parts of it are written in Slint and a Rust core, compiled into the same program through Corrosion.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, unzip, rust, qt6-qtbase, qt6-qtsvg, qt6-qttools, qt6-qtwayland, opencascade, polyclipping, mesa, libglvnd, glu, zlib, openssl, fontconfig, freetype2, libxkbcommon.

Required by: no port names it.

Patches

build.sh applies these; kpkg applies nothing by itself.

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/44_apps/phase.env && kpkg install librepcb'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/eda/librepcb.

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/eda/librepcb
echo 'c5f6443e1fac1682fdb0f662136c4abb582b8ec9ce260ee94b4e82f0d8dd69c0  librepcb-2.1.1.zip' | sha256sum -c -
echo 'fedcc1b46c9923e46b8fac38c3e1b40cd07d3af3b734e296188390113fe9ce34  librepcb-vendor-2.1.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/librepcb
SRC=$SRC_ROOT/librepcb-2.1.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
cp librepcb-2.1.1.zip "$SRC"

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:

unzip -q "$name-$version.zip"
cd "librepcb-$version"

patch -p1 -i "$PORT_SRC/offline-defaults.patch"

tar xf "$PORT_SRC/$name-vendor-$version.tar.xz" -C "$SRC_ROOT"
export CARGO_HOME="$SRC_ROOT/.cargo"
export RUSTFLAGS="-C target-feature=-crt-static"
export CARGO_NET_OFFLINE=true

cmake -S . -B build -G Ninja \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_INSTALL_LIBDIR=lib \
	-DCMAKE_SKIP_INSTALL_RPATH=ON \
	-DBUILD_TESTS=OFF \
	-DBUILD_DISALLOW_WARNINGS=OFF \
	-DUSE_GLU=ON \
	-DUSE_OPENCASCADE=ON \
	-DUNBUNDLE_POLYCLIPPING=ON
cmake --build build
DESTDIR=$PKG cmake --install build
install -Dm644 LICENSE.txt "$PKG/usr/share/licenses/$name/LICENSE.txt"
install -Dm644 -t "$PKG/usr/share/licenses/$name/LICENSES" LICENSES/*.txt
install -Dm644 .reuse/dep5 "$PKG/usr/share/licenses/$name/dep5"

find "$PKG/usr/share/librepcb/i18n" -name '*.qm' ! -name '*_en*.qm' -delete

cat > "$PKG/usr/share/applications/org.librepcb.LibrePCB.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=LibrePCB
GenericName=PCB Designer
Comment=Draw schematics and lay out printed circuit boards
Exec=librepcb %U
Icon=org.librepcb.LibrePCB
Terminal=false
StartupWMClass=org.librepcb.LibrePCB
Categories=Development;Engineering;Electronics;
MimeType=application/x-librepcb-project;application/x-librepcb-project-archive;
Keywords=pcb;schematic;eda;electronics;circuit;gerber;layout;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.librepcb.LibrePCB.desktop"

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

Contents

Installed programs: librepcb, librepcb-cli.

Installed libraries: liblibrepcbslint.so.

Installed directories: /usr/share/librepcb, /usr/share/licenses/librepcb.

Notes

The source is a zip, because upstream publishes no tarball with its submodules. It arrives in $SRC whole, and build.sh unpacks it itself before patching.

Two Cargo workspaces are compiled, the Rust core in libs/librepcb/rust-core and Slint’s C++ interface in libs/slint, and one vendor bundle, librepcb-vendor-<version>.tar.xz, serves both lock files. ports/fetch cannot write it, because it unpacks only tarballs; it is made by hand with cargo vendor --sync libs/slint/Cargo.toml in libs/librepcb/rust-core, run by the fetch container’s cargo (see A bundle no tool writes). Its sha256 = line is its identity, so a version bump means rebuilding the bundle and publishing it with ports/publish librepcb.

The bundle is unpacked into $SRC_ROOT, not into the source tree. Cargo reads its configuration from CARGO_HOME, which build.sh sets to $SRC_ROOT/.cargo, and resolves the bundle’s relative vendor directory against that directory’s parent.

liblibrepcbslint.so carries an RPATH of Qt’s library directory despite -DCMAKE_SKIP_INSTALL_RPATH=ON, and the package lint warns about it: the vendored qttypes crate’s build script passes it to the linker on every Unix target and has no switch, and editing a vendored crate fails its checksum file. Qt’s library directory is /usr/lib, the loader’s default, so the entry changes nothing that loads.

Only the English interface catalogues are kept; build.sh deletes the rest from /usr/share/librepcb/i18n.