summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/libraries/vtk/default.nix30
-rw-r--r--pkgs/top-level/all-packages.nix8
2 files changed, 32 insertions, 6 deletions
diff --git a/pkgs/development/libraries/vtk/default.nix b/pkgs/development/libraries/vtk/default.nix
index 20e2213e3e7c3..e91d5b8d3979e 100644
--- a/pkgs/development/libraries/vtk/default.nix
+++ b/pkgs/development/libraries/vtk/default.nix
@@ -1,5 +1,8 @@
 { stdenv, fetchurl, fetchpatch, cmake, mesa, libX11, xproto, libXt
-, qtLib ? null }:
+, qtLib ? null
+# Darwin support
+, Cocoa, CoreServices, DiskArbitration, IOKit, CFNetwork, Security, GLUT
+, ApplicationServices, CoreText, IOSurface, cf-private, ImageIO, xpc, libobjc }:
 
 with stdenv.lib;
 
@@ -17,8 +20,14 @@ stdenv.mkDerivation rec {
     sha256 = "1hrjxkcvs3ap0bdhk90vymz5pgvxmg7q6sz8ab3wsyddbshr1abq";
   };
 
-  buildInputs = [ cmake mesa libX11 xproto libXt ]
-    ++ optional (qtLib != null) qtLib;
+  buildInputs =
+    if !stdenv.isDarwin
+    then [ cmake mesa libX11 xproto libXt ] ++ optional (qtLib != null) qtLib
+    else [ cmake qtLib xpc CoreServices DiskArbitration IOKit cf-private
+           CFNetwork Security ApplicationServices CoreText IOSurface ImageIO
+           GLUT ];
+  propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ Cocoa libobjc ];
+
 
   preBuild = ''
     export LD_LIBRARY_PATH="$(pwd)/lib";
@@ -30,7 +39,18 @@ stdenv.mkDerivation rec {
   # 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" ]
-    ++ optional (qtLib != null) [ "-DVTK_USE_QT:BOOL=ON" ];
+    ++ optional (qtLib != null) [ "-DVTK_USE_QT:BOOL=ON" ]
+    ++ optional stdenv.isDarwin [ "-DBUILD_TESTING:BOOL=OFF"
+                                  "-DCMAKE_OSX_SYSROOT="
+                                  "-DCMAKE_OSX_DEPLOYMENT_TARGET=" ];
+
+  doCheck = !stdenv.isDarwin;
+
+  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    sed -i 's|COMMAND vtkHashSource|COMMAND "DYLD_LIBRARY_PATH=''${VTK_BINARY_DIR}/lib" ''${VTK_BINARY_DIR}/bin/vtkHashSource-7.0|' ./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;
 
@@ -39,6 +59,6 @@ stdenv.mkDerivation rec {
     homepage = http://www.vtk.org/;
     license = stdenv.lib.licenses.bsd3;
     maintainers = with stdenv.lib.maintainers; [ viric bbenoist ];
-    platforms = with stdenv.lib.platforms; linux;
+    platforms = with stdenv.lib.platforms; unix;
   };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 0722743bf8ae5..1c1e163af9dd2 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9251,7 +9251,13 @@ in
 
   vsqlite = callPackage ../development/libraries/vsqlite { };
 
-  vtk = callPackage ../development/libraries/vtk { };
+  vtk = callPackage ../development/libraries/vtk {
+    inherit (darwin) cf-private libobjc;
+    inherit (darwin.apple_sdk.libs) xpc;
+    inherit (darwin.apple_sdk.frameworks) Cocoa CoreServices DiskArbitration
+                                          IOKit CFNetwork Security ApplicationServices
+                                          CoreText IOSurface ImageIO GLUT;
+  };
 
   vtkWithQt4 = vtk.override { qtLib = qt4; };