From 607e48ba3ccb038e2fa4b956cb62ce628cdc8cd0 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Thu, 12 May 2022 23:43:39 -0400 Subject: gnu: Add vtk-7. * gnu/packages/image-processing.scm: (vtk-7): New variable. * gnu/packages/patches/vtk-7-gcc-10-compat.patch: New patch. * gnu/packages/patches/vtk-7-hdf5-compat.patch: Likewise. * gnu/packages/patches/vtk-7-python-compat.patch: Likewise. * gnu/local.mk (dist_patch_DATA): Register them. --- gnu/local.mk | 3 ++ gnu/packages/image-processing.scm | 22 +++++++++++++++ gnu/packages/patches/vtk-7-gcc-10-compat.patch | 14 ++++++++++ gnu/packages/patches/vtk-7-hdf5-compat.patch | 38 ++++++++++++++++++++++++++ gnu/packages/patches/vtk-7-python-compat.patch | 16 +++++++++++ 5 files changed, 93 insertions(+) create mode 100644 gnu/packages/patches/vtk-7-gcc-10-compat.patch create mode 100644 gnu/packages/patches/vtk-7-hdf5-compat.patch create mode 100644 gnu/packages/patches/vtk-7-python-compat.patch (limited to 'gnu') diff --git a/gnu/local.mk b/gnu/local.mk index 1286bdddb5..0cd874dae7 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1935,6 +1935,9 @@ dist_patch_DATA = \ %D%/packages/patches/vte-CVE-2012-2738-pt1.patch \ %D%/packages/patches/vte-CVE-2012-2738-pt2.patch \ %D%/packages/patches/vtk-fix-freetypetools-build-failure.patch \ + %D%/packages/patches/vtk-7-gcc-10-compat.patch \ + %D%/packages/patches/vtk-7-hdf5-compat.patch \ + %D%/packages/patches/vtk-7-python-compat.patch \ %D%/packages/patches/warsow-qfusion-fix-bool-return-type.patch \ %D%/packages/patches/webkitgtk-adjust-bubblewrap-paths.patch \ %D%/packages/patches/webrtc-audio-processing-big-endian.patch \ diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm index 1995f71cc2..08aeaed202 100644 --- a/gnu/packages/image-processing.scm +++ b/gnu/packages/image-processing.scm @@ -407,6 +407,28 @@ a suite of 3D interaction widgets, supports parallel processing, and integrates with various databases on GUI toolkits such as Qt and Tk.") (license license:bsd-3))) +(define-public vtk-7 + (package + (inherit vtk) + (version "7.1.1") + (source (origin + (method url-fetch) + (uri (string-append "https://vtk.org/files/release/" + (version-major+minor version) + "/VTK-" version ".tar.gz")) + (sha256 + (base32 + "0nm7xwwj7rnsxjdv2ssviys8nhci4n9iiiqm2y14s520hl2dsp1d")) + (patches (search-patches "vtk-7-python-compat.patch" + "vtk-7-hdf5-compat.patch" + "vtk-7-gcc-10-compat.patch")))) + (arguments + (substitute-keyword-arguments (package-arguments vtk) + ((#:configure-flags flags) + ;; Otherwise, the build would fail with: "error: invalid conversion + ;; from ‘const char*’ to ‘char*’ [-fpermissive]". + `(cons "-DCMAKE_CXX_FLAGS=-fpermissive" ,flags)))))) + ;; itksnap needs an older variant of VTK. (define-public vtk-6 (package (inherit vtk) diff --git a/gnu/packages/patches/vtk-7-gcc-10-compat.patch b/gnu/packages/patches/vtk-7-gcc-10-compat.patch new file mode 100644 index 0000000000..50f9f6cca3 --- /dev/null +++ b/gnu/packages/patches/vtk-7-gcc-10-compat.patch @@ -0,0 +1,14 @@ +Retrieved from +https://sources.debian.org/src/vtk7/7.1.1%2Bdfsg2-10.1/debian/patches/. + +--- a/CMake/VTKGenerateExportHeader.cmake ++++ b/CMake/VTKGenerateExportHeader.cmake +@@ -174,7 +174,7 @@ + execute_process(COMMAND ${CMAKE_C_COMPILER} --version + OUTPUT_VARIABLE _gcc_version_info + ERROR_VARIABLE _gcc_version_info) +- string(REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]*" ++ string(REGEX MATCH "[0-9]*\\.[0-9]\\.[0-9]*" + _gcc_version "${_gcc_version_info}") + # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the + # patch level, handle this here: diff --git a/gnu/packages/patches/vtk-7-hdf5-compat.patch b/gnu/packages/patches/vtk-7-hdf5-compat.patch new file mode 100644 index 0000000000..1f3c0c7be4 --- /dev/null +++ b/gnu/packages/patches/vtk-7-hdf5-compat.patch @@ -0,0 +1,38 @@ +Description: The H5FD_class_t struct gained an extra member in 1.10 +Bug-Debian: https://bugs.debian.org/846372 +Author: Iain Lane +--- a/ThirdParty/xdmf2/vtkxdmf2/libsrc/XdmfH5Driver.cxx ++++ b/ThirdParty/xdmf2/vtkxdmf2/libsrc/XdmfH5Driver.cxx +@@ -139,7 +139,11 @@ + #if (H5_VERS_MAJOR>1)||((H5_VERS_MAJOR==1)&&(H5_VERS_MINOR>=8)) + static haddr_t H5FD_dsm_get_eoa(const H5FD_t *_file, H5FD_mem_t type); + static herr_t H5FD_dsm_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr); ++#if (H5_VERS_MAJOR>1)||((H5_VERS_MAJOR==1)&&(H5_VERS_MINOR>=10)) ++static haddr_t H5FD_dsm_get_eof(const H5FD_t *_file, H5FD_mem_t type); ++#else + static haddr_t H5FD_dsm_get_eof(const H5FD_t *_file); ++#endif + #else + static haddr_t H5FD_dsm_get_eoa(H5FD_t *_file); + static herr_t H5FD_dsm_set_eoa(H5FD_t *_file, haddr_t addr); +@@ -155,6 +159,9 @@ + "dsm", /*name */ + MAXADDR, /*maxaddr */ + H5F_CLOSE_WEAK, /*fc_degree */ ++#if (H5_VERS_MAJOR>1)||((H5_VERS_MAJOR==1)&&(H5_VERS_MINOR>=8)) ++ NULL, /* terminate */ ++#endif + NULL, /*sb_size */ + NULL, /*sb_encode */ + NULL, /*sb_decode */ +@@ -687,7 +694,9 @@ + *------------------------------------------------------------------------- + */ + static haddr_t +-#if (H5_VERS_MAJOR>1)||((H5_VERS_MAJOR==1)&&(H5_VERS_MINOR>=8)) ++#if (H5_VERS_MAJOR>1)||((H5_VERS_MAJOR==1)&&(H5_VERS_MINOR>=10)) ++H5FD_dsm_get_eof(const H5FD_t *_file, H5FD_mem_t type) ++#elif (H5_VERS_MAJOR>1)||((H5_VERS_MAJOR==1)&&(H5_VERS_MINOR>=8)) + H5FD_dsm_get_eof(const H5FD_t *_file) + #else + H5FD_dsm_get_eof(H5FD_t *_file) diff --git a/gnu/packages/patches/vtk-7-python-compat.patch b/gnu/packages/patches/vtk-7-python-compat.patch new file mode 100644 index 0000000000..375624e4e2 --- /dev/null +++ b/gnu/packages/patches/vtk-7-python-compat.patch @@ -0,0 +1,16 @@ +Author: Gert Wollny +Description: Work around compile bug with python 3.7.1 +Debian-Bug: https://bugs.debian.org/914347 +diff --git a/Wrapping/PythonCore/vtkPythonArgs.cxx b/Wrapping/PythonCore/vtkPythonArgs.cxx +index 1b1e4b9..682f8b8 100644 +--- a/Wrapping/PythonCore/vtkPythonArgs.cxx ++++ b/Wrapping/PythonCore/vtkPythonArgs.cxx +@@ -102,7 +102,7 @@ bool vtkPythonGetStringValue(PyObject *o, T *&a, const char *exctext) + else if (PyUnicode_Check(o)) + { + #if PY_VERSION_HEX >= 0x03030000 +- a = PyUnicode_AsUTF8(o); ++ a = const_cast(PyUnicode_AsUTF8(o)); + return true; + #else + PyObject *s = _PyUnicode_AsDefaultEncodedString(o, NULL); -- cgit v1.2.3