[PATCH 1/3] gnu: cereal: Use cmake to build and install the library.

  • Done
  • quality assurance status badge
Details
3 participants
  • Ivan Gankevich
  • Liliana Marie Prikler
  • phodina
Owner
unassigned
Submitted by
Ivan Gankevich
Severity
normal
I
I
Ivan Gankevich wrote on 23 Jul 2021 23:00
(address . guix-patches@gnu.org)(name . Ivan Gankevich)(address . i.gankevich@spbu.ru)
20210723210037.28150-1-i.gankevich@spbu.ru
Hello,

this series of patches adds Prusa Slicer. I had to change "cereal"
package definition to use cmake, otherwise "prusa-slicer" failed
to find the library. Also, I added "libigl" that is a dependency
of "prusa-slicer".

gnu/packages/serialization.scm (cereal): Use cmake.

* Replace manual build and installation with standard cmake.
The main reason to do that is to get "cereal-config.cmake"
file that is used to find the library in other projects.
---

gnu/packages/serialization.scm | 39 ++++++++++++----------------------
1 file changed, 13 insertions(+), 26 deletions(-)

Toggle diff (52 lines)
diff --git a/gnu/packages/serialization.scm b/gnu/packages/serialization.scm
index 8f292ae408..9c34da62af 100644
--- a/gnu/packages/serialization.scm
+++ b/gnu/packages/serialization.scm
@@ -141,32 +141,19 @@ implement RPC protocols.")
"0hc8wh9dwpc1w1zf5lfss4vg5hmgpblqxbrpp1rggicpx9ar831p"))))
(build-system cmake-build-system)
(arguments
- `(;; The only included tests are portability tests requiring
- ;; cross-compilation and boost. Since we are building cereal on more
- ;; platforms anyway, there is no compelling reason to build the tests.
- #:tests? #f
- #:out-of-source? #f
- #:phases
- (modify-phases %standard-phases
- (delete 'configure)
- (replace 'build
- (lambda _
- (substitute* "doc/doxygen.in"
- (("@CMAKE_CURRENT_BINARY_DIR@") ".")
- (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
- (with-directory-excursion "doc"
- (invoke "doxygen" "doxygen.in"))))
- ;; There is no "install" target, so we have to provide our own
- ;; "install" phase.
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (doc (string-append out "/share/cereal/docs"))
- (include (string-append out "/include/cereal")))
- (mkdir-p doc)
- (mkdir-p include)
- (copy-recursively "include/cereal" include)
- (copy-recursively "doc/html" doc)))))))
+ `(#:configure-flags (list "-DSKIP_PORTABILITY_TEST=ON")
+ #:tests? #f
+ #:phases (modify-phases %standard-phases
+ (add-before 'configure 'skip-sandbox
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ (("add_subdirectory\\(sandbox\\)") ""))))
+ (add-after 'install 'install-doc
+ (lambda _
+ (let ((doc (string-append %output "/share/doc/html")))
+ (invoke "make" "doc")
+ (mkdir-p doc)
+ (copy-recursively "doc/html" doc)))))))
(native-inputs
`(("doxygen" ,doxygen)))
(home-page "https://uscilab.github.io/cereal/")
--
2.32.0
I
I
Ivan Gankevich wrote on 23 Jul 2021 23:07
[PATCH 2/3] gnu: Add libigl.
(address . 49713@debbugs.gnu.org)(name . Ivan Gankevich)(address . i.gankevich@spbu.ru)
20210723210731.9246-1-i.gankevich@spbu.ru
* gnu/packages/engineering.scm (libigl): New variable.
---
gnu/packages/engineering.scm | 62 ++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)

Toggle diff (72 lines)
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index fc932ddb28..eec12814ff 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2862,3 +2862,65 @@ for hooking Linux system calls in user space. This is achieved by
hot-patching the machine code of the standard C library in the memory of
a process.")
(license license:bsd-2))))
+
+(define-public libigl
+ (package
+ (name "libigl")
+ (version "2.3.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/libigl")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "004a22ifq2vibgkgvrlyihqimpsfizvq5l448204kwfg3lkycajj"))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:configure-flags
+ (list "-DLIBIGL_USE_STATIC_LIBRARY=OFF"
+ "-DLIBIGL_BUILD_TESTS=OFF" ;; tests need to download test data
+ "-DLIBIGL_BUILD_TUTORIALS=OFF"
+ "-DLIBIGL_EXPORT_TARGETS=ON"
+ "-DLIBIGL_WITH_CGAL=ON"
+ "-DLIBIGL_WITH_COMISO=OFF"
+ "-DLIBIGL_WITH_CORK=OFF"
+ "-DLIBIGL_WITH_EMBREE=OFF"
+ "-DLIBIGL_WITH_MATLAB=OFF"
+ "-DLIBIGL_WITH_MOSEK=OFF"
+ "-DLIBIGL_WITH_OPENGL=OFF"
+ "-DLIBIGL_WITH_OPENGL_GLFW=OFF"
+ "-DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF"
+ "-DLIBIGL_WITH_PNG=OFF"
+ "-DLIBIGL_WITH_TETGEN=OFF"
+ "-DLIBIGL_WITH_TRIANGLE=OFF"
+ "-DLIBIGL_WITH_PREDICATES=OFF"
+ "-DLIBIGL_WITH_XML=OFF")
+ #:tests? #f
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'configure 'do-not-download-dependencies
+ (lambda _
+ (substitute* "cmake/libigl.cmake"
+ (("if\\(NOT TARGET Eigen3::Eigen\\)" all)
+ (string-append "find_package(Eigen3 CONFIG REQUIRED)\n" all))
+ (("if\\(NOT TARGET CGAL::CGAL\\)" all)
+ (string-append "find_package(CGAL CONFIG COMPONENTS Core)\n" all)))))
+ (add-after 'install 'install-all-subdirs
+ (lambda _
+ (copy-recursively
+ "../source/include"
+ (string-append (assoc-ref %outputs "out") "/include")))))))
+ (inputs
+ `(("eigen" ,eigen)
+ ("cgal" ,cgal)
+ ("gmp" ,gmp)
+ ("mpfr" ,mpfr)
+ ("boost" ,boost)))
+ (home-page "https://libigl.github.io/")
+ (synopsis "Simple C++ geometry processing library")
+ (description "The library provides functionality for shape modelling,
+visualization, matrix manipulation.")
+ (license (list license:gpl3 license:mpl2.0))))
--
2.32.0
I
I
Ivan Gankevich wrote on 23 Jul 2021 23:08
[PATCH 3/3] gnu: Add prusa-slicer.
(address . 49713@debbugs.gnu.org)(name . Ivan Gankevich)(address . i.gankevich@spbu.ru)
20210723210801.9458-1-i.gankevich@spbu.ru
* gnu/packages/engineering.scm (prusa-slicer): New variable.
---
gnu/packages/engineering.scm | 97 ++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)

