git: 77c0579bf660 - main - net-mgmt/fastnetmon: Update to 1.2.6

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Sun, 18 Feb 2024 16:22:37 UTC
The branch main has been updated by diizzy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=77c0579bf6608c0691170fcf1e86e620b38a150f

commit 77c0579bf6608c0691170fcf1e86e620b38a150f
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2024-02-18 09:22:53 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2024-02-18 16:16:12 +0000

    net-mgmt/fastnetmon: Update to 1.2.6
    
    * Switch from PORTVERSION to DISTVERSION
    * Remove USE_CXXSTD (no longer needed)
    * Drop devel/json-c in LIB_DEPENDS (not used)
    * Use WRKSRC_SUBDIR
    * Drop -DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED switch
    * Remove LLVM version requirements (no longer needed)
    * Use CMAKE helpers
    * Rearrange Makefile for better readability
    * Disable unsupported -W switches making the build a lot less noisy
    * Remove bogus include paths
    
    Based on patch submitted by Marek Zarychta
    
    Changelog:
    https://github.com/pavel-odintsov/fastnetmon/releases/tag/v1.2.6
    
    PR:             276516
    Reported by:    Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
    Reviewed by:    farrokhi (maintainer, previous version)
    Tested by:      Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
    Approved by:    portmgr (maintainer timeout, 2+ weeks)
---
 net-mgmt/fastnetmon/Makefile                       | 66 +++++++++-------------
 net-mgmt/fastnetmon/distinfo                       |  8 ++-
 net-mgmt/fastnetmon/files/fastnetmon.in            |  2 +-
 net-mgmt/fastnetmon/files/patch-CMakeLists.txt     | 30 ++++++++++
 net-mgmt/fastnetmon/files/patch-src_fastnetmon.cpp |  4 +-
 .../fastnetmon/files/patch-src_man_fastnetmon.8    |  4 +-
 .../patch-src_netmap__plugin_netmap__collector.cpp |  4 +-
 net-mgmt/fastnetmon/pkg-plist                      | 10 ++--
 8 files changed, 75 insertions(+), 53 deletions(-)

diff --git a/net-mgmt/fastnetmon/Makefile b/net-mgmt/fastnetmon/Makefile
index fdd483db3138..25b0aaf72038 100644
--- a/net-mgmt/fastnetmon/Makefile
+++ b/net-mgmt/fastnetmon/Makefile
@@ -1,78 +1,68 @@
 PORTNAME=	fastnetmon
-PORTVERSION=	1.2.5
 DISTVERSIONPREFIX=	v
-PORTREVISION=	4
+DISTVERSION=	1.2.6
 CATEGORIES=	net-mgmt security
 
+PATCH_SITES=	https://github.com/pavel-odintsov/${PORTNAME}/commit/
+PATCHFILES=	fad8757b8986226024d549a6dfb40abbab01643e.patch:-p2
+
 MAINTAINER=	farrokhi@FreeBSD.org
 COMMENT=	Very fast DDoS analyzer with sflow/netflow/mirror support
 WWW=		https://fastnetmon.com
 
 LICENSE=	GPLv2
-LICENSE_FILE=	${WRKSRC}/LICENSE
+LICENSE_FILE=	${WRKSRC}/../LICENSE
 
-BROKEN_armv6=		does not build: invokes x86 assembler
-BROKEN_armv7=		does not build: invokes x86 assembler
+BROKEN_armv6=	does not build: invokes x86 assembler
+BROKEN_armv7=	does not build: invokes x86 assembler
 
 LIB_DEPENDS=	libboost_regex.so:devel/boost-libs \
 		liblog4cpp.so:devel/log4cpp \
 		libmongoc-1.0.so:devel/mongo-c-driver \
-		libjson-c.so:devel/json-c \
 		libbson-1.0.so:devel/libbson \
 		libcapnp.so:devel/capnproto \
-		libgrpc.so:devel/grpc142 \
+		libgrpc.so:devel/grpc \
 		libprotobuf.so:devel/protobuf \
 		libabsl_base.so:devel/abseil \
 		libhiredis.so:databases/hiredis
 
-USES=	cmake compiler:c++17-lang pkgconfig localbase:ldflags ssl
-USE_CXXSTD=	c++17
+USES=		cmake compiler:c++20-lang localbase:ldflags pkgconfig ssl
+
 USE_GITHUB=	yes
 GH_ACCOUNT=	pavel-odintsov
