git: fdf1eb985c9c - main - net-mgmt/bsnmp-regex: Fix build time warnings

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Sun, 10 Mar 2024 15:33:07 UTC
The branch main has been updated by bofh:

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

commit fdf1eb985c9c78779e0b1074589c3a763dff33c5
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2024-03-10 15:17:14 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2024-03-10 15:32:55 +0000

    net-mgmt/bsnmp-regex: Fix build time warnings
    
    - Utilize OPTIONSNG
    - Utilize USES=localbase
    - Refresh patches
---
 net-mgmt/bsnmp-regex/Makefile                      | 29 +++++-------
 net-mgmt/bsnmp-regex/files/patch-configure.in      | 52 ++++++++++++++++++++++
 ...ch-bsnmp-regex.c => patch-module_bsnmp-regex.c} |  6 +--
 3 files changed, 66 insertions(+), 21 deletions(-)

diff --git a/net-mgmt/bsnmp-regex/Makefile b/net-mgmt/bsnmp-regex/Makefile
index 62ef0283315c..a10e74da945b 100644
--- a/net-mgmt/bsnmp-regex/Makefile
+++ b/net-mgmt/bsnmp-regex/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	bsnmp-regex
 PORTVERSION=	0.6
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	net-mgmt
 MASTER_SITES=	LOCAL/olivier
 
@@ -10,33 +10,26 @@ WWW=		http://thewalter.net/stef/software/bsnmp-regex/
 
 LICENSE=	BSD3CLAUSE
 
+USES=		libtool localbase
+
 GNU_CONFIGURE=	yes
 GNU_CONFIGURE_MANPREFIX=${PREFIX}/share
-CPPFLAGS+=	"-I${LOCALBASE}/include"
-INSTALL_TARGET=	install-strip
-USES=		libtool
 
-OPTIONS_DEFINE=	DEBUG PCRE
-PCRE_DESC=	Use PCRE instead of the default regex library
+INSTALL_TARGET=	install-strip
 
 PLIST_FILES=	bin/sockin lib/snmp_regex.so lib/snmp_regex.so.0 \
 		lib/snmp_regex.so.0.0.0 lib/snmp_regex.a share/man/man1/sockin.1.gz \
 		share/man/man5/bsnmp-regex.conf.5.gz \
 		share/man/man8/bsnmp-regex.8.gz
 
-.include <bsd.port.options.mk>
+# OPTION PCRE is safe to be removed when devel/pcre is removed
+# CONFIGURE_ARGS+=	--disable-pcre
+OPTIONS_DEFINE=	DEBUG PCRE
 
-.if ${PORT_OPTIONS:MDEBUG}
-CONFIGURE_ARGS+=--enable-debug
-.else
-CONFIGURE_ARGS+=--disable-debug
-.endif
+PCRE_DESC=	Use PCRE instead of the default regex library
 
-.if ${PORT_OPTIONS:MPCRE}
-LIB_DEPENDS+=		libpcre.so:devel/pcre
-CONFIGURE_ARGS+=	--enable-pcre
-.else
-CONFIGURE_ARGS+=	--disable-pcre
-.endif
+DEBUG_CONFIGURE_ENABLE=debug
+PCRE_LIB_DEPENDS=		libpcre.so:devel/pcre
+PCRE_CONFIGURE_ENABLE=pcre
 
 .include <bsd.port.mk>
diff --git a/net-mgmt/bsnmp-regex/files/patch-configure.in b/net-mgmt/bsnmp-regex/files/patch-configure.in
new file mode 100644
index 000000000000..7eb06d891cca
--- /dev/null
+++ b/net-mgmt/bsnmp-regex/files/patch-configure.in
@@ -0,0 +1,52 @@
+--- configure.in.orig	2024-03-10 15:09:20 UTC
++++ configure.in
+@@ -13,14 +13,14 @@ AC_PROG_LIBTOOL
+ AC_PROG_INSTALL
+ AC_PROG_LIBTOOL
+ 
+-AC_CHECK_PROG(GENSNMPTREE, gensnmptree, "gensnmptree") 
+-if test -z "$GENSNMPTREE"; then 
+-    echo "ERROR: gensnmptree program not found." 
+-    exit 1 
++AC_CHECK_PROG(GENSNMPTREE, gensnmptree, "gensnmptree")
++if test -z "$GENSNMPTREE"; then
++    echo "ERROR: gensnmptree program not found."
++    exit 1
+ fi
+ 
+ # Debug mode
+-AC_ARG_ENABLE(debug, 
++AC_ARG_ENABLE(debug,
+         AC_HELP_STRING([--enable-debug],
+         [Compile binaries in debug mode]))
+ 
+@@ -36,20 +36,21 @@ AC_ARG_ENABLE(pcre,
+ AC_ARG_ENABLE(pcre,
+         AC_HELP_STRING([--with-pcre],
+         [Use PCRE instead of the default regular expression library]))
+-        
++
+ if test "$enable_pcre" = "yes"; then
+-    AC_CHECK_LIB(pcre, pcre_compile, , 
++    AC_CHECK_LIB(pcre, pcre_compile, ,
+         [echo "Couldn't find the pcre library"; exit 1])
+-    AC_CHECK_HEADERS("pcre.h", , 
++    AC_CHECK_HEADERS("pcre.h", ,
+         [echo "Couldn't find pcre headers"; exit 1])
+     AC_DEFINE_UNQUOTED(WITH_PCRE, 1, [Use PCRE regular expression library])
+ fi
+ 
+-AC_CHECK_HEADERS([sys/queue.h sys/limits.h sys/stat.h sys/time.h sys/un.h], , 
+-        [echo "ERROR: required header not found."; exit 1]) 
+-AC_CHECK_HEADERS([bsnmp/snmpmod.h], , 
+-        [echo "ERROR: required bsnmp header not found." exit 1]) 
+-    
++AC_CHECK_HEADERS([sys/queue.h sys/limits.h sys/stat.h sys/time.h sys/un.h], ,
++        [echo "ERROR: required header not found."; exit 1])
++AC_CHECK_HEADERS([bsnmp/snmpmod.h], ,
++        [echo "ERROR: required bsnmp header not found." exit 1],
++        [#include <sys/queue.h>])
++
+ # Checks for typedefs, structures, and compiler characteristics.
+ AC_C_CONST
+ AC_TYPE_SIZE_T
diff --git a/net-mgmt/bsnmp-regex/files/patch-bsnmp-regex.c b/net-mgmt/bsnmp-regex/files/patch-module_bsnmp-regex.c
similarity index 61%
rename from net-mgmt/bsnmp-regex/files/patch-bsnmp-regex.c
rename to net-mgmt/bsnmp-regex/files/patch-module_bsnmp-regex.c
index 3118d723b448..296158bac548 100644
--- a/net-mgmt/bsnmp-regex/files/patch-bsnmp-regex.c
+++ b/net-mgmt/bsnmp-regex/files/patch-module_bsnmp-regex.c
@@ -1,6 +1,6 @@
---- module/bsnmp-regex.c.orig	2011-10-21 16:05:37.000000000 +0700
-+++ module/bsnmp-regex.c	2018-06-05 21:16:44.471250000 +0700
-@@ -788,7 +788,7 @@ config_var (char *name, char *value, int
+--- module/bsnmp-regex.c.orig	2011-10-21 09:05:37 UTC
++++ module/bsnmp-regex.c
+@@ -788,7 +788,7 @@ config_var (char *name, char *value, int line)
      if (strcmp (name, "expire") == 0 || strcmp (name, "expires") == 0) {
  
          i = strtol (value, &t2, 10);