Bug 69540

Summary: clashing configure options in net-mgmt/nagios
Product: Ports & Packages Reporter: Sascha Luck <sascha>
Component: Individual Port(s)Assignee: Pav Lucistnik <pav>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Sascha Luck 2004-07-24 19:30:29 UTC
ports/nagios can be built with MySQL support (WITH_MYSQL). If this option is configured, nagios will be built with both: --mysql-xdata and --with-template-extinfo as the latter is selected by default. These two options are mutually exclusive, as the Nagios CGIs are then built with both database and template config file support for extended data. This will result in neither option working.

Fix: 

.if defined(WITH_GD1)--nJMOtiS7dFTyominJFqBNijztIGavOeiR82HpLnVZ51WYZl0
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

*** Makefile    Mon Feb 23 04:42:03 2004
--- Makefile.mysql-xdata        Sat Jul 24 19:08:52 2004
***************
*** 45,49 ****
                --with-nagios-grp=${NAGIOSGROUP} \
                --with-template-objects \
-               --with-template-extinfo \
                --sbindir=${PREFIX}/share/nagios/cgi-bin \
                --libexecdir=${PREFIX}/libexec/nagios \
--- 45,48 ----
***************
*** 52,55 ****
--- 51,58 ----
                --localstatedir=${NAGIOSDIR} \
                --prefix=${PREFIX}
+
+ .if !defined(WITH_MYSQL)
+ CONFIGURE_ARGS+= --with-template-extinfo
+ .endif
How-To-Repeat: 
Build ports/nagios with WITH_MYSQL enabled. Configure extended data for monitoring hosts. Use either the database or the template .cfg file. Neither will work.
Comment 1 Pav Lucistnik freebsd_committer freebsd_triage 2004-07-25 17:17:48 UTC
Dear maintainer of FreeBSD port net-mgmt/nagios, please take a look at

http://www.freebsd.org/cgi/query-pr.cgi?q=69540

and either approve or reject this patch.

-- 
Pav Lucistnik <pav@oook.cz>
              <pav@FreeBSD.org>

May your arrow always find its mark.
Comment 2 Pav Lucistnik freebsd_committer freebsd_triage 2004-07-25 17:17:51 UTC
State Changed
From-To: open->feedback

Asked maintainer for opinion. 


Comment 3 Pav Lucistnik freebsd_committer freebsd_triage 2004-07-25 17:17:51 UTC
Responsible Changed
From-To: freebsd-ports-bugs->pav

Handle.
Comment 4 Blaz Zupan 2004-07-25 19:27:57 UTC
> Dear maintainer of FreeBSD port net-mgmt/nagios, please take a look at
> http://www.freebsd.org/cgi/query-pr.cgi?q=69540
> and either approve or reject this patch.

Approved, but please commit it is part of a bigger update (below).  This
update removes the GD1 support (gd1 is no longer in the ports collection)
and adds OPTIONS support. Also please mention in ports/UPDATING that the
option names have changed (WITH_POSTGRES is now WITH_PGSQL and
NAGIOS_FILE_PERFDATA is now WITH_FILE_PERFDATA).

diff -urN nagios.old/Makefile nagios/Makefile
--- nagios.old/Makefile	Mon Feb 23 05:42:03 2004
+++ nagios/Makefile	Sun Jul 25 20:20:54 2004
@@ -7,6 +7,7 @@

 PORTNAME=	nagios
 PORTVERSION=	1.2
+PORTREVISION=	1
 CATEGORIES=	net-mgmt
 MASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
 MASTER_SITE_SUBDIR=nagios
@@ -14,11 +15,7 @@
 MAINTAINER=	blaz@si.FreeBSD.org
 COMMENT=	Extremely powerful network monitoring system

-.if defined(WITH_GD1)
-LIB_DEPENDS=	gd1.2:${PORTSDIR}/graphics/gd1
-.else
 LIB_DEPENDS=	gd.4:${PORTSDIR}/graphics/gd
