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

309.2. prusaslicer-2.9.6

Turns 3D models into G-code for FDM and resin printers, with the bundled vendor profiles

Version 2.9.6, release 2
Shelf fabrication — 3D-printing slicers and hosts, and CNC control
Phase 44_apps (Applications), 123 of 422 in build order
Licence AGPL-3.0-only
Homepage https://www.prusa3d.com/prusaslicer/
Build time 49.9 SBU
Installed size 147.4 MiB in 1094 files
Recipe ports/core/fabrication/prusaslicer/kpkgbuild

About

PrusaSlicer turns 3D models into G-code for FDM printers and into layer images for resin (SLA) printers, and ships Prusa Research’s and other vendors’ printer profiles. Its interface is wxWidgets on GTK 3, against the tree’s wxwidgets. Unlike orcaslicer, it builds against the tree’s own Boost, CGAL, OpenCASCADE, OpenVDB, oneTBB and Eigen, so most of its patches carry its code forward to the newer versions of those libraries that the tree has.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, boost, eigen, onetbb, curl, openssl, zlib, expat, libpng, libjpeg-turbo, mesa, libglvnd, glu, glew, cereal, nlopt, openvdb, cgal, gmp, mpfr, qhull, nlohmann-json, z3, opencascade, wxwidgets, gtk3, webkitgtk, glib, dbus, hidapi, eudev, libX11, wayland.

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

What kpkg does

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

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/fabrication/prusaslicer
echo '8f9f40d93838b912bd9ed35e598c0b7eabd08024cb18aa620c6aa9f9d49d0b57  prusaslicer-2.9.6.tar.gz' | sha256sum -c -
echo 'f40e669226e9d3236799e22347ee7727bd411d3993b79c192717b1ce6f22efc5  libbgcode-6f4ad7ce6b0e638b760199d6611039a610a5a479.tar.gz' | sha256sum -c -
echo '700f6c7b246a9d132fdc061f167df20b87312bc6d9bc2fc68034b1ad7cd24307  nanosvg-abcd277ea45e9098bed752cf9c6875b533c0892f.tar.gz' | sha256sum -c -
echo '7529a1c8ac501191ad470b166773364e66d9926aad632690c72c63a1dea7e9a6  heatshrink-0.4.1.tar.gz' | 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/prusaslicer
SRC=$SRC_ROOT/prusaslicer-2.9.6
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf prusaslicer-2.9.6.tar.gz -C "$SRC" --strip-components=1
tar --no-same-permissions --warning=no-unknown-keyword -xf libbgcode-6f4ad7ce6b0e638b760199d6611039a610a5a479.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf nanosvg-abcd277ea45e9098bed752cf9c6875b533c0892f.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf heatshrink-0.4.1.tar.gz -C "$SRC_ROOT"

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 recipe’s helpers _bgcode, _nanosvg, _heatshrink and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

for p in eigen5 boost-1.87 boost-1.88 boost-1.89 cgal6 \
	opencascade-tkdestep occtwrapper-libdir imgui-hint-segfault serial-unistd; do
	patch -p1 -i "$PORT_SRC/$p.patch"
done

_deps="$SRC_ROOT/deps"
_depopts="-G Ninja -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DCMAKE_BUILD_TYPE=Release
	-DCMAKE_INSTALL_PREFIX=$_deps -DCMAKE_INSTALL_LIBDIR=lib
	-DCMAKE_PREFIX_PATH=$_deps -DBUILD_SHARED_LIBS=OFF
	-DCMAKE_POSITION_INDEPENDENT_CODE=ON"

cp deps/+heatshrink/CMakeLists.txt deps/+heatshrink/Config.cmake.in \
	"$SRC_ROOT/heatshrink-$_heatshrink/"
cmake -S "$SRC_ROOT/heatshrink-$_heatshrink" -B "$SRC_ROOT/build-heatshrink" $_depopts
ninja -C "$SRC_ROOT/build-heatshrink" install

cmake -S "$SRC_ROOT/libbgcode-$_bgcode" -B "$SRC_ROOT/build-bgcode" $_depopts \
	-DLibBGCode_BUILD_TESTS=OFF \
	-DLibBGCode_BUILD_CMD_TOOL=OFF \
	-DLibBGCode_BUILD_DEPS=OFF
