From 5e716bf469f616c34db40aa81d9b9c95e7aa22e5 Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Sun, 10 May 2020 16:21:26 -0400 Subject: [PATCH] vtk: 7.1.1 -> 8.2.0 - also create vtk_7 as several packages don't build with 8.x: - itk5: vtkVersion.h header not found at compile time - ants: version in tree (2.2.0) is incompatible with 8.2 - itk4: ants depends on both vtk and itk4, so use vtk_7 - gdcm: vtk header issue - python3Packages.vtk: Python C API compilation error with Python 3.8 - upgrade vtkWithQt4 -> vtkWithQt5 --- .../science/biology/ants/default.nix | 4 +- pkgs/development/libraries/gdcm/default.nix | 4 +- pkgs/development/libraries/itk/4.x.nix | 4 +- pkgs/development/libraries/itk/default.nix | 4 +- pkgs/development/libraries/vtk/7.x.nix | 74 +++++++++++++++++++ pkgs/development/libraries/vtk/default.nix | 17 ++--- pkgs/top-level/all-packages.nix | 10 ++- pkgs/top-level/python-packages.nix | 2 +- 8 files changed, 97 insertions(+), 22 deletions(-) create mode 100644 pkgs/development/libraries/vtk/7.x.nix diff --git a/pkgs/applications/science/biology/ants/default.nix b/pkgs/applications/science/biology/ants/default.nix index 20eedfaaa16c..cb88e92fe1cb 100644 --- a/pkgs/applications/science/biology/ants/default.nix +++ b/pkgs/applications/science/biology/ants/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, fetchpatch, cmake, makeWrapper, itk4, vtk }: +{ stdenv, fetchFromGitHub, fetchpatch, cmake, makeWrapper, itk4, vtk_7 }: stdenv.mkDerivation rec { pname = "ANTs"; @@ -20,7 +20,7 @@ stdenv.mkDerivation rec { ]; nativeBuildInputs = [ cmake makeWrapper ]; - buildInputs = [ itk4 vtk ]; + buildInputs = [ itk4 vtk_7 ]; cmakeFlags = [ "-DANTS_SUPERBUILD=FALSE" "-DUSE_VTK=TRUE" ]; diff --git a/pkgs/development/libraries/gdcm/default.nix b/pkgs/development/libraries/gdcm/default.nix index 165fe3a25287..968ee3a09d08 100644 --- a/pkgs/development/libraries/gdcm/default.nix +++ b/pkgs/development/libraries/gdcm/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, cmake, vtk, darwin }: +{ stdenv, fetchurl, cmake, vtk_7, darwin }: stdenv.mkDerivation rec { version = "3.0.5"; @@ -23,7 +23,7 @@ stdenv.mkDerivation rec { ]; enableParallelBuilding = true; - buildInputs = [ cmake vtk ] ++ stdenv.lib.optional stdenv.isDarwin [ darwin.apple_sdk.frameworks.ApplicationServices darwin.apple_sdk.frameworks.Cocoa ]; + buildInputs = [ cmake vtk_7 ] ++ stdenv.lib.optional stdenv.isDarwin [ darwin.apple_sdk.frameworks.ApplicationServices darwin.apple_sdk.frameworks.Cocoa ]; propagatedBuildInputs = [ ]; meta = with stdenv.lib; { diff --git a/pkgs/development/libraries/itk/4.x.nix b/pkgs/development/libraries/itk/4.x.nix index 833723d4d2d2..cd8e70a99767 100644 --- a/pkgs/development/libraries/itk/4.x.nix +++ b/pkgs/development/libraries/itk/4.x.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchurl, cmake, libX11, libuuid, xz, vtk }: +{ stdenv, fetchurl, cmake, libX11, libuuid, xz, vtk_7 }: stdenv.mkDerivation rec { name = "itk-4.13.2"; @@ -22,7 +22,7 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; nativeBuildInputs = [ cmake xz ]; - buildInputs = [ libX11 libuuid vtk ]; + buildInputs = [ libX11 libuuid vtk_7 ]; meta = { description = "Insight Segmentation and Registration Toolkit"; diff --git a/pkgs/development/libraries/itk/default.nix b/pkgs/development/libraries/itk/default.nix index 6c0298c0f71c..84dedfa0b3b6 100644 --- a/pkgs/development/libraries/itk/default.nix +++ b/pkgs/development/libraries/itk/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchFromGitHub, cmake, makeWrapper -, pkgconfig, libX11, libuuid, xz, vtk, Cocoa }: +, pkgconfig, libX11, libuuid, xz, vtk_7, Cocoa }: stdenv.mkDerivation rec { pname = "itk"; @@ -25,7 +25,7 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; nativeBuildInputs = [ cmake xz makeWrapper ]; - buildInputs = [ libX11 libuuid vtk ] ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ]; + buildInputs = [ libX11 libuuid vtk_7 ] ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa ]; postInstall = '' wrapProgram "$out/bin/h5c++" --prefix PATH ":" "${pkgconfig}/bin" diff --git a/pkgs/development/libraries/vtk/7.x.nix b/pkgs/development/libraries/vtk/7.x.nix new file mode 100644 index 000000000000..f3ec383fddfb --- /dev/null +++ b/pkgs/development/libraries/vtk/7.x.nix @@ -0,0 +1,74 @@ +{ stdenv, fetchurl, cmake, libGLU, libGL, libX11, xorgproto, libXt, libtiff +, fetchpatch +, qtLib ? null +, enablePython ? false, python ? null +# Darwin support +, Cocoa, CoreServices, DiskArbitration, IOKit, CFNetwork, Security, GLUT, OpenGL +, ApplicationServices, CoreText, IOSurface, ImageIO, xpc, libobjc }: + +with stdenv.lib; + +let + os = stdenv.lib.optionalString; + majorVersion = "7.1"; + minorVersion = "1"; + version = "${majorVersion}.${minorVersion}"; +in + +stdenv.mkDerivation rec { + name = "vtk-${os (qtLib != null) "qvtk-"}${version}"; + src = fetchurl { + url = "${meta.homepage}files/release/${majorVersion}/VTK-${version}.tar.gz"; + sha256 = "0nm7xwwj7rnsxjdv2ssviys8nhci4n9iiiqm2y14s520hl2dsp1d"; + }; + + patches = [ + (fetchpatch { + url = "https://gitlab.kitware.com/vtk/vtk/-/commit/706f1b397df09a27ab8981ab9464547028d0c322.diff"; + sha256 = "1q3pi5h40g05pzpbqp75xlgzvbfvyw8raza51svmi7d8dlslqybx"; + }) + ]; + + nativeBuildInputs = [ cmake ]; + + buildInputs = [ libtiff ] + ++ optional (qtLib != null) qtLib + ++ optionals stdenv.isLinux [ libGLU libGL libX11 xorgproto libXt ] + ++ optionals stdenv.isDarwin [ xpc Cocoa CoreServices DiskArbitration IOKit + CFNetwork Security ApplicationServices CoreText + IOSurface ImageIO OpenGL GLUT ] + ++ optional enablePython [ + python + ]; + propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ libobjc ]; + + preBuild = '' + export LD_LIBRARY_PATH="$(pwd)/lib"; + ''; + + # Shared libraries don't work, because of rpath troubles with the current + # nixpkgs cmake approach. It wants to call a binary at build time, just + # 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_USE_SYSTEM_TIFF=1" "-DOPENGL_INCLUDE_DIR=${libGL}/include" ] + ++ optional (qtLib != null) [ "-DVTK_Group_Qt:BOOL=ON" ] + ++ optional stdenv.isDarwin [ "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks" ] + ++ optional enablePython [ "-DVTK_WRAP_PYTHON:BOOL=ON" ]; + + postPatch = stdenv.lib.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 + ''; + + enableParallelBuilding = true; + + meta = { + description = "Open source libraries for 3D computer graphics, image processing and visualization"; + homepage = "https://www.vtk.org/"; + license = stdenv.lib.licenses.bsd3; + maintainers = with stdenv.lib.maintainers; [ knedlsepp ]; + platforms = with stdenv.lib.platforms; unix; + }; +} diff --git a/pkgs/development/libraries/vtk/default.nix b/pkgs/development/libraries/vtk/default.nix index 1cc706f4eb73..4ef140a09996 100644 --- a/pkgs/development/libraries/vtk/default.nix +++ b/pkgs/development/libraries/vtk/default.nix @@ -10,8 +10,8 @@ with stdenv.lib; let os = stdenv.lib.optionalString; - majorVersion = "7.1"; - minorVersion = "1"; + majorVersion = "8.2"; + minorVersion = "0"; version = "${majorVersion}.${minorVersion}"; in @@ -19,20 +19,13 @@ stdenv.mkDerivation rec { name = "vtk-${os (qtLib != null) "qvtk-"}${version}"; src = fetchurl { url = "${meta.homepage}files/release/${majorVersion}/VTK-${version}.tar.gz"; - sha256 = "0nm7xwwj7rnsxjdv2ssviys8nhci4n9iiiqm2y14s520hl2dsp1d"; + sha256 = "1fspgp8k0myr6p2a6wkc21ldcswb4bvmb484m12mxgk1a9vxrhrl"; }; - patches = [ - (fetchpatch { - url = "https://gitlab.kitware.com/vtk/vtk/-/commit/706f1b397df09a27ab8981ab9464547028d0c322.diff"; - sha256 = "1q3pi5h40g05pzpbqp75xlgzvbfvyw8raza51svmi7d8dlslqybx"; - }) - ]; - nativeBuildInputs = [ cmake ]; buildInputs = [ libtiff ] - ++ optional (qtLib != null) qtLib + ++ optionals (qtLib != null) (with qtLib; [ qtbase qtx11extras qttools ]) ++ optionals stdenv.isLinux [ libGLU libGL libX11 xorgproto libXt ] ++ optionals stdenv.isDarwin [ xpc Cocoa CoreServices DiskArbitration IOKit CFNetwork Security ApplicationServices CoreText @@ -47,7 +40,7 @@ stdenv.mkDerivation rec { ''; # Shared libraries don't work, because of rpath troubles with the current - # nixpkgs camke approach. It wants to call a binary at build time, just + # nixpkgs cmake approach. It wants to call a binary at build time, just # 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. diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 661bc75daaa4..924c68cf00db 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -14872,6 +14872,14 @@ in vte_290 = callPackage ../development/libraries/vte/2.90.nix { }; vtk = callPackage ../development/libraries/vtk { + inherit (darwin) libobjc; + inherit (darwin.apple_sdk.libs) xpc; + inherit (darwin.apple_sdk.frameworks) Cocoa CoreServices DiskArbitration + IOKit CFNetwork Security ApplicationServices + CoreText IOSurface ImageIO OpenGL GLUT; + }; + + vtk_7 = callPackage ../development/libraries/vtk/7.x.nix { stdenv = if stdenv.isDarwin then stdenv else gcc8Stdenv; inherit (darwin) libobjc; inherit (darwin.apple_sdk.libs) xpc; @@ -14911,7 +14919,7 @@ in }); }; - vtkWithQt4 = vtk.override { qtLib = qt4; }; + vtkWithQt5 = vtk.override { qtLib = qt5; }; vxl = callPackage ../development/libraries/vxl { libpng = libpng12; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index e54a4e9fe456..29035162cc51 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -7061,7 +7061,7 @@ in { visitor = callPackage ../development/python-modules/visitor { }; - vtk = toPythonModule (pkgs.vtk.override { + vtk = toPythonModule (pkgs.vtk_7.override { inherit (self) python; enablePython = true; });