From c10ccacf557417d91b60bbb602e9a9907ff76c3f Mon Sep 17 00:00:00 2001 From: bdrewery Date: Wed, 12 Sep 2012 22:07:07 +0000 Subject: - Add VIRT and WRITE_HTTP options [1] - Convert to new options framework [1] - Remove ABI versions from LIB_DEPENDS - Fix build with Clang by using upstream patch [2] Upstream fix: https://github.com/collectd/collectd/issues/49 [2] PR: ports/171204 [1] Submitted by: Krzysztof Stryjek (maintainer) --- net-mgmt/collectd/Makefile | 177 ++++++++++++++++----------- net-mgmt/collectd/files/patch-src__network.c | 29 +++++ net-mgmt/collectd/pkg-plist | 8 +- 3 files changed, 138 insertions(+), 76 deletions(-) (limited to 'net-mgmt') diff --git a/net-mgmt/collectd/Makefile b/net-mgmt/collectd/Makefile index 62d8f0deaf1d..8fa792fdc1aa 100644 --- a/net-mgmt/collectd/Makefile +++ b/net-mgmt/collectd/Makefile @@ -7,7 +7,7 @@ PORTNAME= collectd PORTVERSION= 4.10.4 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= net-mgmt MASTER_SITES= http://collectd.org/files/ @@ -19,34 +19,46 @@ GNU_CONFIGURE= yes USE_AUTOTOOLS= autoconf autoheader automake libltdl WANT_GNOME= yes -OPTIONS= CGI "Install collection.cgi (requires RRDTOOL)" Off \ - BIND "Enable BIND 9.5+ statistics" On \ - DEBUG "Enable debugging" Off \ - APACHE "Input: Apache mod_status (libcurl)" Off \ - APCUPS "Input: APC UPS (apcupsd)" Off \ - CURL "Input: CURL generic web statistics" Off \ - CURL_JSON "Input: CURL JSON generic web statistics" Off \ - CURL_XML "Input: CURL XML generic web statistics" Off \ - DBI "Input: database abstraction library" Off \ - DISK "Input: Disk performance statistics" Off \ - GCRYPT "Build with libgcrypt" Off \ - NUTUPS "Input: NUT UPS daemon" Off \ - INTERFACE "Input: Network interfaces (libstatgrab)" On \ - MBMON "Input: MBMon" Off \ - MEMCACHED "Input: Memcached" Off \ - MYSQL "Input: MySQL" Off \ - NGINX "Input: Nginx" Off \ - OPENVPN "Input: OpenVPN statistics" Off \ - PDNS "Input: PowerDNS" Off \ - PGSQL "Input: PostgreSQL" Off \ - PING "Input: Network latency (liboping)" On \ - PYTHON "Input: Python plugin" Off \ - ROUTEROS "Input: RouterOS plugin" Off \ - SNMP "Input: SNMP" On \ - TOKYOTYRANT "Input: Tokyotyrant database" Off \ - XMMS "Input: XMMS" Off \ - RRDTOOL "Output: RRDTool" On \ - RRDCACHED "Output: RRDTool Cached (require RRDTOOL)" On +OPTIONS_DEFINE= CGI BIND DEBUG GCRYPT VIRT +OPTIONS_MULTI= INPUT OUTPUT +OPTIONS_MULTI_OUTPUT= RRDTOOL RRDCACHED WRITE_HTTP +OPTIONS_MULTI_INPUT= APACHE APCUPS CURL CURL_JSON CURL_XML DBI DISK \ + NUTUPS INTERFACE MBMON MEMCACHED MYSQL NGINX OPENVPN \ + PDNS PGSQL PING PYTHON ROUTEROS SNMP TOKYOTYRANT XMMS +OPTIONS_DEFAULT= BIND INTERFACE PING SNMP RRDTOOL RRDCACHED + +CGI_DESC= Install collection.cgi (requires RRDTOOL) +BIND_DESC= Enable BIND 9.5+ statistics +DEBUG_DESC= Enable debugging +GCRYPT_DESC= Build with libgcrypt +VIRT_DESC= Build with libvirt +# INPUT +APACHE_DESC= Apache mod_status (libcurl) +APCUPS_DESC= APC UPS (apcupsd) +CURL_DESC= CURL generic web statistics +CURL_JSON_DESC= CURL JSON generic web statistics +CURL_XML_DESC= CURL XML generic web statistics +DBI_DESC= database abstraction library +DISK_DESC= Disk performance statistics +NUTUPS_DESC= NUT UPS daemon +INTERFACE_DESC= Network interfaces (libstatgrab) +MBMON_DESC= MBMon +MEMCACHED_DESC= Memcached +MYSQL_DESC= MySQL +NGINX_DESC= Nginx +OPENVPN_DESC= OpenVPN statistics +PDNS_DESC= PowerDNS +PGSQL_DESC= PostgreSQL +PING_DESC= Network latency (liboping) +PYTHON_DESC= Python plugin +ROUTEROS_DESC= RouterOS plugin +SNMP_DESC= SNMP +TOKYOTYRANT_DESC= Tokyotyrant database +XMMS_DESC= XMMS +# OUTPUT +RRDTOOL_DESC= RRDTool +RRDCACHED_DESC= RRDTool Cached (require RRDTOOL) +WRITE_HTTP_DESC= write_http MAN1= collectd.1 collectd-nagios.1 collectdmon.1 MAN5= collectd.conf.5 collectd-email.5 collectd-exec.5 \ @@ -85,7 +97,6 @@ CONFIGURE_ARGS= --localstatedir=/var \ --disable-ipvs \ --disable-irq \ --disable-java \ - --disable-libvirt \ --disable-madwifi \ --disable-match_empty_counter \ --disable-match_hashed \ @@ -121,7 +132,6 @@ CONFIGURE_ARGS= --localstatedir=/var \ --disable-vmem \ --disable-vserver \ --disable-wireless \ - --disable-write_http \ --disable-zfs_arc \ --without-perl-bindings \ --without-librabbitmq \ @@ -132,22 +142,24 @@ CONFIGURE_ARGS= --localstatedir=/var \ --without-libesmtp \ --disable-static -.if defined(WITH_DEBUG) +.if ${PORT_OPTIONS:MDEBUG} CONFIGURE_ARGS+=--enable-debug .endif -.if defined(WITH_CGI) +.if ${PORT_OPTIONS:MCGI} RUN_DEPENDS+= p5-URI>=0:${PORTSDIR}/net/p5-URI \ p5-CGI.pm>=0:${PORTSDIR}/www/p5-CGI.pm \ p5-Data-Dumper>=0:${PORTSDIR}/devel/p5-Data-Dumper \ p5-HTML-Parser>=0:${PORTSDIR}/www/p5-HTML-Parser PLIST_SUB+= CGI="" -WITH_RRDTOOL= YES +. if empty(PORT_OPTIONS:MRRDTOOL) +IGNORE= CGI requires RRDTOOL. Either select RRDTOOL or deselect CGI +. endif .else PLIST_SUB+= CGI="@comment " .endif -.if defined(WITH_BIND) +.if ${PORT_OPTIONS:MBIND} CONFIGURE_ARGS+=--enable-bind LIB_DEPENDS+= curl:${PORTSDIR}/ftp/curl LIB_DEPENDS+= xml2:${PORTSDIR}/textproc/libxml2 @@ -157,16 +169,16 @@ CONFIGURE_ARGS+=--disable-bind PLIST_SUB+= BIND="@comment " .endif -.if defined(WITH_APACHE) +.if ${PORT_OPTIONS:MAPACHE} CONFIGURE_ARGS+=--enable-apache -LIB_DEPENDS+= curl.6:${PORTSDIR}/ftp/curl +LIB_DEPENDS+= curl:${PORTSDIR}/ftp/curl PLIST_SUB+= APACHE="" .else CONFIGURE_ARGS+=--disable-apache PLIST_SUB+= APACHE="@comment " .endif -.if defined(WITH_APCUPS) +.if ${PORT_OPTIONS:MAPCUPS} CONFIGURE_ARGS+=--enable-apcups BUILD_DEPENDS+= ${LOCALBASE}/sbin/apcupsd:${PORTSDIR}/sysutils/apcupsd PLIST_SUB+= APCUPS="" @@ -175,17 +187,17 @@ CONFIGURE_ARGS+=--disable-apcups PLIST_SUB+= APCUPS="@comment " .endif -.if defined(WITH_CURL) +.if ${PORT_OPTIONS:MCURL} CONFIGURE_ARGS+=--enable-curl --with-libcurl=${LOCALBASE} -LIB_DEPENDS+= curl.6:${PORTSDIR}/ftp/curl +LIB_DEPENDS+= curl:${PORTSDIR}/ftp/curl PLIST_SUB+= CURL="" .else CONFIGURE_ARGS+=--disable-curl PLIST_SUB+= CURL="@comment " .endif -.if defined(WITH_CURL_JSON) -.if !defined(WITH_CURL) +.if ${PORT_OPTIONS:MCURL_JSON} +.if empty(PORT_OPTIONS:MCURL) IGNORE= using CURL_JSON requires CURL support .endif CONFIGURE_ARGS+=--enable-curl_json @@ -196,8 +208,8 @@ CONFIGURE_ARGS+=--disable-curl_json --without-libyajl PLIST_SUB+= CURL_JSON="@comment " .endif -.if defined(WITH_CURL_XML) -.if !defined(WITH_CURL) +.if ${PORT_OPTIONS:MCURL_XML} +.if empty(PORT_OPTIONS:MCURL) IGNORE= using CURL_XML requires CURL support .endif CONFIGURE_ARGS+=--enable-curl_xml @@ -208,16 +220,16 @@ CONFIGURE_ARGS+=--disable-curl_xml PLIST_SUB+= CURL_XML="@comment " .endif -.if defined(WITH_DBI) +.if ${PORT_OPTIONS:MDBI} CONFIGURE_ARGS+=--enable-dbi --with-libdbi=${LOCALBASE} -LIB_DEPENDS+= dbi.1:${PORTSDIR}/databases/libdbi +LIB_DEPENDS+= dbi:${PORTSDIR}/databases/libdbi PLIST_SUB+= DBI="" .else CONFIGURE_ARGS+=--disable-dbi PLIST_SUB+= DBI="@comment " .endif -.if defined(WITH_DISK) +.if ${PORT_OPTIONS:MDISK} CONFIGURE_ARGS+=--enable-disk PLIST_SUB+= DISK="" .else @@ -225,24 +237,24 @@ CONFIGURE_ARGS+=--disable-disk PLIST_SUB+= DISK="@comment " .endif -.if defined(WITH_GCRYPT) +.if ${PORT_OPTIONS:MGCRYPT} CONFIGURE_ARGS+=--with-libgcrypt-prefix=${LOCALBASE} -LIB_DEPENDS+= gcrypt.18:${PORTSDIR}/security/libgcrypt +LIB_DEPENDS+= gcrypt8:${PORTSDIR}/security/libgcrypt .endif -.if defined(WITH_NUTUPS) +.if ${PORT_OPTIONS:MNUTUPS} CONFIGURE_ARGS+=--enable-nut --with-upsclient -LIB_DEPENDS+= upsclient.1:${PORTSDIR}/sysutils/nut +LIB_DEPENDS+= upsclient:${PORTSDIR}/sysutils/nut PLIST_SUB+= NUTUPS="" .else CONFIGURE_ARGS+=--disable-nut --without-libupsclient PLIST_SUB+= NUTUPS="@comment " .endif -.if defined(WITH_INTERFACE) +.if ${PORT_OPTIONS:MINTERFACE} USE_PKGCONFIG= yes CONFIGURE_ARGS+=--enable-interface -LIB_DEPENDS+= statgrab.8:${PORTSDIR}/devel/libstatgrab +LIB_DEPENDS+= statgrab:${PORTSDIR}/devel/libstatgrab PLIST_SUB+= INTERFACE="" CONFIGURE_ENV+= LIBS="`pkg-config --libs libstatgrab`" .else @@ -250,7 +262,7 @@ CONFIGURE_ARGS+=--disable-interface PLIST_SUB+= INTERFACE="@comment " .endif -.if defined(WITH_MBMON) +.if ${PORT_OPTIONS:MMBMON} CONFIGURE_ARGS+=--enable-mbmon RUN_DEPENDS+= ${LOCALBASE}/bin/mbmon:${PORTSDIR}/sysutils/mbmon PLIST_SUB+= MBMON="" @@ -259,8 +271,8 @@ CONFIGURE_ARGS+=--disable-mbmon PLIST_SUB+= MBMON="@comment " .endif -.if defined(WITH_MEMCACHED) -LIB_DEPENDS+= memcached.10:${PORTSDIR}/databases/libmemcached +.if ${PORT_OPTIONS:MMEMCACHED} +LIB_DEPENDS+= memcached:${PORTSDIR}/databases/libmemcached CONFIGURE_ARGS+=--enable-memcached CONFIGURE_ARGS+=--with-libmemcached=${LOCALBASE} PLIST_SUB+= MEMCACHED="" @@ -269,7 +281,7 @@ CONFIGURE_ARGS+=--disable-memcached --without-libmemcached PLIST_SUB+= MEMCACHED="@comment " .endif -.if defined(WITH_MYSQL) +.if ${PORT_OPTIONS:MMYSQL} USE_MYSQL= yes CONFIGURE_ARGS+=--enable-mysql PLIST_SUB+= MYSQL="" @@ -278,9 +290,9 @@ CONFIGURE_ARGS+=--disable-mysql PLIST_SUB+= MYSQL="@comment " .endif -.if defined(WITH_NGINX) +.if ${PORT_OPTIONS:MNGINX} RUN_DEPENDS+= nginx:${PORTSDIR}/www/nginx -LIB_DEPENDS+= curl.6:${PORTSDIR}/ftp/curl +LIB_DEPENDS+= curl:${PORTSDIR}/ftp/curl CONFIGURE_ARGS+=--enable-nginx PLIST_SUB+= NGINX="" .else @@ -288,7 +300,7 @@ CONFIGURE_ARGS+=--disable-nginx PLIST_SUB+= NGINX="@comment " .endif -.if defined(WITH_OPENVPN) +.if ${PORT_OPTIONS:MOPENVPN} CONFIGURE_ARGS+=--enable-openvpn RUN_DEPENDS+= ${LOCALBASE}/sbin/openvpn:${PORTSDIR}/security/openvpn PLIST_SUB+= OPENVPN="" @@ -297,7 +309,7 @@ CONFIGURE_ARGS+=--disable-openvpn PLIST_SUB+= OPENVPN="@comment " .endif -.if defined(WITH_PDNS) +.if ${PORT_OPTIONS:MPDNS} USE_PDNS= yes CONFIGURE_ARGS+=--enable-powerdns PLIST_SUB+= PDNS="" @@ -306,7 +318,7 @@ CONFIGURE_ARGS+=--disable-powerdns PLIST_SUB+= PDNS="@comment " .endif -.if defined(WITH_PGSQL) +.if ${PORT_OPTIONS:MPGSQL} USE_PGSQL= yes CONFIGURE_ARGS+=--enable-postgresql PLIST_SUB+= PGSQL="" @@ -315,7 +327,7 @@ CONFIGURE_ARGS+=--disable-postgresql PLIST_SUB+= PGSQL="@comment " .endif -.if defined(WITH_PING) +.if ${PORT_OPTIONS:MPING} LIB_DEPENDS+= oping:${PORTSDIR}/net/liboping CONFIGURE_ARGS+=--enable-ping PLIST_SUB+= PING="" @@ -324,7 +336,7 @@ CONFIGURE_ARGS+=--disable-ping PLIST_SUB+= PING="@comment " .endif -.if defined(WITH_PYTHON) +.if ${PORT_OPTIONS:MPYTHON} USE_PYTHON= yes CONFIGURE_ARGS+=--enable-python PLIST_SUB+= PYTHON="" @@ -333,7 +345,7 @@ CONFIGURE_ARGS+=--disable-python PLIST_SUB+= PYTHON="@comment " .endif -.if defined(WITH_ROUTEROS) +.if ${PORT_OPTIONS:MROUTEROS} LIB_DEPENDS+= routeros:${PORTSDIR}/net/librouteros CONFIGURE_ARGS+=--enable-routeros --with-librouteros=${LOCALBASE} PLIST_SUB+= ROUTEROS="" @@ -342,7 +354,7 @@ CONFIGURE_ARGS+=--disable-routeros --without-librouteros PLIST_SUB+= ROUTEROS="@comment " .endif -.if defined(WITH_RRDTOOL) +.if ${PORT_OPTIONS:MRRDTOOL} LIB_DEPENDS+= rrd:${PORTSDIR}/databases/rrdtool CONFIGURE_ARGS+=--enable-rrdtool PLIST_SUB+= RRD="" @@ -351,7 +363,7 @@ CONFIGURE_ARGS+=--disable-rrdtool PLIST_SUB+= RRD="@comment " .endif -.if defined(WITH_RRDCACHED) && defined(WITH_RRDTOOL) +.if ${PORT_OPTIONS:MRRDCACHED} && ${PORT_OPTIONS:MRRDTOOL} CONFIGURE_ARGS+=--enable-rrdcached PLIST_SUB+= RRDCACHED="" .else @@ -359,8 +371,8 @@ CONFIGURE_ARGS+=--disable--rrdcached PLIST_SUB+= RRDCACHED="@comment " .endif -.if defined(WITH_SNMP) -LIB_DEPENDS+= netsnmp.30:${PORTSDIR}/net-mgmt/net-snmp +.if ${PORT_OPTIONS:MSNMP} +LIB_DEPENDS+= netsnmp:${PORTSDIR}/net-mgmt/net-snmp CONFIGURE_ARGS+=--enable-snmp PLIST_SUB+= SNMP="" .else @@ -368,8 +380,8 @@ CONFIGURE_ARGS+=--disable-snmp PLIST_SUB+= SNMP="@comment " .endif -.if defined(WITH_TOKYOTYRANT) -LIB_DEPENDS+= tokyotyrant.3:${PORTSDIR}/databases/tokyotyrant +.if ${PORT_OPTIONS:MTOKYOTYRANT} +LIB_DEPENDS+= tokyotyrant:${PORTSDIR}/databases/tokyotyrant CONFIGURE_ARGS+=--enable-tokyotyrant CONFIGURE_ARGS+=--with-libtokyotyrant=${LOCALBASE} PLIST_SUB+= TOKYOTYRANT="" @@ -378,8 +390,25 @@ CONFIGURE_ARGS+=--disable-tokyotyrant --without-libtokyotyrant PLIST_SUB+= TOKYOTYRANT="@comment " .endif -.if defined(WITH_XMMS) -LIB_DEPENDS+= xmms.4:${PORTSDIR}/multimedia/xmms +.if ${PORT_OPTIONS:MVIRT} +CONFIGURE_ARGS+=--enable-libvirt +LIB_DEPENDS+= virt:${PORTSDIR}/devel/libvirt +PLIST_SUB+= VIRT="" +.else +CONFIGURE_ARGS+=--disable-libvirt +PLIST_SUB+= VIRT="@comment " +.endif + +.if ${PORT_OPTIONS:MWRITE_HTTP} +CONFIGURE_ARGS+=--enable-write_http +PLIST_SUB+= WRITE_HTTP="" +.else +CONFIGURE_ARGS+=--disable-write_http +PLIST_SUB+= WRITE_HTTP="@comment " +.endif + +.if ${PORT_OPTIONS:MXMMS} +LIB_DEPENDS+= xmms:${PORTSDIR}/multimedia/xmms CONFIGURE_ARGS+=--enable-xmms CFLAGS+= `xmms-config --cflags` PLIST_SUB+= XMMS="" @@ -416,7 +445,7 @@ post-install: ${CP} -p ${PREFIX}/etc/collectd.conf.sample \ ${PREFIX}/etc/collectd.conf ; \ fi -.if defined(WITH_CGI) +.if ${PORT_OPTIONS:MCGI} ${MKDIR} ${WWWDIR} ${INSTALL_SCRIPT} ${WRKSRC}/contrib/collection.cgi ${WWWDIR}/ ${INSTALL_DATA} ${WRKSRC}/contrib/collection.conf \ diff --git a/net-mgmt/collectd/files/patch-src__network.c b/net-mgmt/collectd/files/patch-src__network.c index e85ff96bb54b..b037bd523d55 100644 --- a/net-mgmt/collectd/files/patch-src__network.c +++ b/net-mgmt/collectd/files/patch-src__network.c @@ -10,3 +10,32 @@ GCRY_THREAD_OPTION_PTHREAD_IMPL; #endif +--- src/network.c ++++ src/network.c +@@ -704,7 +704,7 @@ static int parse_part_values (void **ret_buffer, size_t *ret_buffer_len, + + exp_size = 3 * sizeof (uint16_t) + + pkg_numval * (sizeof (uint8_t) + sizeof (value_t)); +- if ((buffer_len < 0) || (buffer_len < exp_size)) ++ if (buffer_len < exp_size) + { + WARNING ("network plugin: parse_part_values: " + "Packet too short: " +@@ -789,7 +789,7 @@ static int parse_part_number (void **ret_buffer, size_t *ret_buffer_len, + + uint16_t pkg_length; + +- if ((buffer_len < 0) || ((size_t) buffer_len < exp_size)) ++ if (buffer_len < exp_size) + { + WARNING ("network plugin: parse_part_number: " + "Packet too short: " +@@ -828,7 +828,7 @@ static int parse_part_string (void **ret_buffer, size_t *ret_buffer_len, + + uint16_t pkg_length; + +- if ((buffer_len < 0) || (buffer_len < header_size)) ++ if (buffer_len < header_size) + { + WARNING ("network plugin: parse_part_string: " + "Packet too short: " diff --git a/net-mgmt/collectd/pkg-plist b/net-mgmt/collectd/pkg-plist index 52d063e60a5a..565c06cfe296 100644 --- a/net-mgmt/collectd/pkg-plist +++ b/net-mgmt/collectd/pkg-plist @@ -101,11 +101,15 @@ lib/collectd/uptime.so lib/collectd/uptime.la lib/collectd/uuid.so lib/collectd/uuid.la +%%VIRT%%lib/collectd/libvirt.la +%%VIRT%%lib/collectd/libvirt.so +%%WRITE_HTTP%%lib/collectd/write_http.la +%%WRITE_HTTP%%lib/collectd/write_http.so +%%XMMS%%lib/collectd/xmms.la +%%XMMS%%lib/collectd/xmms.so include/collectd/client.h include/collectd/lcc_features.h libdata/pkgconfig/libcollectdclient.pc -%%XMMS%%lib/collectd/xmms.la -%%XMMS%%lib/collectd/xmms.so %%DATADIR%%/postgresql_default.conf %%DATADIR%%/types.db @dirrm lib/collectd -- cgit