Files

233 lines
9.2 KiB
Tcl

# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup cmake 1.1
PortGroup github 1.0
PortGroup legacysupport 1.1
PortGroup mpi 1.0
PortGroup muniversal 1.0
# Undefined symbols for std::bad_variant_access
# 10.12 Sierra = Darwin 16
legacysupport.newest_darwin_requires_legacy 16
legacysupport.use_mp_libcxx yes
# Upstream says require C++17
compiler.cxx_standard 2017
# some older Clang say they support C++11 when they don't
# this is the same blacklisting as for jsoncpp, on which vtk depends.
# compiler.blacklist-append {clang < 900}
# VTK 9.5.1+ Cmake says: Apple Clang 11.0 or later is required
compiler.blacklist-append {clang < 1100}
# 2026 April 7: Must use Kitware Github mirror to avoid Anubis blockers.
# Gitlab instance and VTK custom download page are both Anubis blocked.
# On Github, only tags are mirrored, not releases.
github.setup Kitware vtk 9.6.2 v
github.tarball_from archive
revision 0
categories graphics devel
license BSD
checksums rmd160 5b25818b50f7922633ecb8a92de511c8eca189f8 \
sha256 de5c02499c550aa09052b2d5f3823a8cae54c72ce1b0014afcde2dabd8e390ea \
size 54875775
maintainers {@Dave-Allured noaa.gov:dave.allured} \
openmaintainer
description Visualization Toolkit (VTK)
long_description ${description} is an open-source, freely \
available software system for 3D computer graphics, \
image processing and visualization.
homepage https://www.vtk.org
mpi.setup
set proj_version proj9
depends_lib-append path:share/pkgconfig/eigen3.pc:eigen3 \
port:freetype \
port:hdf5 \
port:jsoncpp \
port:libharu \
path:include/turbojpeg.h:libjpeg-turbo \
port:libpng \
port:libxml2 \
port:lz4 \
port:netcdf \
port:${proj_version} \
port:pugixml \
port:sqlite3 \
port:tiff \
port:zlib
configure.args-append \
-DVTK_MODULE_USE_EXTERNAL_VTK_eigen:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_freetype:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_hdf5:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_jsoncpp:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_libharu:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_jpeg:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_png:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_libproj:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_libxml2:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_lz4:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_netcdf:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_pugixml:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_sqlite:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_tiff:BOOL=ON \
-DVTK_MODULE_USE_EXTERNAL_VTK_zlib:BOOL=ON
mpi.enforce_variant hdf5
# PROJ needs extra help for multiple versioned subdirectories.
configure.args-append \
-DLibPROJ_ROOT=${prefix}/lib/${proj_version}
# Re restoring support for legacy macOS, see:
# https://gitlab.kitware.com/vtk/vtk/-/merge_requests/11171
# https://gitlab.kitware.com/vtk/vtk/-/issues/19352
patchfiles-append patch-MACH_TASK_BASIC_INFO.diff
configure.pre_args-delete \
-DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON
configure.args-append \
../${distname}/ \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DVTK_BUILD_EXAMPLES:BOOL=OFF \
-DVTK_WRAP_PYTHON:BOOL=OFF \
-DVTK_WRAP_JAVA:BOOL=OFF \
-DVTK_USE_COCOA:BOOL=ON
# Do not allow any remote downloads of code or test data.
configure.args-append \
-DVTK_FORBID_DOWNLOADS:BOOL=ON
# Support for Cocoa of 10.6 has been dropped in
# https://github.com/Kitware/VTK/commit/f2e249c0a6a93f12808822cc5e5dddda35a09a35
# However it is an optional module. Instead of breaking the port,
# just disable what is broken. Notice, it may also be possible
# to build with SDL2 backend (VTK_USE_SDL2) or X-less Mesa.
if {${os.platform} eq "darwin" && ${os.major} < 11} {
# Avoid hardcoded failure:
patchfiles-append patch-vtkApple.cmake.diff
# Fix for pthreads, only relevant for < 10.7:
patchfiles-append patch-pthread_threadid_np.diff
# Ensure Cocoa does not get picked and fix GL linking:
patchfiles-append patch-use-x11.diff
# Fix 32-bit builds with gcc:
if {[string match *gcc* ${configure.compiler}] \
&& ${configure.build_arch} in [list arm i386 ppc]} {
patchfiles-append \
patch-DataModel.diff
}
depends_lib-append port:mesa \
port:xorg-libX11 \
port:xorg-libXcursor
configure.args-append \
-DVTK_USE_X:BOOL=ON
configure.args-replace \
-DVTK_USE_COCOA:BOOL=ON -DVTK_USE_COCOA:BOOL=OFF
# As proposed at #46890
configure.args-append \
-DIOKit:FILEPATH=/System/Library/Frameworks/IOKit.framework
}
# loguru.cpp:576:90: error: invalid conversion from 'long unsigned int'
# to 'size_t*' {aka 'long unsigned int*'} [-fpermissive]
# loguru.cpp:580:68: error: invalid conversion from 'const char*'
# to 'char*' [-fpermissive]. Perhaps specific to older SDKs,
# but gcc is not used by default elsewhere anyway.
if {[string match *gcc* ${configure.compiler}]} {
configure.cxxflags-append \
-fpermissive
}
variant ffmpeg description {Add support for ffmpeg} {
depends_lib-append port:ffmpeg
configure.args-append \
-DModule_vtkIOFFMPEG:BOOL=ON
}
variant qt5 description {Add Qt5 support.} {
PortGroup qt5 1.0
configure.args-append \
-DQT_QMAKE_EXECUTABLE:PATH=${qt_qmake_cmd} \
-DQMLPLUGINDUMP_EXECUTABLE:PATH=${qt_bins_dir}/qmlplugindump \
-DVTK_QT_VERSION=5 \
-DVTK_GROUP_ENABLE_Qt:STRING=YES \
-DVTK_MODULE_ENABLE_VTK_GUISupportQt=YES \
-DVTK_MODULE_ENABLE_VTK_RenderingQt=YES \
-DVTK_MODULE_ENABLE_VTK_ViewsQt=YES
}
# Supported pythons
set python_versions {310 311 312 313 314}
foreach pyver ${python_versions} {
# Conflicting python versions
set other_python_versions {}
foreach other_pyver ${python_versions} {
if {${other_pyver} ne ${pyver}} {
if {${other_pyver} ni ${other_python_versions}} {
lappend other_python_versions python${other_pyver}
}
}
}
# Get python branch
set python_branch "[string index ${pyver} 0].[string range ${pyver} 1 end]"
set python_major_ver "[string index ${pyver} 0]"
variant python${pyver} conflicts {*}${other_python_versions} description "Add Python ${python_branch} support" "
depends_lib-append port:python${pyver}
configure.args-delete \
-DVTK_WRAP_PYTHON:BOOL=OFF
configure.args-append \
-DVTK_WRAP_PYTHON:BOOL=ON \
-DPython${python_major_ver}_EXECUTABLE:STRING=${prefix}/bin/python${python_branch} \
-DPython${python_major_ver}_INCLUDE_DIR=${frameworks_dir}/Python.framework/Versions/${python_branch}/Headers/ \
-DPython${python_major_ver}_LIBRARY=${frameworks_dir}/Python.framework/Versions/${python_branch}/lib/libpython${python_branch}.dylib \
-DVTK_PYTHON_SITE_PACKAGES_SUFFIX=Library/Frameworks/Python.framework/Versions/${python_branch}/lib/python${python_branch}/site-packages \
if {[mpi_variant_isset]} {
depends_lib-append port:py${pyver}-mpi4py
configure.args-append \
-DVTK_USE_SYSTEM_MPI4PY:BOOL=ON
}
post-destroot {
# generate setup.py and other necessary files to create .dist-info folder
system -W ${workpath}/build \"cmake -DVTK_WHEEL_BUILD:BOOL=ON -DVTK_VERSION_SUFFIX= ${worksrcpath}\"
set site_pack_dir Library/Frameworks/Python.framework/Versions/${python_branch}/lib/python${python_branch}/site-packages
delete -force ${workpath}/build/vtkmodules
copy ${workpath}/build/\${site_pack_dir}/vtkmodules ${workpath}/build
# create the .dist-info folder and contents
system -W ${workpath}/build \"${prefix}/bin/python${python_branch} setup.py dist_info\"
copy ${workpath}/build/${name}-${version}.dist-info ${destroot}${prefix}/\${site_pack_dir}
}
"
}
if {[mpi_variant_isset]} {
configure.args-append \
-DVTK_Group_MPI:BOOL=ON \
-DVTK_USE_MPI:BOOL=ON
}
# Avoid release candidates.
github.livecheck.regex {([0-9.]+)}