~ruther/guix-local

f6b3eca6f33c50f2981f7dc7821df641e34c2481 — nomike a year ago 687989e
gnu: prusa-slicer: Update to 2.9.2

* gnu/packages/patches/prusa-slicer-add-cmake-module.patch:
New file.
* gnu/packages/patches/prusa-slicer-fix-tests.patch: Remove file.
* gnu/local.mk (dist_patch_DATA): Register new patch, unregister
removed patch.
* gnu/packages/engineering.scm (prusa-slicer): Update to 2.9.2
[source]: Update patches.  Update paths to bundled libraries.  Properly
remove libexpat from target_link_libraries.
[native-inputs]: Replace catch2 by catch2-3.8.
[inputs]: Replace opencascade-occt by opencascade-occt-7.6.1.  Add openssl,
webkitgtk-for-gtk3 and webkitgtk-with-libsoup2 for the new built-in browser
functionality.  Add z3.
[description]: Extend description.

Change-Id: If8c1b23b74e4eba2524276401e4fa468acc14901
Signed-off-by: Andreas Enge <andreas@enge.fr>
4 files changed, 88 insertions(+), 32 deletions(-)

M gnu/local.mk
M gnu/packages/engineering.scm
A gnu/packages/patches/prusa-slicer-add-cmake-module.patch
D gnu/packages/patches/prusa-slicer-fix-tests.patch
M gnu/local.mk => gnu/local.mk +1 -1
@@ 2047,7 2047,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/pounce-readable-checks.patch             \
  %D%/packages/patches/ppsspp-disable-upgrade-and-gold.patch		\
  %D%/packages/patches/procps-strtod-test.patch                 \
  %D%/packages/patches/prusa-slicer-fix-tests.patch		\
  %D%/packages/patches/prusa-slicer-add-cmake-module.patch \
  %D%/packages/patches/prusa-wxwidgets-makefile-fix.patch	\
  %D%/packages/patches/pthreadpool-system-libraries.patch	\
  %D%/packages/patches/python-3.11-fix-tests.patch		\

M gnu/packages/engineering.scm => gnu/packages/engineering.scm +38 -14
@@ 181,6 181,7 @@
  #:use-module (gnu packages tree-sitter)
  #:use-module (gnu packages version-control)
  #:use-module (gnu packages web)
  #:use-module (gnu packages webkit)
  #:use-module (gnu packages wxwidgets)
  #:use-module (gnu packages xdisorg)
  #:use-module (gnu packages xiph)