ninja -C "$SRC_ROOT/build-bgcode" install

cmake -S "$SRC_ROOT/nanosvg-$_nanosvg" -B "$SRC_ROOT/build-nanosvg" $_depopts
ninja -C "$SRC_ROOT/build-nanosvg" install

export CXXFLAGS="$CXXFLAGS -isystem $_deps/include"
cmake -S . -B build -G Ninja -Wno-dev \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_PREFIX_PATH="$_deps" \
	-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON \
	-DOPENVDB_FIND_MODULE_PATH=/usr/lib/cmake/OpenVDB \
	-DSLIC3R_STATIC=OFF \
	-DSLIC3R_FHS=ON \
	-DSLIC3R_GTK=3 \
	-DSLIC3R_GUI=ON \
	-DSLIC3R_PCH=OFF \
	-DSLIC3R_ENABLE_FORMAT_STEP=ON \
	-DSLIC3R_BUILD_TESTS=OFF \
	-DSLIC3R_BUILD_SANDBOXES=OFF
ninja -C build
DESTDIR=$PKG ninja -C build install

rm -rf "$PKG/usr/share/PrusaSlicer/localization"

cat > "$PKG/usr/share/applications/PrusaSlicer.desktop" <<'EOF'
[Desktop Entry]
Name=PrusaSlicer
GenericName=3D Printing Software
Icon=PrusaSlicer
Exec=prusa-slicer %F
Terminal=false
Type=Application
MimeType=model/stl;model/3mf;model/obj;application/x-amf;
Categories=Graphics;3DGraphics;Engineering;
Keywords=3D;Printing;Slicer;slice;3D;printer;convert;gcode;stl;obj;amf;SLA
StartupNotify=false
StartupWMClass=prusa-slicer
EOF

test -x "$PKG/usr/bin/prusa-slicer"
test -e "$PKG/usr/lib/OCCTWrapper.so"
test -f "$PKG/usr/share/applications/PrusaSlicer.desktop"
test -f "$PKG/usr/share/icons/hicolor/128x128/apps/PrusaSlicer.png"
test -d "$PKG/usr/share/PrusaSlicer/profiles"

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

Contents

Installed programs: prusa-gcodeviewer, prusa-slicer.

Installed directories: /usr/share/PrusaSlicer, /usr/share/licenses/prusaslicer.

Notes

Three small libraries that PrusaSlicer pins and no other port uses are vendored as extra sources and built before the program: libbgcode, the binary G-code format, at the commit _bgcode that upstream’s deps/+LibBGCode names; heatshrink, the compressor under it, built with the CMakeLists.txt and Config.cmake.in upstream ships for it in deps/+heatshrink, which build.sh copies into its source; and fltk’s NanoSVG fork, whose nsvgRasterizeXY() the texture loader calls. Upstream’s dependency build downloads each of them; here each is a source checked against its sha256 in kpkgbuild. Every other dependency is the system’s.

opencascade-tkdestep.patch and occtwrapper-libdir.patch together put OCCTWrapper.so in /usr/lib and have STEP import dlopen() it by name. The test lines at the end of build.sh stop the build if the binary, OCCTWrapper.so, the desktop entry, the 128-pixel icon or the vendor profiles are missing from the package.

PrusaSlicer sets GDK_BACKEND=x11 for itself at start-up, because upstream’s wxGTK path has no Wayland support (upstream’s comment in src/CLI/Setup.cpp says it crashes at start-up otherwise), so it runs under Xwayland.

build.sh removes /usr/share/PrusaSlicer/localization. Its catalogs sit at <lang>/PrusaSlicer.mo, outside any LC_MESSAGES directory and with no language in the file name, so the package-wide English-only rule (see Size and language policy) would keep them; without them the interface shows its English source strings.

Upstream’s desktop entry claims .3mf and .obj files by their aliases (application/vnd.ms-3mfdocument, application/prs.wavefront-obj). Open With matches an entry’s MimeType against the canonical type the glob table names and resolves no alias, so the entry build.sh writes claims model/3mf and model/obj.