~ruther/guix-local

795069e4d2bb5bd95623c606b3db9fb1da6828f6 — nomike 11 months ago 93a5cc0
 gnu: Add pythonscad.

* gnu/packages/engineering.scm (pythonscad): New variable.

Change-Id: Ib559ba4f10c0db685520ce1fa3417975c85ba0a6
Signed-off-by: Andreas Enge <andreas@enge.fr>
1 files changed, 66 insertions(+), 0 deletions(-)

M gnu/packages/engineering.scm
M gnu/packages/engineering.scm => gnu/packages/engineering.scm +66 -0
@@ 3438,6 3438,72 @@ models in the STL and OFF file formats.")
      (home-page "https://openscad.org/")
      (license license:gpl2+))))

(define-public pythonscad
  (let ((commit "e2641ca1a208a9a54a034a8818a9774ad4d5867c")
        (version "0.0.0")
        (revision "0"))
    (package
      (inherit openscad)
      (name "pythonscad")
      (version (git-version version revision commit))
      (source
       (origin
         (method git-fetch)
         (uri (git-reference
               (url "https://github.com/pythonscad/pythonscad")
               (commit commit)
               ;; Needed for libraries/MCAD, a library specific to OpenSCAD
               ;; which is included as a submodule. All other libraries are
               ;; deleted in the patch-source build phase.
               (recursive? #t)))
         (sha256
          (base32 "1i6yajamdrha2kpgyhn7jn6dv35qmgq0zsqv8cdzdqg5142v66ay"))
         (modules '((guix build utils)))
         (snippet #~(begin
                      ;; Delete all unbundled libraries to replace them with
                      ;; guix packages.
                      (delete-file-recursively "submodules")
                      (substitute* "CMakeLists.txt"
                        ;; Remove bundled libraries from cmake.
                        (("add_subdirectory\\(submodules\\)")
                         ""))))
         (file-name (git-file-name name version))))
      (arguments
       (substitute-keyword-arguments (package-arguments openscad)
         ((#:configure-flags flags
           '())
          #~(append #$flags
                    (list "-DENABLE_LIBFIVE=ON" "-DUSE_BUILTIN_LIBFIVE=OFF"
                          (string-append "-DPYTHON_VERSION="
                                         #$(version-major+minor
                                            (package-version python))))))
         ((#:phases phases)
          #~(modify-phases #$phases
              (replace 'patch-source
                (lambda* (#:key inputs #:allow-other-keys)
                  (substitute* "CMakeLists.txt"
                    ;; Fix detection of EGL (see
                    ;; https://github.com/openscad/openscad/issues/5880).
                    (("target_link_libraries\\(OpenSCAD PRIVATE OpenGL::EGL\\)")
                     "find_package(ECM REQUIRED NO_MODULE)
        list(APPEND CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
        find_package(EGL REQUIRED)
        target_link_libraries(OpenSCAD PRIVATE EGL::EGL)")
                    ;; Use the system sanitizers-cmake module.
                    (("\\$\\{CMAKE_SOURCE_DIR\\}/submodules/sanitizers-cmake/cmake")
                     (string-append (assoc-ref inputs "sanitizers-cmake")
                                    "/share/sanitizers-cmake/cmake")))))))))
      (inputs (modify-inputs (package-inputs openscad)
                (append curl libfive)))
      (synopsis "Script-based 3D modeling app whith Python support")
      (description
       "PythonSCAD is a programmatic 3D modeling application.  It allows you
to turn simple code into 3D models suitable for 3D printing.  It is a fork of
OpenSCAD which not only adds support for using Python as a native language,
but also adds new features and improves existing ones.")
      (home-page "https://pythonscad.org/")
      (license license:gpl2+))))

(define-public emacs-scad-mode
  (package
    (name "emacs-scad-mode")