git: c88b531512eb - main - graphics/partio: update the port to version 1.14.6 and enable tests

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Mon, 18 Oct 2021 17:28:13 UTC
The branch main has been updated by danfe:

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

commit c88b531512eb927570ed8a701dd2a749c719297f
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2021-10-18 17:25:32 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2021-10-18 17:25:31 +0000

    graphics/partio: update the port to version 1.14.6 and enable tests
    
    Three out of twelve test currently fail, two of them because they
    import port's own Python bits which are not yet installed, and there
    is no trick like LD_LIBRARY_PATH for C tests to the rescue.
    
    Reported by:    portscout
---
 graphics/partio/Makefile                           | 29 +++++++++++-----------
 graphics/partio/distinfo                           |  6 ++---
 graphics/partio/files/patch-src_lib_CMakeLists.txt | 17 +++++--------
 .../partio/files/patch-src_tests_CMakeLists.txt    | 17 +++++++++++++
 graphics/partio/files/patch-src_tools_partedit.py  | 13 ++++++++++
 graphics/partio/pkg-plist                          |  2 +-
 6 files changed, 55 insertions(+), 29 deletions(-)

diff --git a/graphics/partio/Makefile b/graphics/partio/Makefile
index 0e471dcd52e5..5fdacd155f50 100644
--- a/graphics/partio/Makefile
+++ b/graphics/partio/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	partio
-PORTVERSION=	1.14.0
+PORTVERSION=	1.14.6
 DISTVERSIONPREFIX=	v
-PORTREVISION=	1
 CATEGORIES=	graphics math
 
 MAINTAINER=	danfe@FreeBSD.org
@@ -25,8 +24,8 @@ GH_ACCOUNT=	wdas
 PORTDOCS=	*
 PORTEXAMPLES=	*
 
-OPTIONS_DEFINE=		DOCS DOXYGEN EXAMPLES PYQT
-PYQT_DESC=		Install PyQt-based auxiliary tools
+OPTIONS_DEFINE=	DOCS DOXYGEN EXAMPLES PYQT TEST
+PYQT_DESC=	Install PyQt-based auxiliary tools
 
 # DOCS must be selected for PORTDOCS to work
 DOXYGEN_IMPLIES=	DOCS
@@ -37,26 +36,25 @@ DOCS_BUILD_DEPENDS=	doxygen:devel/doxygen
 
 PYQT_USES=		pyqt:5
 PYQT_USE=		PYQT=core,gui,widgets
-PYQT_PLIST_FILES=	bin/partinspect
+PYQT_PLIST_FILES=	bin/partedit bin/partinspect
+
+TEST_LIB_DEPENDS=	libgtest.so:devel/googletest
+TEST_CMAKE_ON=		-DPARTIO_GTEST_ENABLED:BOOL=ON
+TEST_VARS=		SHEBANG_FILES+="src/tests/testpartio.py \
+			src/tests/testpartjson.py"
 
 post-patch:
 	@${REINPLACE_CMD} -e \
-	    '/^project/s,${PORTNAME},& VERSION ${PORTVERSION},' \
-		${WRKSRC}/CMakeLists.txt
-	@${REINPLACE_CMD} -e 's,OpenGL::OpenGL,$${OPENGL_LIBRARIES},' \
-		${WRKSRC}/src/tools/CMakeLists.txt
+		'/^project/s,${PORTNAME},& VERSION ${PORTVERSION}, ; \
+		s,/usr,${LOCALBASE},' ${WRKSRC}/CMakeLists.txt
 	@${REINPLACE_CMD} -e 's,^from Qt,from PyQt5,' \
+		${WRKSRC}/src/tools/partedit.py \
 		${WRKSRC}/src/tools/partinspect.py
-	@${REINPLACE_CMD} -e '/^install/d' ${WRKSRC}/src/tests/CMakeLists.txt
 
 post-patch-DOCS-off:
 	@${REINPLACE_CMD} -e '/add_subdirectory(src\/doc)/d' \
 		${WRKSRC}/CMakeLists.txt
 
-# Remove those files that don't yet work
-post-install:
-	${RM} ${STAGEDIR}${PREFIX}/bin/partedit
-
 post-install-DOCS-on:
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
 	cd ${WRKSRC}/src/doc && ${INSTALL_DATA} tutorial.txt partio.tex ${STAGEDIR}${DOCSDIR}
@@ -68,4 +66,7 @@ post-install-EXAMPLES-on:
 post-install-PYQT-off:
 	cd ${STAGEDIR}${PREFIX} && ${RM} ${PYQT_PLIST_FILES}
 
+do-test-TEST-on:
+	@cd ${TEST_WRKSRC} && ctest -C ${CMAKE_BUILD_TYPE} ${_MAKE_JOBS}
+
 .include <bsd.port.mk>
