From 450dd55d954ab23c3e8f86bc64d020d0e4e8c36e Mon Sep 17 00:00:00 2001 From: Anthony Cowley Date: Thu, 29 Sep 2016 11:37:34 -0400 Subject: vtk: darwin compatibility --- pkgs/development/libraries/vtk/default.nix | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) (limited to 'pkgs/development/libraries/vtk') 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; }; } -- cgit 1.4.1