git: 0bc200372fd1 - main - math/pffft: New port: Pretty Fast FFT (PFFFT) library

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sun, 30 Jan 2022 18:40:00 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0bc200372fd1449cb6ca3a24c1582f128b394f67

commit 0bc200372fd1449cb6ca3a24c1582f128b394f67
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-01-30 17:41:29 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-01-30 18:39:57 +0000

    math/pffft: New port: Pretty Fast FFT (PFFFT) library
---
 math/Makefile                          |  1 +
 math/pffft/Makefile                    | 25 +++++++++++++++
 math/pffft/distinfo                    |  3 ++
 math/pffft/files/patch-CMakeLists.txt  | 57 ++++++++++++++++++++++++++++++++++
 math/pffft/files/patch-pffft__double.c | 11 +++++++
 math/pffft/pkg-descr                   | 14 +++++++++
 math/pffft/pkg-plist                   | 10 ++++++
 7 files changed, 121 insertions(+)

diff --git a/math/Makefile b/math/Makefile
index 709a1d7da548..522c63fbf140 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -762,6 +762,7 @@
     SUBDIR += permlib
     SUBDIR += petanque
     SUBDIR += petiga
+    SUBDIR += pffft
     SUBDIR += php74-bcmath
     SUBDIR += php74-gmp
     SUBDIR += php80-bcmath
