[bug#76269,2/2] gnu: freecad: Add vtk 9.4.1 patch.

Message ID 952e5c6ef995a8e47e6b99355d7bd2c34f3f1ea5.1740386410.git.lars.bilke@ufz.de
State New
Headers
Series [bug#76269,1/2] gnu: vtk: Update to 9.4.1 |

Commit Message

Lars Bilke Feb. 24, 2025, 8:43 a.m. UTC
  * gnu/packages/engineering.scm (freecad): Add vtk 9.4.1 patch.
* gnu/local.mk: Add freecad vtk 9.4.1 patch to list.

Change-Id: I9220aec757c2331a2dfa3eee9d0b84f774785de3
---
 gnu/local.mk                              |  1 +
 gnu/packages/engineering.scm              |  1 +
 gnu/packages/patches/freecad-vtk941.patch | 71 +++++++++++++++++++++++
 3 files changed, 73 insertions(+)
 create mode 100644 gnu/packages/patches/freecad-vtk941.patch
  

Comments

Maxim Cournoyer Feb. 27, 2025, 2:27 p.m. UTC | #1
Hi Lars,

Lars Bilke <lars.bilke@ufz.de> writes:

> * gnu/packages/engineering.scm (freecad): Add vtk 9.4.1 patch.
> * gnu/local.mk: Add freecad vtk 9.4.1 patch to list.
>
> Change-Id: I9220aec757c2331a2dfa3eee9d0b84f774785de3
> ---
>  gnu/local.mk                              |  1 +
>  gnu/packages/engineering.scm              |  1 +
>  gnu/packages/patches/freecad-vtk941.patch | 71 +++++++++++++++++++++++
>  3 files changed, 73 insertions(+)
>  create mode 100644 gnu/packages/patches/freecad-vtk941.patch
>
> diff --git a/gnu/local.mk b/gnu/local.mk
> index 45a9cb635e..35e1b5e6b6 100644
> --- a/gnu/local.mk
> +++ b/gnu/local.mk
> @@ -1317,6 +1317,7 @@ dist_patch_DATA =						\
>    %D%/packages/patches/fpc-reproducibility.patch		\
>    %D%/packages/patches/fpc-glibc-2.34-compat.patch		\
>    %D%/packages/patches/fpm-newer-clamp-fix.patch		\
> +  %D%/packages/patches/freecad-vtk941.patch	\
>    %D%/packages/patches/freedict-tools-fix-determinism.patch	\
>    %D%/packages/patches/freedink-engine-fix-sdl-hints.patch	\
>    %D%/packages/patches/freeimage-libtiff-compat.patch		\
> diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
> index 234f4a2b03..d4d920cd08 100644
> --- a/gnu/packages/engineering.scm
> +++ b/gnu/packages/engineering.scm
> @@ -3173,6 +3173,7 @@ (define-public freecad
>         (file-name (git-file-name name version))
>         (sha256
>          (base32 "0wwymcfgi0cybj7m6awflk8c7n6iy97lpgpfhfncx3zwvjrxv588"))
> +       (patches (search-patches "freecad-vtk941.patch"))  ;; remove on 1.1 release

Thanks for the patch.  Is there a reason we cannot update our freecade
to 1.1 yet?  Perhaps it is not released?

Otherwise, LGTM.

Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>

--
Thanks,
Maxim
  
Lars Bilke Feb. 27, 2025, 2:30 p.m. UTC | #2
Dear Maxim,

thanks for your review.

FreeCAD 1.1 is not released yet.

Sincerely,
Lars

On 27 Feb 2025, at 15:27, Maxim Cournoyer wrote:
>
> Thanks for the patch.  Is there a reason we cannot update our freecade
> to 1.1 yet?  Perhaps it is not released?
>
> Otherwise, LGTM.
>
> Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
>
> --
> Thanks,
> Maxim
  

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 45a9cb635e..35e1b5e6b6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1317,6 +1317,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/fpc-reproducibility.patch		\
   %D%/packages/patches/fpc-glibc-2.34-compat.patch		\
   %D%/packages/patches/fpm-newer-clamp-fix.patch		\
+  %D%/packages/patches/freecad-vtk941.patch	\
   %D%/packages/patches/freedict-tools-fix-determinism.patch	\
   %D%/packages/patches/freedink-engine-fix-sdl-hints.patch	\
   %D%/packages/patches/freeimage-libtiff-compat.patch		\
diff --git a/gnu/packages/engineering.scm b/gnu/packages/engineering.scm
index 234f4a2b03..d4d920cd08 100644
--- a/gnu/packages/engineering.scm
+++ b/gnu/packages/engineering.scm
@@ -3173,6 +3173,7 @@  (define-public freecad
        (file-name (git-file-name name version))
        (sha256
         (base32 "0wwymcfgi0cybj7m6awflk8c7n6iy97lpgpfhfncx3zwvjrxv588"))
+       (patches (search-patches "freecad-vtk941.patch"))  ;; remove on 1.1 release
        (modules '((guix build utils)))
        (snippet
         '(begin
diff --git a/gnu/packages/patches/freecad-vtk941.patch b/gnu/packages/patches/freecad-vtk941.patch
new file mode 100644
index 0000000000..e05548a599
--- /dev/null
+++ b/gnu/packages/patches/freecad-vtk941.patch
@@ -0,0 +1,71 @@ 
+From fafff3a08b7a6212ce3417e08b18cb2fc8e7e868 Mon Sep 17 00:00:00 2001
+From: wmayer <wmayer@freecad.org>
+Date: Mon, 16 Dec 2024 10:56:43 +0100
+Subject: [PATCH] smesh: Fix build failure with vtk 9.4
+
+Fixes #18423
+---
+ .../src/SMDS/SMDS_UnstructuredGrid.cpp          | 17 ++++++++++-------
+ 1 file changed, 10 insertions(+), 7 deletions(-)
+
+diff --git a/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp b/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
+index e9895d615717..4e9d6dc05764 100644
+--- a/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
++++ b/src/3rdParty/salomesmesh/src/SMDS/SMDS_UnstructuredGrid.cpp
+@@ -32,6 +32,7 @@
+ #include <vtkDoubleArray.h>
+ #include <vtkIdTypeArray.h>
+ #include <vtkUnsignedCharArray.h>
++#include <vtkVersionMacros.h>
+ 
+ #include <list>
+ #include <climits>
+@@ -249,14 +250,16 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
+     }
+   }
+ 
+-  if (this->FaceLocations)
++  vtkIdTypeArray* thisFaceLocations = GetFaceLocations();
++  vtkIdTypeArray* thisFaces = GetFaces();
++  if (thisFaceLocations)
+     {
+       vtkIdTypeArray *newFaceLocations = vtkIdTypeArray::New();
+       newFaceLocations->Initialize();
+       newFaceLocations->Allocate(newTypes->GetSize());
+       vtkIdTypeArray *newFaces = vtkIdTypeArray::New();
+       newFaces->Initialize();
+-      newFaces->Allocate(this->Faces->GetSize());
++      newFaces->Allocate(thisFaces->GetSize());
+       for (int i = 0; i < oldCellSize; i++)
+         {
+           if (this->Types->GetValue(i) == VTK_EMPTY_CELL)
+@@ -265,16 +268,16 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
+           if (newTypes->GetValue(newCellId) == VTK_POLYHEDRON)
+             {
+                newFaceLocations->InsertNextValue(newFaces->GetMaxId()+1);
+-               int oldFaceLoc = this->FaceLocations->GetValue(i);
+-               int nCellFaces = this->Faces->GetValue(oldFaceLoc++);
++               int oldFaceLoc = thisFaceLocations->GetValue(i);
++               int nCellFaces = thisFaces->GetValue(oldFaceLoc++);
+                newFaces->InsertNextValue(nCellFaces);
+                for (int n=0; n<nCellFaces; n++)
+                  {
+-                   int nptsInFace = this->Faces->GetValue(oldFaceLoc++);
++                   int nptsInFace = thisFaces->GetValue(oldFaceLoc++);
+                    newFaces->InsertNextValue(nptsInFace);
+                    for (int k=0; k<nptsInFace; k++)
+                      {
+-                       int oldpt = this->Faces->GetValue(oldFaceLoc++);
++                       int oldpt = thisFaces->GetValue(oldFaceLoc++);
+                        newFaces->InsertNextValue(idNodesOldToNew[oldpt]);
+                      }
+                  }
+@@ -292,7 +295,7 @@ void SMDS_UnstructuredGrid::compactGrid(std::vector<int>& idNodesOldToNew, int n
+     }
+   else
+   {
+-    this->SetCells(newTypes, newLocations, newConnectivity, FaceLocations, Faces);
++    this->SetCells(newTypes, newLocations, newConnectivity, thisFaceLocations, thisFaces);
+   }
+ 
+   newPoints->Delete();
\ No newline at end of file