Toggle diff (121 lines)
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index eec12814ff..d88520a306 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -24,6 +24,7 @@
;;; Copyright © 2021 qblade <qblade@protonmail.com>
;;; Copyright © 2021 Gerd Heber <gerd.heber@gmail.com>
;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -95,6 +96,7 @@
#:use-module (gnu packages image-processing)
#:use-module (gnu packages imagemagick)
#:use-module (gnu packages libevent)
+ #:use-module (gnu packages libusb)
#:use-module (gnu packages linux) ;FIXME: for pcb
#:use-module (gnu packages lisp)
#:use-module (gnu packages m4)
@@ -2924,3 +2926,98 @@ a process.")
(description "The library provides functionality for shape modelling,
visualization, matrix manipulation.")
(license (list license:gpl3 license:mpl2.0))))
+
+(define-public prusa-slicer
+ (package
+ (name "prusa-slicer")
+ (version "2.3.3")
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://github.com/prusa3d/PrusaSlicer")
+ (commit (string-append "version_" version))))
+ (file-name (git-file-name name version))
+ (sha256 (base32 "0w0synqi3iz9aigsgv6x1c6sg123fasbx19h4w3ic1l48r8qmpwm"))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:configure-flags
+ '("-DSLIC3R_FHS=1" ;; Use The Filesystem Hierarchy Standard.
+ "-DSLIC3R_WX_STABLE=1") ;; Use wxWidgets 3.0.x.x to prevent GUI crashes.
+ #:phases
+ (modify-phases %standard-phases
+ ;; CMake is unable to find headers from glib, pango and gtk+
+ ;; when compiling src/slic3r. Here we add them via environment variables.
+ (add-before 'configure 'add-glib-pango-gtk+
+ (lambda _
+ (use-modules
+ (ice-9 popen)
+ (ice-9 textual-ports))
+ (define (append-flags name flags)
+ (define old-value (getenv name))
+ (setenv name (if old-value (string-append old-value " " flags) flags)))
+ (define (pkg-config args)
+ (let* ((port (open-input-pipe (string-join (cons "pkg-config" args) " ")))
+ (content (string-trim-both (get-string-all port))))
+ (close-pipe port)
+ content))
+ (define deps '("glib-2.0" "pango" "gtk+-2.0" "hidapi-hidraw"))
+ (define cflags (pkg-config (cons "--cflags" deps)))
+ (define ld-flags (pkg-config (cons "--libs" deps)))
+ (define libigl (assoc-ref %build-inputs "libigl"))
+ (append-flags "CXXFLAGS" cflags)
+ (append-flags "CFLAGS" cflags)
+ (append-flags "LDFLAGS" ld-flags)
+ (append-flags "CFLAGS" (string-append "-I" libigl "/include"))
+ (append-flags "LDFLAGS" (string-append "-L" libigl "/lib"))))
+ (add-before 'configure 'unbundle-3d-party-libraries
+ ;; Prusa slicer bundles a lot of dependencies in src/ directory.
+ ;; Most of them contain prusa-specific modifications (e.g. avrdude),
+ ;; but others do not. Here we replace the latter with Guix packages.
+ (lambda _
+ (delete-file-recursively "src/hidapi")
+ (delete-file-recursively "src/eigen")
+ (delete-file-recursively "src/libigl/igl")
+ (substitute* "src/CMakeLists.txt"
+ (("add_subdirectory\\(libigl\\)" all)
+ (string-append
+ all "\ninclude_directories(libigl INTERFACE libigl::core)"))
+ (("add_subdirectory\\(hidapi\\)") "")
+ (("include_directories\\(hidapi/include\\)") ""))
+ ;; Do not link with bundled hidapi library.
+ (substitute* "src/slic3r/CMakeLists.txt"
+ (("\\bhidapi\\b") "")))))))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)))
+ (inputs
+ `(("boost" ,boost)
+ ("libigl" ,libigl)
+ ("tbb" ,tbb)
+ ("curl" ,curl)
+ ("zlib" ,zlib)
+ ("eigen" ,eigen)
+ ("expat" ,expat)
+ ("mesa" ,mesa)
+ ("cereal" ,cereal)
+ ("nlopt" ,nlopt)
+ ("openvdb" ,openvdb)
+ ("ilmbase" ,ilmbase)
+ ("cgal" ,cgal)
+ ("hidapi" ,hidapi)
+ ;;("wxwidgets" ,wxwidgets-gtk2-3.1) ;; crashes when adding support enforcers
+ ("wxwidgets" ,wxwidgets-gtk2)
+ ("glew" ,glew)
+ ("udev" ,eudev)
+ ("gmp" ,gmp)
+ ("mpfr" ,mpfr)
+ ("libpng" ,libpng)
+ ("dbus" ,dbus)
+ ("glib" ,glib)
+ ("pango" ,pango)
+ ("gtk" ,gtk+-2)))
+ (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.")
+ (license license:agpl3)))
--
2.32.0
P
P
phodina wrote on 18 Sep 2021 17:53
Patches work, how to upstream them
(name . 49713@debbugs.gnu.org)(address . 49713@debbugs.gnu.org)
GZL0i0qkLLzbBV98MK-fchR2pEWvkLJJzVK8fN7xaFB8lUnAUS9GSG9kXeXVsCnhRAelsVLSz75FOvcHB8autz_c0wY6yE918W-nod4Efqg=@protonmail.com
Hi Ivan,

the patches you created work. Is there something else neccessary to upstream them?

Thanks very much!

Regards
Petr
L
L
Liliana Marie Prikler wrote on 18 Sep 2021 19:13
Re: [PATCH 1/3] gnu: cereal: Use cmake to build and install the library.
d54333355b1cffe5b7d84c08527f6b201e3ef291.camel@gmail.com
Hi,

Am Samstag, den 24.07.2021, 00:00 +0300 schrieb Ivan Gankevich:
Toggle quote (13 lines)
> Hello,
>
> this series of patches adds Prusa Slicer. I had to change "cereal"
> package definition to use cmake, otherwise "prusa-slicer" failed
> to find the library. Also, I added "libigl" that is a dependency
> of "prusa-slicer".
>
> gnu/packages/serialization.scm (cereal): Use cmake.
>
> * Replace manual build and installation with standard cmake.
> The main reason to do that is to get "cereal-config.cmake"
> file that is used to find the library in other projects.
> ---
There are already two direct dependents of cereal. Do those still
build?
Toggle quote (46 lines)
>
> gnu/packages/serialization.scm | 39 ++++++++++++------------------
> ----
> 1 file changed, 13 insertions(+), 26 deletions(-)
>
> diff --git a/gnu/packages/serialization.scm
> b/gnu/packages/serialization.scm
> index 8f292ae408..9c34da62af 100644
> --- a/gnu/packages/serialization.scm
> +++ b/gnu/packages/serialization.scm
> @@ -141,32 +141,19 @@ implement RPC protocols.")
> "0hc8wh9dwpc1w1zf5lfss4vg5hmgpblqxbrpp1rggicpx9ar831p"))))
> (build-system cmake-build-system)
> (arguments
> - `(;; The only included tests are portability tests requiring
> - ;; cross-compilation and boost. Since we are building cereal
> on more
> - ;; platforms anyway, there is no compelling reason to build
> the tests.
> - #:tests? #f
> - #:out-of-source? #f
> - #:phases
> - (modify-phases %standard-phases
> - (delete 'configure)
> - (replace 'build
> - (lambda _
> - (substitute* "doc/doxygen.in"
> - (("@CMAKE_CURRENT_BINARY_DIR@") ".")
> - (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
> - (with-directory-excursion "doc"
> - (invoke "doxygen" "doxygen.in"))))
> - ;; There is no "install" target, so we have to provide our
> own
> - ;; "install" phase.
> - (replace 'install
> - (lambda* (#:key outputs #:allow-other-keys)
> - (let* ((out (assoc-ref outputs "out"))
> - (doc (string-append out
> "/share/cereal/docs"))
> - (include (string-append out "/include/cereal")))
> - (mkdir-p doc)
> - (mkdir-p include)
> - (copy-recursively "include/cereal" include)
> - (copy-recursively "doc/html" doc)))))))
> + `(#:configure-flags (list "-DSKIP_PORTABILITY_TEST=ON")
> + #:tests? #f
Never ever leave #:tests? #f uncommented.
Toggle quote (15 lines)
> + #:phases (modify-phases %standard-phases
> + (add-before 'configure 'skip-sandbox
> + (lambda _
> + (substitute* "CMakeLists.txt"
> + (("add_subdirectory\\(sandbox\\)") ""))))
> + (add-after 'install 'install-doc
> + (lambda _
> + (let ((doc (string-append %output
> "/share/doc/html")))
> + (invoke "make" "doc")
> + (mkdir-p doc)
> + (copy-recursively "doc/html" doc)))))))
> (native-inputs
> `(("doxygen" ,doxygen)))
> (home-page "https://uscilab.github.io/cereal/")
L
L
Liliana Marie Prikler wrote on 18 Sep 2021 19:17
Re: [PATCH 2/3] gnu: Add libigl.
60123c258c4a361fec28fb13fed0cde7efa09fa0.camel@gmail.com
Hi,

Am Samstag, den 24.07.2021, 00:07 +0300 schrieb Ivan Gankevich:
Toggle quote (39 lines)
> * gnu/packages/engineering.scm (libigl): New variable.
> ---
> gnu/packages/engineering.scm | 62
> ++++++++++++++++++++++++++++++++++++
> 1 file changed, 62 insertions(+)
>
> diff --git a/gnu/packages/engineering.scm
> b/gnu/packages/engineering.scm
> index fc932ddb28..eec12814ff 100644
> --- a/gnu/packages/engineering.scm
> +++ b/gnu/packages/engineering.scm
> @@ -2862,3 +2862,65 @@ for hooking Linux system calls in user
> space. This is achieved by
> hot-patching the machine code of the standard C library in the
> memory of
> a process.")
> (license license:bsd-2))))
> +
> +(define-public libigl
> + (package
> + (name "libigl")
> + (version "2.3.0")
> + (source
> + (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/libigl/libigl")
> + (commit (string-append "v" version))))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32
> + "004a22ifq2vibgkgvrlyihqimpsfizvq5l448204kwfg3lkycajj"))
> ))
> + (build-system cmake-build-system)
> + (arguments
> + `(#:configure-flags
> + (list "-DLIBIGL_USE_STATIC_LIBRARY=OFF"
> + "-DLIBIGL_BUILD_TESTS=OFF" ;; tests need to download
> test data
Can we provide test data as input?
Toggle quote (16 lines)
> + "-DLIBIGL_BUILD_TUTORIALS=OFF"
> + "-DLIBIGL_EXPORT_TARGETS=ON"
> + "-DLIBIGL_WITH_CGAL=ON"
> + "-DLIBIGL_WITH_COMISO=OFF"
> + "-DLIBIGL_WITH_CORK=OFF"
> + "-DLIBIGL_WITH_EMBREE=OFF"
> + "-DLIBIGL_WITH_MATLAB=OFF"
> + "-DLIBIGL_WITH_MOSEK=OFF"
> + "-DLIBIGL_WITH_OPENGL=OFF"
> + "-DLIBIGL_WITH_OPENGL_GLFW=OFF"
> + "-DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF"
> + "-DLIBIGL_WITH_PNG=OFF"
> + "-DLIBIGL_WITH_TETGEN=OFF"
> + "-DLIBIGL_WITH_TRIANGLE=OFF"
> + "-DLIBIGL_WITH_PREDICATES=OFF"
> + "-DLIBIGL_WITH_XML=OFF")
In Guix we prefer to build packages as feature-complete as possible.
Obviously MATLAB won't work unless they also accept octave, but you
might want to at least enable some of the low-hanging fruits such as
XML or OpenGL. If it's about having a minimal package, simply provide
a -minimal variant as well.
Toggle quote (1 lines)
> + #:tests? #f
Don't leave #:tests? #f uncommented.
Toggle quote (28 lines)
> + #:phases
> + (modify-phases %standard-phases
> + (add-before 'configure 'do-not-download-dependencies
> + (lambda _
> + (substitute* "cmake/libigl.cmake"
> + (("if\\(NOT TARGET Eigen3::Eigen\\)" all)
> + (string-append "find_package(Eigen3 CONFIG
> REQUIRED)\n" all))
> + (("if\\(NOT TARGET CGAL::CGAL\\)" all)
> + (string-append "find_package(CGAL CONFIG COMPONENTS
> Core)\n" all)))))
> + (add-after 'install 'install-all-subdirs
> + (lambda _
> + (copy-recursively
> + "../source/include"
> + (string-append (assoc-ref %outputs "out")
> "/include")))))))
> + (inputs
> + `(("eigen" ,eigen)
> + ("cgal" ,cgal)
> + ("gmp" ,gmp)
> + ("mpfr" ,mpfr)
> + ("boost" ,boost)))
> + (home-page "https://libigl.github.io/")
> + (synopsis "Simple C++ geometry processing library")
> + (description "The library provides functionality for shape
> modelling,
> +visualization, matrix manipulation.")
s/The/This/ ?
Toggle quote (2 lines)
> + (license (list license:gpl3 license:mpl2.0))))

