198.1. curaengine-5.13.0
The slicer behind Cura, also usable on its own from the command line
| Version | 5.13.0, release 2 |
| Shelf | fabrication — 3D-printing slicers and hosts, and CNC control |
| Phase | 42_graphics (Graphics Stack), 89 of 189 in build order |
| Licence | AGPL-3.0-or-later |
| Homepage | https://github.com/Ultimaker/CuraEngine |
| Build time | 11.2 SBU |
| Installed size | 5.8 MiB in 2 files |
| Recipe | ports/core/fabrication/curaengine/kpkgbuild |
About
CuraEngine is the slicer behind Cura: it turns a 3D model and a printer’s settings into the G-code a 3D printer runs. Cura starts it as /usr/bin/CuraEngine and drives it over Arcus, its socket protocol; it also runs on its own from the command line, reading machine definitions from the directories CURA_ENGINE_SEARCH_PATH names (the cura port installs them under /usr/share/cura/resources).
Sources
curaengine-5.13.0.tar.gz(1.8 MiB)
sha256287450f5f4d1afaab6954272cc986e1a4ba5c7b71a28303a70f45996c786980e
upstream: https://github.com/Ultimaker/CuraEngine/archive/refs/tags/5.13.0.tar.gz
archive copy: sources-2/fabrication--curaengine-5.13.0.tar.gzconan-ultimaker-index-c4077fc3e719b436d1cdc2032bf3f851b6f089bb.tar.gz(30.5 KiB)
sha256b35b9b112085c299ee5e9e5e15612e5e065d07220d0c9954b776b15cfa5095b5
upstream: https://github.com/Ultimaker/conan-ultimaker-index/archive/c4077fc3e719b436d1cdc2032bf3f851b6f089bb.tar.gz
archive copy: sources-2/fabrication--conan-ultimaker-index-c4077fc3e719b436d1cdc2032bf3f851b6f089bb.tar.gzscripta-b96045cd9b531d97f42dec8c9a0ef52f773f6b90.tar.gz(16.7 KiB)
sha2560b6737514ba08f68750263c5198ee0e36597ffbbe241ced89c9dd90bd99b05d3
upstream: https://github.com/Ultimaker/Scripta_public/archive/b96045cd9b531d97f42dec8c9a0ef52f773f6b90.tar.gz
archive copy: sources-2/fabrication--scripta-b96045cd9b531d97f42dec8c9a0ef52f773f6b90.tar.gzstb-5736b15f7ea0ffb08dd38af21067c314d6a3aae9.tar.gz(1.3 MiB)
sha256d00921d49b06af62aa6bfb97c1b136bec661dd11dd4eecbcb0da1f6da7cedb4c
upstream: https://github.com/nothings/stb/archive/5736b15f7ea0ffb08dd38af21067c314d6a3aae9.tar.gz
archive copy: sources-2/fabrication--stb-5736b15f7ea0ffb08dd38af21067c314d6a3aae9.tar.gzwagyu-0.5.0.tar.gz(803.1 KiB)
sha25688c41eaba03107ebe79052fdbd66e419e903d331a2616a51849018e13648ab83
upstream: https://github.com/mapbox/wagyu/archive/refs/tags/0.5.0.tar.gz
archive copy: sources-2/fabrication--wagyu-0.5.0.tar.gzgeometry.hpp-2.0.3.tar.gz(19.1 KiB)
sha2569d750d34576069bcc4f39677af08cde2862fbe4b8c0d9af504877c2fae2ae273
upstream: https://github.com/mapbox/geometry.hpp/archive/refs/tags/v2.0.3.tar.gz
archive copy: sources-2/fabrication--geometry.hpp-2.0.3.tar.gzvariant-1.2.0.tar.gz(125.9 KiB)
sha2567059f4420d504c4bc96f8a462a0f6d029c5be914ba55cc030a0a773366dd7bc8
upstream: https://github.com/mapbox/variant/archive/refs/tags/v1.2.0.tar.gz
archive copy: sources-2/fabrication--variant-1.2.0.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, libarcus, protobuf, abseil-cpp, polyclipping, range-v3, rapidjson, boost, spdlog, fmt, onetbb, libpng, zlib.
Required by (1): cura.
Patches
build.sh applies these; kpkg applies nothing by itself.
include-iomanip.patch— Adds#include <iomanip>tosrc/utils/OBJ.cpp, which callsstd::setprecisionand includes no header that declares it here.wagyu-execinfo.patch— Applied to the wagyu source, not CuraEngine’s: inring.hppandring_util.hpp, includes<execinfo.h>for the debug backtrace only whenDEBUGis defined and the header exists (__has_include). musl has noexecinfo.h. It is the patch Ultimaker’s own Conan recipe for wagyu applies.
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 curaengine'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/fabrication/curaengine.
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/curaengine
echo '287450f5f4d1afaab6954272cc986e1a4ba5c7b71a28303a70f45996c786980e curaengine-5.13.0.tar.gz' | sha256sum -c -
echo 'b35b9b112085c299ee5e9e5e15612e5e065d07220d0c9954b776b15cfa5095b5 conan-ultimaker-index-c4077fc3e719b436d1cdc2032bf3f851b6f089bb.tar.gz' | sha256sum -c -
echo '0b6737514ba08f68750263c5198ee0e36597ffbbe241ced89c9dd90bd99b05d3 scripta-b96045cd9b531d97f42dec8c9a0ef52f773f6b90.tar.gz' | sha256sum -c -
echo 'd00921d49b06af62aa6bfb97c1b136bec661dd11dd4eecbcb0da1f6da7cedb4c stb-5736b15f7ea0ffb08dd38af21067c314d6a3aae9.tar.gz' | sha256sum -c -
echo '88c41eaba03107ebe79052fdbd66e419e903d331a2616a51849018e13648ab83 wagyu-0.5.0.tar.gz' | sha256sum -c -
echo '9d750d34576069bcc4f39677af08cde2862fbe4b8c0d9af504877c2fae2ae273 geometry.hpp-2.0.3.tar.gz' | sha256sum -c -
echo '7059f4420d504c4bc96f8a462a0f6d029c5be914ba55cc030a0a773366dd7bc8 variant-1.2.0.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/curaengine
SRC=$SRC_ROOT/curaengine-5.13.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf curaengine-5.13.0.tar.gz -C "$SRC" --strip-components=1
tar --no-same-permissions --warning=no-unknown-keyword -xf conan-ultimaker-index-c4077fc3e719b436d1cdc2032bf3f851b6f089bb.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf scripta-b96045cd9b531d97f42dec8c9a0ef52f773f6b90.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf stb-5736b15f7ea0ffb08dd38af21067c314d6a3aae9.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf wagyu-0.5.0.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf geometry.hpp-2.0.3.tar.gz -C "$SRC_ROOT"
tar --no-same-permissions --warning=no-unknown-keyword -xf variant-1.2.0.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 _index, _scripta, _stb, _wagyu, _geometry, _variant and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -d "$SRC_ROOT/wagyu-$_wagyu" -p1 -i "$PORT_SRC/wagyu-execinfo.patch"
patch -p1 -i "$PORT_SRC/include-iomanip.patch"
_shim="$SRC_ROOT/shim"
mkdir -p "$_shim"
printf 'include("%s")\n' \
"$SRC_ROOT/conan-ultimaker-index-$_index/recipes/standardprojectsettings/all/StandardProjectSettings.cmake" \
> "$_shim/standardprojectsettings-config.cmake"
_iface() {
_pkg=$1 _tgt=$2; shift 2
{
printf 'if(NOT TARGET %s)\n' "$_tgt"
printf '\tadd_library(%s INTERFACE IMPORTED)\n' "$_tgt"
printf '\tset_target_properties(%s PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "%s")\n' \
"$_tgt" "$*"
printf 'endif()\n'
} > "$_shim/$_pkg-config.cmake"
}
_iface scripta scripta::scripta "$SRC_ROOT/Scripta_public-$_scripta/include"
_iface stb stb::stb "$SRC_ROOT/stb-$_stb"
_iface mapbox-wagyu mapbox-wagyu::mapbox-wagyu \
"$SRC_ROOT/wagyu-$_wagyu/include;$SRC_ROOT/geometry.hpp-$_geometry/include;$SRC_ROOT/variant-$_variant/include"
cat > "$_shim/clipper-config.cmake" <<'CMAKE'
find_package(PkgConfig REQUIRED)
pkg_check_modules(POLYCLIPPING REQUIRED IMPORTED_TARGET polyclipping)
if(NOT TARGET clipper::clipper)
add_library(clipper::clipper INTERFACE IMPORTED)
target_link_libraries(clipper::clipper INTERFACE PkgConfig::POLYCLIPPING)
endif()
CMAKE
cat > "$_shim/aliases.cmake" <<'CMAKE'
find_package(Boost CONFIG REQUIRED)
add_library(boost::boost INTERFACE IMPORTED)
target_link_libraries(boost::boost INTERFACE Boost::headers)
find_package(TBB CONFIG REQUIRED)
add_library(onetbb::onetbb INTERFACE IMPORTED)
target_link_libraries(onetbb::onetbb INTERFACE TBB::tbb)
find_path(RAPIDJSON_SHIM_INCLUDE rapidjson/rapidjson.h REQUIRED)
add_library(rapidjson INTERFACE IMPORTED)
set_target_properties(rapidjson PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${RAPIDJSON_SHIM_INCLUDE}")
CMAKE
cmake -S . -B build -G Ninja -Wno-dev \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_STANDARD=20 \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCURA_ENGINE_VERSION="$version" \
-DENABLE_ARCUS=ON \
-DENABLE_PLUGINS=OFF \
-DENABLE_REMOTE_PLUGINS=OFF \
-DENABLE_SENTRY=OFF \
-DENABLE_TESTING=OFF \
-DENABLE_BENCHMARKS=OFF \
-DEXTENSIVE_WARNINGS=OFF \
-DENABLE_MORE_COMPILER_OPTIMIZATION_FLAGS=OFF \
-DENABLE_THREADING=ON \
-Dprotobuf_MODULE_COMPATIBLE=ON \
-Dstandardprojectsettings_DIR="$_shim" \
-Dscripta_DIR="$_shim" \
-Dstb_DIR="$_shim" \
-Dmapbox-wagyu_DIR="$_shim" \
-Dclipper_DIR="$_shim" \
-DCMAKE_PROJECT_INCLUDE="$_shim/aliases.cmake"
ninja -C build CuraEngine
install -Dm755 build/CuraEngine "$PKG/usr/bin/CuraEngine"
The switches, and why each is set:
-DCMAKE_CXX_STANDARD=20— Compile as C++20. Upstream’s build gets its standard from Conan’s toolchain, which this build does not use.-DCURA_ENGINE_VERSION="$version"— The version compiled into the engine and printed by it; Conan’s recipe passes it.-DENABLE_ARCUS=ON— Build the Arcus front end Cura talks to, on libarcus and protobuf, which compilesCura.proto.-DENABLE_PLUGINS=OFF,-DENABLE_REMOTE_PLUGINS=OFF— Build without the gRPC plugin system, which needs asio-grpc, gRPC and Ultimaker’s plugin definitions, and so without remote plugins, which only exist with it.-DENABLE_SENTRY=OFF— Send no crash reports to Sentry.-DENABLE_TESTING=OFF,-DENABLE_BENCHMARKS=OFF— Build no unit tests and no benchmarks.-DEXTENSIVE_WARNINGS=OFF— Do not add the long warning list ofset_project_warnings()from the project settings module.-DENABLE_MORE_COMPILER_OPTIMIZATION_FLAGS=OFF— Declared as an option inCMakeLists.txtand read nowhere else in this release, so it changes nothing.-DENABLE_THREADING=ON— Link the engine and its static library_CuraEngineagainst the thread library through the project settings’use_threads(). It is upstream’s default, stated. onetbb is found and linked either way.-Dprotobuf_MODULE_COMPATIBLE=ON— Make protobuf’s CMake package also define the variables and functions of CMake’s oldFindProtobufmodule,protobuf_generate_cpp()among them, which CuraEngine calls to compileCura.proto.-Dstandardprojectsettings_DIR="$_shim",-Dscripta_DIR="$_shim",-Dstb_DIR="$_shim",-Dmapbox-wagyu_DIR="$_shim",-Dclipper_DIR="$_shim",-DCMAKE_PROJECT_INCLUDE="$_shim/aliases.cmake"— Point each of CuraEngine’sfind_package()calls that only Conan answers at the shim filesbuild.shwrites; see Notes.
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/curaengine, 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 curaengine-5.13.0-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/curaengine, and runs the triggers its paths call for.
Contents
Installed programs: CuraEngine.
Installed directories: /usr/share/licenses/curaengine.
Notes
- The Conan shim. CuraEngine’s CMake is written for Conan: it loads its compiler settings as a package called
standardprojectsettingsand links every dependency by the target name Conan’s recipes generate.build.shanswers each name from the system, in$SRC_ROOT/shim, which never reaches the package:standardprojectsettingsincludesStandardProjectSettings.cmakefrom the pinnedconan-ultimaker-indexsource.scripta,stbandmapbox-wagyuare header-only interface targets made by the_ifacefunction, pointing at the pinned Scripta (slicing-debug hooks, compiled out), stb (forstb_image, which reads density images) and wagyu (polygon repair, with mapbox’sgeometry.hppandvariantheaders it is written against). No other port uses these header libraries, so each is a source of this recipe at the version Ultimaker’s recipes name.clipper::clipperwraps polyclipping’s pkg-config file.aliases.cmake, run right afterproject()throughCMAKE_PROJECT_INCLUDE, adds Conan’s names as aliases of real packages:boost::boostfor Boost’s headers,onetbb::onetbbforTBB::tbb, andrapidjsonfor the RapidJSON include directory.
- Only the binary is installed. The project has no install rules; upstream’s
conanfile.pycopies the binary and the static_CuraEnginelibrary by hand.build.shbuilds only theCuraEnginetarget and installs the binary.