diff --git a/graphics/partio/distinfo b/graphics/partio/distinfo
index 81552a025f3c..697b7c5bbb0f 100644
--- a/graphics/partio/distinfo
+++ b/graphics/partio/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1606871958
-SHA256 (wdas-partio-v1.14.0_GH0.tar.gz) = f98874b781e92ab9b5d0575cabc437d27274cd91cb581f80960918efa491f902
-SIZE (wdas-partio-v1.14.0_GH0.tar.gz) = 335265
+TIMESTAMP = 1623084225
+SHA256 (wdas-partio-v1.14.6_GH0.tar.gz) = 53a5754d6b2fc3e184953d985c233118ef0ab87169f34e3aec4a7e6d20cd9bd4
+SIZE (wdas-partio-v1.14.6_GH0.tar.gz) = 336527
diff --git a/graphics/partio/files/patch-src_lib_CMakeLists.txt b/graphics/partio/files/patch-src_lib_CMakeLists.txt
index e9e5eb95fbac..c4741ac00313 100644
--- a/graphics/partio/files/patch-src_lib_CMakeLists.txt
+++ b/graphics/partio/files/patch-src_lib_CMakeLists.txt
@@ -1,15 +1,10 @@
---- src/lib/CMakeLists.txt.orig	2020-12-02 01:19:18 UTC
+--- src/lib/CMakeLists.txt.orig	2021-06-07 16:43:45 UTC
 +++ src/lib/CMakeLists.txt
-@@ -40,7 +40,11 @@ else()
-     set(PARTIO_LIBRARY_TYPE STATIC)
- endif()
- add_library(partio ${PARTIO_LIBRARY_TYPE} ${io_cpp} ${core_cpp})
--set_target_properties(partio PROPERTIES OUTPUT_NAME partio POSITION_INDEPENDENT_CODE ON)
-+set_target_properties(partio PROPERTIES
-+    OUTPUT_NAME partio
+@@ -44,6 +44,7 @@ add_library(partio ${PARTIO_LIBRARY_TYPE} ${io_cpp} ${
+ set_target_properties(partio PROPERTIES
+     OUTPUT_NAME partio
+     POSITION_INDEPENDENT_CODE ON
 +    VERSION ${CMAKE_PROJECT_VERSION}
-+    SOVERSION 1
-+    POSITION_INDEPENDENT_CODE ON)
+     SOVERSION ${PARTIO_VERSION_MAJOR})
  
  target_include_directories(partio
-     PUBLIC
diff --git a/graphics/partio/files/patch-src_tests_CMakeLists.txt b/graphics/partio/files/patch-src_tests_CMakeLists.txt
new file mode 100644
index 000000000000..8d2bba3f4399
--- /dev/null
+++ b/graphics/partio/files/patch-src_tests_CMakeLists.txt
@@ -0,0 +1,17 @@
+--- src/tests/CMakeLists.txt.orig	2021-06-07 16:43:45 UTC
++++ src/tests/CMakeLists.txt
+@@ -45,12 +45,12 @@ else()
+             ${item} ${PARTIO_LIBRARIES} ${GTEST_LIB} Threads::Threads)
+         target_compile_definitions(${item} PRIVATE -DPARTIO_DATA_DIR="${PROJECT_SOURCE_DIR}/src/data")
+         target_link_directories(${item} PRIVATE ${GTEST_LINK_PATH})
+-        install(TARGETS ${item} DESTINATION ${CMAKE_INSTALL_PARTIO_TESTDIR})
+         add_test(NAME ${item} COMMAND ${item})
++        set_tests_properties(${item} PROPERTIES ENVIRONMENT
++            "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/src/lib")
+     endforeach(item)
+ 
+     foreach(item testpartjson testpartio)
+         add_test(NAME ${item} COMMAND ${PYTHON_EXECUTABLE} -B ${CMAKE_CURRENT_SOURCE_DIR}/${item}.py)
+-        install(PROGRAMS ${item}.py DESTINATION ${CMAKE_INSTALL_PARTIO_TESTDIR} RENAME ${item})
+     endforeach(item)
+ endif()
diff --git a/graphics/partio/files/patch-src_tools_partedit.py b/graphics/partio/files/patch-src_tools_partedit.py
new file mode 100644
index 000000000000..2e94e5fe088f
--- /dev/null
+++ b/graphics/partio/files/patch-src_tools_partedit.py
@@ -0,0 +1,13 @@
+--- src/tools/partedit.py.orig	2021-10-18 09:08:43 UTC
++++ src/tools/partedit.py
+@@ -72,9 +72,7 @@ def getAttrs(numAttributesFunc, attributeInfoFunc, sor
+     numAttr = numAttributesFunc()
+ 
+     nameToIndex = {attributeInfoFunc(anum).name:anum for anum in range(numAttr)}
+-    names = nameToIndex.keys()
+-    if sort:
+-        names.sort()
++    names = sorted(nameToIndex) if sort else nameToIndex.keys()
+ 
+     id_offset = 0
+     for name in names:
diff --git a/graphics/partio/pkg-plist b/graphics/partio/pkg-plist
index ccae3990c53a..093600bc8d05 100644
--- a/graphics/partio/pkg-plist
+++ b/graphics/partio/pkg-plist
@@ -9,7 +9,7 @@ include/PartioIterator.h
 include/PartioVec3.h
 lib/libpartio.so
 lib/libpartio.so.1
-lib/libpartio.so.1.14.0
+lib/libpartio.so.1.14.6
 %%PYTHON_SITELIBDIR%%/_partio.so
 %%PYTHON_SITELIBDIR%%/partedit.py
 %%PYTHON_SITELIBDIR%%/partinspect.py