From 9125cb0170affe1750111a4856bea824a5720186 Mon Sep 17 00:00:00 2001 From: edwin Date: Sat, 28 Feb 2004 22:05:46 +0000 Subject: Let the port choose between a PGSQL or MYSQL backend. Fix compilation of net/zabbix when using the PGSQL backend. (author informed) PR: 61773, 62856 Submitted by: Michal F. Hanula , edwin@Mavetju.org Approved by: maintainer timeout --- net-mgmt/zabbix2/Makefile | 31 ++++++++++++++++++---- net-mgmt/zabbix2/files/patch-include::db.c | 41 ++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 net-mgmt/zabbix2/files/patch-include::db.c (limited to 'net-mgmt/zabbix2') diff --git a/net-mgmt/zabbix2/Makefile b/net-mgmt/zabbix2/Makefile index 171a724f80d1..aa28891e01d2 100644 --- a/net-mgmt/zabbix2/Makefile +++ b/net-mgmt/zabbix2/Makefile @@ -17,6 +17,14 @@ COMMENT= Very advanced network monitoring system NOT_FOR_ARCHS= amd64 +.ifndef(ZABBIX_AGENT_ONLY) +OPTIONS= PGSQL "Use a PostgreSQL backend" Off \ + MYSQL "Use a MySQL backend" On \ + FPING "Use fping for pinging hosts" On +.endif + +.include + .ifdef(ZABBIX_AGENT_ONLY) PKGNAMESUFFIX= -agent PLIST= ${MASTERDIR}/pkg-plist.agent @@ -24,15 +32,28 @@ PKGMESSAGE= nonexistent .else # ZABBIX_AGENT_ONLY LIB_DEPENDS= netsnmp.6:${PORTSDIR}/net-mgmt/net-snmp RUN_DEPENDS= php:${PORTSDIR}/lang/php4-nms +.endif # ZABBIX_AGENT_ONLY -.ifndef(WITHOUT_FPING) +.ifdef(WITH_FPING) RUN_DEPENDS+= ${LOCALBASE}/sbin/fping:${PORTSDIR}/net/fping .endif +.ifndef(WITH_PGSQL) +. ifndef(WITH_MYSQL) +IGNORE= You should configure to use either a MySQL or PostgreSQL backend. +. endif +.endif + +.ifdef(WITH_PGSQL) +CONFIGURE_ARGS+=--with-pgsql +LIB_DEPENDS+= pq.3:${PORTSDIR}/databases/postgresql-client +.endif +.ifdef(WITH_MYSQL) USE_MYSQL= yes -CONFIGURE_ARGS= --with-mysql --with-net-snmp +CONFIGURE_ARGS= --with-mysql +.endif +CONFIGURE_ARGS+=--with-netsnmp PKGMESSAGE= ${WRKDIR}/pkg-message -.endif # ZABBIX_AGENT_ONLY USE_REINPLACE= yes USE_RC_SUBR= yes @@ -60,7 +81,7 @@ pre-patch: .ifndef(ZABBIX_AGENT_ONLY) post-patch: @${REINPLACE_CMD} 's|%LOCALBASE%|${LOCALBASE}|' ${WRKSRC}/src/zabbix_sucker/zabbix_sucker.c -.ifdef WITHOUT_FPING +.ifndef WITH_FPING @${ECHO} 'DisablePinger=yes' >> ${WRKSRC}/misc/conf/zabbix_suckerd.conf .endif .endif # ZABBIX_AGENT_ONLY @@ -95,4 +116,4 @@ do-install: @${CAT} ${PKGMESSAGE} .endif -.include +.include diff --git a/net-mgmt/zabbix2/files/patch-include::db.c b/net-mgmt/zabbix2/files/patch-include::db.c new file mode 100644 index 000000000000..65b688a2ee3d --- /dev/null +++ b/net-mgmt/zabbix2/files/patch-include::db.c @@ -0,0 +1,41 @@ +--- include/db.c.orig Sun Feb 15 09:55:55 2004 ++++ include/db.c Sun Feb 15 09:56:53 2004 +@@ -123,6 +123,10 @@ + */ + int DBexecute(char *query) + { ++#ifdef HAVE_PGSQL ++ PGresult *result; ++#endif ++ + /* zabbix_set_log_level(LOG_LEVEL_DEBUG);*/ + zabbix_log( LOG_LEVEL_DEBUG, "Executing query:%s",query); + #ifdef HAVE_MYSQL +@@ -138,8 +142,6 @@ + } + #endif + #ifdef HAVE_PGSQL +- PGresult *result; +- + result = PQexec(conn,query); + + if( result==NULL) +@@ -168,6 +170,9 @@ + */ + DB_RESULT *DBselect(char *query) + { ++#ifdef HAVE_PGSQL ++ PGresult *result; ++#endif + /* zabbix_set_log_level(LOG_LEVEL_DEBUG);*/ + zabbix_log( LOG_LEVEL_DEBUG, "Executing query:%s",query); + #ifdef HAVE_MYSQL +@@ -185,8 +190,6 @@ + return mysql_store_result(&mysql); + #endif + #ifdef HAVE_PGSQL +- PGresult *result; +- + result = PQexec(conn,query); + + if( result==NULL) -- cgit