diff --git a/math/clad/Makefile b/math/clad/Makefile index 3d91651338d7..523b321ac885 100644 --- a/math/clad/Makefile +++ b/math/clad/Makefile @@ -1,23 +1,34 @@ PORTNAME= clad DISTVERSIONPREFIX= v DISTVERSION= 1.2 CATEGORIES= math MAINTAINER= yuri@FreeBSD.org COMMENT= Automatic differentiation for C/C++ 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 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,