-.endif
 RUN_DEPENDS=	${LOCALBASE}/libexec/nagios/check_nagios:${PORTSDIR}/net-mgmt/nagios-plugins

 USE_GETOPT_LONG=yes
@@ -34,17 +31,22 @@
 NAGIOSGROUP?=	nagios
 NAGIOSDIR?=	/var/spool/nagios

-CPPFLAGS=	${INCGD} -I${LOCALBASE}/include
+OPTIONS=	MYSQL "MySQL suport" off \
+		PGSQL "PostgreSQL suport" off \
+		FILE_PERFDATA "Save performance data to files" off
+
+.include <bsd.port.pre.mk>
+
+CPPFLAGS=	-I${LOCALBASE}/include
 CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS}" \
 		LDFLAGS="${LDFLAGS}" \
-		CFLAGS="${CPPFLAGS} ${CFLAGS} ${INCGD}" \
-		LIBS="-L${LOCALBASE}/lib ${LIBGD}"
+		CFLAGS="${CPPFLAGS} ${CFLAGS}" \
+		LIBS="-L${LOCALBASE}/lib -lgd"
 CONFIGURE_ARGS=	--with-command-user=${NAGIOSUSER} \
 		--with-command-grp=www \
 		--with-nagios-user=${NAGIOSUSER} \
 		--with-nagios-grp=${NAGIOSGROUP} \
 		--with-template-objects \
-		--with-template-extinfo \
 		--sbindir=${PREFIX}/share/nagios/cgi-bin \
 		--libexecdir=${PREFIX}/libexec/nagios \
 		--datadir=${PREFIX}/share/nagios \
@@ -52,22 +54,16 @@
 		--localstatedir=${NAGIOSDIR} \
 		--prefix=${PREFIX}

-.if defined(WITH_GD1)
-INCGD=		-I${LOCALBASE}/include/gd
-LIBGD=		-lgd1
-.else
-INCGD=		-I${LOCALBASE}/include
-LIBGD=		-lgd
-.endif
-
 .if defined(WITH_MYSQL)
 USE_MYSQL=	yes
 CONFIGURE_ARGS+=	--with-mysql-lib=${LOCALBASE}/lib/mysql \
 		--with-mysql-inc=${LOCALBASE}/include/mysql \
 		--with-mysql-xdata
+.else
+CONFIGURE_ARGS+=	--with-template-extinfo
 .endif

-.if defined(NAGIOS_FILE_PERFDATA)
+.if defined(WITH_FILE_PERFDATA)
 CONFIGURE_ARGS+=--with-file-perfdata
 .endif

@@ -86,16 +82,6 @@

 INSTALL_TARGET=	all install config install-config install-commandmode

-pre-everything::
-	@${ECHO_MSG} ""
-	@${ECHO_MSG} "nagios has the following tunables:"
-	@${ECHO_MSG} ""
-	@${ECHO_MSG} "  WITH_MYSQL=yes		Compile with MySQL suport"
-	@${ECHO_MSG} "  WITH_POSTGRES=yes		Compile with PostgreSQL suport"
-	@${ECHO_MSG} "  WITH_GD1=yes			Compile with GD1 instead of GD2"
-	@${ECHO_MSG} "  NAGIOS_FILE_PERFDATA=yes	Save performance data to files"
-	@${ECHO_MSG} ""
-
 pre-build:
 	for file in nagios.sh INSTALL DEINSTALL MESSAGE; do \
 		${SED} ${SED_SCRIPT} < ${FILESDIR}/$${file}.tmpl >${WRKDIR}/$${file}; \
@@ -108,4 +94,4 @@
 	@${INSTALL_SCRIPT} ${WRKDIR}/nagios.sh ${PREFIX}/etc/rc.d/
 	@${CAT} ${PKGMESSAGE}

-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
Comment 5 Pav Lucistnik freebsd_committer freebsd_triage 2004-07-25 19:48:20 UTC
State Changed
From-To: feedback->closed

Maintainer's patch committed, thank you both!