git: bab138a67593 - main - science/pagmo2: fix tests

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 22 Sep 2026 05:47:46 UTC
The branch main has been updated by yuri:

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

commit bab138a6759349a83b6f210070b3e095126059cd
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-09-22 03:07:09 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-09-22 05:47:43 +0000

    science/pagmo2: fix tests
---
 science/pagmo2/Makefile                   |  6 ++++--
 science/pagmo2/files/patch-CMakeLists.txt | 33 +++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/science/pagmo2/Makefile b/science/pagmo2/Makefile
index 64799b5c8dc8..21429c11fb0f 100644
--- a/science/pagmo2/Makefile
+++ b/science/pagmo2/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	pagmo2
 DISTVERSIONPREFIX=	v
 DISTVERSION=	2.19.1
-PORTREVISION=	7
+PORTREVISION=	8
 CATEGORIES=	science
 
 MAINTAINER=	yuri@FreeBSD.org
@@ -26,10 +26,12 @@ USE_LDCONFIG=	yes
 
 CMAKE_ON=	PAGMO_WITH_EIGEN3 PAGMO_WITH_NLOPT PAGMO_WITH_IPOPT PAGMO_ENABLE_IPO
 
-do-test: # many tests fail, see https://github.com/esa/pagmo2/issues/579
+do-test:
 	@cd ${BUILD_WRKSRC} && \
 		${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} -DPAGMO_BUILD_TESTS:BOOL=ON ${CMAKE_SOURCE_PATH} && \
 		${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${ALL_TARGET} && \
 		${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} test
 
+# tests as of 2.19.1: 100% tests passed, 0 tests failed out of 86
+
 .include <bsd.port.mk>
diff --git a/science/pagmo2/files/patch-CMakeLists.txt b/science/pagmo2/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..d0f6624d5064
--- /dev/null
+++ b/science/pagmo2/files/patch-CMakeLists.txt
@@ -0,0 +1,33 @@
+-- Workaround LLVM issue #71196: Clang 17+ -fassume-unique-vtables optimization
+-- breaks Boost.Serialization's polymorphic void cast registration in pagmo2,
+-- causing many tests to fail with "unregistered void cast". This adds the
+-- -fno-assume-unique-vtables flag when building with Clang 17+.
+
+-- LLVM issue: https://github.com/llvm/llvm-project/issues/71196
+-- Upstream fix: https://github.com/esa/pagmo2/pull/585
+
+--- CMakeLists.txt.orig	2026-09-22 02:54:11 UTC
++++ CMakeLists.txt
+@@ -148,6 +148,22 @@ endif()
+     unset(_PAGMO_GCC_SUPPORTS_NO_OVERRIDE)
+ endif()
+ 
++if(YACMA_COMPILER_IS_CLANGXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 17)
++    # workaround for https://github.com/llvm/llvm-project/issues/71196
++    # tldr; The new -fassume-unique-vtables optimization breaks serialization
++    # xref https://releases.llvm.org/17.0.1/tools/clang/docs/ReleaseNotes.html#c-language-changes
++    include(CheckCXXCompilerFlag)
++    set(CMAKE_REQUIRED_QUIET TRUE)
++    check_cxx_compiler_flag("-fno-assume-unique-vtables" _PAGMO_CLANG_SUPPORTS_ASSUME_UNIQUE_VTABLES)
++    unset(CMAKE_REQUIRED_QUIET)
++    if(_PAGMO_CLANG_SUPPORTS_ASSUME_UNIQUE_VTABLES)
++        message(STATUS "The '-fno-assume-unique-vtables' flag is supported, enabling it.")
++        list(APPEND PAGMO_CXX_FLAGS_DEBUG "-fno-assume-unique-vtables")
++        list(APPEND PAGMO_CXX_FLAGS_RELEASE "-fno-assume-unique-vtables")
++    endif()
++    unset(_PAGMO_CLANG_SUPPORTS_ASSUME_UNIQUE_VTABLES)
++endif()
++
+ # TBB. Try to find it first in config mode (supported
+ # since version 2021 after the oneTBB rename), and, if this
+ # fails, fall back to our own FindTBB.cmake. This is of course