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
prusaslicer-2.9.6.tar.gz(78.3 MiB)
sha2568f9f40d93838b912bd9ed35e598c0b7eabd08024cb18aa620c6aa9f9d49d0b57
upstream: https://github.com/prusa3d/PrusaSlicer/archive/refs/tags/version_2.9.6.tar.gz
archive copy: sources-2/fabrication--prusaslicer-2.9.6.tar.gzlibbgcode-6f4ad7ce6b0e638b760199d6611039a610a5a479.tar.gz(520.5 KiB)
sha256f40e669226e9d3236799e22347ee7727bd411d3993b79c192717b1ce6f22efc5
upstream: https://github.com/prusa3d/libbgcode/archive/6f4ad7ce6b0e638b760199d6611039a610a5a479.tar.gz
archive copy: sources-2/fabrication--libbgcode-6f4ad7ce6b0e638b760199d6611039a610a5a479.tar.gznanosvg-abcd277ea45e9098bed752cf9c6875b533c0892f.tar.gz(291.3 KiB)
sha256700f6c7b246a9d132fdc061f167df20b87312bc6d9bc2fc68034b1ad7cd24307
upstream: https://github.com/fltk/nanosvg/archive/abcd277ea45e9098bed752cf9c6875b533c0892f.tar.gz
archive copy: sources-2/fabrication--nanosvg-abcd277ea45e9098bed752cf9c6875b533c0892f.tar.gzheatshrink-0.4.1.tar.gz(36.1 KiB)
sha2567529a1c8ac501191ad470b166773364e66d9926aad632690c72c63a1dea7e9a6
upstream: https://github.com/atomicobject/heatshrink/archive/refs/tags/v0.4.1.tar.gz
archive copy: sources-2/fabrication--heatshrink-0.4.1.tar.gz
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.
boost-1.87.patch— Boost 1.87 removesboost::asio::io_serviceand itspost()member, and a resolve returns a range of endpoints rather than an iterator. The patch usesio_contextin the firmware dialog, the Bonjour client and the serial port, callsboost::asio::poston the executor in the Bonjour client, and has the TCP console connect to the first endpoint of a resolve throughbegin().boost-1.88.patch— Includes Boost.Process’s version 1 headers explicitly (BOOST_PROCESS_VERSION 1,<boost/process/v1/...>) in the G-code post-processor and the removable-drive manager, since<boost/process.hpp>names version 2 from Boost 1.88.boost-1.89.patch— Dropssystemfrom the Boost components the build asks for, because the header-onlyboost_systemhas no library to find, and includes<boost/asio/deadline_timer.hpp>directly in the Bonjour client, which uses the timer.cgal6.patch— CGAL 6 returnsstd::optionalfrom a surface mesh’sproperty_map()where CGAL 5 returned a pair; the patch takes.value()instead of.first, and renamesCGAL::AABB_traitstoAABB_traits_3, in the cut-surface code (CutSurface.cpp) and the emboss test.eigen5.patch— Eigen 5 fails thefind_package(Eigen3 3.3.7)version check and dropsDynamicSparseMatrix; the patch asks for Eigen3 with no version and rewrites the bundled libigl’sdiag,sliceandslice_intowith an uncompressedSparseMatrix. Itsigl::slicehunk assigns the result to the const inputXinstead of the outputY; it compiles only because PrusaSlicer uses libigl header-only and nothing in it instantiates that template.imgui-hint-segfault.patch— Fix segfault due to uninitialized imgui in wxwidgets3.2Bug-Debian: https://bugs.debian.org/1022234 From: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1022234#15 Forwarded: no
occtwrapper-libdir.patch— Install OCCTWrapper into libdir on LinuxThe FHS says that libraries should be installed in the library directory on Linux.
opencascade-tkdestep.patch— OpenCASCADE 7.8 merged the STEP toolkits (TKXDESTEP,TKSTEP,TKSTEP209,TKSTEPAttr,TKSTEPBase) intoTKDESTEP; the patch links that one, asks for OpenCASCADE with no version, and installsOCCTWrapperinto the library directory.serial-unistd.patch—src/slic3r/Utils/Serial.cppincludes<sys/unistd.h>, a name only glibc carries; the patch includes<unistd.h>.
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:
-DCMAKE_INSTALL_PREFIX=$_deps— With the rest of_depopts: the three small libraries built first (see Notes) are configured static (-DBUILD_SHARED_LIBS=OFF), position-independent, and installed into the private prefix$SRC_ROOT/deps, which never reaches the package.-DLibBGCode_BUILD_TESTS=OFF— With-DLibBGCode_BUILD_CMD_TOOL=OFF: libbgcode without its unit tests or itsbgcodecommand-line tool.-DLibBGCode_BUILD_DEPS=OFF— libbgcode does not run its own dependency build, which would download heatshrink; it finds the heatshrink built just before it in the prefix.-isystem $_deps/include— Added toCXXFLAGS. The sources include<nanosvg/nanosvg.h>, and NanoSVG’s CMake package exports thenanosvg/directory itself as its include directory. Targets that link libbgcode get the prefix’sinclude/from it;libslic3r_cgal, which links none of the private libraries, does not. Giving the prefix’sinclude/to every target covers both.-DCMAKE_PREFIX_PATH="$_deps"— Finds the private prefix ahead of/usr.-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON— Has everyfind_packagetry the library’s own CMake package before aFindmodule. Upstream sets it only for its static build.-DOPENVDB_FIND_MODULE_PATH=/usr/lib/cmake/OpenVDB— PrusaSlicer’s bundledFindOpenVDB.cmakefirst tries theFindOpenVDB.cmakein this directory, the one the openvdb port installs, and falls back to its own search only when that one finds nothing. Configure stops with a fatal error when neither finds OpenVDB.-DSLIC3R_STATIC=OFF— Links the tree’s libraries dynamically; only the three private libraries in$_depsare static. Upstream’s default on Linux, named.-DSLIC3R_FHS=ON— Installs into a standard FHS layout: resources, vendor profiles, desktop entries and hicolor icons under/usr/share.-DSLIC3R_GTK=3— With-DSLIC3R_GUI=ON: the GUI, on GTK 3.-DSLIC3R_PCH=OFF— No precompiled headers; upstream’s default is on.-DSLIC3R_ENABLE_FORMAT_STEP=ON— STEP import, through theOCCTWrapper.somodule built on opencascade. Upstream’s default, named.-DSLIC3R_BUILD_TESTS=OFF— No unit tests; upstream’s default is on.-DSLIC3R_BUILD_SANDBOXES=OFF— No developer sandboxes. Upstream’s default, named.
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.