summaryrefslogtreecommitdiff
path: root/math
diff options
context:
space:
mode:
authorYuri Victorovich <yuri@FreeBSD.org>2023-07-18 06:55:24 -0700
committerYuri Victorovich <yuri@FreeBSD.org>2023-07-19 11:26:04 -0700
commitf3a0c9a0ce90f5bc83f96664dc16e94a5d0665cc (patch)
treee10654ed7823c19db6ab0050405d4f2a69738be9 /math
parentwww/pserv: Deprecate and set expiration date to 2023-09-30 (diff)
math/clad: Add test target
Diffstat (limited to 'math')
-rw-r--r--math/clad/Makefile15
-rw-r--r--math/clad/files/patch-demos_ErrorEstimation_CustomModel_CustomModel.cpp16
-rw-r--r--math/clad/files/patch-demos_ErrorEstimation_PrintModel_PrintModel.cpp16
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,