-USE_RC_SUBR=	${PORTNAME}
-
-CMAKE_ARGS+=	-DENABLE_NETMAP_SUPPORT=ON \
-		-DLINK_WITH_ABSL=ON \
-		-DSET_ABSOLUTE_INSTALL_PATH=OFF \
-		-DCMAKE_INSTALL_MANDIR=${PREFIX}/man
-CMAKE_INSTALL_PREFIX=	${PREFIX}
-CMAKE_SOURCE_PATH=	${WRKSRC}/src
-
-CFLAGS_i386=	-march=i586
-CXXFLAGS+=	-DBOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED \
-		-D_GNU_SOURCE
-LDFLAGS+=	-labsl_log_internal_message -labsl_log_internal_nullguard
 
-USERS=	${PORTNAME}
-GROUPS=	${PORTNAME}
+WRKSRC_SUBDIR=	src
 
+USE_RC_SUBR=	${PORTNAME}
+USERS=		${PORTNAME}
+GROUPS=		${PORTNAME}
 PORTDOCS=	*
 
-OPTIONS_DEFINE=	DOCS
-
-.include <bsd.port.options.mk>
+CFLAGS_i386=	-march=i586
+CXXFLAGS+=	-D_GNU_SOURCE
 
-.if ${OPSYS} == FreeBSD && ( ${OSVERSION} >= 1400091 || ( ${OSVERSION} >= 1302505 && ${OSVERSION} < 1400000 ))
-USES+=	llvm:max=15
-.endif
+CMAKE_OFF=	SET_ABSOLUTE_INSTALL_PATH
+CMAKE_ON=	ENABLE_NETMAP_SUPPORT \
+		LINK_WITH_ABSL
 
-.include <bsd.port.pre.mk>
+OPTIONS_DEFINE=	DOCS
 
 post-patch:
 	@${REINPLACE_CMD} -e 's|/usr/local|${PREFIX}|; \
 		s|/var/run|&/fastnetmon|g; s|/var/log|&/fastnetmon|g; \
 		s|"/etc/|"${PREFIX}/etc/|g; s|/root/fastnetmon|${DATADIR}|g' \