Regards
L
L
Liliana Marie Prikler wrote on 18 Sep 2021 19:26
Re: [PATCH 3/3] gnu: Add prusa-slicer.
1e440c6a0f9e9e328eb83519e1df38f506a3d4b3.camel@gmail.com
Hi,

Am Samstag, den 24.07.2021, 00:08 +0300 schrieb Ivan Gankevich:
Toggle quote (87 lines)
> * gnu/packages/engineering.scm (prusa-slicer): New variable.
> ---
> gnu/packages/engineering.scm | 97
> ++++++++++++++++++++++++++++++++++++
> 1 file changed, 97 insertions(+)
>
> diff --git a/gnu/packages/engineering.scm
> b/gnu/packages/engineering.scm
> index eec12814ff..d88520a306 100644
> --- a/gnu/packages/engineering.scm
> +++ b/gnu/packages/engineering.scm
> @@ -24,6 +24,7 @@
> ;;; Copyright © 2021 qblade <qblade@protonmail.com>
> ;;; Copyright © 2021 Gerd Heber <gerd.heber@gmail.com>
> ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
> +;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -95,6 +96,7 @@
> #:use-module (gnu packages image-processing)
> #:use-module (gnu packages imagemagick)
> #:use-module (gnu packages libevent)
> + #:use-module (gnu packages libusb)
> #:use-module (gnu packages linux) ;FIXME: for pcb
> #:use-module (gnu packages lisp)
> #:use-module (gnu packages m4)
> @@ -2924,3 +2926,98 @@ a process.")
> (description "The library provides functionality for shape
> modelling,
> visualization, matrix manipulation.")
> (license (list license:gpl3 license:mpl2.0))))
> +
> +(define-public prusa-slicer
> + (package
> + (name "prusa-slicer")
> + (version "2.3.3")
> + (source
> + (origin
> + (method git-fetch)
> + (uri
> + (git-reference
> + (url "https://github.com/prusa3d/PrusaSlicer")
> + (commit (string-append "version_" version))))
> + (file-name (git-file-name name version))
> + (sha256 (base32
> "0w0synqi3iz9aigsgv6x1c6sg123fasbx19h4w3ic1l48r8qmpwm"))))
> + (build-system cmake-build-system)
> + (arguments
> + `(#:configure-flags
> + '("-DSLIC3R_FHS=1" ;; Use The Filesystem Hierarchy Standard.
> + "-DSLIC3R_WX_STABLE=1") ;; Use wxWidgets 3.0.x.x to
> prevent GUI crashes.
> + #:phases
> + (modify-phases %standard-phases
> + ;; CMake is unable to find headers from glib, pango and
> gtk+
> + ;; when compiling src/slic3r. Here we add them via
> environment variables.
> + (add-before 'configure 'add-glib-pango-gtk+
> + (lambda _
> + (use-modules
> + (ice-9 popen)
> + (ice-9 textual-ports))
> + (define (append-flags name flags)
> + (define old-value (getenv name))
> + (setenv name (if old-value (string-append old-value
> " " flags) flags)))
> + (define (pkg-config args)
> + (let* ((port (open-input-pipe (string-join (cons
> "pkg-config" args) " ")))
> + (content (string-trim-both (get-string-all
> port))))
> + (close-pipe port)
> + content))
> + (define deps '("glib-2.0" "pango" "gtk+-2.0" "hidapi-
> hidraw"))
> + (define cflags (pkg-config (cons "--cflags" deps)))
> + (define ld-flags (pkg-config (cons "--libs" deps)))
> + (define libigl (assoc-ref %build-inputs "libigl"))
> + (append-flags "CXXFLAGS" cflags)
> + (append-flags "CFLAGS" cflags)
> + (append-flags "LDFLAGS" ld-flags)
> + (append-flags "CFLAGS" (string-append "-I" libigl
> "/include"))
> + (append-flags "LDFLAGS" (string-append "-L" libigl
> "/lib"))))
Upstream already appears to search for GTK+3 with their CMake setup.
Perhaps that's why it doesn't find GTK+2?
Toggle quote (21 lines)
> + (add-before 'configure 'unbundle-3d-party-libraries
> + ;; Prusa slicer bundles a lot of dependencies in src/
> directory.
> + ;; Most of them contain prusa-specific modifications
> (e.g. avrdude),
> + ;; but others do not. Here we replace the latter with
> Guix packages.
> + (lambda _
> + (delete-file-recursively "src/hidapi")
> + (delete-file-recursively "src/eigen")
> + (delete-file-recursively "src/libigl/igl")
> + (substitute* "src/CMakeLists.txt"
> + (("add_subdirectory\\(libigl\\)" all)
> + (string-append
> + all "\ninclude_directories(libigl INTERFACE
> libigl::core)"))
> + (("add_subdirectory\\(hidapi\\)") "")
> + (("include_directories\\(hidapi/include\\)") ""))
> + ;; Do not link with bundled hidapi library.
> + (substitute* "src/slic3r/CMakeLists.txt"
> + (("\\bhidapi\\b") "")))))))
Unbundling should be done in the snippet rather than at build time.
Toggle quote (29 lines)
> + (native-inputs
> + `(("pkg-config" ,pkg-config)))
> + (inputs
> + `(("boost" ,boost)
> + ("libigl" ,libigl)
> + ("tbb" ,tbb)
> + ("curl" ,curl)
> + ("zlib" ,zlib)
> + ("eigen" ,eigen)
> + ("expat" ,expat)
> + ("mesa" ,mesa)
> + ("cereal" ,cereal)
> + ("nlopt" ,nlopt)
> + ("openvdb" ,openvdb)
> + ("ilmbase" ,ilmbase)
> + ("cgal" ,cgal)
> + ("hidapi" ,hidapi)
> + ;;("wxwidgets" ,wxwidgets-gtk2-3.1) ;; crashes when adding
> support enforcers
> + ("wxwidgets" ,wxwidgets-gtk2)
> + ("glew" ,glew)
> + ("udev" ,eudev)
> + ("gmp" ,gmp)
> + ("mpfr" ,mpfr)
> + ("libpng" ,libpng)
> + ("dbus" ,dbus)
> + ("glib" ,glib)
> + ("pango" ,pango)
> + ("gtk" ,gtk+-2)))
Try sorting the inputs alphabetically, also w.r.t. gtk+-2, see above.
Toggle quote (9 lines)
> + (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.")
> + (license license:agpl3)))

Regards
I
I
Ivan Gankevich wrote on 19 Sep 2021 20:26
[PATCH 1/3 v2] gnu: cereal: Use cmake to build and install the library.
(address . 49713@debbugs.gnu.org)(name . Ivan Gankevich)(address . i.gankevich@spbu.ru)
20210919182646.20188-1-i.gankevich@spbu.ru
* gnu/packages/serialization.scm (cereal): Use cmake to build and
install the library.
---
gnu/packages/serialization.scm | 38 +++++++++++-----------------------
1 file changed, 12 insertions(+), 26 deletions(-)

Toggle diff (51 lines)
diff --git a/gnu/packages/serialization.scm b/gnu/packages/serialization.scm
index 0e79b7c89c..3263805c68 100644
--- a/gnu/packages/serialization.scm
+++ b/gnu/packages/serialization.scm
@@ -142,32 +142,18 @@ implement RPC protocols.")
"0hc8wh9dwpc1w1zf5lfss4vg5hmgpblqxbrpp1rggicpx9ar831p"))))
(build-system cmake-build-system)
(arguments
- `(;; The only included tests are portability tests requiring
- ;; cross-compilation and boost. Since we are building cereal on more
- ;; platforms anyway, there is no compelling reason to build the tests.
- #:tests? #f
- #:out-of-source? #f
- #:phases
- (modify-phases %standard-phases
- (delete 'configure)
- (replace 'build
- (lambda _
- (substitute* "doc/doxygen.in"
- (("@CMAKE_CURRENT_BINARY_DIR@") ".")
- (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
- (with-directory-excursion "doc"
- (invoke "doxygen" "doxygen.in"))))
- ;; There is no "install" target, so we have to provide our own
- ;; "install" phase.
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (doc (string-append out "/share/cereal/docs"))
- (include (string-append out "/include/cereal")))
- (mkdir-p doc)
- (mkdir-p include)
- (copy-recursively "include/cereal" include)
- (copy-recursively "doc/html" doc)))))))
+ `(#:configure-flags (list "-DSKIP_PORTABILITY_TEST=ON")
+ #:phases (modify-phases %standard-phases
+ (add-before 'configure 'skip-sandbox
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ (("add_subdirectory\\(sandbox\\)") ""))))
+ (add-after 'install 'install-doc
+ (lambda _
+ (let ((doc (string-append %output "/share/doc/html")))
+ (invoke "make" "doc")
+ (mkdir-p doc)
+ (copy-recursively "doc/html" doc)))))))
(native-inputs
`(("doxygen" ,doxygen)))
(home-page "https://uscilab.github.io/cereal/")
--
2.32.0
I
I
Ivan Gankevich wrote on 19 Sep 2021 20:27
Re: [PATCH 1/3] gnu: cereal: Use cmake to build and install the library.
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 49713@debbugs.gnu.org)
YUeBLvU7AfaBTzut@gust
Toggle quote (3 lines)
>There are already two direct dependents of cereal. Do those still
>build?

