git: 683f6ce2cb85 - main - math/libfixmath: New port: Cross-platform fixed point math library

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Mon, 07 Nov 2022 08:04:32 UTC
The branch main has been updated by yuri:

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

commit 683f6ce2cb85fd474aa55a04f6f2188bc76a0c41
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-11-07 07:05:49 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-11-07 08:04:27 +0000

    math/libfixmath: New port: Cross-platform fixed point math library
---
 math/Makefile                                      |  1 +
 math/libfixmath/Makefile                           | 27 +++++++++++++++++++++
 math/libfixmath/distinfo                           |  3 +++
 math/libfixmath/files/patch-CMakeLists.txt         | 28 ++++++++++++++++++++++
 .../files/patch-libfixmath_libfixmath.cmake        | 13 ++++++++++
 math/libfixmath/pkg-descr                          |  1 +
 math/libfixmath/pkg-plist                          |  8 +++++++
 7 files changed, 81 insertions(+)

diff --git a/math/Makefile b/math/Makefile
index 6aa7f98e331d..e3dd42b1f730 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -433,6 +433,7 @@
     SUBDIR += libbraiding
     SUBDIR += libccd
     SUBDIR += libdivide
+    SUBDIR += libfixmath
     SUBDIR += libflame
     SUBDIR += libhomfly
     SUBDIR += libmesh
diff --git a/math/libfixmath/Makefile b/math/libfixmath/Makefile
new file mode 100644
index 000000000000..70419da7eb79
--- /dev/null
+++ b/math/libfixmath/Makefile
@@ -0,0 +1,27 @@
+PORTNAME=	libfixmath
+PORTVERSION=	g20220915
+CATEGORIES=	math
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Cross-platform fixed point math library
+WWW=		https://github.com/PetteriAimonen/libfixmath
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		cmake:testing compiler:c++11-lang
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	PetteriAimonen
+GH_TAGNAME=	1416c99
+
+CMAKE_ON=	BUILD_SHARED_LIBS
+
+do-install:
+	# headers
+	${MKDIR} ${STAGEDIR}${PREFIX}/include/${PORTNAME}
+	${INSTALL_DATA} ${WRKSRC}/libfixmath/*.h* ${STAGEDIR}${PREFIX}/include/${PORTNAME}
+	# library
+	${INSTALL_LIB} ${BUILD_WRKSRC}/libfixmath.so ${STAGEDIR}${PREFIX}/lib
+
+.include <bsd.port.mk>
diff --git a/math/libfixmath/distinfo b/math/libfixmath/distinfo
new file mode 100644
index 000000000000..22ce4ad2a711
--- /dev/null
+++ b/math/libfixmath/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1667802450
+SHA256 (PetteriAimonen-libfixmath-g20220915-1416c99_GH0.tar.gz) = 3e9ee9cb4c6aa06763c5be01ae24486ebc888fd51f8412f33424154e78c6eca3
+SIZE (PetteriAimonen-libfixmath-g20220915-1416c99_GH0.tar.gz) = 267430
diff --git a/math/libfixmath/files/patch-CMakeLists.txt b/math/libfixmath/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..0647c6b3251c
--- /dev/null
+++ b/math/libfixmath/files/patch-CMakeLists.txt
@@ -0,0 +1,28 @@
+--- CMakeLists.txt.orig	2022-09-15 10:24:31 UTC
++++ CMakeLists.txt
+@@ -11,17 +11,23 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra -Werror=return-type")
+ 
+ include(libfixmath/libfixmath.cmake)
++if (BUILD_TESTING)
+ include(tests/tests.cmake)
++endif()
+ 
+ file(GLOB fixsingen-srcs fixsingen/*.c)
++if (BUILD_TESTING)
+ file(GLOB fixtest-srcs fixtest/*.c fixtest/*.h)
++endif()
+ 
++if (BUILD_TESTING)
+ add_executable(fixtest ${fixtest-srcs})
+-target_link_libraries(fixtest PRIVATE libfixmath m)
++target_link_libraries(fixtest PRIVATE fixmath m)
+ target_include_directories(fixtest PRIVATE ${CMAKE_SOURCE_DIR})
++endif()
+ 
+ add_executable(fixsingen ${fixsingen-srcs})
+-target_link_libraries(fixsingen PRIVATE libfixmath m)
++target_link_libraries(fixsingen PRIVATE fixmath m)
+ target_include_directories(fixsingen PRIVATE ${CMAKE_SOURCE_DIR})
+ 
+ 
diff --git a/math/libfixmath/files/patch-libfixmath_libfixmath.cmake b/math/libfixmath/files/patch-libfixmath_libfixmath.cmake
new file mode 100644
index 000000000000..2a95d084d169
--- /dev/null
+++ b/math/libfixmath/files/patch-libfixmath_libfixmath.cmake
@@ -0,0 +1,13 @@
+--- libfixmath/libfixmath.cmake.orig	2022-09-15 10:24:31 UTC
++++ libfixmath/libfixmath.cmake
+@@ -1,6 +1,6 @@
+ file(GLOB libfixmath-srcs libfixmath/*.c)
+ 
+-add_library(libfixmath STATIC ${libfixmath-srcs})
++add_library(fixmath ${libfixmath-srcs})
+ 
+-target_include_directories(libfixmath INTERFACE
+-  ${CMAKE_CURRENT_SOURCE_DIR})
+\ No newline at end of file
++target_include_directories(fixmath INTERFACE
++  ${CMAKE_CURRENT_SOURCE_DIR})
diff --git a/math/libfixmath/pkg-descr b/math/libfixmath/pkg-descr
new file mode 100644
index 000000000000..9e67c9f90bba
--- /dev/null
+++ b/math/libfixmath/pkg-descr
@@ -0,0 +1 @@
+Libfixmath implements Q16.16 format fixed point operations in C.
diff --git a/math/libfixmath/pkg-plist b/math/libfixmath/pkg-plist
new file mode 100644
index 000000000000..bf98271e96eb
--- /dev/null
+++ b/math/libfixmath/pkg-plist
@@ -0,0 +1,8 @@
+include/libfixmath/fix16.h
+include/libfixmath/fix16.hpp
+include/libfixmath/fix16_trig_sin_lut.h
+include/libfixmath/fixmath.h
+include/libfixmath/fract32.h
+include/libfixmath/int64.h
+include/libfixmath/uint32.h
+lib/libfixmath.so