backports/cura: new aports

This commit is contained in:
Antoine Martin 2024-01-18 21:59:56 -05:00
parent e811398af9
commit 1a792f23c9
5 changed files with 327 additions and 0 deletions

73
backports/cura/APKBUILD Normal file
View file

@ -0,0 +1,73 @@
# Contributor: Anjandev Momi <anjan@momi.ca>
# Maintainer: Anjandev Momi <anjan@momi.ca>
pkgname=cura
# uranium and curaengine packages must be updated in sync with this verion number
# py3-pynest2d and fdm-materials should be checked as well, but their versions are not always in sync
pkgver=5.2.2
pkgrel=0
pkgdesc="3D printer / slicing GUI built on top of the Uranium framework"
url="https://ultimaker.com/software/ultimaker-cura"
arch="noarch !ppc64le !x86 !armhf !riscv64 !s390x !armv7" # ppc64le: no py3-keyring
# x86: no curaengine
# armhf: no uranium, qt5-qtquickcontrols, qt5-qtquickcontrols2, qt5-qtgraphicaleffects
# riscv64: no uranium
# s390x: no py3-trimesh, no py3-numpy-stl
# armv7: no py3-trimesh
license="LGPL-3.0-or-later"
# add cura-binary-data to depends when packaged
depends="
curaengine
fdm-materials
uranium
py3-arcus
py3-keyring
py3-numpy-stl
py3-pyclipper
py3-pynest2d
py3-pyserial
py3-qt6
py3-requests
py3-trimesh
py3-zeroconf
"
makedepends="samurai cmake gettext gettext-dev" # needs msginit from gettext
checkdepends="py3-pytest"
subpackages="$pkgname-lang"
source="$pkgname-$pkgver.tar.gz::https://github.com/Ultimaker/Cura/archive/refs/tags/$pkgver.tar.gz
AppDesktopData.patch
CuraVersion.patch
cmake-helpers.patch
cmake.patch"
builddir="$srcdir/Cura-$pkgver"
options="!check" # tests broken after v5.x
build() {
cmake -B build -G Ninja \
-DCURA_VERSION=$pkgver \
-DURANIUM_DIR=/usr/share/uranium \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DGETTEXT_MSGINIT_EXECUTABLE=msginit \
-DCURA_BINARY_DATA_DIRECTORY=/usr/share/cura \
-DCMAKE_BUILD_TYPE=minsizerel
cmake --build build
}
package() {
DESTDIR="$pkgdir" cmake --install build
mv $pkgdir/usr/bin/cura_app.py $pkgdir/usr/bin/cura
# don't ever send any user or print info through the internet to Ultimaker
rm -rf "$pkgdir/usr/lib/cura/plugins/SliceInfoPlugin"
install -d "$pkgdir"/usr/share/locale
mv "$pkgdir"/usr/share/cura/resources/i18n/* "$pkgdir"/usr/share/locale/
}
sha512sums="
5d4e0fdc740d0c048905e2b87cc8c73eedea59b54766b74760505902007b365582d22b46b1cfdcd6914828840865c10a3beb0ef6a1f04ea181c81d44f42434bc cura-5.2.2.tar.gz
214e373f6cab7e3ccac12c96d1b5ca636d8d1e9ecdadaae84fc28fb429969c7c2d6055ce2a01b6db3ad85ab6cbc8d135cf2c26c77d7cfe13a73eb81aa5e85f11 AppDesktopData.patch
e3bb302db70ca195b2ce9831e71302c8ee2a51955fecc7264a495d7d4fc9c107cfd48811aa5865f16671e7b1ae126f95d3d7bbb6a70f367f7f91a2b32bce377b CuraVersion.patch
0db4ff97e7f82ae1a9dbc9c330d08c3e46249feeb3fb630f7c4e2de73749327337ec041680c39a07e0b5034c1b3f3656d75614ab4dc2f39861c8e27bdb2a58ef cmake-helpers.patch
05a73f892700ff6279230385b04180873a62b7413fa7f7d55ae150f1bcee57ef05eda0bd7fe444fe660ab66a044c958f42badd33b743fca81033ae8f19dd3805 cmake.patch
"

View file

@ -0,0 +1,58 @@
--- /dev/null
+++ ./com.ultimaker.cura.appdata.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright 2016 Richard Hughes <richard@hughsie.com> -->
+<component type="desktop">
+ <id>com.ultimaker.cura.desktop</id>
+ <metadata_license>CC0-1.0</metadata_license>
+ <project_license>LGPL-3.0 and CC-BY-SA-4.0</project_license>
+ <name>Cura</name>
+ <summary>The world's most advanced 3d printer software</summary>
+ <description>
+ <p>
+ Cura creates a seamless integration between hardware, software and
+ materials for the best 3D printing experience around.
+ Cura supports the 3MF, OBJ and STL file formats and is available on
+ Windows, Mac and Linux.
+ </p>
+ <ul>
+ <li>Novices can start printing right away</li>
+ <li>Experts are able to customize 300 settings to achieve the best results</li>
+ <li>Optimized profiles for Ultimaker materials</li>
+ <li>Supported by a global network of Ultimaker certified service partners</li>
+ <li>Print multiple objects at once with different settings for each object</li>
+ <li>Cura supports STL, 3MF and OBJ file formats</li>
+ <li>Open source and completely free</li>
+ </ul>
+ </description>
+ <screenshots>
+ <screenshot type="default">
+ <image>https://raw.githubusercontent.com/Ultimaker/Cura/master/screenshot.png</image>
+ </screenshot>
+ </screenshots>
+ <url type="homepage">https://ultimaker.com/software/ultimaker-cura?utm_source=cura&amp;utm_medium=software&amp;utm_campaign=cura-update-linux</url>
+ <translation type="gettext">Cura</translation>
+</component>
--- /dev/null
+++ ./com.ultimaker.cura.desktop.in
@@ -0,0 +1,19 @@
+[Desktop Entry]
+Name=Ultimaker Cura
+Name[de]=Ultimaker Cura
+Name[nl]=Ultimaker Cura
+GenericName=3D Printing Software
+GenericName[de]=3D-Druck-Software
+GenericName[nl]=3D-printsoftware
+Comment=Cura converts 3D models into paths for a 3D printer. It prepares your print for maximum accuracy, minimum printing time and good reliability with many extra features that make your print come out great.
+Comment[de]=Cura wandelt 3D-Modelle in Pfade für einen 3D-Drucker um. Es bereitet Ihren Druck für maximale Genauigkeit, minimale Druckzeit und guter Zuverlässigkeit mit vielen zusätzlichen Funktionen vor, damit Ihr Druck großartig wird.
+Comment[nl]=Cura converteert 3D-modellen naar paden voor een 3D printer. Het bereidt je print voor om zeer precies, snel en betrouwbaar te kunnen printen, met veel extra functionaliteit om je print er goed uit te laten komen.
+Exec=@CMAKE_INSTALL_FULL_BINDIR@/cura %F
+TryExec=@CMAKE_INSTALL_FULL_BINDIR@/cura
+Icon=cura-icon
+Terminal=false
+Type=Application
+MimeType=model/stl;application/vnd.ms-3mfdocument;application/prs.wavefront-obj;image/bmp;image/gif;image/jpeg;image/png;text/x-gcode;application/x-amf;application/x-ply;application/x-ctm;model/vnd.collada+xml;model/gltf-binary;model/gltf+json;model/vnd.collada+xml+zip;
+Categories=Graphics;
+Keywords=3D;Printing;Slicer;
+StartupWMClass=cura.real

View file

@ -0,0 +1,16 @@
--- /dev/null
+++ ./cura/CuraVersion.py.in
@@ -0,0 +1,13 @@
+# Copyright (c) 2020 Ultimaker B.V.
+# Cura is released under the terms of the LGPLv3 or higher.
+
+CuraAppName = "@CURA_APP_NAME@"
+CuraAppDisplayName = "@CURA_APP_DISPLAY_NAME@"
+CuraVersion = "@CURA_VERSION@"
+CuraBuildType = "@CURA_BUILDTYPE@"
+CuraDebugMode = True if "@_cura_debugmode@" == "ON" else False
+CuraCloudAPIRoot = "@CURA_CLOUD_API_ROOT@"
+CuraCloudAPIVersion = "@CURA_CLOUD_API_VERSION@"
+CuraCloudAccountAPIRoot = "@CURA_CLOUD_ACCOUNT_API_ROOT@"
+CuraMarketplaceRoot = "@CURA_MARKETPLACE_ROOT@"
+CuraDigitalFactoryURL = "@CURA_DIGITAL_FACTORY_URL@"

View file

@ -0,0 +1,95 @@
--- /dev/null
+++ ./cmake/CuraPluginInstall.cmake
@@ -0,0 +1,92 @@
+# Copyright (c) 2022 Ultimaker B.V.
+# CuraPluginInstall.cmake is released under the terms of the LGPLv3 or higher.
+
+#
+# This module detects all plugins that need to be installed and adds them using the CMake install() command.
+# It detects all plugin folder in the path "plugins/*" where there's a "plugin.json" in it.
+#
+# Plugins can be configured to NOT BE INSTALLED via the variable "CURA_NO_INSTALL_PLUGINS" as a list of string in the
+# form of "a;b;c" or "a,b,c". By default all plugins will be installed.
+#
+
+option(PRINT_PLUGIN_LIST "Should the list of plugins that are installed be printed?" ON)
+
+# Options or configuration variables
+set(CURA_NO_INSTALL_PLUGINS "" CACHE STRING "A list of plugins that should not be installed, separated with ';' or ','.")
+
+file(GLOB_RECURSE _plugin_json_list ${CMAKE_SOURCE_DIR}/plugins/*/plugin.json)
+list(LENGTH _plugin_json_list _plugin_json_list_len)
+
+# Sort the lists alphabetically so we can handle cases like this:
+# - plugins/my_plugin/plugin.json
+# - plugins/my_plugin/my_module/plugin.json
+# In this case, only "plugins/my_plugin" should be added via install().
+set(_no_install_plugin_list ${CURA_NO_INSTALL_PLUGINS})
+# Sanitize the string so the comparison will be case-insensitive.
+string(STRIP "${_no_install_plugin_list}" _no_install_plugin_list)
+string(TOLOWER "${_no_install_plugin_list}" _no_install_plugin_list)
+
+# WORKAROUND counterpart of what's in cura-build.
+string(REPLACE "," ";" _no_install_plugin_list "${_no_install_plugin_list}")
+
+list(LENGTH _no_install_plugin_list _no_install_plugin_list_len)
+
+if(_no_install_plugin_list_len GREATER 0)
+ list(SORT _no_install_plugin_list)
+endif()
+if(_plugin_json_list_len GREATER 0)
+ list(SORT _plugin_json_list)
+endif()
+
+# Check all plugin directories and add them via install() if needed.
+set(_install_plugin_list "")
+foreach(_plugin_json_path ${_plugin_json_list})
+ get_filename_component(_plugin_dir ${_plugin_json_path} DIRECTORY)
+ file(RELATIVE_PATH _rel_plugin_dir ${CMAKE_CURRENT_SOURCE_DIR} ${_plugin_dir})
+ get_filename_component(_plugin_dir_name ${_plugin_dir} NAME)
+
+ # Make plugin name comparison case-insensitive
+ string(TOLOWER "${_plugin_dir_name}" _plugin_dir_name_lowercase)
+
+ # Check if this plugin needs to be skipped for installation
+ set(_add_plugin ON) # Indicates if this plugin should be added to the build or not.
+ set(_is_no_install_plugin OFF) # If this plugin will not be added, this indicates if it's because the plugin is
+ # specified in the NO_INSTALL_PLUGINS list.
+ if(_no_install_plugin_list)
+ if("${_plugin_dir_name_lowercase}" IN_LIST _no_install_plugin_list)
+ set(_add_plugin OFF)
+ set(_is_no_install_plugin ON)
+ endif()
+ endif()
+
+ # Make sure this is not a subdirectory in a plugin that's already in the install list
+ if(_add_plugin)
+ foreach(_known_install_plugin_dir ${_install_plugin_list})
+ if(_plugin_dir MATCHES "${_known_install_plugin_dir}.+")
+ set(_add_plugin OFF)
+ break()
+ endif()
+ endforeach()
+ endif()
+
+ if(_add_plugin)
+ if(${PRINT_PLUGIN_LIST})
+ message(STATUS "[+] PLUGIN TO INSTALL: ${_rel_plugin_dir}")
+ endif()
+ get_filename_component(_rel_plugin_parent_dir ${_rel_plugin_dir} DIRECTORY)
+ install(DIRECTORY ${_rel_plugin_dir}
+ DESTINATION lib${LIB_SUFFIX}/cura/${_rel_plugin_parent_dir}
+ PATTERN "__pycache__" EXCLUDE
+ PATTERN "*.qmlc" EXCLUDE
+ )
+ list(APPEND _install_plugin_list ${_plugin_dir})
+ elseif(_is_no_install_plugin)
+ if(${PRINT_PLUGIN_LIST})
+ message(STATUS "[-] PLUGIN TO REMOVE : ${_rel_plugin_dir}")
+ endif()
+ execute_process(COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/mod_bundled_packages_json.py
+ -d ${CMAKE_CURRENT_SOURCE_DIR}/resources/bundled_packages
+ ${_plugin_dir_name}
+ RESULT_VARIABLE _mod_json_result)
+ endif()
+endforeach()

