Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Jul 2023 18:26:08 GMT
From:      Yuri Victorovich <yuri@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: f3a0c9a0ce90 - main - math/clad: Add test target
Message-ID:  <202307191826.36JIQ8VG016742@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by yuri:

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

commit f3a0c9a0ce90f5bc83f96664dc16e94a5d0665cc
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-07-18 13:55:24 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-07-19 18:26:04 +0000

    math/clad: Add test target
---
 math/clad/Makefile                                       | 15 +++++++++++++--
 ...tch-demos_ErrorEstimation_CustomModel_CustomModel.cpp | 16 ++++++++++++++++
 ...patch-demos_ErrorEstimation_PrintModel_PrintModel.cpp | 16 ++++++++++++++++
 3 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/math/clad/Makefile b/math/clad/Makefile
index 3d91651338d7..523b321ac885 100644
--- a/math/clad/Makefile
+++ b/math/clad/Makefile
@@ -10,14 +10,25 @@ WWW=		https://github.com/vgvassilev/clad
 LICENSE=	LGPL3
 LICENSE_FILE=	${WRKSRC}/License.txt
 
-USES=		cmake compiler:c++14-lang llvm:15,build,run
+USES=		cmake:testing compiler:c++14-lang llvm:15,build,run
 USE_LDCONFIG=	yes
 
 USE_GITHUB=	yes
 GH_ACCOUNT=	vgvassilev
 
 CMAKE_ARGS=	-DClang_DIR=${LLVM_PREFIX}/lib/cmake/clang \
-		-DLLVM_DIR=${LLVM_PREFIX}/lib/cmake/llvm
+		-DLLVM_DIR=${LLVM_PREFIX}/lib/cmake/llvm \
+		-DLLVM_EXTERNAL_LIT=${LLVM_PREFIX}/bin/llvm-lit
 CMAKE_ON=	BUILD_SHARED_LIBS
+CMAKE_TESTING_ON=	FREEBSD_BUILD_TESTS FREEBSD_BUILD_DEMOS
+CMAKE_TESTING_TARGET=	check-clad
+
+post-patch:
+	@${REINPLACE_CMD} \
+		-e ' \
+			s|import lit|&${LLVM_VERSION}|; \
+			s|lit\.|lit${LLVM_VERSION}.| \
+		' \
+		${WRKSRC}/test/lit.cfg
 
 .include <bsd.port.mk>
diff --git a/math/clad/files/patch-demos_ErrorEstimation_CustomModel_CustomModel.cpp b/math/clad/files/patch-demos_ErrorEstimation_CustomModel_CustomModel.cpp
new file mode 100644
index 000000000000..d8e6163e4c60
--- /dev/null
+++ b/math/clad/files/patch-demos_ErrorEstimation_CustomModel_CustomModel.cpp
@@ -0,0 +1,16 @@
+- workaround for errors like:
+- ld: error: undefined reference due to --no-allow-shlib-undefined: __progname
+- >>> referenced by /lib/libc.so.7
+
+--- demos/ErrorEstimation/CustomModel/CustomModel.cpp.orig	2023-07-19 16:59:14 UTC
++++ demos/ErrorEstimation/CustomModel/CustomModel.cpp
+@@ -2,6 +2,9 @@
+ 
+ #include "CustomModel.h"
+ 
++char **environ = nullptr;
++const char *__progname = "x";
++
+ // Here we use the BuildOp function provided by clad to build a multiplication
+ // expression that clad can generate code for.
+ clang::Expr* CustomModel::AssignError(clad::StmtDiff refExpr,
diff --git a/math/clad/files/patch-demos_ErrorEstimation_PrintModel_PrintModel.cpp b/math/clad/files/patch-demos_ErrorEstimation_PrintModel_PrintModel.cpp
new file mode 100644
index 000000000000..ba2ae07083d5
--- /dev/null
+++ b/math/clad/files/patch-demos_ErrorEstimation_PrintModel_PrintModel.cpp
@@ -0,0 +1,16 @@
+- workaround for errors like:
+- ld: error: undefined reference due to --no-allow-shlib-undefined: __progname
+- >>> referenced by /lib/libc.so.7
+
+--- demos/ErrorEstimation/PrintModel/PrintModel.cpp.orig	2023-07-18 14:54:11 UTC
++++ demos/ErrorEstimation/PrintModel/PrintModel.cpp
+@@ -4,6 +4,9 @@
+ #include "PrintModel.h"
+ #include "clad/Differentiator/CladUtils.h"
+ 
++char **environ = nullptr;
++const char *__progname = "x";
++
+ // Here we use the BuildOp function provided by clad to build a multiplication
+ // expression that clad can generate code for.
+ clang::Expr* PrintModel::AssignError(clad::StmtDiff refExpr,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307191826.36JIQ8VG016742>