git: 2c9dc366f214 - main - devel/cpp-utilities: Add patch; Attempt to fix tests

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Wed, 05 Jul 2023 05:30:13 UTC
The branch main has been updated by yuri:

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

commit 2c9dc366f214cdbb623d3b954ce3f701f87e9989
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-07-05 03:44:42 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-07-05 05:30:09 +0000

    devel/cpp-utilities: Add patch; Attempt to fix tests
---
 devel/cpp-utilities/Makefile                        |  5 +++--
 devel/cpp-utilities/files/patch-tests_testutils.cpp | 11 +++++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/devel/cpp-utilities/Makefile b/devel/cpp-utilities/Makefile
index d4cfea6e818c..d631c136efa4 100644
--- a/devel/cpp-utilities/Makefile
+++ b/devel/cpp-utilities/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	cpp-utilities
 DISTVERSIONPREFIX=	v
 DISTVERSION=	5.24.0
+PORTREVISION=	1
 CATEGORIES=	devel
 
 MAINTAINER=	yuri@FreeBSD.org
@@ -11,6 +12,7 @@ LICENSE=	GPLv2
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
 LIB_DEPENDS=	libboost_iostreams.so:devel/boost-libs
+TEST_DEPENDS=	cppunit>0:devel/cppunit
 
 USES=		cmake:testing compiler:c++17-lang
 USE_LDCONFIG=	yes
@@ -19,7 +21,6 @@ USE_GITHUB=	yes
 GH_ACCOUNT=	Martchus
 
 CMAKE_ON=	BUILD_SHARED_LIBS
-
-# unclear how to run tests, see https://github.com/Martchus/cpp-utilities/issues/26
+CMAKE_TESTING_ARGS=	-DEXCLUDE_TESTS_FROM_ALL=OFF # tests fail to link: ld: error: unable to find library -lcppunit, see https://github.com/Martchus/cpp-utilities/issues/27
 
 .include <bsd.port.mk>
diff --git a/devel/cpp-utilities/files/patch-tests_testutils.cpp b/devel/cpp-utilities/files/patch-tests_testutils.cpp
new file mode 100644
index 000000000000..f98330cb99ec
--- /dev/null
+++ b/devel/cpp-utilities/files/patch-tests_testutils.cpp
@@ -0,0 +1,11 @@
+--- tests/testutils.cpp.orig	2023-07-05 03:40:48 UTC
++++ tests/testutils.cpp
+@@ -621,7 +621,7 @@ std::vector<std::string> TestApplication::readTestfile
+     auto binaryPath = std::string();
+ #if defined(CPP_UTILITIES_USE_STANDARD_FILESYSTEM) && defined(PLATFORM_UNIX)
+     try {
+-        binaryPath = std::filesystem::read_symlink("/proc/self/exe").parent_path();
++        binaryPath = std::filesystem::read_symlink("/proc/curproc/file").parent_path();
+         binaryPath += '/';
+     } catch (const std::filesystem::filesystem_error &e) {
+         cerr << Phrases::Warning << "Unable to detect binary path for finding \"srcdirref\": " << e.what() << Phrases::EndFlush;