git: 8d4414cedb42 - main - math/clad: New port: Automatic differentiation for C/C++

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Wed, 19 Jul 2023 09:24:18 UTC
The branch main has been updated by yuri:

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

commit 8d4414cedb428a93d67444dffb01abaef739d28a
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2023-07-18 13:55:24 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2023-07-19 09:24:16 +0000

    math/clad: New port: Automatic differentiation for C/C++
---
 math/Makefile                        |  1 +
 math/clad/Makefile                   | 23 ++++++++++++++++++++++
 math/clad/distinfo                   |  3 +++
 math/clad/files/patch-CMakeLists.txt | 19 ++++++++++++++++++
 math/clad/pkg-descr                  |  6 ++++++
 math/clad/pkg-plist                  | 37 ++++++++++++++++++++++++++++++++++++
 6 files changed, 89 insertions(+)

diff --git a/math/Makefile b/math/Makefile
index 4ef0d27252f9..208191e8ea97 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -223,6 +223,7 @@
     SUBDIR += chryzodus
     SUBDIR += chuffed
     SUBDIR += cimod
+    SUBDIR += clad
     SUBDIR += clasp
     SUBDIR += clblas
     SUBDIR += clblast
diff --git a/math/clad/Makefile b/math/clad/Makefile
new file mode 100644
index 000000000000..3d91651338d7
--- /dev/null
+++ b/math/clad/Makefile
@@ -0,0 +1,23 @@
+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
+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
+CMAKE_ON=	BUILD_SHARED_LIBS
+
+.include <bsd.port.mk>
diff --git a/math/clad/distinfo b/math/clad/distinfo
new file mode 100644
index 000000000000..b2b8e00aab64
--- /dev/null
+++ b/math/clad/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1689756219
+SHA256 (vgvassilev-clad-v1.2_GH0.tar.gz) = 35dd72349553acfe7cd66938bdd097cf86c6dc3ac71b1379ec6d0908a4fae08f
+SIZE (vgvassilev-clad-v1.2_GH0.tar.gz) = 918593
diff --git a/math/clad/files/patch-CMakeLists.txt b/math/clad/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..5bd87e30404d
--- /dev/null
+++ b/math/clad/files/patch-CMakeLists.txt
@@ -0,0 +1,19 @@
+--- CMakeLists.txt.orig	2023-07-19 08:50:39 UTC
++++ CMakeLists.txt
+@@ -299,9 +299,13 @@ if (CLAD_INCLUDE_DOCS)
+ endif()
+ 
+ if (NOT CLAD_BUILD_STATIC_ONLY)
+-  add_subdirectory(test)
+-  add_subdirectory(demos/ErrorEstimation/CustomModel)
+-  add_subdirectory(demos/ErrorEstimation/PrintModel)
++  if (FREEBSD_BUILD_TESTS)
++    add_subdirectory(test)
++  endif()
++  if (FREEBSD_BUILD_DEMOS)
++    add_subdirectory(demos/ErrorEstimation/CustomModel)
++    add_subdirectory(demos/ErrorEstimation/PrintModel)
++  endif()
+ 
+   # Add benchmarking infrastructure.
+   if (CLAD_ENABLE_BENCHMARKS)
diff --git a/math/clad/pkg-descr b/math/clad/pkg-descr
new file mode 100644
index 000000000000..97f6e87a82c4
--- /dev/null
+++ b/math/clad/pkg-descr
@@ -0,0 +1,6 @@
+Clad enables automatic differentiation (AD) for C++. It is based on LLVM
+compiler infrastructure and is a plugin for Clang compiler. Clad is based on
+source code transformation. Given C++ source code of a mathematical function, it
+can automatically generate C++ code for computing derivatives of the function.
+It supports both forward-mode and reverse-mode AD.Clad has extensive coverage of
+modern C++ features and a robust fallback and recovery system in place.
diff --git a/math/clad/pkg-plist b/math/clad/pkg-plist
new file mode 100644
index 000000000000..1363f7b4609a
--- /dev/null
+++ b/math/clad/pkg-plist
@@ -0,0 +1,37 @@
+include/clad/Differentiator/Array.h
+include/clad/Differentiator/ArrayRef.h
+include/clad/Differentiator/BaseForwardModeVisitor.h
+include/clad/Differentiator/BuiltinDerivatives.h
+include/clad/Differentiator/CladConfig.h
+include/clad/Differentiator/CladUtils.h
+include/clad/Differentiator/Compatibility.h
+include/clad/Differentiator/DerivativeBuilder.h
+include/clad/Differentiator/DiffMode.h
+include/clad/Differentiator/DiffPlanner.h
+include/clad/Differentiator/Differentiator.h
+include/clad/Differentiator/ErrorEstimator.h
+include/clad/Differentiator/EstimationModel.h
+include/clad/Differentiator/ExternalRMVSource.h
+include/clad/Differentiator/ForwardModeVisitor.h
+include/clad/Differentiator/FunctionTraits.h
+include/clad/Differentiator/HessianModeVisitor.h
+include/clad/Differentiator/JacobianModeVisitor.h
+include/clad/Differentiator/MultiplexExternalRMVSource.h
+include/clad/Differentiator/NumericalDiff.h
+include/clad/Differentiator/ParseDiffArgsTypes.h
+include/clad/Differentiator/ReverseModeVisitor.h
+include/clad/Differentiator/ReverseModeVisitorDirectionKinds.h
+include/clad/Differentiator/STLBuiltins.h
+include/clad/Differentiator/StmtClone.h
+include/clad/Differentiator/Tape.h
+include/clad/Differentiator/VectorForwardModeVisitor.h
+include/clad/Differentiator/Version.h
+include/clad/Differentiator/VisitorBase.h
+include/clad/tools/ClangBackendPlugin.h
+include/clad/tools/ClangPlugin.h
+include/clad/tools/DerivedFnInfo.h
+lib/clad.so
+lib/libcladDifferentiator.so
+lib/libcladDifferentiator.so.15
+lib/libcladPlugin.so
+lib/libcladPlugin.so.15