1{ stdenv, fetchurl, fetchpatch, cmake, mesa, libX11, xproto, libXt
2, qtLib ? null }:
3
4with stdenv.lib;
5
6let
7 os = stdenv.lib.optionalString;
8 majorVersion = "5.10";
9 minorVersion = "1";
10 version = "${majorVersion}.${minorVersion}";
11in
12
13stdenv.mkDerivation rec {
14 name = "vtk-${os (qtLib != null) "qvtk-"}${version}";
15 src = fetchurl {
16 url = "${meta.homepage}files/release/${majorVersion}/vtk-${version}.tar.gz";
17 sha256 = "1fxxgsa7967gdphkl07lbfr6dcbq9a72z5kynlklxn7hyp0l18pi";
18 };
19
20 # https://bugzilla.redhat.com/show_bug.cgi?id=1138466
21 postPatch = "sed '/^#define GL_GLEXT_LEGACY/d' -i ./Rendering/vtkOpenGL.h";
22
23 buildInputs = [ cmake mesa libX11 xproto libXt ]
24 ++ optional (qtLib != null) qtLib;
25
26 # Shared libraries don't work, because of rpath troubles with the current
27 # nixpkgs camke approach. It wants to call a binary at build time, just
28 # built and requiring one of the shared objects.
29 # At least, we use -fPIC for other packages to be able to use this in shared
30 # objects.
31 cmakeFlags = [ "-DCMAKE_C_FLAGS=-fPIC" "-DCMAKE_CXX_FLAGS=-fPIC" ]
32 ++ optional (qtLib != null) [ "-DVTK_USE_QT:BOOL=ON" ];
33
34 enableParallelBuilding = true;
35
36 meta = {
37 description = "Open source libraries for 3D computer graphics, image processing and visualization";
38 homepage = http://www.vtk.org/;
39 license = stdenv.lib.licenses.bsd3;
40 maintainers = with stdenv.lib.maintainers; [ viric bbenoist ];
41 platforms = with stdenv.lib.platforms; linux;
42 };
43}