- Stage support

- USES=libtool
- Use new LIB_DEPENDS format
- Create database directory during startup rather than in the package

PR:		ports/189769
Submitted by:	Krzysztof Stryjek <ports@bsdserwis.com>
This commit is contained in:
Tim Bishop 2014-05-23 19:32:36 +00:00
parent dac9b152b4
commit cf849cc8c7
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=354958
5 changed files with 71 additions and 106 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= collectd
PORTVERSION= 4.10.9
PORTREVISION= 6
PORTREVISION= 7
CATEGORIES= net-mgmt
MASTER_SITES= http://collectd.org/files/
@ -12,7 +12,7 @@ COMMENT= Systems & network statistics collection daemon
LICENSE= GPLv2
USE_GMAKE= yes
USES= gmake libtool
GNU_CONFIGURE= yes
USE_AUTOTOOLS= autoconf autoheader automake libltdl
WANT_GNOME= yes
@ -54,10 +54,6 @@ 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 \
collectd-snmp.5 collectd-unixsock.5 collectd-perl.5 \
collectd-java.5 collectd-python.5 types.db.5
USE_RC_SUBR= collectd collectdmon
USE_LDCONFIG= yes
@ -67,7 +63,6 @@ CONFLICTS= collectd-5.[0-9]*
CPPFLAGS+= -I${LOCALBASE}/include
LDFLAGS+= -L${LOCALBASE}/lib
NO_STAGE= yes
.include <bsd.port.options.mk>
# NOTE: Feel free to submit patches adding support for any of these
@ -153,8 +148,8 @@ PLIST_SUB+= CGI="@comment "
.if ${PORT_OPTIONS:MBIND}
CONFIGURE_ARGS+=--enable-bind
LIB_DEPENDS+= curl:${PORTSDIR}/ftp/curl
LIB_DEPENDS+= xml2:${PORTSDIR}/textproc/libxml2
LIB_DEPENDS+= libcurl.so:${PORTSDIR}/ftp/curl
LIB_DEPENDS+= libxml2.so:${PORTSDIR}/textproc/libxml2
PLIST_SUB+= BIND=""
. if empty(PORT_OPTIONS:MCURL)
IGNORE= BIND requires CURL. Either select CURL or deselect BIND
@ -166,7 +161,7 @@ PLIST_SUB+= BIND="@comment "
.if ${PORT_OPTIONS:MAPACHE}
CONFIGURE_ARGS+=--enable-apache
LIB_DEPENDS+= curl:${PORTSDIR}/ftp/curl
LIB_DEPENDS+= libcurl.so:${PORTSDIR}/ftp/curl
PLIST_SUB+= APACHE=""
. if empty(PORT_OPTIONS:MCURL)
IGNORE= APACHE requires CURL. Either select CURL or deselect APACHE
@ -187,7 +182,7 @@ PLIST_SUB+= APCUPS="@comment "
.if ${PORT_OPTIONS:MCURL}
CONFIGURE_ARGS+=--enable-curl --with-libcurl=${LOCALBASE}
LIB_DEPENDS+= curl:${PORTSDIR}/ftp/curl
LIB_DEPENDS+= libcurl.so:${PORTSDIR}/ftp/curl
PLIST_SUB+= CURL=""
.else
CONFIGURE_ARGS+=--disable-curl
@ -199,7 +194,7 @@ PLIST_SUB+= CURL="@comment "
IGNORE= using CURL_JSON requires CURL support
.endif
CONFIGURE_ARGS+=--enable-curl_json
LIB_DEPENDS+= yajl:${PORTSDIR}/devel/yajl
LIB_DEPENDS+= libyajl.so:${PORTSDIR}/devel/yajl
PLIST_SUB+= CURL_JSON=""
.else
CONFIGURE_ARGS+=--disable-curl_json --without-libyajl
@ -211,7 +206,7 @@ PLIST_SUB+= CURL_JSON="@comment "
IGNORE= using CURL_XML requires CURL support
.endif
CONFIGURE_ARGS+=--enable-curl_xml
LIB_DEPENDS+= xml2:${PORTSDIR}/textproc/libxml2
LIB_DEPENDS+= libxml2.so:${PORTSDIR}/textproc/libxml2
PLIST_SUB+= CURL_XML=""
.else
CONFIGURE_ARGS+=--disable-curl_xml
@ -220,7 +215,7 @@ PLIST_SUB+= CURL_XML="@comment "
.if ${PORT_OPTIONS:MDBI}
CONFIGURE_ARGS+=--enable-dbi --with-libdbi=${LOCALBASE}
LIB_DEPENDS+= dbi:${PORTSDIR}/databases/libdbi
LIB_DEPENDS+= libdbi.so:${PORTSDIR}/databases/libdbi
PLIST_SUB+= DBI=""
.else
CONFIGURE_ARGS+=--disable-dbi
@ -237,12 +232,12 @@ PLIST_SUB+= DISK="@comment "
.if ${PORT_OPTIONS:MGCRYPT}
CONFIGURE_ARGS+=--with-libgcrypt-prefix=${LOCALBASE}
LIB_DEPENDS+= gcrypt:${PORTSDIR}/security/libgcrypt
LIB_DEPENDS+= libgcrypt.so:${PORTSDIR}/security/libgcrypt
.endif
.if ${PORT_OPTIONS:MNUTUPS}
CONFIGURE_ARGS+=--enable-nut --with-upsclient
LIB_DEPENDS+= upsclient:${PORTSDIR}/sysutils/nut
LIB_DEPENDS+= libupsclient.so:${PORTSDIR}/sysutils/nut
PLIST_SUB+= NUTUPS=""
.else
CONFIGURE_ARGS+=--disable-nut --without-libupsclient
@ -270,7 +265,7 @@ PLIST_SUB+= MBMON="@comment "
.endif
.if ${PORT_OPTIONS:MMEMCACHED}
LIB_DEPENDS+= memcached:${PORTSDIR}/databases/libmemcached
LIB_DEPENDS+= libmemcached.so:${PORTSDIR}/databases/libmemcached
CONFIGURE_ARGS+=--enable-memcached
CONFIGURE_ARGS+=--with-libmemcached=${LOCALBASE}
PLIST_SUB+= MEMCACHED=""
@ -289,7 +284,7 @@ PLIST_SUB+= MYSQL="@comment "
.endif
.if ${PORT_OPTIONS:MNGINX}
LIB_DEPENDS+= curl:${PORTSDIR}/ftp/curl
LIB_DEPENDS+= libcurl.so:${PORTSDIR}/ftp/curl
CONFIGURE_ARGS+=--enable-nginx
PLIST_SUB+= NGINX=""
. if empty(PORT_OPTIONS:MCURL)
@ -301,15 +296,16 @@ PLIST_SUB+= NGINX="@comment "
.endif
.if ${PORT_OPTIONS:MNOTIFYDESKTOP}
LIB_DEPENDS+= notify:${PORTSDIR}/devel/libnotify
CONFIGURE_ARGS+=--enable-notify_desktop \
LIB_DEPENDS+= libnotify.so:${PORTSDIR}/devel/libnotify
CONFIGURE_ARGS+=--enable-notify_desktop
PLIST_SUB+= NOTIFYDESKTOP=""
.else
CONFIGURE_ARGS+=--disable-notify_desktop
PLIST_SUB+= NOTIFYDESKTOP="@comment "
.endif
.if ${PORT_OPTIONS:MNOTIFYEMAIL}
LIB_DEPENDS+= esmtp:${PORTSDIR}/mail/libesmtp
LIB_DEPENDS+= libesmtp.so:${PORTSDIR}/mail/libesmtp
CONFIGURE_ARGS+=--enable-notify_email
CONFIGURE_ARGS+=--with-libesmtp=${PREFIX}
PLIST_SUB+= NOTIFYEMAIL=""
@ -346,7 +342,7 @@ PLIST_SUB+= PGSQL="@comment "
.endif
.if ${PORT_OPTIONS:MPING}
LIB_DEPENDS+= oping:${PORTSDIR}/net/liboping
LIB_DEPENDS+= liboping.so:${PORTSDIR}/net/liboping
CONFIGURE_ARGS+=--enable-ping
PLIST_SUB+= PING=""
.else
@ -356,7 +352,7 @@ PLIST_SUB+= PING="@comment "
.if ${PORT_OPTIONS:MPYTHON}
USE_PYTHON= yes
CONFIGURE_ARGS+=--enable-python
CONFIGURE_ARGS+=--enable-python --with-python=${PYTHON_CMD}
PLIST_SUB+= PYTHON=""
.else
CONFIGURE_ARGS+=--disable-python
@ -364,7 +360,7 @@ PLIST_SUB+= PYTHON="@comment "
.endif
.if ${PORT_OPTIONS:MROUTEROS}
LIB_DEPENDS+= routeros:${PORTSDIR}/net/librouteros
LIB_DEPENDS+= librouteros.so:${PORTSDIR}/net/librouteros
CONFIGURE_ARGS+=--enable-routeros --with-librouteros=${LOCALBASE}
PLIST_SUB+= ROUTEROS=""
.else
@ -373,7 +369,7 @@ PLIST_SUB+= ROUTEROS="@comment "
.endif
.if ${PORT_OPTIONS:MRRDTOOL}
LIB_DEPENDS+= rrd:${PORTSDIR}/databases/rrdtool
LIB_DEPENDS+= librrd.so:${PORTSDIR}/databases/rrdtool
CONFIGURE_ARGS+=--enable-rrdtool
PLIST_SUB+= RRD=""
.else
@ -390,7 +386,7 @@ PLIST_SUB+= RRDCACHED="@comment "
.endif
.if ${PORT_OPTIONS:MSNMP}
LIB_DEPENDS+= netsnmp:${PORTSDIR}/net-mgmt/net-snmp
LIB_DEPENDS+= libnetsnmp.so:${PORTSDIR}/net-mgmt/net-snmp
CONFIGURE_ARGS+=--enable-snmp
PLIST_SUB+= SNMP=""
.else
@ -399,7 +395,7 @@ PLIST_SUB+= SNMP="@comment "
.endif
.if ${PORT_OPTIONS:MTOKYOTYRANT}
LIB_DEPENDS+= tokyotyrant:${PORTSDIR}/databases/tokyotyrant
LIB_DEPENDS+= libtokyotyrant.so:${PORTSDIR}/databases/tokyotyrant
CONFIGURE_ARGS+=--enable-tokyotyrant
CONFIGURE_ARGS+=--with-libtokyotyrant=${LOCALBASE}
PLIST_SUB+= TOKYOTYRANT=""
@ -426,7 +422,7 @@ PLIST_SUB+= WRITE_HTTP="@comment "
.endif
.if ${PORT_OPTIONS:MXMMS}
LIB_DEPENDS+= xmms:${PORTSDIR}/multimedia/xmms
LIB_DEPENDS+= libxmms.so:${PORTSDIR}/multimedia/xmms
CONFIGURE_ARGS+=--enable-xmms
CFLAGS+= `xmms-config --cflags`
PLIST_SUB+= XMMS=""
@ -445,7 +441,8 @@ post-patch:
-e 's;@prefix@/var/;/var/;' \
-e 's;/var/lib/;/var/db/;' \
${WRKSRC}/src/collectd.conf.in
@${REINPLACE_CMD} -e '/$$[(]mkinstalldirs)/d' ${WRKSRC}/Makefile.in
@${REINPLACE_CMD} -e '/\$$[(]mkinstalldirs)/d' ${WRKSRC}/Makefile.in \
${WRKSRC}/Makefile.am
@${REINPLACE_CMD} \
-e 's;/etc/collection\.conf;${WWWDIR}/collection.conf;' \
${WRKSRC}/contrib/collection.cgi
@ -458,20 +455,11 @@ post-patch:
${WRKSRC}/configure.in
post-install:
${MKDIR} /var/db/collectd
if [ ! -f ${PREFIX}/etc/collectd.conf ]; then \
${CP} -p ${PREFIX}/etc/collectd.conf.sample \
${PREFIX}/etc/collectd.conf ; \
fi
.if ${PORT_OPTIONS:MCGI}
${MKDIR} ${WWWDIR}
${INSTALL_SCRIPT} ${WRKSRC}/contrib/collection.cgi ${WWWDIR}/
${MKDIR} ${STAGEDIR}${WWWDIR}
${INSTALL_SCRIPT} ${WRKSRC}/contrib/collection.cgi ${STAGEDIR}${WWWDIR}/
${INSTALL_DATA} ${WRKSRC}/contrib/collection.conf \
${WWWDIR}/collection.conf.sample
if [ ! -f ${WWWDIR}/collection.conf ]; then \
${CP} -p ${WWWDIR}/collection.conf.sample \
${WWWDIR}/collection.conf ; \
fi
${STAGEDIR}${WWWDIR}/collection.conf.sample
.endif
.include <bsd.port.mk>