@@ 4616,7 4617,7 @@ G-codes to binary and vice versa.")
(define-public prusa-slicer
  (package
    (name "prusa-slicer")
    (version "2.7.4")
    (version "2.9.2")
    (source
     (origin
       (method git-fetch)


@@ 4625,8 4626,8 @@ G-codes to binary and vice versa.")
         (url "https://github.com/prusa3d/PrusaSlicer")
         (commit (string-append "version_" version))))
       (file-name (git-file-name name version))
       (sha256 (base32 "0s1cfvhfilyv0y98asr61c6rwlgyr1hf5v5hg8q9zwmzm2bkcql3"))
       (patches (search-patches "prusa-slicer-fix-tests.patch"))
       (sha256 (base32 "05zwwhqv3fjg9rx6a4ga55f4ic1136f6lwms0kb4kaq50w9dvxwg"))
       (patches (search-patches "prusa-slicer-add-cmake-module.patch"))
       (modules '((guix build utils)))
       (snippet
        `(begin


@@ 4634,25 4635,40 @@ G-codes to binary and vice versa.")
           ;; Most of them contain prusa-specific modifications (e.g. avrdude),
           ;; but others do not. Here we replace the latter with Guix packages.
           ;; Remove bundled libraries that were not modified by Prusa Slicer developers.
           (delete-file-recursively "src/hidapi")
           (delete-file-recursively "src/eigen")
           (delete-file-recursively "src/libigl/igl")
           (delete-file-recursively "bundled_deps/hidapi")
           (delete-file-recursively "bundled_deps/libigl/igl")
           (substitute* "CMakeLists.txt"
             (("target_link_libraries\\(libexpat INTERFACE EXPAT::EXPAT\\)")
              "")
             (("add_library\\(libexpat INTERFACE\\)")
              ""))
           (substitute* "src/libigl/CMakeLists.txt"
           (substitute* "bundled_deps/CMakeLists.txt"
             (("add_subdirectory\\(hidapi\\)")
              ""))
           (substitute* "bundled_deps/libigl/CMakeLists.txt"
             (("target_link_libraries\\(libigl INTERFACE igl::core\\)") ""))
           (substitute* "src/CMakeLists.txt"
             (("add_subdirectory\\(hidapi\\)")
              "pkg_check_modules(HIDAPI REQUIRED hidapi-hidraw)")
             (("include_directories\\(hidapi/include\\)")
              "include_directories()"))
              "include_directories()")
            (("add_library\\(libexpat INTERFACE\\)")
            "")
            (("target_link_libraries\\(libexpat INTERFACE EXPAT::EXPAT\\)")
            "")
            (("list\\(APPEND wxWidgets_LIBRARIES libexpat\\)")
            "list(APPEND wxWidgets_LIBRARIES expat)"))
            (substitute* "src/libslic3r/CMakeLists.txt"
            (("libexpat")
            "expat"))
           (substitute* "src/slic3r/CMakeLists.txt"
             (("add_library\\(libslic3r_gui.*" all)
              (string-append
               "find_package(HidAPI REQUIRED)\n"
               all
               "\ntarget_include_directories(libslic3r_gui PUBLIC ${HIDAPI_INCLUDE_DIRS})\n"))
             (("\\bhidapi\\b") "${HIDAPI_LIBRARIES}"))))))
               "\ntarget_include_directories(libslic3r_gui PUBLIC ${HIDAPI_INCLUDE_DIR})\n"))
             (("    hidapi")
              "    ${HIDAPI_LIBRARY}"))))))
    (build-system cmake-build-system)
    (arguments
     (list #:configure-flags


@@ 4674,7 4690,7 @@ G-codes to binary and vice versa.")
                     (("#include <libigl/igl/qslim.h>")
                      "#include <igl/qslim.h>")))))))
    (native-inputs
     (list pkg-config catch2))
     (list pkg-config catch2-3.8))
    (inputs
     (list boost
           cereal


@@ 4698,7 4714,8 @@ G-codes to binary and vice versa.")
           mpfr
           nanosvg
           nlopt
           opencascade-occt
           opencascade-occt-7.6.1
           openssl
           openvdb
           pango
           prusa-libbgcode


@@ 4707,11 4724,18 @@ G-codes to binary and vice versa.")
           prusa-wxwidgets
           qhull
           tbb
           webkitgtk-for-gtk3
           webkitgtk-with-libsoup2
           z3
           zlib))
    (home-page "https://www.prusa3d.com/prusaslicer/")
    (synopsis "G-code generator for 3D printers (RepRap, Makerbot, Ultimaker etc.)")
    (description "PrusaSlicer takes 3D models (STL, OBJ, AMF) and converts them into
G-code instructions for FFF printers or PNG layers for mSLA 3D printers.")
    (description "PrusaSlicer takes 3D models (STL, OBJ, AMF) and converts
them into G-code instructions for FFF printers or PNG layers for mSLA 3D
printers.  It is compatible with any modern printer based on the RepRap
toolchain, including all those based on the Marlin, Prusa, Sprinter and
Repetier firmware.  It also works with Mach3, LinuxCNC and Machinekit
controllers.")
    (license license:agpl3)

    ;; Mark as tunable to take advantage of SIMD code in Eigen and in libigl.

A gnu/packages/patches/prusa-slicer-add-cmake-module.patch => gnu/packages/patches/prusa-slicer-add-cmake-module.patch +49 -0
@@ 0,0 1,49 @@
From 23f1b40dbf6223b4b8af3845efe64b076998b2d7 Mon Sep 17 00:00:00 2001
From: nomike <nomike@nomike.com>
Date: Sat, 12 Jul 2025 03:14:16 +0200
Subject: [PATCH] Add CMake module for finding HidAPI library

---
 cmake/modules/FindHidAPI.cmake | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 cmake/modules/FindHidAPI.cmake

diff --git a/cmake/modules/FindHidAPI.cmake b/cmake/modules/FindHidAPI.cmake
new file mode 100644
index 000000000..0fdcecf88
--- /dev/null
+++ b/cmake/modules/FindHidAPI.cmake
@@ -0,0 +1,30 @@
+find_package(PkgConfig)
+pkg_search_module(PC_HIDAPI QUIET hidapi hidapi-libusb)
+
+find_path(HIDAPI_INCLUDE_DIR NAMES hidapi.h
+	HINTS
+	${PC_HIDAPI_INCLUDEDIR}
+	${PC_HIDAPI_INCLUDE_DIRS})
+
+find_library(HIDAPI_LIBRARY NAMES hidapi hidapi-libusb
+	HINTS
+	${PC_HIDAPI_LIBDIR}
+	${PC_HIDAPI_LIBRARY_DIRS})
+
+if(HIDAPI_INCLUDE_DIR AND EXISTS "${HIDAPI_INCLUDE_DIR}/hidapi.h")
+  file(STRINGS "${HIDAPI_INCLUDE_DIR}/hidapi.h" hidapi_version_major
+      REGEX "^#define[\t ]+HID_API_VERSION_MAJOR[\t ]+[0-9]+")
+  file(STRINGS "${HIDAPI_INCLUDE_DIR}/hidapi.h" hidapi_version_minor
+      REGEX "^#define[\t ]+HID_API_VERSION_MINOR[\t ]+[0-9]+")
+  file(STRINGS "${HIDAPI_INCLUDE_DIR}/hidapi.h" hidapi_version_patch
+      REGEX "^#define[\t ]+HID_API_VERSION_PATCH[\t ]+[0-9]+")
+  string(REGEX REPLACE "[^0-9.]" "" HIDAPI_VERSION_STRING "${hidapi_version_major}.${hidapi_version_minor}.${hidapi_version_patch}")
+  unset(hidapi_version_major)
+  unset(hidapi_version_minor)
+  unset(hidapi_version_patch)
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(HidAPI REQUIRED_VARS HIDAPI_LIBRARY HIDAPI_INCLUDE_DIR)
+
+mark_as_advanced(HIDAPI_INCLUDE_DIR HIDAPI_LIBRARY)
-- 
2.50.0


D gnu/packages/patches/prusa-slicer-fix-tests.patch => gnu/packages/patches/prusa-slicer-fix-tests.patch +0 -17
@@ 1,17 0,0 @@
This patch comes from Gentoo:
 portage/media-gfx/prusaslicer/files/prusaslicer-2.5.0_rc1-fix-tests.patch

--- a/tests/fff_print/test_data.cpp
+++ b/tests/fff_print/test_data.cpp
@@ -4,10 +4,9 @@
 #include "libslic3r/GCodeReader.hpp"
 #include "libslic3r/Config.hpp"
 #include "libslic3r/Print.hpp"
-#include "libslic3r/Format/OBJ.hpp"
-#include "libslic3r/Format/STL.hpp"

 #include <cstdlib>
+#include <fstream>
 #include <string>

 #include <boost/nowide/cstdio.hpp>