Subject: Re: [bug#36440] [PATCH] Add FreeCAD

From: John Soo <[email-masked]>
Date: Wed, 4 Sep 2019 05:44:06 +0000

Hi Paul and everyone,

I added libxmu and libxi as inputs and that gets progress. I am not sure
whether we want to propagate them from opencascade-occt though. I can see
either way working well.

Now there is this error when building:

/tmp/guix-build-freecad-0.18.3.drv-0/source/src/Mod/Import/App/ImportOCAF.cpp:100:30:
fatal error: tbb/parallel_for.h: No such file or directory compilation
terminated.
make[2]: *** [src/Mod/Import/App/CMakeFiles/Import.dir/build.make:114:
src/Mod/Import/App/CMakeFiles/Import.dir/ImportOCAF.cpp.o] Error 1

Thanks again,

John

On Tue, Sep 3, 2019 at 7:45 PM Paul Garlick <
[email-masked]> wrote:

> Hi John,
>
> > Switching to opencascade-occt does not build. It fails with `ld:
> > cannot find -lXmu` when building the PartDesigner module.
>
> libxmu is one of the opencascade-occt dependencies.  It might make
> sense to propagate this input in the opencascade-occt package
> definition.
>
> Could you test whether FreeCAD builds successfully with a libxmu input?
> There may be other dependencies that need to be propagated too.
>
> Best regards,
>
> Paul.
>
>
From dee0f37b105e58b3c05e7d6ff4738d47f42856bd Mon Sep 17 00:00:00 2001
From: John Soo <[email-masked]>
Date: Wed, 3 Jul 2019 09:40:31 -0700
Subject: [PATCH 01/10] gnu: Add coin3D.

* gnu/packages/graphics.scm (coin3D): New variable.
---
 gnu/packages/graphics.scm | 48 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index b06a369325..4c1b9cf24f 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2018 Kei Kebreau <[email-masked]>
 ;;; Copyright © 2019 Mark H Weaver <[email-masked]>
 ;;; Copyright © 2019 Carlo Zancanaro <[email-masked]>
+;;; Copyright © 2019 John Soo <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -74,6 +75,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))
@@ -1018,3 +1020,49 @@ requirements.")
 performance subdivision surface (subdiv) evaluation on massively parallel CPU
 and GPU architectures.")
     (license license:asl2.0)))
+
+(define-public coin3D
+  (package
+    (name "coin3D")
+    (version "4.0.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://bitbucket.org/Coin3D/coin/downloads/coin-"
+             version "-src.zip"))
+       (sha256
+        (base32
+         "1mqwlqzvc9ydfxi0bfskwlil16mbnkphfz36p0zl2mvw6h05aqh0"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           (for-each delete-file
+                     '("cfg/csubst.exe"
+                       "cfg/wrapmsvc.exe"))
+           #t))))
+    (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)))
-- 
2.23.0

From 4db1ea8b81cddb753076f342de8c1afe1a8d28e1 Mon Sep 17 00:00:00 2001
From: John Soo <[email-masked]>
Date: Sat, 6 Jul 2019 08:34:24 -0700
Subject: [PATCH 02/10] gnu: Add llvm-toolchain-6.

* gnupackages/llvm.scm (llvm-toolchain-6): New variable.
---
 gnu/packages/llvm.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 9efb4a4841..19d5f63fd6 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2018 Tim Gesthuizen <[email-masked]>
 ;;; Copyright © 2018 Pierre Neidhardt <[email-masked]>
 ;;; Copyright © 2019 Rutger Helling <[email-masked]>
+;;; Copyright © 2019 John Soo <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -37,6 +38,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
@@ -690,3 +692,36 @@ 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)))
+
-- 
2.23.0

From 04945ef3be3a7c1d006e752e0a21f946c9bf06e6 Mon Sep 17 00:00:00 2001
From: John Soo <[email-masked]>
Date: Sat, 6 Jul 2019 09:13:50 -0700
Subject: [PATCH 03/10] gnu: Add python-shiboken-2.

