git: 5fff47e3957b - main - math/vtk9: Use external packages instead of bundled dependencies

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 23 Nov 2021 23:53:33 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=5fff47e3957bc066cb63f6810e5e285820a8d86d

commit 5fff47e3957bc066cb63f6810e5e285820a8d86d
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2021-11-23 23:49:20 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2021-11-23 23:53:29 +0000

    math/vtk9: Use external packages instead of bundled dependencies
    
    This is partially restoring what has eroded with vtk updates,
    and is partially adding new external dependencies.
---
 math/vtk9/Makefile | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/math/vtk9/Makefile b/math/vtk9/Makefile
index 7583f31a6c2c..debd1f583cd2 100644
--- a/math/vtk9/Makefile
+++ b/math/vtk9/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	vtk
 DISTVERSION=	9.1.0
+PORTREVISION=	1
 CATEGORIES=	math graphics
 MASTER_SITES=	https://vtk.org/files/release/${VTK_SHORT_VER}/
 PKGNAMESUFFIX=	9
@@ -10,25 +11,29 @@ COMMENT=	Visualization toolkit
 
 LICENSE=	BSD3CLAUSE
 
-LIB_DEPENDS=	libtiff.so:graphics/tiff \
-		libpng.so:graphics/png \
+LIB_DEPENDS=	\
+		libexpat.so:textproc/expat2 \
 		libfreetype.so:print/freetype2 \
-		libexpat.so:textproc/expat2
+		libhdf5.so:science/hdf5 \
+		libnetcdf.so:science/netcdf \
+		libpng.so:graphics/png \
+		libtiff.so:graphics/tiff
 
 USES=		alias cmake compiler:c++11-lang gl jpeg localbase xorg
 USE_LDCONFIG=	${PREFIX}/lib/vtk-${VTK_SHORT_VER}
 USE_XORG=	ice x11 xt xext sm xcursor xfixes xrender
 
 CMAKE_ON=	BUILD_SHARED_LIBS \
-		VTK_INSTALL_NO_DOCUMENTATION VTK_USE_SYSTEM_EXPAT VTK_USE_SYSTEM_TIFF \
-		VTK_USE_SYSTEM_PNG VTK_USE_SYSTEM_JPEG VTK_USE_SYSTEM_FREETYPE VTK_USE_SYSTEM_ZLIB \
+		VTK_INSTALL_NO_DOCUMENTATION \
 		Module_vtkTestingCore Module_vtkTestingRendering
+.for m in expat freetype hdf5 jpeg netcdf png tiff zlib
+CMAKE_ON+=	VTK_MODULE_USE_EXTERNAL_VTK_${m}
+.endfor
 CMAKE_ARGS=	-DVTK_INSTALL_LIBRARY_DIR=lib/vtk-${VTK_SHORT_VER} \
 		-DVTK_INSTALL_ARCHIVE_DIR=lib/vtk-${VTK_SHORT_VER} \
 		-DVTK_INSTALL_QT_DIR=/${QT_LIBDIR_REL}/plugins/designer \
 		-DSTAGEDIR=${STAGEDIR}
-
-CFLAGS+=	-Du_int=unsigned # workaround for https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=259975
+		# all build options are documented here: https://gitlab.kitware.com/vtk/vtk/blob/master/Documentation/dev/build.md
 
 VTK_SHORT_VER=	${PORTVERSION:R}
 
@@ -102,13 +107,6 @@ DOCS_BUILD_DEPENDS=	doxygen:devel/doxygen
 
 EXAMPLES_CMAKE_BOOL=	BUILD_EXAMPLES
 
-# Mangling so that it will build when science/netcdf is installed.
-post-patch:
-	@${MV} ${WRKSRC}/ThirdParty/netcdf/vtknetcdf/include/netcdf.h \
-		${WRKSRC}/ThirdParty/netcdf/vtknetcdf/include/xxxnetcdf.h
-	@${FIND} ${WRKSRC}/ThirdParty/netcdf -type f | ${XARGS} ${REINPLACE_CMD} \
-		-E 's/[[:<:]]netcdf\.h[[:>:]]/xxxnetcdf.h/'
-
 .include <bsd.port.options.mk>
 
 .for g in ${VTK_GROUPS}