Hello.

I’ve successfully built “salmon” and “seqan” with this patch.


Toggle quote (2 lines)
>Never ever leave #:tests? #f uncommented.

Removed this line. The tests work fine.


I’ve submitted new version of this patch with tests.
Thanks for the corrections!


Regards,
Ivan
I
I
Ivan Gankevich wrote on 19 Sep 2021 22:18
[PATCH 2/3 v2] gnu: Add libigl.
(address . 49713@debbugs.gnu.org)(name . Ivan Gankevich)(address . i.gankevich@spbu.ru)
20210919201831.30414-1-i.gankevich@spbu.ru
* gnu/packages/engineering.scm (libigl): New variable.
---
gnu/packages/engineering.scm | 88 ++++++++++++++++++++++++++++++++++++
1 file changed, 88 insertions(+)

Toggle diff (98 lines)
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 46622f3a1f..2c22cc3278 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2863,3 +2863,91 @@ for hooking Linux system calls in user space. This is achieved by
hot-patching the machine code of the standard C library in the memory of
a process.")
(license license:bsd-2))))
+
+(define-public libigl
+ (package
+ (name "libigl")
+ (version "2.3.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/libigl")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "004a22ifq2vibgkgvrlyihqimpsfizvq5l448204kwfg3lkycajj"))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:configure-flags
+ (list "-DLIBIGL_USE_STATIC_LIBRARY=OFF"
+ "-DLIBIGL_BUILD_TESTS=ON"
+ "-DLIBIGL_BUILD_TUTORIALS=OFF"
+ "-DLIBIGL_EXPORT_TARGETS=ON"
+ "-DLIBIGL_WITH_CGAL=ON"
+ "-DLIBIGL_WITH_COMISO=OFF"
+ "-DLIBIGL_WITH_CORK=OFF"
+ "-DLIBIGL_WITH_EMBREE=OFF"
+ "-DLIBIGL_WITH_MATLAB=OFF"
+ "-DLIBIGL_WITH_MOSEK=OFF"
+ "-DLIBIGL_WITH_OPENGL=OFF"
+ "-DLIBIGL_WITH_OPENGL_GLFW=OFF"
+ "-DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF"
+ "-DLIBIGL_WITH_PNG=OFF"
+ "-DLIBIGL_WITH_TETGEN=OFF"
+ "-DLIBIGL_WITH_TRIANGLE=OFF"
+ "-DLIBIGL_WITH_PREDICATES=OFF"
+ "-DLIBIGL_WITH_XML=ON")
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'configure 'do-not-download-dependencies
+ (lambda _
+ (setenv "HOME" (getcwd)) ;; cmake needs this to export modules
+ (substitute* "cmake/libigl.cmake"
+ (("if\\(NOT TARGET Eigen3::Eigen\\)" all)
+ (string-append "find_package(Eigen3 CONFIG REQUIRED)\n" all))
+ (("if\\(NOT TARGET CGAL::CGAL\\)" all)
+ (string-append "find_package(CGAL CONFIG COMPONENTS Core)\n" all))
+ (("if\\(NOT TARGET tinyxml2\\)" all)
+ (string-append "find_package(tinyxml2 CONFIG REQUIRED)\n"
+ "if (NOT TARGET tinyxml2::tinyxml2)"))
+ )
+ (substitute* "tests/CMakeLists.txt"
+ (("igl_download_test_data\\(\\)") "")
+ (("set\\(IGL_TEST_DATA.*")
+ (format #f "set(IGL_TEST_DATA ~a)\n"
+ (assoc-ref %build-inputs "libigl-test-data")))
+ (("igl_download_catch2\\(\\)") "find_package(Catch2 CONFIG REQUIRED)")
+ (("list\\(APPEND CMAKE_MODULE_PATH \\$\\{LIBIGL_EXTERNAL\\}/catch2/contrib\\)")
+ "")
+ (("add_subdirectory\\(\\$\\{LIBIGL_EXTERNAL\\}/catch2 catch2\\)") ""))))
+ (add-after 'install 'install-all-subdirs
+ (lambda _
+ (copy-recursively
+ "../source/include"
+ (string-append (assoc-ref %outputs "out") "/include")))))))
+ (inputs
+ `(("eigen" ,eigen)
+ ("gmp" ,gmp)
+ ("mpfr" ,mpfr)
+ ("boost" ,boost)))
+ (native-inputs
+ `(("cgal" ,cgal)
+ ("tinyxml2" ,tinyxml2)
+ ("catch2" ,catch-framework2)
+ ("libigl-test-data"
+ ,(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/libigl-tests-data")
+ ;; This commit should be updated for each version
+ ;; from "cmake/LibiglDownloadExternal.cmake".
+ (commit "19cedf96d70702d8b3a83eb27934780c542356fe")))
+ (file-name (git-file-name "libigl-test-data" version))
+ (sha256 (base32 "1wxglrxw74xw4a4jmmjpm8719f3mnlbxbwygjb4ddfixxxyya4i2"))))))
+ (home-page "https://libigl.github.io/")
+ (synopsis "Simple C++ geometry processing library")
+ (description "This library provides functionality for shape modelling,
+visualization, matrix manipulation.")
+ (license (list license:gpl3 license:mpl2.0))))
--
2.32.0
I
I
Ivan Gankevich wrote on 19 Sep 2021 22:18
Re: [PATCH 2/3] gnu: Add libigl.
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 49713@debbugs.gnu.org)
YUebLuVBESs1mTHU@gust
Toggle quote (2 lines)
>Can we provide test data as input?

