diff --git a/pkgs/development/libraries/gdcm/default.nix b/pkgs/development/libraries/gdcm/default.nix index cacfb778c7bcc..5e0ea819f676a 100644 --- a/pkgs/development/libraries/gdcm/default.nix +++ b/pkgs/development/libraries/gdcm/default.nix @@ -29,6 +29,9 @@ stdenv.mkDerivation rec { hash = "sha256-Zlb6UCP4aFZOJJNhFQBBrwzst+f37gs1zaCBMTOUgZE="; }; + # slight reformatting from https://raw.githubusercontent.com/nilason/macports-ports/7de732656c10e31530622f405f916ba34d7677b3/science/gdcm/files/patch-vtk-930.diff: + patches = [ ./vtk-9.3.0.patch ]; + cmakeFlags = [ "-DGDCM_BUILD_APPLICATIONS=ON" "-DGDCM_BUILD_SHARED_LIBS=ON" diff --git a/pkgs/development/libraries/gdcm/vtk-9.3.0.patch b/pkgs/development/libraries/gdcm/vtk-9.3.0.patch new file mode 100644 index 0000000000000..59f1b12d97eb1 --- /dev/null +++ b/pkgs/development/libraries/gdcm/vtk-9.3.0.patch @@ -0,0 +1,91 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -698,6 +698,7 @@ + HEADERS_DESTINATION "${GDCM_INSTALL_INCLUDE_DIR}/vtk${vtk_version_suffix}" + CMAKE_DESTINATION "${GDCM_INSTALL_PACKAGE_DIR}" + LICENSE_DESTINATION "${GDCM_INSTALL_DATA_DIR}/vtkgdcm-${GDCM_SHORT_VERSION}" ++ SPDX_DESTINATION "${GDCM_INSTALL_DATA_DIR}/vtkgdcm-${GDCM_SHORT_VERSION}" + HIERARCHY_DESTINATION "${GDCM_INSTALL_LIB_DIR}/vtk${vtk_version_suffix}/hierarchy/vtkgdcm" + LIBRARY_NAME_SUFFIX "${vtkgdcm_library_suffix}" + VERSION "${GDCM_VERSION}" + + +--- a/Utilities/VTK/vtkImageColorViewer.h ++++ b/Utilities/VTK/vtkImageColorViewer.h +@@ -199,22 +199,6 @@ + virtual int GetOffScreenRendering(); + vtkBooleanMacro(OffScreenRendering,int); + +- // Description: +- // @deprecated Replaced by vtkImageColorViewer::GetSliceMin() as of VTK 5.0. +- VTK_LEGACY(int GetWholeZMin()); +- +- // Description: +- // @deprecated Replaced by vtkImageColorViewer::GetSliceMax() as of VTK 5.0. +- VTK_LEGACY(int GetWholeZMax()); +- +- // Description: +- // @deprecated Replaced by vtkImageColorViewer::GetSlice() as of VTK 5.0. +- VTK_LEGACY(int GetZSlice()); +- +- // Description: +- // @deprecated Replaced by vtkImageColorViewer::SetSlice() as of VTK 5.0. +- VTK_LEGACY(void SetZSlice(int)); +- + protected: + vtkImageColorViewer(); + ~vtkImageColorViewer(); + + + +--- a/Utilities/VTK/vtkImageColorViewer.cxx ++++ b/Utilities/VTK/vtkImageColorViewer.cxx +@@ -919,34 +919,6 @@ + } + + //---------------------------------------------------------------------------- +-#ifndef VTK_LEGACY_REMOVE +-int vtkImageColorViewer::GetWholeZMin() +-{ +- VTK_LEGACY_REPLACED_BODY(vtkImageColorViewer::GetWholeZMin, "VTK 5.0", +- vtkImageColorViewer::GetSliceMin); +- return this->GetSliceMin(); +-} +-int vtkImageColorViewer::GetWholeZMax() +-{ +- VTK_LEGACY_REPLACED_BODY(vtkImageColorViewer::GetWholeZMax, "VTK 5.0", +- vtkImageColorViewer::GetSliceMax); +- return this->GetSliceMax(); +-} +-int vtkImageColorViewer::GetZSlice() +-{ +- VTK_LEGACY_REPLACED_BODY(vtkImageColorViewer::GetZSlice, "VTK 5.0", +- vtkImageColorViewer::GetSlice); +- return this->GetSlice(); +-} +-void vtkImageColorViewer::SetZSlice(int s) +-{ +- VTK_LEGACY_REPLACED_BODY(vtkImageColorViewer::SetZSlice, "VTK 5.0", +- vtkImageColorViewer::SetSlice); +- this->SetSlice(s); +-} +-#endif +- +-//---------------------------------------------------------------------------- + void vtkImageColorViewer::PrintSelf(ostream& os, vtkIndent indent) + { + this->Superclass::PrintSelf(os, indent); + + + +--- a/Utilities/VTK/vtkGDCMTesting.cxx ++++ b/Utilities/VTK/vtkGDCMTesting.cxx +@@ -14,7 +14,6 @@ + #include "vtkGDCMTesting.h" + + #include "vtkObjectFactory.h" +-#include "vtkToolkits.h" + #include "gdcmTesting.h" + #include "gdcmFilename.h" + + diff --git a/pkgs/development/libraries/vtk/9.x.nix b/pkgs/development/libraries/vtk/9.x.nix index 3734c20f0e055..bfad6a219dc27 100644 --- a/pkgs/development/libraries/vtk/9.x.nix +++ b/pkgs/development/libraries/vtk/9.x.nix @@ -1,5 +1,5 @@ import ./generic.nix { - majorVersion = "9.2"; - minorVersion = "6"; - sourceSha256 = "sha256-BvyNScTlb0mMQPyzilY+2NTsMTWNAQHomI8LtNU53RI="; + majorVersion = "9.3"; + minorVersion = "1"; + sourceSha256 = "sha256-g1TsCE6g0tw9I9vkJDgjxL/CcDgtDOjWWJOf1QBhyrg="; } diff --git a/pkgs/development/libraries/vtk/generic.nix b/pkgs/development/libraries/vtk/generic.nix index d131fe173ab80..ea69791a7b2d2 100644 --- a/pkgs/development/libraries/vtk/generic.nix +++ b/pkgs/development/libraries/vtk/generic.nix @@ -1,12 +1,46 @@ -{ majorVersion, minorVersion, sourceSha256, patchesToFetch ? [] }: -{ stdenv, lib, fetchurl, cmake, libGLU, libGL, libX11, xorgproto, libXt, libpng, libtiff -, fetchpatch -, enableQt ? false, qtx11extras, qttools, qtdeclarative, qtEnv -, enablePython ? false, python ? throw "vtk: Python support requested, but no python interpreter was given." -, enableEgl ? false -# Darwin support -, AGL, Cocoa, CoreServices, DiskArbitration, IOKit, CFNetwork, Security, GLUT, OpenGL -, ApplicationServices, CoreText, IOSurface, ImageIO, xpc, libobjc +{ + majorVersion, + minorVersion, + sourceSha256, + patchesToFetch ? [ ], +}: +{ + stdenv, + lib, + fetchurl, + cmake, + libGLU, + libGL, + libX11, + xorgproto, + libXt, + libpng, + libtiff, + fetchpatch, + enableQt ? false, + qtx11extras, + qttools, + qtdeclarative, + qtEnv, + enablePython ? false, + python ? throw "vtk: Python support requested, but no python interpreter was given.", + enableEgl ? false, + # Darwin support + AGL, + Cocoa, + CoreServices, + DiskArbitration, + IOKit, + CFNetwork, + Security, + GLUT, + OpenGL, + ApplicationServices, + CoreText, + IOSurface, + ImageIO, + xpc, + libobjc, }: let @@ -15,10 +49,9 @@ let version = "${majorVersion}.${minorVersion}"; pythonMajor = lib.substring 0 1 python.pythonVersion; -in stdenv.mkDerivation { - pname = "vtk" - + optionalString enableEgl "-egl" - + optionalString enableQt "-qvtk"; +in +stdenv.mkDerivation { + pname = "vtk" + optionalString enableEgl "-egl" + optionalString enableQt "-qvtk"; inherit version; src = fetchurl { @@ -28,13 +61,24 @@ in stdenv.mkDerivation { nativeBuildInputs = [ cmake ]; - buildInputs = [ libpng libtiff ] - ++ optionals enableQt [ (qtEnv "qvtk-qt-env" [ qtx11extras qttools qtdeclarative ]) ] + buildInputs = + [ + libpng + libtiff + ] + ++ optionals enableQt [ + (qtEnv "qvtk-qt-env" [ + qtx11extras + qttools + qtdeclarative + ]) + ] ++ optionals stdenv.isLinux [ libGLU xorgproto libXt - ] ++ optionals stdenv.isDarwin [ + ] + ++ optionals stdenv.isDarwin [ xpc AGL Cocoa @@ -49,26 +93,30 @@ in stdenv.mkDerivation { ImageIO OpenGL GLUT - ] ++ optionals enablePython [ - python + ] + ++ optionals enablePython [ python ]; + propagatedBuildInputs = + optionals stdenv.isDarwin [ libobjc ] + ++ optionals stdenv.isLinux [ + libX11 + libGL ]; - propagatedBuildInputs = optionals stdenv.isDarwin [ libobjc ] - ++ optionals stdenv.isLinux [ libX11 libGL ]; - # see https://github.com/NixOS/nixpkgs/pull/178367#issuecomment-1238827254 + # see https://github.com/NixOS/nixpkgs/pull/178367#issuecomment-1238827254 patches = map fetchpatch patchesToFetch; # GCC 13: error: 'int64_t' in namespace 'std' does not name a type - postPatch = '' - sed '1i#include ' \ - -i ThirdParty/libproj/vtklibproj/src/proj_json_streaming_writer.hpp \ - -i IO/Image/vtkSEPReader.h - '' - + optionalString stdenv.isDarwin '' - sed -i 's|COMMAND vtkHashSource|COMMAND "DYLD_LIBRARY_PATH=''${VTK_BINARY_DIR}/lib" ''${VTK_BINARY_DIR}/bin/vtkHashSource-${majorVersion}|' ./Parallel/Core/CMakeLists.txt - sed -i 's/fprintf(output, shift)/fprintf(output, "%s", shift)/' ./ThirdParty/libxml2/vtklibxml2/xmlschemas.c - sed -i 's/fprintf(output, shift)/fprintf(output, "%s", shift)/g' ./ThirdParty/libxml2/vtklibxml2/xpath.c - ''; + postPatch = + '' + sed '1i#include ' \ + -i ThirdParty/libproj/vtklibproj/src/proj_json_streaming_writer.hpp \ + -i IO/Image/vtkSEPReader.h + '' + + optionalString stdenv.isDarwin '' + sed -i 's|COMMAND vtkHashSource|COMMAND "DYLD_LIBRARY_PATH=''${VTK_BINARY_DIR}/lib" ''${VTK_BINARY_DIR}/bin/vtkHashSource-${majorVersion}|' ./Parallel/Core/CMakeLists.txt + sed -i 's/fprintf(output, shift)/fprintf(output, "%s", shift)/' ./ThirdParty/libxml2/vtklibxml2/xmlschemas.c + sed -i 's/fprintf(output, shift)/fprintf(output, "%s", shift)/g' ./ThirdParty/libxml2/vtklibxml2/xpath.c + ''; dontWrapQtApps = true; @@ -77,23 +125,25 @@ in stdenv.mkDerivation { # built and requiring one of the shared objects. # At least, we use -fPIC for other packages to be able to use this in shared # objects. - cmakeFlags = [ - "-DCMAKE_C_FLAGS=-fPIC" - "-DCMAKE_CXX_FLAGS=-fPIC" - "-DVTK_MODULE_USE_EXTERNAL_vtkpng=ON" - "-DVTK_MODULE_USE_EXTERNAL_vtktiff=1" - "-DVTK_MODULE_ENABLE_VTK_RenderingExternal=YES" - ] ++ lib.optionals (!stdenv.isDarwin) [ - "-DOPENGL_INCLUDE_DIR=${libGL}/include" - (lib.cmakeBool "VTK_OPENGL_HAS_EGL" enableEgl) - ] ++ [ - "-DCMAKE_INSTALL_LIBDIR=lib" - "-DCMAKE_INSTALL_INCLUDEDIR=include" - "-DCMAKE_INSTALL_BINDIR=bin" - "-DVTK_VERSIONED_INSTALL=OFF" - ] ++ optionals enableQt [ - "-DVTK_GROUP_ENABLE_Qt:STRING=YES" - ] + cmakeFlags = + [ + "-DCMAKE_C_FLAGS=-fPIC" + "-DCMAKE_CXX_FLAGS=-fPIC" + "-DVTK_MODULE_USE_EXTERNAL_vtkpng=ON" + "-DVTK_MODULE_USE_EXTERNAL_vtktiff=1" + "-DVTK_MODULE_ENABLE_VTK_RenderingExternal=YES" + ] + ++ lib.optionals (!stdenv.isDarwin) [ + "-DOPENGL_INCLUDE_DIR=${libGL}/include" + (lib.cmakeBool "VTK_OPENGL_HAS_EGL" enableEgl) + ] + ++ [ + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_INCLUDEDIR=include" + "-DCMAKE_INSTALL_BINDIR=bin" + "-DVTK_VERSIONED_INSTALL=OFF" + ] + ++ optionals enableQt [ "-DVTK_GROUP_ENABLE_Qt:STRING=YES" ] ++ optionals stdenv.isDarwin [ "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks" ] ++ optionals enablePython [ "-DVTK_WRAP_PYTHON:BOOL=ON" @@ -115,7 +165,10 @@ in stdenv.mkDerivation { description = "Open source libraries for 3D computer graphics, image processing and visualization"; homepage = "https://www.vtk.org/"; license = licenses.bsd3; - maintainers = with maintainers; [ knedlsepp tfmoraes ]; + maintainers = with maintainers; [ + knedlsepp + tfmoraes + ]; platforms = platforms.unix; badPlatforms = optionals enableEgl platforms.darwin; };