View File

@ -19,8 +19,18 @@ rcvar=collectd_enable
command=%%PREFIX%%/sbin/${name}
_dbdir=/var/db/collectd
start_precmd="collectdmon_prepcmd"
load_rc_config $name
: ${collectd_enable="NO"}
collectdmon_prepcmd()
{
if [ ! -d ${_dbdir} ] ; then
mkdir -p ${_dbdir}
fi
}
run_rc_command "$1"

View File

@ -19,9 +19,19 @@ rcvar=collectdmon_enable
command=%%PREFIX%%/sbin/${name}
_dbdir=/var/db/collectd
start_precmd="collectd_prepcmd"
load_rc_config $name
: ${collectdmon_enable="NO"}
: ${collectdmon_flags="-c %%PREFIX%%/sbin/collectd"}
collectd_prepcmd()
{
if [ ! -d ${_dbdir} ] ; then
mkdir -p ${_dbdir}
fi
}
run_rc_command "$1"

View File

@ -1,6 +1,6 @@
--- ./src/collectd.h.orig 2007-09-28 17:55:34.000000000 +0300
+++ ./src/collectd.h 2008-05-06 10:32:08.000000000 +0300
@@ -183,7 +183,7 @@
--- src/collectd.h.orig 2013-04-08 08:26:17.000000000 +0200
+++ src/collectd.h 2014-05-22 22:08:39.288743891 +0200
@@ -244,15 +244,15 @@
#endif
#ifndef LOCALSTATEDIR
@ -9,7 +9,8 @@
#endif
#ifndef PKGLOCALSTATEDIR
@@ -191,7 +191,7 @@
-#define PKGLOCALSTATEDIR PREFIX "/var/lib/" PACKAGE_NAME
+#define PKGLOCALSTATEDIR "/var/db/" PACKAGE_NAME
#endif
#ifndef PIDFILE