I’ve added test data and enabled tests.


Toggle quote (22 lines)
>> + "-DLIBIGL_BUILD_TUTORIALS=OFF"
>> + "-DLIBIGL_EXPORT_TARGETS=ON"
>> + "-DLIBIGL_WITH_CGAL=ON"
>> + "-DLIBIGL_WITH_COMISO=OFF"
>> + "-DLIBIGL_WITH_CORK=OFF"
>> + "-DLIBIGL_WITH_EMBREE=OFF"
>> + "-DLIBIGL_WITH_MATLAB=OFF"
>> + "-DLIBIGL_WITH_MOSEK=OFF"
>> + "-DLIBIGL_WITH_OPENGL=OFF"
>> + "-DLIBIGL_WITH_OPENGL_GLFW=OFF"
>> + "-DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF"
>> + "-DLIBIGL_WITH_PNG=OFF"
>> + "-DLIBIGL_WITH_TETGEN=OFF"
>> + "-DLIBIGL_WITH_TRIANGLE=OFF"
>> + "-DLIBIGL_WITH_PREDICATES=OFF"
>> + "-DLIBIGL_WITH_XML=OFF")
>In Guix we prefer to build packages as feature-complete as possible.
>Obviously MATLAB won't work unless they also accept octave, but you
>might want to at least enable some of the low-hanging fruits such as
>XML or OpenGL. If it's about having a minimal package, simply provide
>a -minimal variant as well.

This library is header-only. All the dependencies from this list are used in the
tests. Headers that use these dependencies are installed no matter which
dependenies are “ON” in this list. I’ve added XML. Adding other dependencies
would require rewriting most of “cmake/libigl.cmake” file, because the
authors of the package like to download and build all the dependencies manually.


Toggle quote (3 lines)
>> + #:tests? #f
>Don't leave #:tests? #f uncommented.

Enabled tests.


