git: 30fd631ce5ca - main - math/trlib: New port: Trust Region Subproblem Solver Library

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 18 Jan 2022 08:31:45 UTC
The branch main has been updated by yuri:

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

commit 30fd631ce5ca62b4f63452571c4767f8c9ca607e
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-01-18 08:31:09 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-01-18 08:31:43 +0000

    math/trlib: New port: Trust Region Subproblem Solver Library
---
 math/Makefile                               |  1 +
 math/trlib/Makefile                         | 25 +++++++++++++++++++++++++
 math/trlib/distinfo                         |  3 +++
 math/trlib/files/patch-CMakeLists.txt       | 10 ++++++++++
 math/trlib/files/patch-tests_CMakeLists.txt | 11 +++++++++++
 math/trlib/pkg-descr                        |  3 +++
 math/trlib/pkg-plist                        | 19 +++++++++++++++++++
 7 files changed, 72 insertions(+)

diff --git a/math/Makefile b/math/Makefile
index d41bbff7eb2f..e101c8a2cc18 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -1059,6 +1059,7 @@
     SUBDIR += topcom
     SUBDIR += triangle
     SUBDIR += trlan
+    SUBDIR += trlib
     SUBDIR += tvmet
     SUBDIR += ump
     SUBDIR += units
diff --git a/math/trlib/Makefile b/math/trlib/Makefile
new file mode 100644
index 000000000000..ab75d4fabe2f
--- /dev/null
+++ b/math/trlib/Makefile
@@ -0,0 +1,25 @@
+PORTNAME=	trlib
+DISTVERSION=	g20211004
+CATEGORIES=	math
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Trust Region Subproblem Solver Library
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+LIB_DEPENDS=	libopenblas.so:math/openblas
+TEST_DEPENDS=	check>0:devel/check \
+		gsed:textproc/gsed \
+		valgrind:devel/valgrind
+
+USES=		cmake:testing pkgconfig localbase:ldflags
+USE_LDCONFIG=	yes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	felixlen
+GH_TAGNAME=	f168b59
+
+# some tests fail, see https://github.com/felixlen/trlib/issues/16
+
+.include <bsd.port.mk>
diff --git a/math/trlib/distinfo b/math/trlib/distinfo
new file mode 100644
index 000000000000..8f65eb8066d3
--- /dev/null
+++ b/math/trlib/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1642493541
+SHA256 (felixlen-trlib-g20211004-f168b59_GH0.tar.gz) = 98b2fc702d08e32488ff7662133aef19b5aaad97f082a28062a77c36dbd7e72e
+SIZE (felixlen-trlib-g20211004-f168b59_GH0.tar.gz) = 91695
diff --git a/math/trlib/files/patch-CMakeLists.txt b/math/trlib/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..26bb41db4f11
--- /dev/null
+++ b/math/trlib/files/patch-CMakeLists.txt
@@ -0,0 +1,10 @@
+--- CMakeLists.txt.orig	2022-01-18 08:15:22 UTC
++++ CMakeLists.txt
+@@ -17,5 +17,7 @@ add_subdirectory(src)
+ add_subdirectory(bindings)
+ add_subdirectory(examples)
+ enable_testing()
++if (BUILD_TESTING)
+ add_subdirectory(tests)
++endif()
+ add_subdirectory(doc)
diff --git a/math/trlib/files/patch-tests_CMakeLists.txt b/math/trlib/files/patch-tests_CMakeLists.txt
new file mode 100644
index 000000000000..df5c9803c7be
--- /dev/null
+++ b/math/trlib/files/patch-tests_CMakeLists.txt
@@ -0,0 +1,11 @@
+--- tests/CMakeLists.txt.orig	2022-01-18 08:26:36 UTC
++++ tests/CMakeLists.txt
+@@ -47,7 +47,7 @@ if(CHECK_FOUND)
+ 
+         if(APPLE)
+         else()
+-            add_custom_command(OUTPUT "test_${t}_valgrind.c" COMMAND sed "'/sr = srunner_create(s);/a    srunner_set_fork_status(sr, CK_NOFORK);'" "${CMAKE_CURRENT_SOURCE_DIR}/test_${t}.c" > "test_${t}_valgrind.c" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/test_${t}.c")
++            add_custom_command(OUTPUT "test_${t}_valgrind.c" COMMAND gsed "'/sr = srunner_create(s);/a    srunner_set_fork_status(sr, CK_NOFORK);'" "${CMAKE_CURRENT_SOURCE_DIR}/test_${t}.c" > "test_${t}_valgrind.c" DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/test_${t}.c")
+             add_executable("test_${t}_valgrind" "test_${t}_valgrind.c" "${CMAKE_CURRENT_SOURCE_DIR}/trlib_test.c" ${MESSAGEFILES})
+             set_property(TARGET "test_${t}_valgrind" PROPERTY C_STANDARD 11)
+             target_link_libraries("test_${t}_valgrind" trlib ${LIBS})
diff --git a/math/trlib/pkg-descr b/math/trlib/pkg-descr
new file mode 100644
index 000000000000..95770b665e40
--- /dev/null
+++ b/math/trlib/pkg-descr
@@ -0,0 +1,3 @@
+trlib provides various methods related to the trust region subproblem.
+
+WWW: https://github.com/felixlen/trlib
diff --git a/math/trlib/pkg-plist b/math/trlib/pkg-plist
new file mode 100644
index 000000000000..03beb958814c
--- /dev/null
+++ b/math/trlib/pkg-plist
@@ -0,0 +1,19 @@
+include/trlib.h
+include/trlib/trlib_eigen_inverse.h
+include/trlib/trlib_krylov.h
+include/trlib/trlib_leftmost.h
+include/trlib/trlib_private.h
+include/trlib/trlib_quadratic_zero.h
+include/trlib/trlib_tri_factor.h
+include/trlib/trlib_types.h
+lib/cmake/trlib/trlib-config-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/trlib/trlib-config-version.cmake
+lib/cmake/trlib/trlib-config.cmake
+lib/libtrlib.so
+share/pkgconfig/trlib.pc
+%%DATADIR%%/src/trlib_eigen_inverse.c
+%%DATADIR%%/src/trlib_krylov.c
+%%DATADIR%%/src/trlib_leftmost.c
+%%DATADIR%%/src/trlib_private.h
+%%DATADIR%%/src/trlib_quadratic_zero.c
+%%DATADIR%%/src/trlib_tri_factor.c