* gnu/packages/qt.scm (python-shiboken-2): New variable.
---
 gnu/packages/qt.scm | 55 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 52eb46cce0..ce64ab5d09 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -11,6 +11,7 @@
 ;;; Copyright © 2018 Nicolas Goaziou <[email-masked]>
 ;;; Copyright © 2018 Hartmut Goebel <[email-masked]>
 ;;; Copyright © 2018 Eric Bavier <[email-masked]>
+;;; Copyright © 2018 John Soo <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -38,7 +39,9 @@
   #:use-module (guix packages)
   #:use-module (guix utils)
   #:use-module (gnu packages)
+  #:use-module (gnu packages base)
   #:use-module (gnu packages bison)
+  #:use-module (gnu packages cmake)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cups)
   #:use-module (gnu packages databases)
@@ -54,6 +57,7 @@
   #:use-module (gnu packages icu4c)
   #:use-module (gnu packages image)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages llvm)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages nss)
   #:use-module (gnu packages pciutils)
@@ -67,6 +71,7 @@
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages vulkan)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xorg)
@@ -2277,3 +2282,53 @@ user-friendly than the default @code{QColorDialog} and several other
 color-related widgets.")
       ;; Includes a license exception for combining with GPL2 code.
       (license license:lgpl3+))))
+
+(define-public python-shiboken-2
+  (let ((revision "1")
+        ;; Pinned to branches with support for qt 5.11.3
+        (commit "4018787a3cc01d632fdca7891ac8aa9487110c26"))
+    (package
+      (name "python-shiboken-2")
+      (version (git-version "v5.11.3" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               ;; The latest versions of Shiboken live in the pyside repo.
+               ;; There is another standalone repo only for Shiboken
+               ;; but it is outdated
+               (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
+         ;; FIXME: Building tests fails
+         #: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 (assoc-ref inputs "llvm-toolchain-6")))
+                 (setenv "CLANG_INSTALL_DIR" llvm)
+                 #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)))))
-- 
2.23.0

From 5b74864be1690759141f5a971d11c2d5e4d889e3 Mon Sep 17 00:00:00 2001
From: John Soo <[email-masked]>
Date: Mon, 2 Sep 2019 07:27:15 -0700
Subject: [PATCH 05/10] gnu: Add python-pyside-2.

 * gnu/packages/qt.scm (python-pyside-2): New variable.
---
 gnu/packages/qt.scm | 81 +++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index ce64ab5d09..2ad529dd19 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -2332,3 +2332,84 @@ color-related widgets.")
       ;; Help!
       (license `(,license:gpl2+
                  ,license:llgpl)))))
+
+(define-public python-pyside-2
+  (let ((revision "1")
+        ;; Pinned to branches with support for qt 5.11.3
+        (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
+       `(("libcxx" ,libcxx-6)
+         ("libxml2" ,libxml2)
+         ("libxslt" ,libxslt)
+         ("llvm-toolchain-6" ,llvm-toolchain-6)
+         ("qtbase" ,qtbase)
+         ("qtdatavis3d" ,qtdatavis3d)
+         ("qtlocation" ,qtlocation)
+         ("qtmultimedia" ,qtmultimedia)
+         ("qtquickcontrols" ,qtquickcontrols)
+         ("qtscript" ,qtscript)
+         ("qtscxml" ,qtscxml)
+         ("qtsensors" ,qtsensors)
+         ("qtspeech" ,qtspeech)
+         ("qtsvg" ,qtsvg)
+         ("qtwebchannel" ,qtwebchannel)
+         ("qtwebsockets" ,qtwebsockets)
+         ("qtx11extras" ,qtx11extras)
+         ("qtxmlpatterns" ,qtxmlpatterns)))
+      (native-inputs
+       `(("cmake" ,cmake)
+         ("git" ,git)
+         ("python-shiboken-2" ,python-shiboken-2)
+         ("python-wrapper" ,python-wrapper)
+         ("qttools" ,qttools)
+         ("which" ,which)))
+      (arguments
+       `(#:tests? #f
+         ;; FIXME: Building tests fail.
+         #:configure-flags '("-DBUILD_TESTS=FALSE")
+         #: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 (assoc-ref inputs "llvm-toolchain-6"))
+                     (libcxx (assoc-ref inputs "libcxx")))
+                 (setenv "CLANG_INSTALL_DIR" clang)
+                 (substitute* "cmake/Macros/PySideModules.cmake"
+                   (("--include-paths=")
+                    (string-append "--include-paths=" libcxx "/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)))))
-- 
2.23.0

From 73801611f8b878c442b220b06aa796063436936d Mon Sep 17 00:00:00 2001
From: John Soo <[email-masked]>
Date: Sun, 11 Aug 2019 12:38:08 -0700
Subject: [PATCH 04/10] gnu: Add libcxx-6

* gnu/packages/llvm.scm (libcxx-6): New variable.
---
 gnu/packages/llvm.scm | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 19d5f63fd6..0425591e50 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -442,6 +442,27 @@ with that of libgomp, the GNU Offloading and Multi Processing Library.")
                    "0rxn4rh7rrnsqbdgp4gzc8ishbkryhpl1kd3mpnxzpxxhla3y93w"
                    #:patches '("clang-6.0-libc-search-path.patch")))
 
+(define-public libcxx-6
+  (package
+    (inherit libcxx)
+    (name "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)))
+    (synopsis
+     "Libcxx files specifically used by PySide2")
+    (description
+     "Libcxx files specifically used by PySide2.")))
+
 (define-public llvm-3.9.1
   (package (inherit llvm)
     (name "llvm")
-- 
2.23.0

From 6149b0d87f87eee79372c8e95e62dcde945f048a Mon Sep 17 00:00:00 2001
From: John Soo <[email-masked]>
Date: Sat, 6 Jul 2019 19:05:37 -0700
Subject: [PATCH 07/10] gnu: Add libspnav.

* gnu/packages/engineering.scm (libspnav): New variable.
---
 gnu/packages/engineering.scm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 54bf5a7b69..9ef985b9f9 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -13,6 +13,7 @@
 ;;; Copyright © 2019 Tim Stahel <[email-masked]>
 ;;; Copyright © 2019 Jovany Leandro G.C <[email-masked]>
 ;;; Copyright © 2019 Steve Sprang <[email-masked]>
+;;; Copyright © 2019 John Soo <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2145,3 +2146,38 @@ well as conversion and validation tools for input and output data.  The
 specification can be downloaded at @url{http://3mf.io/specification/}.")
     (home-page "https://3mf.io/")
     (license license:bsd-2)))
+
+(define-public libspnav
+  (package
+    (name "libspnav")
+    (version "0.2.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://downloads.sourceforge.net/spacenav/libspnav-"
+             version ".tar.gz"))
+       (sha256
+        (base32
+         "14qzbzpfdb0dfscj4n0g8h8n71fcmh0ix2c7nhldlpbagyxxgr3s"))))
+    (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)))
-- 
2.23.0

From 5ae82affcec8f78164b687f28daea8c028477eb1 Mon Sep 17 00:00:00 2001
From: John Soo <[email-masked]>
Date: Sat, 6 Jul 2019 18:49:08 -0700
Subject: [PATCH 06/10] gnu: Add python-pyside-2-tools.

* gnu/packages/qt.scm (python-pyside-2-tools): New variable.
---
 gnu/packages/qt.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index 2ad529dd19..a76e023fb6 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -2413,3 +2413,36 @@ generate Python bindings for your C or C++ code.")
          ;; 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-pyside-2-tools
+  (let ((revision "1")
+        ;; Pinned to branches with support for qt 5.11.3
+        (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 command line tools for PySide2")
+      (description
+       "Contains lupdate, rcc and uic tools for PySide2")
+      ;; Help! (This is from arch)
+      (license license:lgpl2.1+))))
-- 
2.23.0

From 606613bf4d3fff71921a6ec22542c9e96620661a Mon Sep 17 00:00:00 2001
From: John Soo <[email-masked]>
Date: Sun, 7 Jul 2019 10:03:38 -0700
Subject: [PATCH 08/10] gnu: Add libarea.

* gnu/packages/engineering.scm (libarea): New variable.
---
 gnu/packages/engineering.scm | 42 ++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 9ef985b9f9..cd74c73d7e 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -51,6 +51,7 @@
   #: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)
@@ -2147,6 +2148,47 @@ specification can be downloaded at @url{http://3mf.io/specification/}.")
     (home-page "https://3mf.io/")
     (license license:bsd-2)))
 
+(define-public 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:gpl3+))))
+
 (define-public libspnav
   (package
     (name "libspnav")
-- 
2.23.0

From 6cb467285036bcd3eedd304d2491bf62fe2f881d Mon Sep 17 00:00:00 2001
From: John Soo <[email-masked]>
Date: Sun, 7 Jul 2019 10:13:17 -0700
Subject: [PATCH 09/10] gnu: Add libmedfile.

* gnu/packages/engineering.scm (libmedfile): New variable.
---
 gnu/packages/engineering.scm | 45 ++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index cd74c73d7e..5dd50cef3a 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2148,6 +2148,51 @@ specification can be downloaded at @url{http://3mf.io/specification/}.")
     (home-page "https://3mf.io/")
     (license license:bsd-2)))
 
+(define-public libmedfile
+  (package
+    (name "libmedfile")
+    (version "4.0.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://files.salome-platform.org/Salome/other/med-"
+             version ".tar.gz"))
+       (sha256
+        (base32
+         "017h9p0x533fm4gn6pwc8kmp72rvqmcn6vznx72nkkl2b05yjx54"))))
+    (build-system cmake-build-system)
+    (inputs `(("hdf5" ,hdf5-1.10)))
+    (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
+     "The purpose of the MED module is to provide a standard for storing and
+recovering computer data associated to numerical meshes and fields, and to
+facilitate the exchange between codes and solvers.
+
+The persistent data storage is based upon HDF format (like CGNS, a standard
+developed by Boeing and NASA in the area of Computational Fluid Dynamic).
+
+MED also provides structures to hold data on meshes and fields. These
+structures are exchanged between solvers, hide the communication level (CORBA
+or MPI), and offer persistence (read/write in .med files).
+
+The main benefit of a common exchange format is reduced complexity of code
+coupling. It also allows sharing such high level functionalities as
+computation of nodal connectivity of sub-elements (faces and edges),
+arithmetic operations on fields, entity location functionalities, and
+interpolation toolkit.")
+    (license license:gpl3+)))
+
 (define-public libarea
   (let ((revision "1")
         (commit "8f8bac811c10f1f01fda0d742a18591f61dd76ee"))
-- 
2.23.0

From 5196710f4fcec44fa93ea1f061dc6057b7bdc0a7 Mon Sep 17 00:00:00 2001
From: John Soo <[email-masked]>
Date: Sun, 7 Jul 2019 10:32:10 -0700
Subject: [PATCH 10/10] gnu: Add freecad.

* gnu/packages/engineering.scm (freecad): New variable.
---
 gnu/packages/engineering.scm | 86 ++++++++++++++++++++++++++++++++++++
 1 file changed, 86 insertions(+)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 5dd50cef3a..627ce5e22c 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -55,6 +55,7 @@
   #: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)
@@ -67,10 +68,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)
@@ -91,6 +95,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
@@ -2148,6 +2153,87 @@ specification can be downloaded at @url{http://3mf.io/specification/}.")
     (home-page "https://3mf.io/")
     (license license:bsd-2)))
 
+(define-public freecad
+  (package
+    (name "freecad")
+    (version "0.18.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/FreeCAD/FreeCAD.git")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1ny29y0h8smg1bwi5yn4kcnyfprqh3v7v2z8837cmmhcwp8dr95m"))))
+    (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-1.10)
+       ("libarea" ,libarea)
+       ("libmedfile" ,libmedfile)
+       ("libspnav" ,libspnav)
+       ("libxi" ,libxi)
+       ("libxmu" ,libxmu)
+       ("openmpi" ,openmpi)
+       ("opencascade-occt" ,opencascade-occt)
+       ("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)
+       ("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-public libmedfile
   (package
     (name "libmedfile")
-- 
2.23.0