Toggle quote (5 lines)
>> + (description "The library provides functionality for shape
>> modelling,
>> +visualization, matrix manipulation.")
>s/The/This/ ?

Fixed!


Thanks for your corrections. I’ve sent the updated version of this patch via
“git send-email”.


Regards,
Ivan
I
I
Ivan Gankevich wrote on 19 Sep 2021 23:38
[PATCH 3/3 v2] gnu: Add prusa-slicer.
(address . 49713@debbugs.gnu.org)(name . Ivan Gankevich)(address . i.gankevich@spbu.ru)
20210919213838.2343-1-i.gankevich@spbu.ru
* gnu/packages/engineering.scm (prusa-slicer): New variable.
---
gnu/packages/engineering.scm | 83 ++++++++++++++++++++++++++++++++++++
1 file changed, 83 insertions(+)

Toggle diff (107 lines)
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 2c22cc3278..3f7d087269 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -24,6 +24,7 @@
;;; Copyright © 2021 qblade <qblade@protonmail.com>
;;; Copyright © 2021 Gerd Heber <gerd.heber@gmail.com>
;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -95,6 +96,7 @@
#:use-module (gnu packages image-processing)
#:use-module (gnu packages imagemagick)
#:use-module (gnu packages libevent)
+ #:use-module (gnu packages libusb)
#:use-module (gnu packages linux) ;FIXME: for pcb
#:use-module (gnu packages lisp)
#:use-module (gnu packages m4)
@@ -2951,3 +2953,84 @@ a process.")
(description "This library provides functionality for shape modelling,
visualization, matrix manipulation.")
(license (list license:gpl3 license:mpl2.0))))
+
+(define-public prusa-slicer
+ (package
+ (name "prusa-slicer")
+ (version "2.3.3")
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://github.com/prusa3d/PrusaSlicer")
+ (commit (string-append "version_" version))))
+ (file-name (git-file-name name version))
+ (sha256 (base32 "0w0synqi3iz9aigsgv6x1c6sg123fasbx19h4w3ic1l48r8qmpwm"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; 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")))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:configure-flags
+ '("-DSLIC3R_FHS=1" ;; Use The Filesystem Hierarchy Standard.
+ "-DSLIC3R_GTK=3" ;; Use GTK+
+ "-DSLIC3R_WX_STABLE=1") ;; Use wxWidgets 3.0.x.x to prevent GUI crashes.
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'configure 'unbundle-3d-party-libraries
+ ;; Prusa slicer bundles a lot of dependencies in src/ directory.
+ ;; Most of them contain prusa-specific modifications (e.g. avrdude),
+ ;; but others do not. Here we replace the latter with Guix packages.
+ (lambda _
+ (substitute* "src/CMakeLists.txt"
+ (("add_subdirectory\\(libigl\\)" all)
+ (string-append
+ all "\ninclude_directories(libigl INTERFACE libigl::core)"))
+ (("add_subdirectory\\(hidapi\\)")
+ "pkg_check_modules(HIDAPI REQUIRED hidapi-hidraw)")
+ (("include_directories\\(hidapi/include\\)")
+ "include_directories()"))
+ ;; Do not link with bundled hidapi library.
+ (substitute* "src/slic3r/CMakeLists.txt"
+ (("add_library\\(libslic3r_gui.*" all)
+ (string-append
+ all
+ "\ntarget_include_directories(libslic3r_gui PUBLIC ${HIDAPI_INCLUDE_DIRS})\n"))
+ (("\\bhidapi\\b") "${HIDAPI_LIBRARIES}")))))))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)))
+ (inputs
+ `(("boost" ,boost)
+ ("cereal" ,cereal)
+ ("cgal" ,cgal)
+ ("curl" ,curl)
+ ("dbus" ,dbus)
+ ("eigen" ,eigen)
+ ("expat" ,expat)
+ ("glew" ,glew)
+ ("glib" ,glib)
+ ("gmp" ,gmp)
+ ("gtk" ,gtk+)
+ ("hidapi" ,hidapi)
+ ("ilmbase" ,ilmbase)
+ ("libigl" ,libigl)
+ ("libpng" ,libpng)
+ ("mesa" ,mesa)
+ ("mpfr" ,mpfr)
+ ("nlopt" ,nlopt)
+ ("openvdb" ,openvdb)
+ ("pango" ,pango)
+ ("tbb" ,tbb)
+ ("udev" ,eudev)
+ ("wxwidgets" ,wxwidgets)
+ ("zlib" ,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.")
+ (license license:agpl3)))
--
2.32.0
I
I
Ivan Gankevich wrote on 19 Sep 2021 23:39
Re: [PATCH 3/3] gnu: Add prusa-slicer.
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 49713@debbugs.gnu.org)
YUeuGPnE/7OOkO68@gust
Toggle quote (8 lines)
>> + ;; CMake is unable to find headers from glib, pango and
>> gtk+
>> + ;; when compiling src/slic3r. Here we add them via
>> environment variables.
>> + (add-before 'configure 'add-glib-pango-gtk+
>Upstream already appears to search for GTK+3 with their CMake setup.
>Perhaps that's why it doesn't find GTK+2?

I changed GTK+2 to GTK+3 and removed the whole “add-glib-pango-gtk+” phase.


Toggle quote (23 lines)
>> + (add-before 'configure 'unbundle-3d-party-libraries
>> + ;; Prusa slicer bundles a lot of dependencies in src/
>> directory.
>> + ;; Most of them contain prusa-specific modifications
>> (e.g. avrdude),
>> + ;; but others do not. Here we replace the latter with
>> Guix packages.
>> + (lambda _
>> + (delete-file-recursively "src/hidapi")
>> + (delete-file-recursively "src/eigen")
>> + (delete-file-recursively "src/libigl/igl")
>> + (substitute* "src/CMakeLists.txt"
>> + (("add_subdirectory\\(libigl\\)" all)
>> + (string-append
>> + all "\ninclude_directories(libigl INTERFACE
>> libigl::core)"))
>> + (("add_subdirectory\\(hidapi\\)") "")
>> + (("include_directories\\(hidapi/include\\)") ""))
>> + ;; Do not link with bundled hidapi library.
>> + (substitute* "src/slic3r/CMakeLists.txt"
>> + (("\\bhidapi\\b") "")))))))
>Unbundling should be done in the snippet rather than at build time.

Moved deletion of directories to the snippet.


Toggle quote (2 lines)
>Try sorting the inputs alphabetically, also w.r.t. gtk+-2, see above.

Now its is sorted and no more GTK+2.


Thanks for your corrections. I’ve sent the updated version of this patch via
“git send-email”.


Regards,
Ivan
L
L
Liliana Marie Prikler wrote on 19 Sep 2021 23:53
(name . Ivan Gankevich)(address . i.gankevich@spbu.ru)(address . 49713@debbugs.gnu.org)
55e4a71f3756689728238b05fd063662f79ca3d7.camel@gmail.com
Am Montag, den 20.09.2021, 00:39 +0300 schrieb Ivan Gankevich:
Toggle quote (3 lines)
> > Unbundling should be done in the snippet rather than at build time.
>
> Moved deletion of directories to the snippet.
I'd argue that fixing the CMakeLists also falls into snippet territory,
as it's directly related to unbundling.

Am Sonntag, den 19.09.2021, 23:18 +0300 schrieb Ivan Gankevich:
Toggle quote (6 lines)
> This library is header-only. All the dependencies from this list are
> used in the tests. Headers that use these dependencies are installed
> no matter which dependenies are “ON” in this list. I’ve added XML.
> Adding other dependencies would require rewriting most of
> “cmake/libigl.cmake” file, because the authors of the package like to
> download and build all the dependencies manually.
Could this be done with substitute* as for the other packages? If not,
we should group those options under a sufficiently explanatory comment.
Also, there's little need to explicitly enable things that would
already be enabled by default, let's keep the list of flags small and
understandable :)

When you send v3, please do all patches in one go and also specify --
reroll-count, as that's easier on mumi.

Thanks
I
I
Ivan Gankevich wrote on 21 Sep 2021 00:15
[PATCH v3 1/3] gnu: cereal: Use cmake to build and install the library.
(address . 49713@debbugs.gnu.org)(name . Ivan Gankevich)(address . i.gankevich@spbu.ru)
20210920221549.14678-1-i.gankevich@spbu.ru
* gnu/packages/serialization.scm (cereal): Use cmake to build and
install the library.
---
gnu/packages/serialization.scm | 38 +++++++++++-----------------------
1 file changed, 12 insertions(+), 26 deletions(-)

Toggle diff (51 lines)
diff --git a/gnu/packages/serialization.scm b/gnu/packages/serialization.scm
index 0e79b7c89c..3263805c68 100644
--- a/gnu/packages/serialization.scm
+++ b/gnu/packages/serialization.scm
@@ -142,32 +142,18 @@ implement RPC protocols.")
"0hc8wh9dwpc1w1zf5lfss4vg5hmgpblqxbrpp1rggicpx9ar831p"))))
(build-system cmake-build-system)
(arguments
- `(;; The only included tests are portability tests requiring
- ;; cross-compilation and boost. Since we are building cereal on more
- ;; platforms anyway, there is no compelling reason to build the tests.
- #:tests? #f
- #:out-of-source? #f
- #:phases
- (modify-phases %standard-phases
- (delete 'configure)
- (replace 'build
- (lambda _
- (substitute* "doc/doxygen.in"
- (("@CMAKE_CURRENT_BINARY_DIR@") ".")
- (("@CMAKE_CURRENT_SOURCE_DIR@") "."))
- (with-directory-excursion "doc"
- (invoke "doxygen" "doxygen.in"))))
- ;; There is no "install" target, so we have to provide our own
- ;; "install" phase.
- (replace 'install
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((out (assoc-ref outputs "out"))
- (doc (string-append out "/share/cereal/docs"))
- (include (string-append out "/include/cereal")))
- (mkdir-p doc)
- (mkdir-p include)
- (copy-recursively "include/cereal" include)
- (copy-recursively "doc/html" doc)))))))
+ `(#:configure-flags (list "-DSKIP_PORTABILITY_TEST=ON")
+ #:phases (modify-phases %standard-phases
+ (add-before 'configure 'skip-sandbox
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ (("add_subdirectory\\(sandbox\\)") ""))))
+ (add-after 'install 'install-doc
+ (lambda _
+ (let ((doc (string-append %output "/share/doc/html")))
+ (invoke "make" "doc")
+ (mkdir-p doc)
+ (copy-recursively "doc/html" doc)))))))
(native-inputs
`(("doxygen" ,doxygen)))
(home-page "https://uscilab.github.io/cereal/")
--
2.32.0
I
I
Ivan Gankevich wrote on 21 Sep 2021 00:15
[PATCH v3 2/3] gnu: Add libigl.
(address . 49713@debbugs.gnu.org)(name . Ivan Gankevich)(address . i.gankevich@spbu.ru)
20210920221549.14678-2-i.gankevich@spbu.ru
* gnu/packages/engineering.scm (libigl): New variable.
---
gnu/packages/engineering.scm | 139 +++++++++++++++++++++++++++++++++++
1 file changed, 139 insertions(+)