View file

@ -0,0 +1,85 @@
--- ./CMakeLists.txt.orig
+++ ./CMakeLists.txt
@@ -1,10 +1,6 @@
# Copyright (c) 2022 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
-# NOTE: This is only being used for translation scripts.
-
-# For MSVC flags, will be ignored on non-Windows OS's and this project in general. Only needed for cura-build-environment.
-cmake_policy(SET CMP0091 NEW)
project(cura)
cmake_minimum_required(VERSION 3.18)
@@ -15,8 +11,44 @@
set(URANIUM_DIR "${CMAKE_SOURCE_DIR}/../Uranium" CACHE PATH "The location of the Uranium repository")
set(URANIUM_SCRIPTS_DIR "${URANIUM_DIR}/scripts" CACHE PATH "The location of the scripts directory of the Uranium repository")
+option(CURA_DEBUGMODE "Enable debug dialog and other debug features" OFF)
+if(CURA_DEBUGMODE)
+ set(_cura_debugmode "ON")
+endif()
+
option(GENERATE_TRANSLATIONS "Should the translations be generated?" ON)
+set(CURA_APP_NAME "cura" CACHE STRING "Short name of Cura, used for configuration folder")
+set(CURA_APP_DISPLAY_NAME "Ultimaker Cura" CACHE STRING "Display name of Cura")
+set(CURA_VERSION "master" CACHE STRING "Version name of Cura")
+set(CURA_BUILDTYPE "" CACHE STRING "Build type of Cura, eg. 'PPA'")
+set(CURA_CLOUD_API_ROOT "" CACHE STRING "Alternative Cura cloud API root")
+set(CURA_CLOUD_API_VERSION "" CACHE STRING "Alternative Cura cloud API version")
+set(CURA_CLOUD_ACCOUNT_API_ROOT "" CACHE STRING "Alternative Cura cloud account API version")
+set(CURA_MARKETPLACE_ROOT "" CACHE STRING "Alternative Marketplace location")
+set(CURA_DIGITAL_FACTORY_URL "" CACHE STRING "Alternative Digital Factory location")
+
+configure_file(${CMAKE_SOURCE_DIR}/com.ultimaker.cura.desktop.in ${CMAKE_BINARY_DIR}/com.ultimaker.cura.desktop @ONLY)
+
+configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY)
+
+if(NOT DEFINED Python_VERSION)
+ set(Python_VERSION
+ 3.11
+ CACHE STRING "Python Version" FORCE)
+ message(STATUS "Setting Python version to ${Python_VERSION}. Set Python_VERSION if you want to compile against an other version.")
+endif()
+if(APPLE)
+ set(Python_FIND_FRAMEWORK NEVER)
+endif()
+find_package(Python ${Python_VERSION} EXACT REQUIRED COMPONENTS Interpreter)
+message(STATUS "Linking and building ${project_name} against Python ${Python_VERSION}")
+if(NOT DEFINED Python_SITELIB_LOCAL)
+ set(Python_SITELIB_LOCAL
+ "${Python_SITELIB}"
+ CACHE PATH "Local alternative site-package location to install Cura" FORCE)
+endif()
+
if(NOT ${URANIUM_DIR} STREQUAL "")
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${URANIUM_DIR}/cmake")
endif()
@@ -29,4 +61,24 @@
if(${GENERATE_TRANSLATIONS})
CREATE_TRANSLATION_TARGETS()
endif()
-endif()
\ No newline at end of file
+endif()
+
+install(DIRECTORY resources DESTINATION ${CMAKE_INSTALL_DATADIR}/cura)
+
+include(CuraPluginInstall)
+
+install(FILES cura_app.py DESTINATION ${CMAKE_INSTALL_BINDIR}
+ PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
+install(DIRECTORY cura DESTINATION "${Python_SITELIB_LOCAL}")
+install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py DESTINATION "${Python_SITELIB_LOCAL}/cura/")
+if(NOT APPLE AND NOT WIN32)
+ install(FILES ${CMAKE_BINARY_DIR}/com.ultimaker.cura.desktop
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
+ install(FILES ${CMAKE_SOURCE_DIR}/resources/images/cura-icon.png
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/128x128/apps/)
+ install(FILES com.ultimaker.cura.appdata.xml
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/metainfo)
+ install(FILES cura.sharedmimeinfo
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/mime/packages/
+ RENAME cura.xml )
+endif()