git: f83a6b9b6256 - main - sysutils/ganglia-monitor-core: Fix build with llvm16

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Wed, 02 Aug 2023 21:18:23 UTC
The branch main has been updated by bofh:

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

commit f83a6b9b6256ee9e5b14a69cc47f865fb6f500dc
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2023-08-02 19:28:30 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2023-08-02 21:18:13 +0000

    sysutils/ganglia-monitor-core: Fix build with llvm16
    
    - Utilize OPTIONSNG where possible
    
    Approved by:    portmgr (blanket)
    Sponsored by:   The FreeBSD Foundation
---
 sysutils/ganglia-monitor-core/Makefile | 55 +++++++++++++++++-----------------
 1 file changed, 27 insertions(+), 28 deletions(-)

diff --git a/sysutils/ganglia-monitor-core/Makefile b/sysutils/ganglia-monitor-core/Makefile
index 0b5d18181e61..79f99de0d52a 100644
--- a/sysutils/ganglia-monitor-core/Makefile
+++ b/sysutils/ganglia-monitor-core/Makefile
@@ -20,46 +20,45 @@ LIB_DEPENDS=	libapr-1.so:devel/apr1 \
 		libpcre.so:devel/pcre \
 		libexpat.so:textproc/expat2
 
-USES=		libtool pkgconfig
+USES=		libtool localbase:ldflags pkgconfig
+USE_LDCONFIG=	yes
+USE_RC_SUBR=	gmond
 
 GNU_CONFIGURE=	yes
 CONFIGURE_ARGS=	--enable-setuid=ganglia --enable-setgid=ganglia \
 		--disable-python
 CONFIGURE_ENV=	GANGLIA_ACK_SYSCONFDIR=1
-CFLAGS+=	-I${LOCALBASE}/include
-LDFLAGS+=	-L${LOCALBASE}/lib
+
+INSTALL_TARGET=	install-strip
+
+SUB_FILES+=	pkg-message
 
 USERS=		ganglia
 GROUPS=		ganglia
 
-OPTIONS_DEFINE=	GMETAD
-OPTIONS_DEFAULT=	GMETAD
-GMETAD_DESC=	include gmetad
-
 PLIST_SUB+=	PORTVERSION=${PORTVERSION}
 
-SUB_FILES+=	pkg-message
+OPTIONS_DEFINE=	GMETAD
+OPTIONS_DEFAULT=	GMETAD
+OPTIONS_SUB=	yes
 
-INSTALL_TARGET=	install-strip
+GMETAD_DESC=	include gmetad
 
-USE_RC_SUBR=	gmond
+GMETAD_LIB_DEPENDS=	librrd.so:databases/rrdtool
+GMETAD_CONFIGURE_ON=	--with-gmetad
+GMETAD_SUB_LIST=	GMETAD=""
+GMETAD_SUB_LIST_OFF=	GMETAD="\#"
 
 .include <bsd.port.options.mk>
 
+.if ${OPSYS} == FreeBSD && ( ${OSVERSION} >= 1400091 || ( ${OSVERSION} >= 1302507 && ${OSVERSION} < 1400000 ))
+CFLAGS+=	-Wno-error=incompatible-function-pointer-types
+.endif
+
 .if ${PORT_OPTIONS:MGMETAD}
 USE_RC_SUBR+=	gmetad
-
-LIB_DEPENDS+=	librrd.so:databases/rrdtool
-CONFIGURE_ARGS+=	--with-gmetad
-PLIST_SUB+=	GMETAD=""
-SUB_LIST+=	GMETAD=""
-.else
-PLIST_SUB+=	GMETAD="@comment "
-SUB_LIST+=	GMETAD="\#"
 .endif
 
-USE_LDCONFIG=	yes
-
 CONF_DIR=	${PREFIX}/etc
 
 MODULES=	modcpu.so \
@@ -91,14 +90,6 @@ post-build:
 post-install:
 	${INSTALL_DATA} ${WRKDIR}/gmond.conf \
 		${STAGEDIR}${PREFIX}/etc/gmond.conf.sample
-.if ${PORT_OPTIONS:MGMETAD}
-	${INSTALL_SCRIPT} ${FILESDIR}/gmetasnap.sh \
-		${STAGEDIR}${PREFIX}/sbin/gmetasnap
-	${INSTALL_DATA} ${WRKSRC}/gmetad/gmetad.conf \
-		${STAGEDIR}${PREFIX}/etc/gmetad.conf.sample
-	${INSTALL_MAN} ${WRKSRC}/mans/gmetad.1 \
-		${STAGEDIR}${MANPREFIX}/man/man1
-.endif
 	${INSTALL_MAN} \
 		${WRKSRC}/mans/gmetric.1 \
 		${WRKSRC}/mans/gmond.1 \
@@ -109,4 +100,12 @@ post-install:
 	${MKDIR} ${STAGEDIR}/var/db/ganglia/rrds
 	@${CHMOD} -R a+rX ${STAGEDIR}/var/db/ganglia
 
+post-install-GMETAD-on:
+	${INSTALL_SCRIPT} ${FILESDIR}/gmetasnap.sh \
+		${STAGEDIR}${PREFIX}/sbin/gmetasnap
+	${INSTALL_DATA} ${WRKSRC}/gmetad/gmetad.conf \
+		${STAGEDIR}${PREFIX}/etc/gmetad.conf.sample
+	${INSTALL_MAN} ${WRKSRC}/mans/gmetad.1 \
+		${STAGEDIR}${MANPREFIX}/man/man1
+
 .include <bsd.port.mk>