Toggle diff (149 lines)
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 46622f3a1f..421a10292a 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2863,3 +2863,142 @@ for hooking Linux system calls in user space. This is achieved by
hot-patching the machine code of the standard C library in the memory of
a process.")
(license license:bsd-2))))
+
+(define-public libigl
+ (package
+ (name "libigl")
+ (version "2.3.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/libigl")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "004a22ifq2vibgkgvrlyihqimpsfizvq5l448204kwfg3lkycajj"))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:configure-flags
+ (list "-DLIBIGL_USE_STATIC_LIBRARY=OFF"
+ "-DLIBIGL_BUILD_TESTS=ON"
+ "-DLIBIGL_BUILD_TUTORIALS=OFF"
+ "-DLIBIGL_EXPORT_TARGETS=ON"
+ ;; The following options disable tests for the corresponding libraries.
+ ;; The options do not affect whether the libraries are linked to libigl or not,
+ ;; they are used for tests.
+ "-DLIBIGL_WITH_COMISO=OFF"
+ "-DLIBIGL_WITH_CORK=OFF"
+ "-DLIBIGL_WITH_MATLAB=OFF"
+ "-DLIBIGL_WITH_MOSEK=OFF"
+ "-DLIBIGL_WITH_TRIANGLE=OFF" ;; Undefined reference to "triangulate".
+ "-DLIBIGL_WITH_OPENGL_GLFW_IMGUI=OFF")
+ #:phases
+ (modify-phases %standard-phases
+ (add-before 'configure 'do-not-download-dependencies
+ (lambda _
+ (setenv "HOME" (getcwd)) ;; cmake needs this to export modules
+ (mkdir "external")
+ (copy-recursively (assoc-ref %build-inputs "libigl-glad") "external/glad")
+ (copy-recursively (assoc-ref %build-inputs "libigl-stb") "external/stb")
+ (copy-recursively (assoc-ref %build-inputs "libigl-tetgen") "external/tetgen")
+ (copy-recursively (assoc-ref %build-inputs "libigl-predicates") "external/predicates")
+ (substitute* "cmake/libigl.cmake"
+ (("if\\(NOT TARGET Eigen3::Eigen\\)" all)
+ (string-append "find_package(Eigen3 CONFIG REQUIRED)\n" all))
+ (("if\\(NOT TARGET CGAL::CGAL\\)" all)
+ (string-append "find_package(CGAL CONFIG COMPONENTS Core)\n" all))
+ (("if\\(NOT TARGET tinyxml2\\)" all)
+ (string-append "find_package(tinyxml2 CONFIG REQUIRED)\n"
+ "if (NOT TARGET tinyxml2::tinyxml2)"))
+ (("if\\(NOT TARGET embree\\)" all)
+ (string-append "find_package(embree 3 CONFIG REQUIRED)\n" all))
+ (("if\\(NOT TARGET glfw\\)" all)
+ (string-append "find_package(glfw3 CONFIG REQUIRED)\n" all))
+ (("igl_download_glad\\(\\)" all) "")
+ (("igl_download_stb\\(\\)" all) "")
+ (("igl_download_tetgen\\(\\)" all) "")
+ (("igl_download_triangle\\(\\)" all) "")
+ (("igl_download_predicates\\(\\)" all) ""))
+ (substitute* "tests/CMakeLists.txt"
+ (("igl_download_test_data\\(\\)") "")
+ (("set\\(IGL_TEST_DATA.*")
+ (format #f "set(IGL_TEST_DATA ~a)\n"
+ (assoc-ref %build-inputs "libigl-test-data")))
+ (("igl_download_catch2\\(\\)") "find_package(Catch2 CONFIG REQUIRED)")
+ (("list\\(APPEND CMAKE_MODULE_PATH \\$\\{LIBIGL_EXTERNAL\\}/catch2/contrib\\)")
+ "")
+ (("add_subdirectory\\(\\$\\{LIBIGL_EXTERNAL\\}/catch2 catch2\\)") ""))))
+ (add-after 'install 'install-all-subdirs
+ (lambda _
+ (copy-recursively
+ "../source/include"
+ (string-append (assoc-ref %outputs "out") "/include")))))))
+ (inputs
+ `(("eigen" ,eigen)
+ ("gmp" ,gmp)
+ ("mpfr" ,mpfr)
+ ("boost" ,boost)))
+ (native-inputs
+ `(("catch2" ,catch-framework2)
+ ("cgal" ,cgal)
+ ("embree" ,embree)
+ ("mesa" ,mesa)
+ ("glfw" ,glfw)
+ ("tinyxml2" ,tinyxml2)
+ ("libigl-test-data"
+ ,(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/libigl-tests-data")
+ ;; This commit should be updated for each version
+ ;; from "cmake/LibiglDownloadExternal.cmake".
+ (commit "19cedf96d70702d8b3a83eb27934780c542356fe")))
+ (file-name (git-file-name "libigl-test-data" version))
+ (sha256 (base32 "1wxglrxw74xw4a4jmmjpm8719f3mnlbxbwygjb4ddfixxxyya4i2"))))
+ ("libigl-glad"
+ ,(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/libigl-glad")
+ ;; This commit should be updated for each version
+ ;; from "cmake/LibiglDownloadExternal.cmake".
+ (commit "09b4969c56779f7ddf8e6176ec1873184aec890f")))
+ (file-name (git-file-name "libigl-glad" version))
+ (sha256 (base32 "0rwrs7513ylp6gxv7crjzflapcg9p7x04nzfvywgl665vl53rawk"))))
+ ("libigl-stb"
+ ,(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/libigl-stb.git")
+ ;; This commit should be updated for each version
+ ;; from "cmake/LibiglDownloadExternal.cmake".
+ (commit "cd0fa3fcd90325c83be4d697b00214e029f94ca3")))
+ (file-name (git-file-name "libigl-stb" version))
+ (sha256 (base32 "0wwlb370z40y63ic3ny6q7lxibhixg2k1pjdkl4ymzv79zld28kj"))))
+ ("libigl-tetgen"
+ ,(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/tetgen.git")
+ ;; This commit should be updated for each version
+ ;; from "cmake/LibiglDownloadExternal.cmake".
+ (commit "4f3bfba3997f20aa1f96cfaff604313a8c2c85b6")))
+ (file-name (git-file-name "libigl-tetgen" version))
+ (sha256 (base32 "1k724syssw37py7kwmibk3sfwkkgyjyy7qkijnhn6rjm91g8qxsg"))))
+ ("libigl-predicates"
+ ,(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/libigl/libigl-predicates.git")
+ ;; This commit should be updated for each version
+ ;; from "cmake/LibiglDownloadExternal.cmake".
+ (commit "488242fa2b1f98a9c5bd1441297fb4a99a6a9ae4")))
+ (file-name (git-file-name "libigl-predicates" version))
+ (sha256 (base32 "13bd98g8lgcq37i3crj66433z09grnb2xjrcqpwqmyn147rp5wyh"))))))
+ (home-page "https://libigl.github.io/")
+ (synopsis "Simple C++ geometry processing library")
+ (description "This library provides functionality for shape modelling,
+visualization, matrix manipulation.")
+ (license (list license:gpl3 license:mpl2.0))))
--
2.32.0
I
I
Ivan Gankevich wrote on 21 Sep 2021 00:15
[PATCH v3 3/3] gnu: Add prusa-slicer.
(address . 49713@debbugs.gnu.org)(name . Ivan Gankevich)(address . i.gankevich@spbu.ru)
20210920221549.14678-3-i.gankevich@spbu.ru
* gnu/packages/engineering.scm (prusa-slicer): New variable.
---
gnu/packages/engineering.scm | 79 ++++++++++++++++++++++++++++++++++++
1 file changed, 79 insertions(+)

