1 |
commit: 19fa78b557686620270aa70ca58d398b3ecc2e33 |
2 |
Author: François-Xavier Carton <fx.carton91 <AT> gmail <DOT> com> |
3 |
AuthorDate: Tue Feb 1 10:14:53 2022 +0000 |
4 |
Commit: Andrew Ammerlaan <andrewammerlaan <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Aug 23 10:58:02 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=19fa78b5 |
7 |
|
8 |
sci-libs/gdcm: new package |
9 |
|
10 |
Signed-off-by: François-Xavier Carton <fx.carton91 <AT> gmail.com> |
11 |
Signed-off-by: Andrew Ammerlaan <andrewammerlaan <AT> gentoo.org> |
12 |
|
13 |
.../gdcm/files/gdcm-3.0.14-include-math-h.patch | 15 +++ |
14 |
sci-libs/gdcm/files/gdcm_support_vtk9.patch | 70 ++++++++++++ |
15 |
sci-libs/gdcm/gdcm-3.0.14.ebuild | 121 +++++++++++++++++++++ |
16 |
sci-libs/gdcm/metadata.xml | 14 +++ |
17 |
4 files changed, 220 insertions(+) |
18 |
|
19 |
diff --git a/sci-libs/gdcm/files/gdcm-3.0.14-include-math-h.patch b/sci-libs/gdcm/files/gdcm-3.0.14-include-math-h.patch |
20 |
new file mode 100644 |
21 |
index 000000000..ba99c3547 |
22 |
--- /dev/null |
23 |
+++ b/sci-libs/gdcm/files/gdcm-3.0.14-include-math-h.patch |
24 |
@@ -0,0 +1,15 @@ |
25 |
+https://cgit.freebsd.org/ports/plain/devel/gdcm/files/patch-Utilities_VTK_vtkImageMapToWindowLevelColors2.cxx?id=8f5541298099b722e34632ca9ed388bda91064e7 |
26 |
+ |
27 |
+- workaround for https://sourceforge.net/p/gdcm/bugs/536/ |
28 |
+ |
29 |
+--- a/Utilities/VTK/vtkImageMapToWindowLevelColors2.cxx 2022-06-26 20:39:45 UTC |
30 |
++++ b/Utilities/VTK/vtkImageMapToWindowLevelColors2.cxx |
31 |
+@@ -37,6 +37,8 @@ |
32 |
+ #include "vtkScalarsToColors.h" |
33 |
+ #include "vtkPointData.h" |
34 |
+ |
35 |
++#include <math.h> |
36 |
++ |
37 |
+ //vtkCxxRevisionMacro(vtkImageMapToWindowLevelColors2, "$Revision: 1.3 $") |
38 |
+ vtkStandardNewMacro(vtkImageMapToWindowLevelColors2) |
39 |
+ |
40 |
|
41 |
diff --git a/sci-libs/gdcm/files/gdcm_support_vtk9.patch b/sci-libs/gdcm/files/gdcm_support_vtk9.patch |
42 |
new file mode 100644 |
43 |
index 000000000..3818a82b5 |
44 |
--- /dev/null |
45 |
+++ b/sci-libs/gdcm/files/gdcm_support_vtk9.patch |
46 |
@@ -0,0 +1,70 @@ |
47 |
+--- a/Utilities/VTK/CMakeLists.txt |
48 |
++++ b/Utilities/VTK/CMakeLists.txt |
49 |
+@@ -26,6 +26,11 @@ |
50 |
+ ) |
51 |
+ endif() |
52 |
+ |
53 |
++if( ${VTK_MAJOR_VERSION} GREATER_EQUAL 9 ) |
54 |
++ set(VTK_INCLUDE_DIRS "${VTK_PREFIX_PATH}/include/vtk-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}") |
55 |
++ include_directories(AFTER ${VTK_INCLUDE_DIRS}) |
56 |
++endif() |
57 |
++ |
58 |
+ include(CheckCXXSourceCompiles) |
59 |
+ set(CMAKE_REQUIRED_INCLUDES ${VTK_INCLUDE_DIRS}) |
60 |
+ CHECK_CXX_SOURCE_COMPILES( |
61 |
+@@ -94,6 +99,10 @@ |
62 |
+ endforeach() |
63 |
+ endif() |
64 |
+ |
65 |
++if( ${VTK_MAJOR_VERSION} GREATER_EQUAL 9 ) |
66 |
++ string(REGEX REPLACE "vtk([^;]+)" "VTK::\\1" vtkgdcm_LIBS "${vtkgdcm_LIBS}") |
67 |
++endif() |
68 |
++ |
69 |
+ # Use wrapping hints for this project. |
70 |
+ #set(VTK_WRAP_HINTS "${PROJECT_SOURCE_DIR}/hints") |
71 |
+ |
72 |
+--- a/Utilities/VTK/Applications/CMakeLists.txt |
73 |
++++ b/Utilities/VTK/Applications/CMakeLists.txt |
74 |
+@@ -25,6 +25,11 @@ |
75 |
+ ) |
76 |
+ endif() |
77 |
+ |
78 |
++set(vtk_ioxml vtkIOXML) |
79 |
++if( ${VTK_MAJOR_VERSION} GREATER_EQUAL 9 ) |
80 |
++ set(vtk_ioxml VTK::IOXML) |
81 |
++endif() |
82 |
++ |
83 |
+ foreach(app ${GDCM_VTK_APPS}) |
84 |
+ add_executable(${app} ${app}.cxx) |
85 |
+ if(GDCM_EXECUTABLE_PROPERTIES) |
86 |
+@@ -42,7 +47,7 @@ |
87 |
+ endif() |
88 |
+ else() |
89 |
+ # >= 6.0 |
90 |
+- target_link_libraries(${app} ${VTK_LIBRARIES} vtkIOXML) |
91 |
++ target_link_libraries(${app} ${VTK_LIBRARIES} ${vtk_ioxml}) |
92 |
+ endif() |
93 |
+ if(WIN32 AND NOT CYGWIN) |
94 |
+ target_link_libraries(${app} gdcmgetopt) |
95 |
+--- a/Utilities/VTK/vtkGDCMPolyDataWriter.cxx |
96 |
++++ b/Utilities/VTK/vtkGDCMPolyDataWriter.cxx |
97 |
+@@ -496,6 +496,9 @@ |
98 |
+ sqi = new SequenceOfItems; |
99 |
+ |
100 |
+ vtkIdType npts = 0; |
101 |
++#if VTK_MAJOR_VERSION >= 9 |
102 |
++ const |
103 |
++#endif |
104 |
+ vtkIdType *indx = 0; |
105 |
+ double v[3]; |
106 |
+ unsigned int cellnum = 0; |
107 |
+@@ -759,6 +762,9 @@ |
108 |
+ vtkPoints *pts; |
109 |
+ vtkCellArray *polys; |
110 |
+ vtkIdType npts = 0; |
111 |
++#if VTK_MAJOR_VERSION >= 9 |
112 |
++ const |
113 |
++#endif |
114 |
+ vtkIdType *indx = 0; |
115 |
+ pts = theData->GetPoints(); |
116 |
+ polys = theData->GetPolys(); |
117 |
|
118 |
diff --git a/sci-libs/gdcm/gdcm-3.0.14.ebuild b/sci-libs/gdcm/gdcm-3.0.14.ebuild |
119 |
new file mode 100644 |
120 |
index 000000000..5249e81b7 |
121 |
--- /dev/null |
122 |
+++ b/sci-libs/gdcm/gdcm-3.0.14.ebuild |
123 |
@@ -0,0 +1,121 @@ |
124 |
+# Copyright 2022 Gentoo Authors |
125 |
+# Distributed under the terms of the GNU General Public License v2 |
126 |
+ |
127 |
+EAPI=8 |
128 |
+ |
129 |
+PYTHON_COMPAT=( python3_{9..10} ) |
130 |
+ |
131 |
+inherit cmake python-single-r1 |
132 |
+ |
133 |
+DESCRIPTION="Cross-platform DICOM implementation" |
134 |
+HOMEPAGE="http://gdcm.sourceforge.net/" |
135 |
+SRC_URI="mirror://sourceforge/gdcm/${P}.tar.bz2 |
136 |
+ test? ( mirror://sourceforge/gdcm/gdcmData.tar.gz )" # 3.0.14: .bz2 is broken, should be checked in next release |
137 |
+ |
138 |
+LICENSE="BSD" |
139 |
+SLOT="0" |
140 |
+KEYWORDS="~amd64 ~x86" |
141 |
+IUSE="doc python test vtk" |
142 |
+RESTRICT="!test? ( test )" |
143 |
+ |
144 |
+DEPEND=" |
145 |
+ app-text/poppler:0=[cxx] |
146 |
+ dev-libs/expat:0= |
147 |
+ dev-libs/json-c:0= |
148 |
+ dev-libs/libxml2:2= |
149 |
+ dev-libs/openssl:0= |
150 |
+ >=media-libs/charls-2.0.0:0= |
151 |
+ >=media-libs/openjpeg-2.0.0:2= |
152 |
+ sys-apps/util-linux:0= |
153 |
+ sys-libs/zlib:0= |
154 |
+ python? ( ${PYTHON_DEPS} ) |
155 |
+ vtk? ( |
156 |
+ sci-libs/vtk[rendering] |
157 |
+ python? ( |
158 |
+ sci-libs/vtk[python,${PYTHON_SINGLE_USEDEP}] |
159 |
+ ) |
160 |
+ ) |
161 |
+" |
162 |
+RDEPEND="${DEPEND}" |
163 |
+BDEPEND=" |
164 |
+ dev-libs/libxslt |
165 |
+ app-text/docbook-xsl-ns-stylesheets |
166 |
+ doc? ( app-doc/doxygen[dot] ) |
167 |
+ python? ( |
168 |
+ ${PYTHON_DEPS} |
169 |
+ >=dev-lang/swig-3.0.7 |
170 |
+ )" |
171 |
+ |
172 |
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )" |
173 |
+ |
174 |
+PATCHES=( |
175 |
+ "${FILESDIR}/gdcm_support_vtk9.patch" |
176 |
+ "${FILESDIR}/gdcm-3.0.14-include-math-h.patch" |
177 |
+) |
178 |
+ |
179 |
+pkg_setup() { |
180 |
+ use python && python-single-r1_pkg_setup |
181 |
+} |
182 |
+ |
183 |
+src_prepare() { |
184 |
+ # drop unbundled libs |
185 |
+ local -a DROPS=( gdcmcharls gdcmexpat gdcmopenjpeg gdcmuuid gdcmzlib getopt pvrg KWStyle Release ) |
186 |
+ local x |
187 |
+ for x in "${DROPS[@]}"; do |
188 |
+ ebegin "Dropping bundled ${x#gdcm}" |
189 |
+ rm -r "Utilities/${x}" || die |
190 |
+ sed -i "s,^[ \t]*APPEND_COPYRIGHT(\\\${CMAKE_CURRENT_SOURCE_DIR}/${x}/,#&," "Utilities/CMakeLists.txt" || die |
191 |
+ eend $? |
192 |
+ done |
193 |
+ find Utilities -mindepth 1 -maxdepth 1 '!' -name doxygen '!' -name VTK -type d \ |
194 |
+ -exec ewarn "Using bundled" {} ';' || die |
195 |
+ |
196 |
+ # fix charls include case |
197 |
+ sed -i 's:CharLS/charls\.h:charls/charls.h:' CMake/FindCharLS.cmake Utilities/gdcm_charls.h || die |
198 |
+ sed -i 's:NAMES CharLS:NAMES charls:' CMake/FindCharLS.cmake || die |
199 |
+ |
200 |
+ # Use prefixed socket++ (to avoid potential conflicts) |
201 |
+ sed -i '/target_link_libraries(/s/socketxx/gdcm&/' \ |
202 |
+ Source/MessageExchangeDefinition/CMakeLists.txt \ |
203 |
+ Applications/Cxx/CMakeLists.txt \ |
204 |
+ || die |
205 |
+ |
206 |
+ cmake_src_prepare |
207 |
+} |
208 |
+ |
209 |
+src_configure() { |
210 |
+ local mycmakeargs=( |
211 |
+ -DCMAKE_SKIP_RPATH=ON |
212 |
+ -DGDCM_BUILD_SHARED_LIBS=ON |
213 |
+ -DGDCM_DATA_ROOT="${WORKDIR}/gdcmData" |
214 |
+ -DGDCM_INSTALL_LIB_DIR="$(get_libdir)" |
215 |
+ -DGDCM_INSTALL_DOC_DIR="share/doc/${P}" |
216 |
+ -DGDCM_INSTALL_PYTHONMODULE_DIR="lib/${EPYTHON}/site-packages" |
217 |
+ -DGDCM_USE_SYSTEM_ZLIB=ON |
218 |
+ -DGDCM_USE_SYSTEM_OPENSSL=ON |
219 |
+ -DGDCM_USE_SYSTEM_UUID=ON |
220 |
+ -DGDCM_USE_SYSTEM_EXPAT=ON |
221 |
+ -DGDCM_USE_SYSTEM_JSON=ON |
222 |
+ -DGDCM_USE_SYSTEM_PAPYRUS3=OFF |
223 |
+ -DGDCM_USE_SYSTEM_SOCKETXX=OFF |
224 |
+ -DSOCKETXX_NAMESPACE=GDCMSOCKETXX |
225 |
+ -DGDCM_USE_SYSTEM_LJPEG=OFF |
226 |
+ -DGDCM_USE_SYSTEM_OPENJPEG=ON |
227 |
+ -DGDCM_USE_SYSTEM_CHARLS=ON |
228 |
+ -DGDCM_USE_SYSTEM_POPPLER=ON |
229 |
+ -DGDCM_USE_SYSTEM_LIBXML2=ON |
230 |
+ -DGDCM_BUILD_TESTING=$(usex test) |
231 |
+ -DGDCM_WRAP_PYTHON=$(usex python) |
232 |
+ $(usex python "-DGDCM_DEFAULT_PYTHON_VERSION=${EPYTHON#python}" "") |
233 |
+ -DGDCM_WRAP_PERL=OFF |
234 |
+ -DGDCM_WRAP_PHP=OFF |
235 |
+ -DGDCM_WRAP_JAVA=OFF |
236 |
+ -DGDCM_WRAP_CSHARP=OFF |
237 |
+ -DGDCM_DOCUMENTATION=$(usex doc) |
238 |
+ $(usex doc "-DGDCM_PDF_DOCUMENTATION=OFF" "") |
239 |
+ -DGDCM_BUILD_EXAMPLES=OFF |
240 |
+ -DGDCM_BUILD_APPLICATIONS=ON |
241 |
+ -DGDCM_USE_VTK=$(usex vtk) |
242 |
+ ) |
243 |
+ cmake_src_configure |
244 |
+} |
245 |
|
246 |
diff --git a/sci-libs/gdcm/metadata.xml b/sci-libs/gdcm/metadata.xml |
247 |
new file mode 100644 |
248 |
index 000000000..1845bf1bd |
249 |
--- /dev/null |
250 |
+++ b/sci-libs/gdcm/metadata.xml |
251 |
@@ -0,0 +1,14 @@ |
252 |
+<?xml version="1.0" encoding="UTF-8"?> |
253 |
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd"> |
254 |
+<pkgmetadata> |
255 |
+ <maintainer type="person"> |
256 |
+ <email>fx.carton91@×××××.com</email> |
257 |
+ <name>François-Xavier Carton</name> |
258 |
+ </maintainer> |
259 |
+ <use> |
260 |
+ <flag name="vtk">Build <pkg>sci-libs/vtk</pkg> bridge</flag> |
261 |
+ </use> |
262 |
+ <upstream> |
263 |
+ <remote-id type="sourceforge">gdcm</remote-id> |
264 |
+ </upstream> |
265 |
+</pkgmetadata> |