Subject: [PATCH v2] gnu: vtk: Update to 9.3.0

From: Lars Bilke <[email-masked]>
Date: Mon, 03 Jun 2024 16:01:41 +0200

Change-Id: Iec44a8e8dcfcf188a872af99e5b6e8c9fda7b416
---
 gnu/packages/engineering.scm               |  4 +-
 gnu/packages/image-processing.scm          |  5 ++-
 gnu/packages/patches/freecad-vtk-9.3.patch | 43 ++++++++++++++++++++++
 3 files changed, 49 insertions(+), 3 deletions(-)
 create mode 100644 gnu/packages/patches/freecad-vtk-9.3.patch

diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 624024b8d4..cfcd3f8da7 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -2806,7 +2806,9 @@ (define-public freecad
              (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0s720q6vxlh78jzahqp69nl8wagb42l05dym5aqhfnr31dx666hc"))))
+        (base32 "0s720q6vxlh78jzahqp69nl8wagb42l05dym5aqhfnr31dx666hc"))
+       ;; https://github.com/FreeCAD/FreeCAD/pull/11496
+       (patches (search-patches "freecad-vtk-9.3.patch"))))
     (build-system qt-build-system)
     (native-inputs
      (list doxygen
diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm
index 7c9d12557e..65fe793f2d 100644
--- a/gnu/packages/image-processing.scm
+++ b/gnu/packages/image-processing.scm
@@ -309,7 +309,7 @@ (define-public opencolorio
 (define-public vtk
   (package
     (name "vtk")
-    (version "9.2.2")
+    (version "9.3.0")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://vtk.org/files/release/"
@@ -317,7 +317,7 @@ (define-public vtk
                                   "/VTK-" version ".tar.gz"))
               (sha256
                (base32
-                "0x8h2bwxq2870067j7wqd0qym87pa3inkbri93zrdb0zwwmhlnqw"))
+                "1s8vd34nhrgnw1bf9zhfn062d53fwq3csjfwvm7lxcr5a8lvkizx"))
               (modules '((guix build utils)))
               (snippet
                '(begin
@@ -388,6 +388,7 @@ (define-public vtk
 
                    ;; Do not retain a reference to GCC.
                    (substitute* (choose
+                                 "Common/Core/vtkBuild.h.in" ;dummy >=v9.3
                                  "Common/Core/vtkConfigureDeprecated.h.in" ;v9.x
                                  "Common/Core/vtkConfigure.h.in") ;v7.x
                      (("@CMAKE_CXX_COMPILER@") "c++")))))
diff --git a/gnu/packages/patches/freecad-vtk-9.3.patch b/gnu/packages/patches/freecad-vtk-9.3.patch
new file mode 100644
index 0000000000..af9d654046
--- /dev/null
+++ b/gnu/packages/patches/freecad-vtk-9.3.patch
@@ -0,0 +1,43 @@
+From d0fb2b8b29fe0428d9dd8aa790b0d6e45c8a9516 Mon Sep 17 00:00:00 2001
+From: Adrian Insaurralde Avalos <[email-masked]>
+Date: Wed, 22 Nov 2023 16:42:06 -0300
+Subject: [PATCH] 3rdPart/salomesmesh - fix for vtk 9.3 compatibility
+
+minimum required version is 7.1
+---
+ src/3rdParty/salomesmesh/inc/SMESH_SMDS.hxx                 | 4 ----
+ src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp | 5 +++++
+ 2 files changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/3rdParty/salomesmesh/inc/SMESH_SMDS.hxx b/src/3rdParty/salomesmesh/inc/SMESH_SMDS.hxx
+index 7f89573efd0d..47a52fe585fe 100644
+--- a/src/3rdParty/salomesmesh/inc/SMESH_SMDS.hxx
++++ b/src/3rdParty/salomesmesh/inc/SMESH_SMDS.hxx
+@@ -39,10 +39,6 @@
+  #define SMDS_EXPORT
+ #endif
+ 
+-#ifdef VTK_HAS_MTIME_TYPE
+ #define VTK_MTIME_TYPE vtkMTimeType
+-#else
+-#define VTK_MTIME_TYPE unsigned long
+-#endif
+ 
+ #endif
+diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
+index 7e3de0070a02..e9895d615717 100644
+--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
++++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
+@@ -1026,7 +1026,12 @@ void SMDS_UnstructuredGrid::BuildLinks()
+   GetLinks()->Allocate(this->GetNumberOfPoints());
+   GetLinks()->Register(this);
+ //FIXME: vtk9
++  #if VTK_VERSION_NUMBER < VTK_VERSION_CHECK(9,3,0)
+   GetLinks()->BuildLinks(this);
++  #else
++  GetLinks()->SetDataSet(this);
++  GetLinks()->BuildLinks();
++  #endif
+   GetLinks()->Delete();
+ #else
+   this->Links = SMDS_CellLinks::New();
\ No newline at end of file

base-commit: 2dfe45e12ed55e5f9bf3d4061200bc607e2e5db8
-- 
2.44.0