diff --git a/math/pffft/Makefile b/math/pffft/Makefile
new file mode 100644
index 000000000000..1ed5f334b7d8
--- /dev/null
+++ b/math/pffft/Makefile
@@ -0,0 +1,25 @@
+PORTNAME=	pffft
+PORTVERSION=	g20210806
+CATEGORIES=	math
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Pretty Fast FFT (PFFFT) library
+
+LICENSE=	BSD3CLAUSE
+LICENSE_FILE=	${WRKSRC}/LICENSE.txt
+
+USES=		cmake
+USE_LDCONFIG=	yes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	marton78
+GH_TAGNAME=	9603871
+
+CMAKE_ON=	BUILD_SHARED_LIBS INSTALL_PFDSP INSTALL_PFFASTCONV
+
+post-install: # move headers into a dedicated directory
+	cd ${STAGEDIR}${PREFIX} && \
+		${MKDIR} include/${PORTNAME} && \
+		${MV} include/*.h include/*.hpp include/${PORTNAME}
+
+.include <bsd.port.mk>
diff --git a/math/pffft/distinfo b/math/pffft/distinfo
new file mode 100644
index 000000000000..534c8297e382
--- /dev/null
+++ b/math/pffft/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1643563740
+SHA256 (marton78-pffft-g20210806-9603871_GH0.tar.gz) = 474d929600969d2a55e0f599459e4c2a5e004f059ad2a5a001dd481285257e14
+SIZE (marton78-pffft-g20210806-9603871_GH0.tar.gz) = 143602
diff --git a/math/pffft/files/patch-CMakeLists.txt b/math/pffft/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..5a3a9f50d8ad
--- /dev/null
+++ b/math/pffft/files/patch-CMakeLists.txt
@@ -0,0 +1,57 @@
+--- CMakeLists.txt.orig	2021-08-06 18:28:48 UTC
++++ CMakeLists.txt
+@@ -144,7 +144,7 @@ endif()
+ 
+ ######################################################
+ 
+-add_library(PFFFT STATIC ${FLOAT_SOURCES} ${DOUBLE_SOURCES} pffft_common.c pffft_priv_impl.h pffft.hpp )
++add_library(PFFFT ${FLOAT_SOURCES} ${DOUBLE_SOURCES} pffft_common.c pffft_priv_impl.h pffft.hpp )
+ set_target_properties(PFFFT PROPERTIES OUTPUT_NAME "pffft")
+ target_compile_definitions(PFFFT PRIVATE _USE_MATH_DEFINES)
+ if (USE_SCALAR_VECT)
+@@ -193,7 +193,7 @@ endif()
+ 
+ if (USE_TYPE_FLOAT)
+ 
+-  add_library(PFDSP STATIC pf_mixer.cpp pf_mixer.h pf_carrier.cpp pf_carrier.h pf_cic.cpp pf_cic.h fmv.h )
++  add_library(PFDSP pf_mixer.cpp pf_mixer.h pf_carrier.cpp pf_carrier.h pf_cic.cpp pf_cic.h fmv.h )
+   set_target_properties(PFDSP PROPERTIES OUTPUT_NAME "pfdsp")
+   target_compile_definitions(PFDSP PRIVATE _USE_MATH_DEFINES)
+   if (USE_DEBUG_ASAN)
+@@ -218,7 +218,7 @@ endif()
+ if (USE_FFTPACK)
+ 
+   # float / single precision
+-  add_library(FFTPACK_FLOAT STATIC fftpack.c fftpack.h)
++  add_library(FFTPACK_FLOAT fftpack.c fftpack.h)
+   target_compile_definitions(FFTPACK_FLOAT PRIVATE _USE_MATH_DEFINES)
+   target_compile_options(FFTPACK_FLOAT PRIVATE $<$<C_COMPILER_ID:GNU>:-Wall -Wextra -pedantic>)
+   target_link_libraries( FFTPACK_FLOAT ${MATHLIB} )
+@@ -227,7 +227,7 @@ if (USE_FFTPACK)
+   )
+ 
+   # double precision
+-  add_library(FFTPACK_DOUBLE STATIC fftpack.c fftpack.h)
++  add_library(FFTPACK_DOUBLE fftpack.c fftpack.h)
+   target_compile_definitions(FFTPACK_DOUBLE PRIVATE _USE_MATH_DEFINES)
+   target_compile_definitions(FFTPACK_DOUBLE PUBLIC FFTPACK_DOUBLE_PRECISION)
+   target_compile_options(FFTPACK_DOUBLE PRIVATE $<$<C_COMPILER_ID:GNU>:-Wall -Wextra -pedantic>)
+@@ -251,7 +251,7 @@ endif()
+ 
+ if (USE_TYPE_FLOAT)
+   # only 'float' supported in PFFASTCONV
+-  add_library(PFFASTCONV STATIC pffastconv.c pffastconv.h pffft.h )
++  add_library(PFFASTCONV pffastconv.c pffastconv.h pffft.h )
+   set_target_properties(PFFASTCONV PROPERTIES OUTPUT_NAME "pffastconv")
+   target_compile_definitions(PFFASTCONV PRIVATE _USE_MATH_DEFINES)
+   if (USE_DEBUG_ASAN)
+@@ -447,7 +447,9 @@ endif()
+ 
+ ######################################################
+ 
++if (FREEBSD_BUILD_EXAMPLES)
+ add_subdirectory(examples)
++endif()
+ 
+ ######################################################
+ 
diff --git a/math/pffft/files/patch-pffft__double.c b/math/pffft/files/patch-pffft__double.c
new file mode 100644
index 000000000000..275598b10e69
--- /dev/null
+++ b/math/pffft/files/patch-pffft__double.c
@@ -0,0 +1,11 @@
+--- pffft_double.c.orig	2022-01-30 17:29:25 UTC
++++ pffft_double.c
+@@ -75,6 +75,8 @@
+ #  include <malloc.h>
+ #elif defined(__MINGW32__) || defined(__MINGW64__)
+ #  include <malloc.h>
++#elif defined(__FreeBSD__)
++#  include <stdlib.h>
+ #else
+ #  include <alloca.h>
+ #endif
diff --git a/math/pffft/pkg-descr b/math/pffft/pkg-descr
new file mode 100644
index 000000000000..6cd7c62a8f57
--- /dev/null
+++ b/math/pffft/pkg-descr
@@ -0,0 +1,14 @@
+PFFFT does 1D Fast Fourier Transforms, of single precision real and
+complex vectors. It tries do it fast, it tries to be correct, and it
+tries to be small. Computations do take advantage of SSE1 instructions
+on x86 cpus, Altivec on powerpc cpus, and NEON on ARM cpus.
+
+PFFFT is a fork of Julien Pommier's library on bitbucket with some
+changes and additions.
+
+PFFASTCONV does fast convolution (FIR filtering), of single precision
+real vectors, utilizing the PFFFT library.
+
+PFDSP contains a few other signal processing functions.
+
+WWW: https://github.com/marton78/pffft
diff --git a/math/pffft/pkg-plist b/math/pffft/pkg-plist
new file mode 100644
index 000000000000..e0515d72a96e
--- /dev/null
+++ b/math/pffft/pkg-plist
@@ -0,0 +1,10 @@
+include/pffft/pf_carrier.h
+include/pffft/pf_cic.h
+include/pffft/pf_mixer.h
+include/pffft/pffastconv.h
+include/pffft/pffft.h
+include/pffft/pffft.hpp
+include/pffft/pffft_double.h
+lib/libpfdsp.so
+lib/libpffastconv.so
+lib/libpffft.so