Toggle diff (103 lines)
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 421a10292a..c4183c0c71 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -24,6 +24,7 @@
;;; Copyright © 2021 qblade <qblade@protonmail.com>
;;; Copyright © 2021 Gerd Heber <gerd.heber@gmail.com>
;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -95,6 +96,7 @@
#:use-module (gnu packages image-processing)
#:use-module (gnu packages imagemagick)
#:use-module (gnu packages libevent)
+ #:use-module (gnu packages libusb)
#:use-module (gnu packages linux) ;FIXME: for pcb
#:use-module (gnu packages lisp)
#:use-module (gnu packages m4)
@@ -3002,3 +3004,80 @@ a process.")
(description "This library provides functionality for shape modelling,
visualization, matrix manipulation.")
(license (list license:gpl3 license:mpl2.0))))
+
+(define-public prusa-slicer
+ (package
+ (name "prusa-slicer")
+ (version "2.3.3")
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://github.com/prusa3d/PrusaSlicer")
+ (commit (string-append "version_" version))))
+ (file-name (git-file-name name version))
+ (sha256 (base32 "0w0synqi3iz9aigsgv6x1c6sg123fasbx19h4w3ic1l48r8qmpwm"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; Prusa slicer bundles a lot of dependencies in src/ directory.
+ ;; 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")
+ (substitute* "src/CMakeLists.txt"
+ (("add_subdirectory\\(libigl\\)" all)
+ (string-append
+ all "\ninclude_directories(libigl INTERFACE libigl::core)"))
+ (("add_subdirectory\\(hidapi\\)")
+ "pkg_check_modules(HIDAPI REQUIRED hidapi-hidraw)")
+ (("include_directories\\(hidapi/include\\)")
+ "include_directories()"))
+ (substitute* "src/slic3r/CMakeLists.txt"
+ (("add_library\\(libslic3r_gui.*" all)
+ (string-append
+ all
+ "\ntarget_include_directories(libslic3r_gui PUBLIC ${HIDAPI_INCLUDE_DIRS})\n"))
+ (("\\bhidapi\\b") "${HIDAPI_LIBRARIES}"))))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:configure-flags
+ '("-DSLIC3R_FHS=1" ;; Use The Filesystem Hierarchy Standard.
+ "-DSLIC3R_GTK=3" ;; Use GTK+
+ ;; Use wxWidgets 3.0.x.x to prevent GUI crashes when adding support enforcers.
+ "-DSLIC3R_WX_STABLE=1")))
+ (native-inputs
+ `(("pkg-config" ,pkg-config)))
+ (inputs
+ `(("boost" ,boost)
+ ("cereal" ,cereal)
+ ("cgal" ,cgal)
+ ("curl" ,curl)
+ ("dbus" ,dbus)
+ ("eigen" ,eigen)
+ ("expat" ,expat)
+ ("glew" ,glew)
+ ("glib" ,glib)
+ ("gmp" ,gmp)
+ ("gtk" ,gtk+)
+ ("hidapi" ,hidapi)
+ ("ilmbase" ,ilmbase)
+ ("libigl" ,libigl)
+ ("libpng" ,libpng)
+ ("mesa" ,mesa)
+ ("mpfr" ,mpfr)
+ ("nlopt" ,nlopt)
+ ("openvdb" ,openvdb)
+ ("pango" ,pango)
+ ("tbb" ,tbb)
+ ("udev" ,eudev)
+ ("wxwidgets" ,wxwidgets)
+ ("zlib" ,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.")
+ (license license:agpl3)))
--
2.32.0
I
I
Ivan Gankevich wrote on 21 Sep 2021 00:17
Re: [PATCH 3/3] gnu: Add prusa-slicer.
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)(address . 49713@debbugs.gnu.org)
YUkIitz6vZMa8G0N@surge
Toggle quote (3 lines)
>I'd argue that fixing the CMakeLists also falls into snippet territory,
>as it's directly related to unbundling.

Agreed. Moved the code to the snippet.


Toggle quote (6 lines)
>Could this be done with substitute* as for the other packages? If not,
>we should group those options under a sufficiently explanatory comment.
>Also, there's little need to explicitly enable things that would
>already be enabled by default, let's keep the list of flags small and
>understandable :)

Enabled all “low-hanging fruits” and added the comment explaning that
these are tests depedencies.


Toggle quote (3 lines)
>When you send v3, please do all patches in one go and also specify --
>reroll-count, as that's easier on mumi.

I hope I did it right :-)


Regards,
Ivan
L
L
Liliana Marie Prikler wrote on 21 Sep 2021 14:12
(name . Ivan Gankevich)(address . i.gankevich@spbu.ru)(address . 49713-done@debbugs.gnu.org)
77b82891ee4dc0bf385e22be0503b793194cb67f.camel@gmail.com
Hi,

Am Dienstag, den 21.09.2021, 01:17 +0300 schrieb Ivan Gankevich:
Toggle quote (1 lines)
> I hope I did it right :-)
I've pushed this now with some changes. Apart from trivial indentation
changes and (list ...) -> '(...), I made all inputs to libigl regular
and fixed up the phases as follows:
- do-not-download-dependencies split into unpack-external and
patch-cmake
- install-all-subdirs dropped, instead patched cmake to install
relevant headers.

Regards
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 49713@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 49713
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch