Subject: Re: [bug#45573] [PATCH] Correct freecad runtime errors

From: Ekaitz Zarraga <[email-masked]>
Date: Fri, 01 Jan 2021 14:37:39 +0000

Hi,

I attach the corrected patch set.
If something is missing please let me know.

Thanks.

Happy new year.

Ekaitz

From 8c8c82dfc52a8775b01a0d038ddf42ba453624e5 Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <[email-masked]>
Date: Fri, 1 Jan 2021 15:16:07 +0100
Subject: [PATCH 1/6] gnu: Add coin3D-4.

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

diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 7a61084f24..86c95ef11b 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -1732,6 +1732,57 @@ standard graphics library for 3D visualization and visual simulation
 software in the scientific and engineering community.")
       (license license:bsd-3))))
 
+(define-public coin3D-4
+    (package
+    (name "coin3D-4")
+    (version "4.0.0")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/coin3d/coin")
+               (commit (string-append "Coin-" version))
+               (recursive? #t)))
+        (file-name (git-file-name name version))
+        (sha256
+          (base32 "1ayg0hl8wanhadahm5xbghghxw1qjwqbrs3dl3ngnff027hsyf8p"))
+        (modules '((guix build utils)))
+        (snippet
+          '(begin
+             ;; Delete binaries
+             (for-each delete-file
+                       '("cfg/csubst.exe"
+                         "cfg/wrapmsvc.exe"))
+             ;; Delete references to packaging tool cpack
+             (substitute* "CMakeLists.txt"
+               ((".*cpack.d.*") ""))
+             #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://github.com/coin3d/coin")
+    (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 superfamiconv
   (package
     (name "superfamiconv")
-- 
2.29.2

From 97b6ebf7e1c0dfe5728c9e8dc72cd6f7cb237909 Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <[email-masked]>
Date: Fri, 1 Jan 2021 15:17:06 +0100
Subject: [PATCH 2/6] gnu: Add soqt.

    * gnu/packages/qt.scm (soqt): 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 2e621e758c..3e93bc55f4 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -67,6 +67,7 @@
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnupg)
   #:use-module (gnu packages gperf)
+  #:use-module (gnu packages graphics)
   #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages icu4c)
@@ -2824,3 +2825,35 @@ being fully customizable and easy to extend.")
     ;; According to LICENSE, either version 2 or version 3 of the GNU GPL may
     ;; be used.
     (license (list license:gpl2 license:gpl3))))
+
+
+(define-public soqt
+  (let ((commit-ref "fb8f655632bb9c9c60e0ff9fa69a5ba22d3ff99d")
+        (revision "1"))
+    (package
+    (name "soqt")
+    (version (git-version "1.6.0" revision commit-ref))
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/coin3d/soqt")
+               (commit commit-ref)
+               (recursive? #t)))
+        (file-name (git-file-name name version))
+        (sha256
+          (base32 "16vikb3fy8rmk10sg5g0gy2c343hi3x7zccsga90ssnkzpq6m032"))))
+    (build-system cmake-build-system)
+    (arguments '(#:tests? #f)) ; There are no tests
+    (native-inputs
+      `(("pkg-config" ,pkg-config)
+        ("cmake" ,cmake)))
+    (inputs
+      `(("qtbase" ,qtbase)
+        ("coin3D-4" ,coin3D-4)))
+    (home-page "https://github.com/coin3d/soqt")
+    (synopsis "Qt 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))))
-- 
2.29.2

From d823feac3d4a0e05d1c452a0caeaeb528cb01587 Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <[email-masked]>
Date: Fri, 1 Jan 2021 15:24:54 +0100
Subject: [PATCH 5/6] gnu: freecad: move python-pyside-2-tools to native-inputs

    * gnu/packages/engineering.scm (freecad):
    [inputs]: Remove python-pyside-2-tools.
    [native-inputs]: Add python-pyside-2-tools.
---
 gnu/packages/engineering.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 4bb7f68939..113766d453 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2453,6 +2453,7 @@ full programmatic control over your models.")
        ("graphviz" ,graphviz)
        ("qttools" ,qttools)
        ("pkg-config" ,pkg-config)
+       ("python-pyside-2-tools" ,python-pyside-2-tools)
        ("swig" ,swig)))
     (inputs
      `(("boost" ,boost)
@@ -2470,7 +2471,6 @@ full programmatic control over your models.")
        ("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-pivy" ,python-pivy)
        ("python-wrapper" ,python-wrapper)
-- 
2.29.2

From 273b0e5cc9813c2e1965531a11b3778bea46e057 Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <[email-masked]>
Date: Fri, 1 Jan 2021 15:28:09 +0100
Subject: [PATCH 6/6] gnu: freecad: Add qtwebkit input.

    * gnu/packages/engineering.scm (freecad):
    [inputs]: Add qtwebkit.
---
 gnu/packages/engineering.scm | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 113766d453..30846bc1ad 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2478,9 +2478,7 @@ full programmatic control over your models.")
        ("qtsvg" ,qtsvg)
        ("qtx11extras" ,qtx11extras)
        ("qtxmlpatterns" ,qtxmlpatterns)
-       ;; qtwebkit is optional. We remove it currently, because it takes
-       ;; much time to compile and substitutes are often unavailable
-       ;;("qtwebkit" ,qtwebkit)
+       ("qtwebkit" ,qtwebkit)
        ("tbb" ,tbb)
        ("vtk" ,vtk)
        ("xerces-c" ,xerces-c)
-- 
2.29.2

From beb817f850a334ecc3b773499bbd4845ab6d835f Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <[email-masked]>
Date: Fri, 1 Jan 2021 15:17:37 +0100
Subject: [PATCH 3/6] gnu: Add python-pivy.

    * gnu/packages/python-xyz.scm (python-pivy): New variable.
---
 gnu/packages/python-xyz.scm | 44 +++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index d07c91121a..183cfa2894 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -175,6 +175,7 @@
   #:use-module (gnu packages shells)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages ssh)
+  #:use-module (gnu packages swig)
   #:use-module (gnu packages terminals)
   #:use-module (gnu packages tex)
   #:use-module (gnu packages texinfo)
@@ -23238,3 +23239,46 @@ process.")
      "Gamera is a toolkit for building document image recognition systems.")
     (home-page "https://gamera.informatik.hsnr.de/")
     (license license:gpl2+)))
+
+(define-public python-pivy
+  (package
+    (name "python-pivy")
+    (version "0.6.5")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/coin3d/pivy")
+               (commit version)))
+        (file-name (git-file-name name version))
+        (sha256
+          (base32 "0vids7sxk8w5vr73xdnf8xdci71a7syl6cd35aiisppbqyyfmykx"))))
+    (build-system python-build-system)
+    (arguments
+      `(#:tests? #f ; Tests are broken
+        #:phases
+        (modify-phases %standard-phases
+          (add-after 'unpack 'patch-cmake-include-dirs
+           (lambda _
+             ;; Patch buildsystem to respect Coin3D include directory
+             (substitute* "CMakeLists.txt"
+                          (("\\$\\{SoQt_INCLUDE_DIRS}")
+                           "${Coin_INCLUDE_DIR};${SoQt_INCLUDE_DIRS}"))
+             #t)))))
+    (native-inputs
+      `(("cmake" ,cmake)
+        ("swig" ,swig)))
+    (inputs
+      `(("python-wrapper" ,python-wrapper)
+        ("qtbase" ,qtbase)
+        ("libxi" ,libxi)
+        ("libice" ,libice)
+        ("soqt" ,soqt)
+        ("glew" ,glew)
+        ("coin3D-4" ,coin3D-4)))
+    (home-page "https://github.com/coin3d/pivy")
+    (synopsis "Python bindings to Coin3D")
+    (description
+      "Pivy provides python bindings for Coin, a 3D graphics library with an
+Application Programming Interface based on the Open Inventor 2.1 API.")
+    (license license:isc)))
-- 
2.29.2

From 42a78d572abdddbed86b69de0e87468823bfe8d9 Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <[email-masked]>
Date: Fri, 1 Jan 2021 15:22:02 +0100
Subject: [PATCH 4/6] gnu: FreeCad: Update to 0.18.5-1.7616153.

Fixes Draft module import errors

    * gnu/packages/engineering.scm (freecad): Update to 0.18.5-1.7616153.
    [inputs]: Add python-pivy.
---
 gnu/packages/engineering.scm | 41 ++++++++++++++++--------------------
 1 file changed, 18 insertions(+), 23 deletions(-)

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index e436994492..4bb7f68939 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2432,28 +2432,21 @@ full programmatic control over your models.")
     (license license:gpl2+)))
 
 (define-public freecad
-  (package
-    (name "freecad")
-    (version "0.18.5")
-    (source
-     (origin
-       (method git-fetch)
-       (uri (git-reference
-             (url "https://github.com/FreeCAD/FreeCAD")
-             (commit version)))
-       (modules '((guix build utils)))
-       (snippet
-        '(begin
-           ;; Fix build with Python 3.8, see
-           ;; <https://tracker.freecadweb.org/view.php?id=4143>.
-           (substitute* "src/Base/swigpyrun.inl"
-             (("PyObject \\*modules = interp->modules;")
-              "PyObject *modules = PyEval_GetBuiltins();"))
-           #t))
-       (file-name (git-file-name name version))
-       (sha256
-        (base32
-         "0r31jzzkamf76l19fb175hhv48irk06fpi8ldxdlr31w8c1ix4aa"))))
+  (let ((commit-ref "7616153b3c31ace006169cdc2fdafab484498858")
+        (revision "1"))
+    (package
+      (name "freecad")
+      (version (git-version "0.18.5" revision commit-ref))
+      (source
+        (origin
+          (method git-fetch)
+          (uri (git-reference
+                 (url "https://github.com/FreeCAD/FreeCAD")
+                 (commit commit-ref)))
+          (file-name (git-file-name name version))
+          (sha256
+            (base32
+              "16965yxnp2pq7nm8z3p0pjkzjdyq62vfrj8j3nk26bwc898czyn2"))))
     (build-system qt-build-system)
     (native-inputs
      `(("doxygen" ,doxygen)
@@ -2479,6 +2472,7 @@ full programmatic control over your models.")
        ("python-pyside-2" ,python-pyside-2)
        ("python-pyside-2-tools" ,python-pyside-2-tools)
        ("python-shiboken-2" ,python-shiboken-2)
+       ("python-pivy" ,python-pivy)
        ("python-wrapper" ,python-wrapper)
        ("qtbase" ,qtbase)
        ("qtsvg" ,qtsvg)
@@ -2546,7 +2540,8 @@ customization.")
       license:lgpl2.1+
       license:lgpl2.0+
       license:gpl3+
-      license:bsd-3))))
+      license:bsd-3)))))
+
 
 (define-public libmedfile
   (package
-- 
2.29.2