git: 3002262c9396 - main - net-mgmt/fastnetmon: Unreak build on 12.x

From: Babak Farrokhi <farrokhi_at_FreeBSD.org>
Date: Fri, 24 Mar 2023 14:57:41 UTC
The branch main has been updated by farrokhi:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3002262c9396ba38da42839a1a8c48ef444f80f0

commit 3002262c9396ba38da42839a1a8c48ef444f80f0
Author:     Babak Farrokhi <farrokhi@FreeBSD.org>
AuthorDate: 2023-03-24 14:56:36 +0000
Commit:     Babak Farrokhi <farrokhi@FreeBSD.org>
CommitDate: 2023-03-24 14:56:36 +0000

    net-mgmt/fastnetmon: Unreak build on 12.x
    
    - Unbreak build on 12.x
    - Enable netmap support
    - Cleanup unused options
    - Fix startup script
    
    PR: 270126
---
 net-mgmt/fastnetmon/Makefile                                | 13 ++++++-------
 net-mgmt/fastnetmon/files/fastnetmon.in                     |  6 +++---
 .../files/patch-src_netmap__plugin_netmap__collector.cpp    | 10 ++++++++++
 net-mgmt/fastnetmon/pkg-plist                               |  2 +-
 4 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/net-mgmt/fastnetmon/Makefile b/net-mgmt/fastnetmon/Makefile
index f1269937c2ad..128d059d46ec 100644
--- a/net-mgmt/fastnetmon/Makefile
+++ b/net-mgmt/fastnetmon/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	fastnetmon
 PORTVERSION=	1.2.4
 DISTVERSIONPREFIX=	v
+PORTREVISION=	1
 CATEGORIES=	net-mgmt security
 
 MAINTAINER=	farrokhi@FreeBSD.org
@@ -34,17 +35,15 @@ GROUPS=	${PORTNAME}
 
 USE_RC_SUBR=	${PORTNAME}
 
-OPTIONS_DEFINE=	DOCS REDIS
-
-REDIS_LIB_DEPENDS=	libhiredis.so:databases/hiredis
+OPTIONS_DEFINE=	DOCS
 
 PORTDOCS=	*
 
-CXXFLAGS += -DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
+CXXFLAGS += -DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED \
+	    -D_GNU_SOURCE
 CFLAGS_i386=	-march=i586
 CMAKE_SOURCE_PATH=	${WRKSRC}/src
-CMAKE_ARGS+=	-DDISABLE_PF_RING_SUPPORT=ON \
-		-DENABLE_NETMAP_SUPPORT=OFF \
+CMAKE_ARGS+=	-DENABLE_NETMAP_SUPPORT=ON \
 		-DLINK_WITH_ABSL=ON \
 		-DSET_ABSOLUTE_INSTALL_PATH=OFF \
 		-DCMAKE_INSTALL_MANDIR=${PREFIX}/man
@@ -64,7 +63,7 @@ post-patch:
 post-install:
 	${MV} ${STAGEDIR}${PREFIX}/etc/${PORTNAME}.conf \
 		${STAGEDIR}${PREFIX}/etc/${PORTNAME}.conf.sample
-	${MKDIR} ${STAGEDIR}/var/run/fastnetmon ${STAGEDIR}/var/log/fastnetmon
+	${MKDIR} ${STAGEDIR}/var/run/fastnetmon ${STAGEDIR}/var/log/fastnetmon_attacks
 	${INSTALL_SCRIPT} ${WRKSRC}/src/notify_about_attack.sh ${STAGEDIR}${PREFIX}/bin
 
 post-install-DOCS-on:
diff --git a/net-mgmt/fastnetmon/files/fastnetmon.in b/net-mgmt/fastnetmon/files/fastnetmon.in
index 431a34793412..c6ee5b2aa52e 100644
--- a/net-mgmt/fastnetmon/files/fastnetmon.in
+++ b/net-mgmt/fastnetmon/files/fastnetmon.in
@@ -19,12 +19,12 @@ rcvar=fastnetmon_enable
 load_rc_config "$name"
 
 : ${fastnetmon_enable:=NO}
-: ${fastnetmon_conf:=%%ETCDIR%%/$name.conf}
-: ${fastnetmon_flags:=--daemonize}
+: ${fastnetmon_conf:=%%PREFIX%%/etc/$name.conf}
+: ${fastnetmon_flags:=}
 : ${fastnetmon_user:=fastnetmon}
 
 command=%%PREFIX%%/bin/fastnetmon
-command_args="--configuration_file ${fastnetmon_conf} ${fastnetmon_flags}"
+command_args="--daemonize --configuration_file ${fastnetmon_conf} ${fastnetmon_flags}"
 pidfile=/var/run/fastnetmon/$name.pid
 
 run_rc_command "$1"
diff --git a/net-mgmt/fastnetmon/files/patch-src_netmap__plugin_netmap__collector.cpp b/net-mgmt/fastnetmon/files/patch-src_netmap__plugin_netmap__collector.cpp
new file mode 100644
index 000000000000..19a3f3d8b17d
--- /dev/null
+++ b/net-mgmt/fastnetmon/files/patch-src_netmap__plugin_netmap__collector.cpp
@@ -0,0 +1,10 @@
+--- src/netmap_plugin/netmap_collector.cpp.orig	2023-03-01 14:23:34 UTC
++++ src/netmap_plugin/netmap_collector.cpp
+@@ -19,6 +19,7 @@
+ 
+ // Disable debug messages from Netmap
+ #define NETMAP_NO_DEBUG
++typedef bool _Bool;
+ #include <boost/thread.hpp>
+ #include <net/netmap_user.h>
+ 
diff --git a/net-mgmt/fastnetmon/pkg-plist b/net-mgmt/fastnetmon/pkg-plist
index 01e28de42b0d..6c244f25be27 100644
--- a/net-mgmt/fastnetmon/pkg-plist
+++ b/net-mgmt/fastnetmon/pkg-plist
@@ -8,4 +8,4 @@ man/man8/fastnetmon.8.gz
 man/man1/fastnetmon_client.1.gz
 @sample etc/fastnetmon.conf.sample
 @dir(fastnetmon,fastnetmon) /var/run/fastnetmon
-@dir(fastnetmon,fastnetmon) /var/log/fastnetmon
+@dir(fastnetmon,fastnetmon) /var/log/fastnetmon_attacks