vtk: 9.2.6 -> 9.5.0 (#417613)

This commit is contained in:
Weijia Wang 2025-07-28 21:10:04 -06:00 committed by GitHub
commit 658c6aabba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 362 additions and 148 deletions

View File

@ -36,7 +36,7 @@ python3Packages.buildPythonApplication rec {
dependencies = with python3Packages; [
pygobject3
f3d_egl
f3d
];
dontWrapGApps = true;

View File

@ -9,10 +9,7 @@
libXt,
openusd,
tbb,
# There is a f3d overridden with EGL enabled vtk in top-level/all-packages.nix
# compiling with EGL enabled vtk will result in f3d running in headless mode
# See https://github.com/NixOS/nixpkgs/pull/324022. This may change later.
vtk_9,
vtk,
autoPatchelfHook,
python3Packages,
opencascade-occt,
@ -50,7 +47,7 @@ stdenv.mkDerivation rec {
];
buildInputs = [
vtk_9
vtk
opencascade-occt
assimp
fontconfig

View File

@ -1,5 +0,0 @@
import ./generic.nix {
majorVersion = "9.2";
minorVersion = "6";
sourceSha256 = "sha256-BvyNScTlb0mMQPyzilY+2NTsMTWNAQHomI8LtNU53RI=";
}

View File

@ -0,0 +1,30 @@
{
callPackage,
fetchpatch2,
}:
let
mkVtk = initArgs: callPackage (import ./generic.nix initArgs) { };
in
{
vtk_9_5 = mkVtk {
version = "9.5.0";
sourceSha256 = "sha256-BK6GJGuVV8a2GvvFNKbfCZJE+8jzk3+C5rwFcJU6+H0=";
patches = [
# https://gitlab.kitware.com/vtk/vtk/-/issues/19699
(fetchpatch2 {
url = "https://gitlab.kitware.com/vtk/vtk/-/commit/6b4f7b853675c63e4831c366ca8f78e320c1bfb5.diff";
hash = "sha256-hWJc5RxW6iK+W/rTxp2GUWKcm/2+oxbP5nVZ0EUSKHE=";
})
# https://gitlab.kitware.com/vtk/vtk/-/issues/19705
(fetchpatch2 {
url = "https://gitlab.kitware.com/vtk/vtk/-/commit/ce10dfe82ffa19c8108885625a6f8b3f980bed3b.diff";
hash = "sha256-kyPM0whL4WeaV27sNM1fbbs5kwMYn+9E561HtvnwHRc=";
})
# https://gitlab.kitware.com/vtk/vtk/-/merge_requests/12262
(fetchpatch2 {
url = "https://gitlab.kitware.com/vtk/vtk/-/commit/c0e0f793e6adf740f5b1c91ac330afdbc2a03b72.diff";
hash = "sha256-BinSv8sPqpAEcgkn8trnCPv2snR9MGcA8rkVflAhc5w=";
})
];
};
}

View File

@ -1,145 +1,347 @@
{
majorVersion,
minorVersion,
version,
sourceSha256,
patchesToFetch ? [ ],
patches ? [ ],
}:
{
stdenv,
lib,
newScope,
stdenv,
fetchurl,
cmake,
libGLU,
libGL,
libX11,
xorgproto,
libXt,
pkg-config,
# common dependencies
tk,
mpi,
python3Packages,
catalyst,
cli11,
boost,
eigen,
verdict,
double-conversion,
# common data libraries
lz4,
xz,
zlib,
pugixml,
expat,
jsoncpp,
libxml2,
exprtk,
utf8cpp,
libarchive,
nlohmann_json,
# filters
openturns,
openslide,
# io modules
cgns,
adios2,
libLAS,
libgeotiff,
laszip_2,
gdal,
pdal,
alembic,
imath,
openvdb,
c-blosc,
unixODBC,
postgresql,
libmysqlclient,
ffmpeg,
libjpeg,
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,
proj,
sqlite,
libogg,
libharu,
libtheora,
hdf5,
netcdf,
opencascade-occt,
# threading
tbb,
llvmPackages,
# rendering
viskores,
freetype,
fontconfig,
libX11,
libXfixes,
libXrender,
libXcursor,
gl2ps,
libGL,
qt5,
qt6,
# custom options
qtVersion ? null,
# To avoid conflicts between the propagated vtkPackages.hdf5
# and the input hdf5 used by most downstream packages,
# we set mpiSupport to false by default.
mpiSupport ? false,
pythonSupport ? false,
# passthru.tests
testers,
}:
let
inherit (lib) optionalString optionals;
version = "${majorVersion}.${minorVersion}";
pythonMajor = lib.substring 0 1 python.pythonVersion;
qtPackages =
if (isNull qtVersion) then
null
else if (qtVersion == "6") then
qt6
else if (qtVersion == "5") then
qt5
else
throw ''qtVersion must be "5", "6" or null'';
vtkPackages = lib.makeScope newScope (self: {
inherit
tbb
mpi
mpiSupport
python3Packages
pythonSupport
;
hdf5 = hdf5.override {
inherit mpi mpiSupport;
cppSupport = !mpiSupport;
};
openvdb = self.callPackage openvdb.override { };
netcdf = self.callPackage netcdf.override { };
catalyst = self.callPackage catalyst.override { };
adios2 = self.callPackage adios2.override { };
cgns = self.callPackage cgns.override { };
viskores = self.callPackage viskores.override { };
});
vtkBool = feature: bool: lib.cmakeFeature feature "${if bool then "YES" else "NO"}";
in
stdenv.mkDerivation {
pname = "vtk" + optionalString enableEgl "-egl" + optionalString enableQt "-qvtk";
inherit version;
stdenv.mkDerivation (finalAttrs: {
pname = "vtk";
inherit version patches;
src = fetchurl {
url = "https://www.vtk.org/files/release/${majorVersion}/VTK-${version}.tar.gz";
sha256 = sourceSha256;
url = "https://www.vtk.org/files/release/${lib.versions.majorMinor finalAttrs.version}/VTK-${finalAttrs.version}.tar.gz";
hash = sourceSha256;
};
nativeBuildInputs = [ cmake ];
nativeBuildInputs = [
cmake
pkg-config # required for finding MySQl
]
++ lib.optional pythonSupport python3Packages.python
++ lib.optional (
pythonSupport && stdenv.buildPlatform == stdenv.hostPlatform
) python3Packages.pythonImportsCheckHook;
buildInputs = [
libLAS
libgeotiff
laszip_2
gdal
pdal
alembic
imath
c-blosc
unixODBC
postgresql
libmysqlclient
ffmpeg
opencascade-occt
fontconfig
openturns
libarchive
libGL
vtkPackages.openvdb
]
++ lib.optionals stdenv.hostPlatform.isLinux [
libXfixes
libXrender
libXcursor
]
++ lib.optional (!(isNull qtPackages)) qtPackages.qttools
++ lib.optional mpiSupport mpi
++ lib.optional pythonSupport tk;
# propagated by vtk-config.cmake
propagatedBuildInputs = [
eigen
boost
verdict
double-conversion
freetype
lz4
xz
zlib
expat
exprtk
pugixml
jsoncpp
libxml2
utf8cpp
nlohmann_json
libjpeg
libpng
libtiff
proj
sqlite
libogg
libharu
libtheora
cli11
openslide
vtkPackages.hdf5
vtkPackages.cgns
vtkPackages.adios2
vtkPackages.netcdf
vtkPackages.catalyst
vtkPackages.viskores
vtkPackages.tbb
]
++ optionals enableQt [
(qtEnv "qvtk-qt-env" [
qtx11extras
qttools
qtdeclarative
])
++ lib.optionals stdenv.cc.isClang [
llvmPackages.openmp
]
++ optionals stdenv.hostPlatform.isLinux [
libGLU
xorgproto
libXt
]
++ optionals enablePython [
python
];
propagatedBuildInputs = optionals stdenv.hostPlatform.isLinux [
++ lib.optionals stdenv.hostPlatform.isLinux [
libX11
libGL
gl2ps
]
# create meta package providing dist-info for python3Pacakges.vtk that common cmake build does not do
++ lib.optionals pythonSupport [
(python3Packages.mkPythonMetaPackage {
inherit (finalAttrs) pname version meta;
dependencies =
with python3Packages;
[
numpy
wslink
matplotlib
]
++ lib.optional mpiSupport (mpi4py.override { inherit mpi; });
})
];
# 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 <cstdint>' \
-i ThirdParty/libproj/vtklibproj/src/proj_json_streaming_writer.hpp \
-i IO/Image/vtkSEPReader.h
''
+ optionalString stdenv.hostPlatform.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
# wrapper script calls qmlplugindump, crashes due to lack of minimal platform plugin
# Could not find the Qt platform plugin "minimal" in ""
preConfigure = lib.optionalString (qtVersion == "5") ''
export QT_PLUGIN_PATH=${lib.getBin qt5.qtbase}/${qt5.qtbase.qtPluginPrefix}
'';
env = {
CMAKE_PREFIX_PATH = "${lib.getDev openvdb}/lib/cmake/OpenVDB";
NIX_LDFLAGS = "-L${lib.getLib libmysqlclient}/lib/mariadb";
};
cmakeFlags = [
(lib.cmakeFeature "CMAKE_INSTALL_BINDIR" "bin")
(lib.cmakeFeature "CMAKE_INSTALL_LIBDIR" "lib")
(lib.cmakeFeature "CMAKE_INSTALL_INCLUDEDIR" "include")
# vtk common configure options
(lib.cmakeBool "VTK_DISPATCH_SOA_ARRAYS" true)
(lib.cmakeBool "VTK_ENABLE_CATALYST" true)
(lib.cmakeBool "VTK_WRAP_SERIALIZATION" true)
(lib.cmakeBool "VTK_BUILD_ALL_MODULES" true)
(lib.cmakeBool "VTK_VERSIONED_INSTALL" false)
(lib.cmakeBool "VTK_SMP_ENABLE_OPENMP" true)
(lib.cmakeFeature "VTK_SMP_IMPLEMENTATION_TYPE" "TBB")
# use system packages if possible
(lib.cmakeBool "VTK_USE_EXTERNAL" true)
(lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_fast_float" false) # required version incompatible
(lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_pegtl" false) # required version incompatible
(lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_ioss" false) # missing in nixpkgs
(lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_token" false) # missing in nixpkgs
(lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_fmt" false) # prefer vendored fmt
(lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_scn" false) # missing in nixpkgs
(lib.cmakeBool "VTK_MODULE_USE_EXTERNAL_VTK_gl2ps" stdenv.hostPlatform.isLinux) # external gl2ps causes failure linking to macOS OpenGL.framework
# Rendering
(vtkBool "VTK_MODULE_ENABLE_VTK_RenderingRayTracing" false) # ospray
(vtkBool "VTK_MODULE_ENABLE_VTK_RenderingOpenXR" false) # openxr
(vtkBool "VTK_MODULE_ENABLE_VTK_RenderingOpenVR" false) # openvr
(vtkBool "VTK_MODULE_ENABLE_VTK_RenderingAnari" false) # anari
# qtSupport
(vtkBool "VTK_GROUP_ENABLE_Qt" (!(isNull qtPackages)))
(lib.cmakeFeature "VTK_QT_VERSION" "Auto") # will search for Qt6 first
# pythonSupport
(lib.cmakeBool "VTK_USE_TK" pythonSupport)
(vtkBool "VTK_GROUP_ENABLE_Tk" pythonSupport)
(lib.cmakeBool "VTK_WRAP_PYTHON" pythonSupport)
(lib.cmakeBool "VTK_BUILD_PYI_FILES" pythonSupport)
(lib.cmakeFeature "VTK_PYTHON_VERSION" "3")
# mpiSupport
(lib.cmakeBool "VTK_USE_MPI" mpiSupport)
(vtkBool "VTK_GROUP_ENABLE_MPI" mpiSupport)
];
# byte-compile python modules since the CMake build does not do it
postInstall = lib.optionalString pythonSupport ''
python -m compileall -s $out $out/${python3Packages.python.sitePackages}
'';
pythonImportsCheck = [ "vtk" ];
dontWrapQtApps = true;
# 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_MODULE_USE_EXTERNAL_vtkpng=ON"
"-DVTK_MODULE_USE_EXTERNAL_vtktiff=1"
"-DVTK_MODULE_ENABLE_VTK_RenderingExternal=YES"
]
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
"-DOPENGL_INCLUDE_DIR=${lib.getInclude 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 enablePython [
"-DVTK_WRAP_PYTHON:BOOL=ON"
"-DVTK_PYTHON_VERSION:STRING=${pythonMajor}"
];
postFixup =
# Remove thirdparty find module that have been provided in nixpkgs.
''
rm -rf $out/lib/cmake/vtk/patches
rm $out/lib/cmake/vtk/Find{EXPAT,Freetype,utf8cpp,LibXml2,FontConfig}.cmake
''
# libvtkglad.so will find and load libGL.so at runtime.
+ lib.optionalString stdenv.hostPlatform.isLinux ''
patchelf --add-rpath ${lib.getLib libGL}/lib $out/lib/libvtkglad.so
'';
env = {
# Lots of warnings in vendored code…
NIX_CFLAGS_COMPILE =
if stdenv.cc.isClang then
"-Wno-error=incompatible-function-pointer-types"
else
"-Wno-error=incompatible-pointer-types";
passthru = {
inherit
pythonSupport
mpiSupport
;
vtkPackages = vtkPackages.overrideScope (
final: prev: {
vtk = finalAttrs.finalPackage;
}
);
tests = {
cmake-config = testers.hasCmakeConfigModules {
moduleNames = [ "VTK" ];
package = finalAttrs.finalPackage;
nativeBuildInputs = lib.optionals (!(isNull qtPackages)) [
qtPackages.qttools
qtPackages.wrapQtAppsHook
];
};
};
};
postInstall = optionalString enablePython ''
substitute \
${./vtk.egg-info} \
$out/${python.sitePackages}/vtk-${version}.egg-info \
--subst-var-by VTK_VER "${version}"
'';
requiredSystemFeatures = [ "big-parallel" ];
meta = with lib; {
meta = {
description = "Open source libraries for 3D computer graphics, image processing and visualization";
homepage = "https://www.vtk.org/";
license = licenses.bsd3;
maintainers = with maintainers; [
tfmoraes
];
platforms = platforms.unix;
badPlatforms = optionals enableEgl platforms.darwin;
changelog = "https://docs.vtk.org/en/latest/release_details/${lib.versions.majorMinor finalAttrs.version}.html";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ qbisi ];
platforms = lib.platforms.unix;
};
}
})

View File

@ -1,5 +0,0 @@
Metadata-Version: 2.1
Name: vtk
Version: @VTK_VER@
Summary: VTK is an open-source toolkit for 3D computer graphics, image processing, and visualization
Platform: UNKNOWN

View File

@ -25,6 +25,9 @@ buildPythonPackage rec {
hash = "sha256-9N1dF/zwjzoxX4xYIr5084M9pAk3YK3T48OUnCoC0NU=";
};
# remove this line once pyvista 0.46 is released
pythonRelaxDeps = [ "vtk" ];
build-system = [ setuptools ];
dependencies = [
@ -43,7 +46,6 @@ buildPythonPackage rec {
pythonImportsCheck = [ "pyvista" ];
meta = with lib; {
broken = pythonAtLeast "3.13"; # segfault
description = "Easier Pythonic interface to VTK";
homepage = "https://pyvista.org";
changelog = "https://github.com/pyvista/pyvista/releases/tag/${src.tag}";

View File

@ -666,6 +666,7 @@ mapAliases {
### F ###
f3d_egl = lib.warnOnInstantiate "'f3d' now build with egl support by default, so `f3d_egl` is deprecated, consider using 'f3d' instead." f3d; # added 2025-07-18
factor-lang-scope = throw "'factor-lang-scope' has been renamed to 'factorPackages'"; # added 2024-11-28
fahcontrol = throw "fahcontrol has been removed because the download is no longer available"; # added 2024-09-24
fahviewer = throw "fahviewer has been removed because the download is no longer available"; # added 2024-09-24
@ -2123,6 +2124,9 @@ mapAliases {
vocal = throw "'vocal' has been archived upstream. Consider using 'gnome-podcasts' or 'kasts' instead."; # Added 2025-04-12
void = throw "'void' has been removed due to lack of upstream maintenance"; # Added 2025-01-25
volnoti = throw "'volnoti' has been removed due to lack of maintenance upstream."; # Added 2024-12-04
vtk_9 = lib.warnOnInstantiate "'vtk_9' has been renamed to 'vtk_9_5'" vtk_9_5; # Added 2025-07-18
vtk_9_egl = lib.warnOnInstantiate "'vtk_9_5' now build with egl support by default, so `vtk_9_egl` is deprecated, consider using 'vtk_9_5' instead." vtk_9_5; # Added 2025-07-18
vtk_9_withQt5 = throw "'vtk_9_withQt5' has been removed, Consider using 'vtkWithQt5' instead." vtkWithQt5; # Added 2025-07-18
vuze = throw "'vuze' was removed because it is unmaintained upstream and insecure (CVE-2018-13417). BiglyBT is a maintained fork."; # Added 2024-11-22
vwm = throw "'vwm' was removed as it is broken and not maintained upstream"; # Added 2025-05-17
inherit (libsForQt5.mauiPackages) vvave; # added 2022-05-17

View File

@ -2112,8 +2112,6 @@ with pkgs;
waylandSupport = !stdenv.hostPlatform.isDarwin;
};
f3d_egl = f3d.override { vtk_9 = vtk_9_egl; };
fast-cli = nodePackages.fast-cli;
### TOOLS/TYPESETTING/TEX
@ -9635,17 +9633,19 @@ with pkgs;
wine = wineWowPackages.staging;
};
vtk_9 = libsForQt5.callPackage ../development/libraries/vtk/9.x.nix {
stdenv = if stdenv.cc.isClang then llvmPackages_17.stdenv else stdenv;
inherit (callPackage ../development/libraries/vtk { }) vtk_9_5;
vtk = vtk_9_5;
vtk-full = vtk.override {
qtVersion = "6";
mpiSupport = true;
pythonSupport = true;
};
vtk_9_withQt5 = vtk_9.override { enableQt = true; };
vtkWithQt5 = vtk.override { qtVersion = "5"; };
vtk = vtk_9;
vtk_9_egl = vtk_9.override { enableEgl = true; };
vtkWithQt5 = vtk_9_withQt5;
vtkWithQt6 = vtk.override { qtVersion = "6"; };
vulkan-caps-viewer = libsForQt5.callPackage ../tools/graphics/vulkan-caps-viewer { };

View File

@ -240,6 +240,7 @@ mapAliases ({
ev3dev2 = python-ev3dev2; # added 2023-06-19
evernote = throw "evernote is intended for use with Python 2.X";
eyeD3 = eyed3; # added 2024-01-03
f3d_egl = lib.warnOnInstantiate "'f3d' now build with egl support by default, so `f3d_egl` is deprecated, consider using 'f3d' instead." f3d; # added 2025-07-18
Fabric = fabric; # addedd 2023-02-19
face_recognition = face-recognition; # added 2022-10-15
face_recognition_models = face-recognition-models; # added 2022-10-15

View File

@ -4872,13 +4872,6 @@ self: super: with self; {
}
);
f3d_egl = toPythonModule (
pkgs.f3d_egl.override {
withPythonBinding = true;
python3Packages = self;
}
);
f5-icontrol-rest = callPackage ../development/python-modules/f5-icontrol-rest { };
f5-sdk = callPackage ../development/python-modules/f5-sdk { };
@ -19397,12 +19390,7 @@ self: super: with self; {
vtjp = callPackage ../development/python-modules/vtjp { };
vtk = toPythonModule (
pkgs.vtk_9.override {
inherit python;
enablePython = true;
}
);
vtk = toPythonModule (pkgs.vtk-full.override { python3Packages = self; });
vttlib = callPackage ../development/python-modules/vttlib { };