summaryrefslogtreecommitdiff
path: root/gnu/packages/engineering.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/engineering.scm')
-rw-r--r--gnu/packages/engineering.scm66
1 files changed, 66 insertions, 0 deletions
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index c6905d3308..451d5ab9c9 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -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")