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
This commit is contained in:
Ben Darwin 2020-05-10 16:21:26 -04:00
parent 24fcef1b9e
commit 5e716bf469
8 changed files with 97 additions and 22 deletions

View file

@ -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" ];

View file

@ -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; {

View file

@ -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";

View file

@ -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"

View file

@ -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;
};
}

View file

@ -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.

View file

@ -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;

View file

@ -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;
});