From 6c84c3a3f723d43145d9105f5c2929a3abeb978b Mon Sep 17 00:00:00 2001 From: John Soo Date: Wed, 19 Jun 2019 06:16:52 -0700 Subject: [PATCH] gnu: Add FreeCAD. - Dependencies: pyside 2 toolchain and llvm dependencies, Coin3D and soqt --- gnu/packages/engineering.scm | 197 +++++++++++++++++++++++++++++++++++ gnu/packages/graphics.scm | 80 ++++++++++++++ gnu/packages/llvm.scm | 105 +++++++++++++++++++ gnu/packages/python-xyz.scm | 151 +++++++++++++++++++++++++++ 4 files changed, 533 insertions(+) diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm index 7d48414889..f000d7eeaa 100644 --- a/gnu/packages/engineering.scm +++ b/gnu/packages/engineering.scm @@ -48,9 +48,11 @@ #:use-module (gnu packages bison) #:use-module (gnu packages boost) #:use-module (gnu packages check) + #:use-module (gnu packages cmake) #:use-module (gnu packages commencement) #:use-module (gnu packages compression) #:use-module (gnu packages curl) + #:use-module (gnu packages documentation) #:use-module (gnu packages flex) #:use-module (gnu packages fontutils) #:use-module (gnu packages fpga) @@ -63,10 +65,13 @@ #:use-module (gnu packages glib) #:use-module (gnu packages gnome) #:use-module (gnu packages gperf) + #:use-module (gnu packages graphics) + #:use-module (gnu packages graphviz) #:use-module (gnu packages groff) #:use-module (gnu packages gtk) #:use-module (gnu packages guile) #:use-module (gnu packages image) + #:use-module (gnu packages image-processing) #:use-module (gnu packages imagemagick) #:use-module (gnu packages linux) ;FIXME: for pcb #:use-module (gnu packages m4) @@ -87,6 +92,7 @@ #:use-module (gnu packages tex) #:use-module (gnu packages version-control) #:use-module (gnu packages wxwidgets) + #:use-module (gnu packages xml) #:use-module (gnu packages xorg)) (define-public librecad @@ -2062,3 +2068,194 @@ purpose circuit simulator and can perform DC and transient analyses, fourier analysis and AC analysis. The engine is designed to do true mixed-mode simulation.") (license license:gpl3+))) + +;; FreeCAD +(define-public freecad + (let ((commit "dbb4cc6415bac848a294f03b80f65e888d531742") + (revision "1")) + (package + (name "freecad") + (version (git-version "0.18.2" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/FreeCAD/FreeCAD.git") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "01ay9wdacm1hymnaw67y8sg63pv0ar1n72ap77q12dv3qibmwz75")))) + (build-system cmake-build-system) + (native-inputs + `(("doxygen" ,doxygen) + ("graphviz" ,graphviz) + ("qttools" ,qttools) + ("pkg-config" ,pkg-config) + ("swig" ,swig))) + (inputs + `(("boost" ,boost) + ("coin3D" ,coin3D) + ("eigen" ,eigen) + ("freetype" ,freetype) + ("glew" ,glew) + ("hdf5" ,hdf5) + ("libarea" ,libarea) + ("libspnav" ,libspnav) + ("medfile" ,medfile) + ("openmpi" ,openmpi) + ("opencascade-oce" ,opencascade-oce) + ("python-matplotlib" ,python-matplotlib) + ("python-pyside-2" ,python-pyside-2) + ("python-pyside-2-tools" ,python-pyside-2-tools) + ("python-shiboken-2" ,python-shiboken-2) + ("python-wrapper" ,python-wrapper) + ("qtbase" ,qtbase) + ("qtsvg" ,qtsvg) + ("qtx11extras" ,qtx11extras) + ("qtxmlpatterns" ,qtxmlpatterns) + ("qtwebkit" ,qtwebkit) + ("soqt" ,soqt) + ("vtk" ,vtk) + ("xerces-c" ,xerces-c) + ("zlib" ,zlib))) + (arguments + `(#:tests? #f + #:configure-flags + (list + "-DBUILD_QT5=ON" + (string-append "-DCMAKE_INSTALL_LIBDIR=" + (assoc-ref %outputs "out") "/lib")) + #:phases + (modify-phases %standard-phases + (add-before 'configure 'restore-pythonpath + (lambda _ + (substitute* "src/Main/MainGui.cpp" + (("_?putenv\\(\"PYTHONPATH=\"\\);") "")) + #t)) + (add-after 'install 'wrap-pythonpath + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (wrap-program (string-append out "/bin/FreeCAD") + (list "PYTHONPATH" + 'prefix (list (getenv "PYTHONPATH"))))) + #t))))) + (home-page "https://www.freecadweb.org/") + (synopsis "Your Own 3D Parametric Modeler") + (description + "FreeCAD is a general purpose feature-based, parametric 3D modeler for +CAD, MCAD, CAx, CAE and PLM, aimed directly at mechanical engineering and +product design but also fits a wider range of uses in engineering, such as +architecture or other engineering specialties. It is 100% Open Source (LGPL2+ +license) and extremely modular, allowing for very advanced extension and +customization.") + ;; Help! + (license license:lgpl2.1+)))) + +(define medfile + (package + (name "medfile") + (version "3.3.1") + (source + (origin + (method url-fetch) + (uri (string-append + "http://files.salome-platform.org/Salome/other/med-" + version ".tar.gz")) + (sha256 + (base32 + "1215sal10xp6xirgggdszay2bmx0sxhn9pgh7x0wg2w32gw1wqyx")))) + (build-system cmake-build-system) + (inputs `(("hdf5" ,hdf5))) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'install 'remove-test-output + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (delete-file-recursively + (string-append out "/bin/testc")) + #t)))))) + (home-page "https://www.salome-platform.org") + (synopsis "Library to read and write MED files") + (description "Library to read and write MED files") + (license license:lgpl2.1))) + +(define libarea + (let ((revision "1") + (commit "8f8bac811c10f1f01fda0d742a18591f61dd76ee")) + (package + (name "libarea") + (version (git-version "0" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference (url "https://github.com/Heeks/libarea.git") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 "0pvqz6cabxqdz5y26wnj6alkn8v5d7gkx0d3h8xmg4lvy9r3kh3g")))) + (build-system gnu-build-system) + (inputs `(("boost" ,boost) + ("python-wrapper" ,python-wrapper))) + (native-inputs + `(("cmake" ,cmake))) + (arguments + `(#:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'configure 'cmake-configure + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out")) + (cmake (assoc-ref inputs "cmake"))) + (mkdir-p "build") + (invoke "cmake" + (string-append "-DCMAKE_INSTALL_PREFIX=" out))))) + (delete 'configure)))) + (home-page "https://github.com/Heeks/libarea") + (synopsis + "Library and python module for pocketing and profiling operations") + (description + "Area is a CAM-related software for pocketing operation. + +This project provides library and associated python-module to compute pocket +operations.") + (license license:bsd-3)))) + +(define libspnav + (let ((commit "20961617eecc845b23fcf9e06acd1a6bb340b88b") + (revision "1")) + (package + (name "libspnav") + (version (git-version "0.2.3" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/FreeSpacenav/libspnav") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1ib5jxcpz76lr90f69vb50yn2q9ss45axlgil29layh36dnyifac")))) + (build-system gnu-build-system) + (inputs + `(("libx11" ,libx11))) + (arguments `(#:tests? #f)) + (home-page "http://spacenav.sourceforge.net/") + (synopsis + "Library for communicating with spacenavd or 3dxsrv") + (description + "The libspnav library is provided as a replacement of the magellan +library. It provides a cleaner, and more orthogonal interface. libspnav +supports both the original X11 protocol for communicating with the driver, and +the new alternative non-X protocol. Programs that choose to use the X11 +protocol, are automatically compatible with either the free spacenavd driver +or the official 3dxserv, as if they were using the magellan SDK. + +Also, libspnav provides a magellan API wrapper on top of the new API. So, any +applications that were using the magellan library, can switch to libspnav +without any changes. And programmers that are familliar with the magellan API +can continue using it with a free library without the restrictions of the +official SDK.") + (license license:bsd-3)))) +;; End FreeCAD diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm index f9baf49fe9..7f0b99476b 100644 --- a/gnu/packages/graphics.scm +++ b/gnu/packages/graphics.scm @@ -52,6 +52,7 @@ #:use-module (gnu packages image) #:use-module (gnu packages imagemagick) #:use-module (gnu packages jemalloc) + #:use-module (gnu packages llvm) #:use-module (gnu packages multiprecision) #:use-module (gnu packages pdf) #:use-module (gnu packages perl) @@ -73,6 +74,7 @@ #:use-module (guix build-system python) #:use-module (guix download) #:use-module (guix git-download) + #:use-module (guix hg-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix packages) #:use-module (guix utils)) @@ -961,3 +963,81 @@ your terminal. It comes bundled with predefined styles: look. The result can be uploaded on any web server without additional requirements.") (license license:gpl2+))) + +(define-public coin3D + (let ((changeset "8d860d7ba112b22c4e9b289268fd8b3625ab81d3") + (revision "1")) + (package + (name "coin3D") + (version + (string-append "4.0.0a-" revision "." (string-take changeset 7))) + (source + (origin + (method hg-fetch) + (uri (hg-reference (url "https://bitbucket.org/Coin3D/coin") + (changeset changeset))) + (sha256 + (base32 + "0kgg782j8lkd4bicd8x207mj66vali6kxh6idczjszcxq2iifsr0")) + (file-name (git-file-name "coin3D" version)))) + (build-system cmake-build-system) + (native-inputs + `(("doxygen" ,doxygen) + ("graphviz" ,graphviz))) + (inputs + `(("boost" ,boost) + ("freeglut" ,freeglut) + ("glew" ,glew))) + (arguments + `(#:configure-flags + (list + "-DCOIN_BUILD_DOCUMENTATION_MAN=ON" + (string-append "-DBOOST_ROOT=" + (assoc-ref %build-inputs "boost"))))) + (home-page "https://bitbucket.org/Coin3D/coin/wiki/Home") + (synopsis + "High-level 3D visualization library with Open Inventor 2.1 API") + (description + "Coin is a 3D graphics library with an Application Programming Interface +based on the Open Inventor 2.1 API. For those who are not familiar with +Open Inventor, it is a scene-graph based retain-mode rendering and model +interaction library, written in C++, which has become the de facto +standard graphics library for 3D visualization and visual simulation +software in the scientific and engineering community.") + (license license:bsd-3)))) + +(define-public soqt + (let ((changeset "58b495aa6bed9e58542e60df28843f58e2ab8db4") + (revision "1")) + (package + (name "soqt") + (version + (string-append "1.6.0-" revision "." (string-take changeset 7))) + (source + (origin + (method hg-fetch) + (uri (hg-reference (url "https://bitbucket.org/Coin3d/soqt") + (changeset changeset))) + (sha256 + (base32 + "023rhf8piwcmgi08d3xyqj1cj83v30z6l3zbd5qs1y1mkw9lqfpz")) + (file-name (git-file-name "soqt" version)))) + (build-system cmake-build-system) + (native-inputs + `(("doxygen" ,doxygen) + ("graphviz" ,graphviz))) + (inputs + `(("coin3D" ,coin3D) + ("glew" ,glew) + ("libcxx" ,libcxx) + ("qtbase" ,qtbase))) + (arguments `(#:tests? #f)) + (home-page "https://bitbucket.org/Coin3D/soqt") + (synopsis + "GUI component toolkit library for Coin") + (description + "SoQt is a Qt GUI component toolkit library for Coin. It is also +compatible with SGI and TGS Open Inventor, and the API is based on the API of +the InventorXt GUI component toolkit.") + (license license:bsd-3)))) + diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm index 0315740bcd..4a044ce9f6 100644 --- a/gnu/packages/llvm.scm +++ b/gnu/packages/llvm.scm @@ -37,6 +37,7 @@ #:use-module (guix build-system cmake) #:use-module (guix build-system emacs) #:use-module (guix build-system python) + #:use-module (guix build-system trivial) #:use-module (gnu packages) #:use-module (gnu packages gcc) #:use-module (gnu packages bootstrap) ;glibc-dynamic-linker @@ -667,3 +668,107 @@ C/C++/Obj-C code according to a set of style options, see (synopsis "Rename every occurrence of a symbol using clang-rename") (description "This package renames every occurrence of a symbol at point using @code{clang-rename}."))) + +;; PySide2 docs recommend using a bundled version of libclang +;; See https://wiki.qt.io/Qt_for_Python/GettingStarted +;; The source they recommend: https://download.qt.io/development_releases/prebuilt/libclang/ +(define-public llvm-toolchain-6 + (package + (inherit llvm-6) + (name "llvm-toolchain") + (build-system trivial-build-system) + (inputs + `(("clang-6" ,clang-6) + ("llvm-6" ,llvm-6))) + (arguments + `(#:modules ((guix build union) + (guix build utils)) + #:builder + (begin + (use-modules (guix build union) + (ice-9 match) + (srfi srfi-1)) + (union-build + (assoc-ref %outputs "out") + (filter-map + (match-lambda + ((name . dir) + (if (or (string=? name "clang-6") + (string=? name "llvm-6")) + dir + #f))) + %build-inputs)) + #t))) + (license license:ncsa))) + +;; See https://bugreports.qt.io/browse/PYSIDE-787 +;; STL headers are not parsed correctly, so only send in some headers +(define-public python-pyside-2-libcxx-headers + (package + (inherit libcxx) + (name "python-pyside-2-libcxx-headers") + (version (package-version llvm-6)) + (source + (origin + (inherit (package-source libcxx)) + (uri (string-append "http://llvm.org/releases/" + version "/libcxx-" version ".src.tar.xz")) + (sha256 + (base32 + "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n")))) + (native-inputs + `(("clang" ,clang-6) + ("llvm" ,llvm-6))) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'install 'use-only-required-headers + (lambda* (#:key outputs #:allow-other-keys) + (use-modules ((srfi srfi-1))) + (let ((out (assoc-ref outputs "out")) + (required-headers + '("type_traits" + "__config" + "cstddef" + "__nullptr" + "utility" + "__tuple" + "initializer_list" + "cstring" + "cstdint" + "__debug"))) + (for-each + delete-file + (filter + (lambda (file) + (not + (fold + (lambda (acc header) + (or acc (string-contains file header))) + #f + required-headers))) + (find-files (string-append out "/include/c++/v1")))) + (delete-file-recursively (string-append out "/include/c++/v1/ext")) + (delete-file-recursively (string-append out "/include/c++/v1/support")) + (delete-file-recursively (string-append out "/lib"))) + #t))))) + (synopsis + "Libcxx files specifically used by PySide2.") + (description + "Libcxx files specifically used by PySide2."))) + +(define-public libcxx-6 + (package + (inherit libcxx) + (version (package-version llvm-6)) + (source + (origin + (inherit (package-source libcxx)) + (uri (string-append "http://llvm.org/releases/" + version "/libcxx-" version ".src.tar.xz")) + (sha256 + (base32 + "0rzw4qvxp6qx4l4h9amrq02gp7hbg8lw4m0sy3k60f50234gnm3n")))) + (native-inputs + `(("clang" ,clang-6) + ("llvm" ,llvm-6))))) diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm index 181899da36..315682294b 100644 --- a/gnu/packages/python-xyz.scm +++ b/gnu/packages/python-xyz.scm @@ -86,6 +86,7 @@ #:use-module (gnu packages backup) #:use-module (gnu packages bash) #:use-module (gnu packages check) + #:use-module (gnu packages cmake) #:use-module (gnu packages compression) #:use-module (gnu packages crypto) #:use-module (gnu packages databases) @@ -15803,3 +15804,153 @@ hash, recno, and queue. Complete support of Berkeley DB distributed transactions. Complete support for Berkeley DB Replication Manager. Complete support for Berkeley DB Base Replication. Support for RPC.") (license license:bsd-3))) + +(define-public python-pyside-2 + (let ((revision "1") + (commit "4018787a3cc01d632fdca7891ac8aa9487110c26")) + (package + (name "python-pyside-2") + (version (git-version "v5.11.3" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://code.qt.io/pyside/pyside-setup") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0g8jacm2iqd7lw2m7f1dp1nnrsk38bl3m8pihm8zz9gxs8d31sf5")))) + (build-system cmake-build-system) + (inputs + `(("python-pyside-2-libcxx-headers" ,python-pyside-2-libcxx-headers) + ("libxml2" ,libxml2) + ("libxslt" ,libxslt) + ("llvm-toolchain-6" ,llvm-toolchain-6) + ("qtbase" ,qtbase) + ("qtdatavis3d" ,qtdatavis3d) + ("qtmultimedia" ,qtmultimedia) + ("qtquickcontrols" ,qtquickcontrols) ;; ?? + ("qtscript" ,qtscript) + ("qtscxml" ,qtscxml) + ("qtsensors" ,qtsensors) + ("qtspeech" ,qtspeech) + ("qtsvg" ,qtsvg) + ("qtwebchannel" ,qtwebchannel) + ("qtwebsockets" ,qtwebsockets) + ("qtx11extras" ,qtx11extras))) + (native-inputs + `(("cmake" ,cmake) + ("git" ,git) + ("python-shiboken-2" ,python-shiboken-2) + ("python-wrapper" ,python-wrapper) + ("qttools" ,qttools) + ("which" ,which))) + (arguments + `(#:tests? #f + #:configure-flags '("-DBUILD_TESTS=off") + #:phases + (modify-phases + %standard-phases + (add-after 'unpack 'go-to-source-dir + (lambda _ (chdir "sources/pyside2") #t)) + (add-before 'configure 'set-clang-dir + (lambda* (#:key inputs #:allow-other-keys) + (let ((clang-dir (assoc-ref inputs "llvm-toolchain-6")) + (libcxx-dir (assoc-ref inputs "python-pyside-2-libcxx-headers"))) + (setenv "CLANG_INSTALL_DIR" clang-dir) + (substitute* "cmake/Macros/PySideModules.cmake" + (("--include-paths=") + (string-append "--include-paths=" libcxx-dir "/include/c++/v1:"))) + #t)))))) + (home-page "https://wiki.qt.io/Qt_for_Python") + (synopsis + "The Qt for Python product enables the use of Qt5 APIs in Python applications.") + (description + "The Qt for Python product enables the use of Qt5 APIs in Python applications. It lets Python developers utilize the full potential of Qt, using the PySide2 module. The PySide2 module provides access to the individual Qt modules such as QtCore, QtGui, and so on. Qt for Python also comes with the Shiboken2 CPython binding code generator, which can be used to generate Python bindings for your C or C++ code.") + ;; Help! + (license + `(,license:fdl1.3+ + ,license:gpl2+ + ,license:gpl3+ + ;; https://code.qt.io/cgit/pyside/pyside-setup.git/tree/LICENSE.GPLv3-EXCEPT + ;; https://code.qt.io/cgit/pyside/pyside-setup.git/tree/LICENSE.COMMERCIAL + ,license:lgpl3))))) + +(define-public python-shiboken-2 + (let ((revision "1") + (commit "4018787a3cc01d632fdca7891ac8aa9487110c26")) + (package + (name "python-shiboken-2") + (version (git-version "v5.11.3" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://code.qt.io/pyside/pyside-setup") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0g8jacm2iqd7lw2m7f1dp1nnrsk38bl3m8pihm8zz9gxs8d31sf5")))) + (build-system cmake-build-system) + (inputs + `(("llvm-toolchain-6" ,llvm-toolchain-6) + ("libxml2" ,libxml2) + ("libxslt" ,libxslt) + ("python-wrapper" ,python-wrapper) + ("qtbase" ,qtbase) + ("qtxmlpatterns" ,qtxmlpatterns))) + (arguments + `(#:tests? #f + #:configure-flags '("-DBUILD_TESTS=off") + #:phases + (modify-phases + %standard-phases + (add-after 'unpack 'use-shiboken-dir-only + (lambda _ (chdir "sources/shiboken2") #t)) + (add-before 'configure 'set-build-env + (lambda* (#:key inputs #:allow-other-keys) + (let ((llvm-toolchain-dir (assoc-ref inputs "llvm-toolchain-6"))) + (setenv "CLANG_INSTALL_DIR" llvm-toolchain-dir) + #t)))))) + (home-page "https://wiki.qt.io/Qt_for_Python") + (synopsis + "Shiboken generates bindings for C++ libraries using CPython source code") + (description + "Shiboken generates bindings for C++ libraries using CPython source code") + ;; Help! + (license `(,license:gpl2+ + ,license:llgpl))))) + +(define-public python-pyside-2-tools + (let ((revision "1") + (commit "f1b775537e7fbd718516749583b2abf1cb6adbce")) + (package + (name "python-pyside-2-tools") + (version (git-version "v5.11.2" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://code.qt.io/pyside/pyside-tools") + (commit commit))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1w2g5afvww9r89wmdm9jx8sz67x4bzy9difkh72n4c73ya1n91ry")))) + (build-system cmake-build-system) + (inputs + `(("python-pyside-2" ,python-pyside-2) + ("python-shiboken-2" ,python-shiboken-2) + ("qtbase" ,qtbase))) + (arguments + `(#:tests? #f + #:configure-flags '("-DBUILD_TESTS=off"))) + (home-page "https://wiki.qt.io/Qt_for_Python") + (synopsis + "Contains lupdate, rcc and uic tools for PySide2") + (description + "Contains lupdate, rcc and uic tools for PySide2") + ;; Help! (This is from arch) + (license license:lgpl2.1+)))) -- 2.22.0