View File

@ -1,125 +1,81 @@
@stopdaemon collectd
sbin/collectd
sbin/collectdmon
@unexec if cmp -s %D/etc/collectd.conf.sample %D/etc/collectd.conf; then rm -f %D/etc/collectd.conf; fi
etc/collectd.conf.sample
@exec if [ ! -f %B/collectd.conf ] ; then cp -p %B/%f %B/collectd.conf; fi
@sample etc/collectd.conf.sample
%%CGI%%%%WWWDIR%%/collection.cgi
%%CGI%%@unexec if cmp -s %B/collection.conf.sample %B/collection.conf; then rm -f %B/collection.conf; fi
%%CGI%%%%WWWDIR%%/collection.conf.sample
%%CGI%%@exec if [ ! -f %B/collection.conf ] ; then cp -p %B/%f %B/collection.conf; fi
%%CGI%%@sample %%WWWDIR%%/collection.conf.sample
%%CGI%%@dirrmtry %%WWWDIR%%
bin/collectd-nagios
lib/libcollectdclient.la
lib/libcollectdclient.so
lib/libcollectdclient.so.0
%%APACHE%%lib/collectd/apache.la
lib/libcollectdclient.so.0.0.0
%%APACHE%%lib/collectd/apache.so
%%APCUPS%%lib/collectd/apcups.la
%%APCUPS%%lib/collectd/apcups.so
%%BIND%%lib/collectd/bind.la
%%BIND%%lib/collectd/bind.so
lib/collectd/cpu.la
lib/collectd/cpu.so
lib/collectd/csv.la
lib/collectd/csv.so
%%CURL%%lib/collectd/curl.la
%%CURL%%lib/collectd/curl.so
%%CURL_JSON%%lib/collectd/curl_json.la
%%CURL_JSON%%lib/collectd/curl_json.so
%%CURL_XML%%lib/collectd/curl_xml.la
%%CURL_XML%%lib/collectd/curl_xml.so
%%DBI%%lib/collectd/dbi.la
%%DBI%%lib/collectd/dbi.so
%%DISK%%lib/collectd/disk.la
%%DISK%%lib/collectd/disk.so
lib/collectd/df.la
lib/collectd/df.so
lib/collectd/dns.la
lib/collectd/dns.so
lib/collectd/email.la
lib/collectd/email.so
lib/collectd/exec.la
lib/collectd/exec.so
lib/collectd/filecount.so
lib/collectd/filecount.la
%%INTERFACE%%lib/collectd/interface.la
%%INTERFACE%%lib/collectd/interface.so
lib/collectd/load.la
lib/collectd/load.so
lib/collectd/logfile.la
lib/collectd/logfile.so
%%MBMON%%lib/collectd/mbmon.la
%%MBMON%%lib/collectd/mbmon.so
%%MEMCACHED%%lib/collectd/memcached.la
%%MEMCACHED%%lib/collectd/memcached.so
lib/collectd/memory.la
lib/collectd/memory.so
%%MYSQL%%lib/collectd/mysql.la
%%MYSQL%%lib/collectd/mysql.so
%%NGINX%%lib/collectd/nginx.la
%%NGINX%%lib/collectd/nginx.so
lib/collectd/network.la
lib/collectd/network.so
%%NOTIFYDESKTOP%%/notify_desktop.la
%%NOTIFYDESKTOP%%/notify_desktop.so
%%NOTIFYEMAIL%%/notify_email.la
%%NOTIFYEMAIL%%/notify_email.so
%%NUTUPS%%lib/collectd/nut.la
%%NOTIFYDESKTOP%%lib/collectd/notify_desktop.so
%%NOTIFYEMAIL%%lib/collectd/notify_email.so
%%NUTUPS%%lib/collectd/nut.so
lib/collectd/ntpd.la
lib/collectd/ntpd.so
%%OPENVPN%%lib/collectd/openvpn.la
%%OPENVPN%%lib/collectd/openvpn.so
%%PGSQL%%lib/collectd/postgresql.la
%%PGSQL%%lib/collectd/postgresql.so
%%PING%%lib/collectd/ping.la
%%PING%%lib/collectd/ping.so
%%PDNS%%lib/collectd/powerdns.so
%%PDNS%%lib/collectd/powerdns.la
%%PYTHON%%lib/collectd/python.la
%%PYTHON%%lib/collectd/python.so
lib/collectd/processes.so
lib/collectd/processes.la
%%ROUTEROS%%lib/collectd/routeros.la
%%ROUTEROS%%lib/collectd/routeros.so
%%RRD%%lib/collectd/rrdtool.la
%%RRD%%lib/collectd/rrdtool.so
%%RRDCACHED%%lib/collectd/rrdcached.la
%%RRDCACHED%%lib/collectd/rrdcached.so
%%SNMP%%lib/collectd/snmp.la
%%SNMP%%lib/collectd/snmp.so
lib/collectd/swap.la
lib/collectd/swap.so
lib/collectd/syslog.la
lib/collectd/syslog.so
lib/collectd/tail.so
lib/collectd/tail.la
lib/collectd/tcpconns.so
lib/collectd/tcpconns.la
%%TOKYOTYRANT%%lib/collectd/tokyotyrant.la
%%TOKYOTYRANT%%lib/collectd/tokyotyrant.so
lib/collectd/unixsock.la
lib/collectd/unixsock.so
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
lib/collectd/zfs_arc.la
lib/collectd/zfs_arc.so
include/collectd/client.h
include/collectd/lcc_features.h
libdata/pkgconfig/libcollectdclient.pc
man/man1/collectd-nagios.1.gz
man/man1/collectd.1.gz
man/man1/collectdmon.1.gz
man/man5/collectd-email.5.gz
man/man5/collectd-exec.5.gz
man/man5/collectd-java.5.gz
man/man5/collectd-perl.5.gz
man/man5/collectd-python.5.gz
man/man5/collectd-snmp.5.gz
man/man5/collectd-unixsock.5.gz
man/man5/collectd.conf.5.gz
man/man5/types.db.5.gz
%%DATADIR%%/postgresql_default.conf
%%DATADIR%%/types.db
@dirrm lib/collectd
@dirrm include/collectd
@dirrm %%DATADIR%%
@exec mkdir -p /var/db/collectd
@unexec rmdir /var/db/collectd 2>/dev/null || true