vtk: darwin compatibility

This commit is contained in:
Anthony Cowley 2016-09-29 11:37:34 -04:00
parent 4d8e445a14
commit 450dd55d95
2 changed files with 32 additions and 6 deletions

View File

@ -1,5 +1,8 @@
{ stdenv, fetchurl, fetchpatch, cmake, mesa, libX11, xproto, libXt { 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; with stdenv.lib;
@ -17,8 +20,14 @@ stdenv.mkDerivation rec {
sha256 = "1hrjxkcvs3ap0bdhk90vymz5pgvxmg7q6sz8ab3wsyddbshr1abq"; sha256 = "1hrjxkcvs3ap0bdhk90vymz5pgvxmg7q6sz8ab3wsyddbshr1abq";
}; };
buildInputs = [ cmake mesa libX11 xproto libXt ] buildInputs =
++ optional (qtLib != null) qtLib; 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 = '' preBuild = ''
export LD_LIBRARY_PATH="$(pwd)/lib"; 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 # At least, we use -fPIC for other packages to be able to use this in shared
# objects. # objects.
cmakeFlags = [ "-DCMAKE_C_FLAGS=-fPIC" "-DCMAKE_CXX_FLAGS=-fPIC" ] 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; enableParallelBuilding = true;
@ -39,6 +59,6 @@ stdenv.mkDerivation rec {
homepage = http://www.vtk.org/; homepage = http://www.vtk.org/;
license = stdenv.lib.licenses.bsd3; license = stdenv.lib.licenses.bsd3;
maintainers = with stdenv.lib.maintainers; [ viric bbenoist ]; maintainers = with stdenv.lib.maintainers; [ viric bbenoist ];
platforms = with stdenv.lib.platforms; linux; platforms = with stdenv.lib.platforms; unix;
}; };
} }

View File

@ -9251,7 +9251,13 @@ in
vsqlite = callPackage ../development/libraries/vsqlite { }; 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; }; vtkWithQt4 = vtk.override { qtLib = qt4; };