Gentoo Archives: gentoo-commits

From: Alexey Shvetsov <alexxy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/opencascade/files/, sci-libs/opencascade/
Date: Thu, 24 Jun 2021 10:06:29
Message-Id: 1624529173.0f7a957b96c79b35bd8cbb7c712bb7358188853e.alexxy@gentoo
1 commit: 0f7a957b96c79b35bd8cbb7c712bb7358188853e
2 Author: Roman Beranek <roman.beranek <AT> prusa3d <DOT> com>
3 AuthorDate: Thu Jun 3 14:09:09 2021 +0000
4 Commit: Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
5 CommitDate: Thu Jun 24 10:06:13 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0f7a957b
7
8 sci-libs/opencascade[vtk]: prevent name collision
9
10 VTK-9.0 declares in their headers 'struct AllValues' which collides with
11 a macro defined by GLX.
12
13 This has been only partially fixed in the upstream:
14 https://git.dev.opencascade.org/gitweb/?p=occt.git;a=commit;h=2c276f91da0
15
16 It was necessary to put `#undef`s in a few other places.
17
18 Closes: https://bugs.gentoo.org/794031
19 Signed-off-by: Roman Beranek <roman.beranek <AT> prusa3d.com>
20 Closes: https://github.com/gentoo/gentoo/pull/21105
21 Signed-off-by: Alexey Shvetsov <alexxy <AT> gentoo.org>
22
23 ...fix-AllValues-name-collision-with-vtk-9.0.patch | 172 +++++++++++++++++++++
24 sci-libs/opencascade/opencascade-7.5.1-r1.ebuild | 1 +
25 2 files changed, 173 insertions(+)
26
27 diff --git a/sci-libs/opencascade/files/opencascade-7.5.1-fix-AllValues-name-collision-with-vtk-9.0.patch b/sci-libs/opencascade/files/opencascade-7.5.1-fix-AllValues-name-collision-with-vtk-9.0.patch
28 new file mode 100644
29 index 00000000000..e2725ebb2c6
30 --- /dev/null
31 +++ b/sci-libs/opencascade/files/opencascade-7.5.1-fix-AllValues-name-collision-with-vtk-9.0.patch
32 @@ -0,0 +1,172 @@
33 +From f624c55d7b75ccbe3fdfef0db141fdbe1f6b383a Mon Sep 17 00:00:00 2001
34 +From: anv <anv@×××××××××××.com>
35 +Date: Tue, 27 Apr 2021 21:33:54 +0300
36 +Subject: [PATCH 1/2] 0032331: Visualization - Exception when trying to display
37 + some surfaces using iVtk with VTK 9
38 +
39 +Updated memory allocation for vtkPolyData to use more suited method for VTK versions after 9.0
40 +---
41 + src/IVtkDraw/IVtkDraw_Interactor.cxx | 7 +++
42 + src/IVtkTools/IVtkTools_SubPolyDataFilter.cxx | 50 ++++++++++++++++++-
43 + 2 files changed, 56 insertions(+), 1 deletion(-)
44 +
45 +diff --git a/src/IVtkDraw/IVtkDraw_Interactor.cxx b/src/IVtkDraw/IVtkDraw_Interactor.cxx
46 +index f9f68c37b6..1b68c959f5 100644
47 +--- a/src/IVtkDraw/IVtkDraw_Interactor.cxx
48 ++++ b/src/IVtkDraw/IVtkDraw_Interactor.cxx
49 +@@ -20,6 +20,13 @@
50 + #include <vtkWin32OpenGLRenderWindow.h>
51 + #else
52 + #include <GL/glx.h>
53 ++
54 ++// Preventing naming collisions between
55 ++// GLX and VTK versions 9.0 and above
56 ++#ifdef AllValues
57 ++#undef AllValues
58 ++#endif
59 ++
60 + #include <vtkXRenderWindowInteractor.h>
61 + #include <vtkXOpenGLRenderWindow.h>
62 + #endif
63 +diff --git a/src/IVtkTools/IVtkTools_SubPolyDataFilter.cxx b/src/IVtkTools/IVtkTools_SubPolyDataFilter.cxx
64 +index 26ded68af5..bd289d2b51 100644
65 +--- a/src/IVtkTools/IVtkTools_SubPolyDataFilter.cxx
66 ++++ b/src/IVtkTools/IVtkTools_SubPolyDataFilter.cxx
67 +@@ -87,6 +87,11 @@ int IVtkTools_SubPolyDataFilter::RequestData (vtkInformation *vtkNotUsed(theRequ
68 +
69 + // Prepare the list of ids from the set of ids.
70 + // Iterate on input cells.
71 ++#if (VTK_MAJOR_VERSION >= 9)
72 ++ // Count number of different cells.
73 ++ int aNbVerts = 0, aNbLines = 0, aNbPolys = 0, aNbStrips = 0;
74 ++ int aNbVertPts = 0, aNbLinePts = 0, aNbPolyPts = 0, aNbStripPts = 0;
75 ++#endif
76 + if (!myIdsSet.IsEmpty())
77 + {
78 + for (vtkIdType anI = 0; anI < aSize; anI++)
79 +@@ -95,13 +100,56 @@ int IVtkTools_SubPolyDataFilter::RequestData (vtkInformation *vtkNotUsed(theRequ
80 + {
81 + // Add a cell id to output if it's value is in the set.
82 + anIdList->InsertNextId (anI);
83 ++#if (VTK_MAJOR_VERSION >= 9)
84 ++ switch (anInput->GetCellType(anI))
85 ++ {
86 ++ case VTK_VERTEX:
87 ++ aNbVerts++;
88 ++ aNbVertPts++;
89 ++ break;
90 ++ case VTK_POLY_VERTEX:
91 ++ aNbVerts++;
92 ++ aNbVertPts += anInput->GetCell(anI)->GetNumberOfPoints();
93 ++ break;
94 ++ case VTK_LINE:
95 ++ aNbLines++;
96 ++ aNbLinePts += 2;
97 ++ break;
98 ++ case VTK_POLY_LINE:
99 ++ aNbLines++;
100 ++ aNbLinePts += anInput->GetCell(anI)->GetNumberOfPoints();
101 ++ break;
102 ++ case VTK_TRIANGLE:
103 ++ aNbPolys++;
104 ++ aNbPolyPts += 3;
105 ++ break;
106 ++ case VTK_QUAD:
107 ++ aNbPolys++;
108 ++ aNbPolyPts += 4;
109 ++ break;
110 ++ case VTK_POLYGON:
111 ++ aNbPolys++;
112 ++ aNbPolyPts += anInput->GetCell(anI)->GetNumberOfPoints();
113 ++ break;
114 ++ case VTK_TRIANGLE_STRIP:
115 ++ aNbStrips++;
116 ++ aNbStripPts += anInput->GetCell(anI)->GetNumberOfPoints();
117 ++ break;
118 ++ }
119 ++#endif
120 + }
121 + }
122 + }
123 +
124 + // Copy cells with their points according to the prepared list of cell ids.
125 + anOutput->GetCellData()->AllocateArrays(anInput->GetCellData()->GetNumberOfArrays());
126 +- anOutput->Allocate(anInput, anIdList->GetNumberOfIds()); // Allocate output cells
127 ++ // Allocate output cells
128 ++#if (VTK_MAJOR_VERSION >= 9)
129 ++ anOutput->AllocateExact (aNbVerts, aNbVertPts, aNbLines, aNbLinePts, aNbPolys, aNbPolyPts, aNbStrips, aNbStripPts);
130 ++#else
131 ++ anOutput->Allocate (anInput, anIdList->GetNumberOfIds());
132 ++#endif
133 ++
134 + // Pass data arrays.
135 + // Create new arrays for output data
136 + vtkSmartPointer<vtkCellData> anInData = anInput->GetCellData();
137 +--
138 +2.31.1
139 +
140 +
141 +From 3a0d59614378af258b285c7a3cab66c4bb7cecd3 Mon Sep 17 00:00:00 2001
142 +From: Roman Beranek <roman.beranek@×××××××.com>
143 +Date: Thu, 3 Jun 2021 15:41:45 +0200
144 +Subject: [PATCH 2/2] undef AllValues after inclusion of GL/glx.h
145 +
146 +Replicate the measure from 0032331 also for IVtkDraw.cxx and InterfaceGraphic.hxx
147 +---
148 + src/IVtkDraw/IVtkDraw.cxx | 17 +++++++++++------
149 + src/InterfaceGraphic/InterfaceGraphic.hxx | 4 +++-
150 + 2 files changed, 14 insertions(+), 7 deletions(-)
151 +
152 +diff --git a/src/IVtkDraw/IVtkDraw.cxx b/src/IVtkDraw/IVtkDraw.cxx
153 +index 93d4a2fd1a..84bacdc55a 100644
154 +--- a/src/IVtkDraw/IVtkDraw.cxx
155 ++++ b/src/IVtkDraw/IVtkDraw.cxx
156 +@@ -52,6 +52,17 @@
157 +
158 + // prevent disabling some MSVC warning messages by VTK headers
159 + #include <Standard_WarningsDisable.hxx>
160 ++#ifndef _WIN32
161 ++ #include <X11/X.h>
162 ++ #include <X11/Shell.h>
163 ++ #include <X11/Xlib.h>
164 ++ #include <X11/Xutil.h>
165 ++ #include <GL/glx.h>
166 ++ #include <Xw_Window.hxx>
167 ++ #ifdef AllValues
168 ++ #undef AllValues
169 ++ #endif
170 ++#endif
171 + #include <vtkAlgorithmOutput.h>
172 + #include <vtkAppendPolyData.h>
173 + #include <vtkBMPWriter.h>
174 +@@ -75,12 +86,6 @@
175 + #include <vtkTIFFWriter.h>
176 + #include <vtkWindowToImageFilter.h>
177 + #ifndef _WIN32
178 +- #include <X11/X.h>
179 +- #include <X11/Shell.h>
180 +- #include <X11/Xlib.h>
181 +- #include <X11/Xutil.h>
182 +- #include <GL/glx.h>
183 +- #include <Xw_Window.hxx>
184 + #include <vtkXRenderWindowInteractor.h>
185 + #include <vtkXOpenGLRenderWindow.h>
186 + #include <tk.h>
187 +diff --git a/src/InterfaceGraphic/InterfaceGraphic.hxx b/src/InterfaceGraphic/InterfaceGraphic.hxx
188 +index c533f68cd5..bf02b3f397 100644
189 +--- a/src/InterfaceGraphic/InterfaceGraphic.hxx
190 ++++ b/src/InterfaceGraphic/InterfaceGraphic.hxx
191 +@@ -39,7 +39,9 @@
192 + #include <X11/Xutil.h>
193 + #include <X11/Xatom.h>
194 + #include <GL/glx.h>
195 +-
196 ++#ifdef AllValues
197 ++#undef AllValues
198 ++#endif
199 + #endif
200 +
201 + #endif // __INTERFACE_GRAPHIC_HXX
202 +--
203 +2.31.1
204 +
205
206 diff --git a/sci-libs/opencascade/opencascade-7.5.1-r1.ebuild b/sci-libs/opencascade/opencascade-7.5.1-r1.ebuild
207 index ffa4d80678e..666120a0cd9 100644
208 --- a/sci-libs/opencascade/opencascade-7.5.1-r1.ebuild
209 +++ b/sci-libs/opencascade/opencascade-7.5.1-r1.ebuild
210 @@ -68,6 +68,7 @@ PATCHES=(
211 "${FILESDIR}"/${P}-0004-fix-installation-of-cmake-config-files.patch
212 "${FILESDIR}"/${P}-0005-fix-write-permissions-on-scripts.patch
213 "${FILESDIR}"/${P}-0006-fix-creation-of-custom.sh-script.patch
214 + "${FILESDIR}"/${P}-fix-AllValues-name-collision-with-vtk-9.0.patch
215 )
216
217 src_prepare() {