-		${WRKSRC}/src/fastnetmon.conf ${WRKSRC}/src/fastnetmon.cpp
+		${WRKSRC}/fastnetmon.conf ${WRKSRC}/fastnetmon.cpp
 	@${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \
-		${WRKSRC}/src/man/fastnetmon.8
+		${WRKSRC}/man/fastnetmon.8
 
 post-install:
-	${MV} ${STAGEDIR}${PREFIX}/etc/${PORTNAME}.conf \
-		${STAGEDIR}${PREFIX}/etc/${PORTNAME}.conf.sample
+	${INSTALL_DATA} ${WRKSRC}/fastnetmon.conf ${STAGEDIR}${PREFIX}/etc/fastnetmon.conf.sample
+	${INSTALL_DATA} ${WRKSRC}/networks_list ${STAGEDIR}${PREFIX}/etc/networks_list.sample
+	${INSTALL_DATA} ${WRKSRC}/networks_whitelist ${STAGEDIR}${PREFIX}/etc/networks_whitelist.sample
 	${MKDIR} ${STAGEDIR}/var/run/fastnetmon ${STAGEDIR}/var/log/fastnetmon_attacks
-	${INSTALL_SCRIPT} ${WRKSRC}/src/notify_about_attack.sh ${STAGEDIR}${PREFIX}/bin
+	${INSTALL_SCRIPT} ${WRKSRC}/notify_about_attack.sh ${STAGEDIR}${PREFIX}/bin/notify_about_attack.sh.sample
 
 post-install-DOCS-on:
-	cd ${WRKSRC} && ${COPYTREE_SHARE} "README.md docs" ${STAGEDIR}${DOCSDIR}
+	cd ${WRKSRC}/../ && ${COPYTREE_SHARE} "README.md docs" ${STAGEDIR}${DOCSDIR}
 
-.include <bsd.port.post.mk>
+.include <bsd.port.mk>
diff --git a/net-mgmt/fastnetmon/distinfo b/net-mgmt/fastnetmon/distinfo
index ef5b9939a04a..f8d70d4ffad9 100644
--- a/net-mgmt/fastnetmon/distinfo
+++ b/net-mgmt/fastnetmon/distinfo
@@ -1,3 +1,5 @@
-TIMESTAMP = 1686746794
-SHA256 (pavel-odintsov-fastnetmon-v1.2.5_GH0.tar.gz) = d92a1f16e60b6ab6f5c5e023a215570e9352ce9d0c9a9d7209416f8cd0227ae6
-SIZE (pavel-odintsov-fastnetmon-v1.2.5_GH0.tar.gz) = 1383370
+TIMESTAMP = 1706176431
+SHA256 (pavel-odintsov-fastnetmon-v1.2.6_GH0.tar.gz) = b6a7d1e9ba98c1c042d774bff82ea3e8bbf03085e0be43a2676e41d590f668cf
+SIZE (pavel-odintsov-fastnetmon-v1.2.6_GH0.tar.gz) = 1421719
+SHA256 (fad8757b8986226024d549a6dfb40abbab01643e.patch) = 22e739071959c4e2b88cca4ad8278c07be998505c152952d6f18b69227cc8844
+SIZE (fad8757b8986226024d549a6dfb40abbab01643e.patch) = 2694
diff --git a/net-mgmt/fastnetmon/files/fastnetmon.in b/net-mgmt/fastnetmon/files/fastnetmon.in
index c6ee5b2aa52e..598dbc0382d8 100644
--- a/net-mgmt/fastnetmon/files/fastnetmon.in
+++ b/net-mgmt/fastnetmon/files/fastnetmon.in
@@ -24,7 +24,7 @@ load_rc_config "$name"
 : ${fastnetmon_user:=fastnetmon}
 
 command=%%PREFIX%%/bin/fastnetmon
-command_args="--daemonize --configuration_file ${fastnetmon_conf} ${fastnetmon_flags}"
+command_args="--daemonize --configuration_file ${fastnetmon_conf} --pid_logic ${fastnetmon_flags}"
 pidfile=/var/run/fastnetmon/$name.pid
 
 run_rc_command "$1"
diff --git a/net-mgmt/fastnetmon/files/patch-CMakeLists.txt b/net-mgmt/fastnetmon/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..d833ac56fc9d
--- /dev/null
+++ b/net-mgmt/fastnetmon/files/patch-CMakeLists.txt
@@ -0,0 +1,30 @@
+--- CMakeLists.txt.orig	2023-10-14 15:48:26 UTC
++++ CMakeLists.txt
+@@ -47,7 +47,8 @@ set(GTEST_INSTALL_PATH "${FASTNETMON_LIBRARIES_GLOBAL_
+ # In order to get a warning about an unused function parameter, you must either specify -Wextra -Wunused (note that -Wall implies -Wunused), or separately specify -Wunused-parameter.
+ # TODO: return -Wunused-parameter and address all warning later, I started it but did not finish as we have too many of them
+ # catch-value is documented here: https://patchwork.ozlabs.org/project/gcc/patch/tkrat.8c7b4260a533be2f@netcologne.de/#1680619
+-add_definitions("-Wreorder -Wunused -Wparentheses -Wimplicit-fallthrough -Wreturn-type -Wuninitialized -Winit-self -Wmaybe-uninitialized -Wcatch-value=3 -Wclass-memaccess")
++# add_definitions("-Wreorder -Wunused -Wparentheses -Wimplicit-fallthrough -Wreturn-type -Wuninitialized -Winit-self -Wmaybe-uninitialized -Wcatch-value=3 -Wclass-memaccess")
++add_definitions("-Wreorder -Wunused -Wparentheses -Wimplicit-fallthrough -Wreturn-type -Wuninitialized -Winit-self")
+ 
+ # On Windows we need to build libgcc and libstdc++ statically to avoid need to carry dlls with us
+ if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
+@@ -81,7 +82,7 @@ option(KAFKA_SUPPORT "Enables Kafka support" OFF)
+ option(KAFKA_SUPPORT "Enables Kafka support" OFF)
+ 
+ # We need to add it into include path as gRPC uses it include path
+-include_directories("${ABSL_INSTALL_PATH}/include")
++# include_directories("${ABSL_INSTALL_PATH}/include")
+ 
+ option(DO_NOT_USE_SYSTEM_LIBRARIES_FOR_BUILD "Disables use of libraries from system path" OFF)
+ 
+@@ -848,7 +849,7 @@ if (ENABLE_CAPNP_SUPPORT)
+         message(FATAL_ERROR "Could not find capnp libraries")
+     endif()
+ 
+-    include_directories("${CAPNP_CUSTOM_INSTALL_PATH}/include")
++    # include_directories("${CAPNP_CUSTOM_INSTALL_PATH}/include")
+ 
+     target_link_libraries(simple_packet_capnp ${CAPNP_LIBRARY_PATH} ${CAPNP_KJ_LIBRARY_PATH})
+ 
diff --git a/net-mgmt/fastnetmon/files/patch-src_fastnetmon.cpp b/net-mgmt/fastnetmon/files/patch-src_fastnetmon.cpp
index 0883c1581808..74155be61ca9 100644
--- a/net-mgmt/fastnetmon/files/patch-src_fastnetmon.cpp
+++ b/net-mgmt/fastnetmon/files/patch-src_fastnetmon.cpp
@@ -1,5 +1,5 @@
---- src/fastnetmon.cpp.orig	2023-05-23 06:20:59 UTC
-+++ src/fastnetmon.cpp
+--- fastnetmon.cpp.orig	2023-05-23 06:20:59 UTC
++++ fastnetmon.cpp
 @@ -156,7 +156,7 @@ unsigned int stats_thread_initial_call_delay = 30;
  std::string reporting_server = "community-stats.fastnetmon.com";
  
diff --git a/net-mgmt/fastnetmon/files/patch-src_man_fastnetmon.8 b/net-mgmt/fastnetmon/files/patch-src_man_fastnetmon.8
index bb43f4f3a050..75d8a25831a5 100644
--- a/net-mgmt/fastnetmon/files/patch-src_man_fastnetmon.8
+++ b/net-mgmt/fastnetmon/files/patch-src_man_fastnetmon.8
@@ -1,5 +1,5 @@
---- src/man/fastnetmon.8.orig	2023-03-03 16:20:18 UTC
-+++ src/man/fastnetmon.8
+--- man/fastnetmon.8.orig	2023-03-03 16:20:18 UTC
++++ man/fastnetmon.8
 @@ -8,7 +8,7 @@ fastnetmon [--daemonize]
  .SH DESCRIPTION
  FastNetMon - a high performance DoS/DDoS load analyzer built on top of multiple packet capture engines (NetFlow, IPFIX, sFlow, port mirror).
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
index 19a3f3d8b17d..1bc5cd90e69f 100644
--- a/net-mgmt/fastnetmon/files/patch-src_netmap__plugin_netmap__collector.cpp
+++ b/net-mgmt/fastnetmon/files/patch-src_netmap__plugin_netmap__collector.cpp
@@ -1,5 +1,5 @@
---- src/netmap_plugin/netmap_collector.cpp.orig	2023-03-01 14:23:34 UTC
-+++ src/netmap_plugin/netmap_collector.cpp
+--- netmap_plugin/netmap_collector.cpp.orig	2023-03-01 14:23:34 UTC
++++ netmap_plugin/netmap_collector.cpp
 @@ -19,6 +19,7 @@
  
  // Disable debug messages from Netmap
diff --git a/net-mgmt/fastnetmon/pkg-plist b/net-mgmt/fastnetmon/pkg-plist
index 6c244f25be27..2912f9ef0846 100644
--- a/net-mgmt/fastnetmon/pkg-plist
+++ b/net-mgmt/fastnetmon/pkg-plist
@@ -1,11 +1,11 @@
 bin/fastnetmon
 bin/fastnetmon_api_client
 bin/fastnetmon_client
-bin/notify_about_attack.sh
-etc/networks_list
-etc/networks_whitelist
-man/man8/fastnetmon.8.gz
-man/man1/fastnetmon_client.1.gz
+share/man/man8/fastnetmon.8.gz
+share/man/man1/fastnetmon_client.1.gz
+@sample bin/notify_about_attack.sh.sample
+@sample etc/networks_list.sample
+@sample etc/networks_whitelist.sample
 @sample etc/fastnetmon.conf.sample
 @dir(fastnetmon,fastnetmon) /var/run/fastnetmon
 @dir(fastnetmon,fastnetmon) /var/log/fastnetmon_attacks