Unverified Commit a45da83a authored by Mario Rodas's avatar Mario Rodas Committed by GitHub
Browse files

Merge pull request #266884 from bcdarwin/vtk-cleanup

vtk: cleanup
parents 6f314053 d6179b96
Loading
Loading
Loading
Loading
+8 −13
Original line number Diff line number Diff line
{ majorVersion, minorVersion, sourceSha256, patchesToFetch ? [] }:
{ stdenv, lib, fetchurl, cmake, libGLU, libGL, libX11, xorgproto, libXt, libpng, libtiff
, fetchpatch
, enableQt ? false, qtbase, qtx11extras, qttools, qtdeclarative, qtEnv
, enableQt ? false, qtx11extras, qttools, qtdeclarative, qtEnv
, enablePython ? false, python ? throw "vtk: Python support requested, but no python interpreter was given."
# Darwin support
, AGL, Cocoa, CoreServices, DiskArbitration, IOKit, CFNetwork, Security, GLUT, OpenGL
@@ -11,11 +11,12 @@
let
  inherit (lib) optionalString optionals optional;

  version = "${majorVersion}.${minorVersion}";
  pythonMajor = lib.substring 0 1 python.pythonVersion;

in stdenv.mkDerivation rec {
in stdenv.mkDerivation {
  pname = "vtk${optionalString enableQt "-qvtk"}";
  version = "${majorVersion}.${minorVersion}";
  inherit version;

  src = fetchurl {
    url = "https://www.vtk.org/files/release/${majorVersion}/VTK-${version}.tar.gz";
@@ -25,9 +26,7 @@ in stdenv.mkDerivation rec {
  nativeBuildInputs = [ cmake ];

  buildInputs = [ libpng libtiff ]
    ++ optionals enableQt (if lib.versionOlder majorVersion "9"
                           then [ qtbase qtx11extras qttools ]
                           else  [ (qtEnv "qvtk-qt-env" [ qtx11extras qttools qtdeclarative ]) ])
    ++ optionals enableQt [ (qtEnv "qvtk-qt-env" [ qtx11extras qttools qtdeclarative ]) ]
    ++ optionals stdenv.isLinux [
      libGLU
      xorgproto
@@ -66,8 +65,8 @@ in stdenv.mkDerivation rec {
  cmakeFlags = [
    "-DCMAKE_C_FLAGS=-fPIC"
    "-DCMAKE_CXX_FLAGS=-fPIC"
    "-D${if lib.versionOlder version "9.0" then "VTK_USE_SYSTEM_PNG" else "VTK_MODULE_USE_EXTERNAL_vtkpng"}=ON"
    "-D${if lib.versionOlder version "9.0" then "VTK_USE_SYSTEM_TIFF" else "VTK_MODULE_USE_EXTERNAL_vtktiff"}=1"
    "-DVTK_MODULE_USE_EXTERNAL_vtkpng=ON"
    "-DVTK_MODULE_USE_EXTERNAL_vtktiff=1"
  ] ++ lib.optionals (!stdenv.isDarwin) [
    "-DOPENGL_INCLUDE_DIR=${libGL}/include"
  ] ++ [
@@ -76,9 +75,7 @@ in stdenv.mkDerivation rec {
    "-DCMAKE_INSTALL_BINDIR=bin"
    "-DVTK_VERSIONED_INSTALL=OFF"
  ] ++ optionals enableQt [
    "-D${if lib.versionOlder version "9.0" then "VTK_Group_Qt:BOOL=ON" else "VTK_GROUP_ENABLE_Qt:STRING=YES"}"
  ] ++ optionals (enableQt && lib.versionOlder version "8.0") [
    "-DVTK_QT_VERSION=5"
    "-DVTK_GROUP_ENABLE_Qt:STRING=YES"
  ]
    ++ optionals stdenv.isDarwin [ "-DOPENGL_INCLUDE_DIR=${OpenGL}/Library/Frameworks" ]
    ++ optionals enablePython [
@@ -105,7 +102,5 @@ in stdenv.mkDerivation rec {
    license = licenses.bsd3;
    maintainers = with maintainers; [ knedlsepp tfmoraes lheckemann ];
    platforms = with platforms; unix;
    # /nix/store/xxxxxxx-apple-framework-Security/Library/Frameworks/Security.framework/Headers/Authorization.h:192:7: error: variably modified 'bytes' at file scope
    broken = stdenv.isDarwin && (lib.versions.major majorVersion == "8");
  };
}