collectd: Enable parallel build
[packages.git] / utils / collectd / Makefile
1 #
2 # Copyright (C) 2006-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=collectd
11 PKG_VERSION:=4.9.1
12 PKG_RELEASE:=3
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=http://collectd.org/files/
16 PKG_MD5SUM:=5753496651c8c84afaea1fe290876bfc
17
18 PKG_FIXUP:=libtool
19 PKG_INSTALL:=1
20 PKG_BUILD_PARALLEL:=1
21
22 COLLECTD_PLUGINS_DISABLED:= \
23         apple_sensors \
24         battery \
25         cpufreq \
26         curl_json \
27         entropy \
28         genericjmx \
29         gmond \
30         hddtemp \
31         ipmi \
32         ipvs \
33         java \
34         libvirt \
35         mbmon \
36         memcachec \
37         memcached \
38         monitorus \
39         multimeter \
40         netapp \
41         nfs \
42         notify_desktop \
43         notify_email \
44         openvz \
45         oracle \
46         perl \
47         python \
48         routeros \
49         rrdcached \
50         serial \
51         swap \
52         tape \
53         tokyotyrant \
54         uuid \
55         vserver \
56         xmms \
57         zfs_arc \
58
59 COLLECTD_PLUGINS_SELECTED:= \
60         apache \
61         apcups \
62         ascent \
63         bind \
64         conntrack \
65         contextswitch \
66         cpu \
67         csv \
68         curl \
69         dbi \
70         df \
71         disk \
72         dns \
73         email \
74         exec \
75         filecount \
76         fscache \
77         interface \
78         iptables \
79         irq \
80         load \
81         logfile \
82         madwifi \
83         memory \
84         mysql \
85         netlink \
86         network \
87         nginx \
88         ntpd \
89         nut \
90         olsrd \
91         onewire \
92         openvpn \
93         ping \
94         postgresql \
95         powerdns \
96         processes \
97         protocols \
98         rrdtool \
99         sensors \
100         snmp \
101         syslog \
102         tail \
103         table \
104         ted \
105         tcpconns \
106         teamspeak2 \
107         thermal \
108         unixsock \
109         uptime \
110         users \
111         vmem \
112         wireless \
113         write_http \
114
115 PKG_CONFIG_DEPENDS:= \
116         $(patsubst %,CONFIG_PACKAGE_collectd-mod-%,$(subst _,-,$(COLLECTD_PLUGINS_SELECTED))) \
117
118 include $(INCLUDE_DIR)/package.mk
119 include $(INCLUDE_DIR)/kernel.mk
120
121 define Package/collectd/Default
122   SECTION:=utils
123   CATEGORY:=Utilities
124   TITLE:=Lightweight system statistics collection daemon
125   URL:=http://verplant.org/collectd/
126 endef
127
128 define Package/collectd
129 $(call Package/collectd/Default)
130   DEPENDS:= +libpthread +zlib
131   MENU:=1
132 endef
133
134 define Package/collectd/description
135  collectd is a small daemon which collects system information periodically
136  and provides mechanismns to store the values in a variety of ways.
137 endef
138
139 ifneq ($(CONFIG_avr32),)
140   TARGET_CFLAGS += -fsigned-char
141 endif
142
143 # common configure args
144 CONFIGURE_ARGS+= \
145         --disable-debug \
146         --enable-daemon \
147         --enable-getifaddrs \
148         --with-nan-emulation \
149
150 CONFIGURE_VARS+= \
151         CFLAGS="$$$$CFLAGS $(FPIC)" \
152         LDFLAGS="$$$$LDFLAGS -lm -lz" \
153         KERNEL_DIR="$(LINUX_DIR)" \
154
155 CONFIGURE_PLUGIN= \
156         $(foreach m, $(1), \
157                 $(if $(CONFIG_PACKAGE_collectd-mod-$(subst _,-,$(m))),--enable-$(m),--disable-$(m)) \
158         )
159
160 CONFIGURE_ARGS+= \
161         $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_SELECTED)) \
162         $(call CONFIGURE_PLUGIN,$(COLLECTD_PLUGINS_DISABLED)) \
163
164 # exception: mod-ascent needs libxml2
165 ifneq ($(CONFIG_PACKAGE_collectd-mod-ascent),)
166   CONFIGURE_VARS+= \
167         CPPFLAGS="$$$$CPPFLAGS -I$(STAGING_DIR)/usr/include/libxml2"
168 endif
169
170 ifneq ($(CONFIG_BIG_ENDIAN),)
171   CONFIGURE_ARGS+= --with-fp-layout=endianflip
172 else
173   CONFIGURE_ARGS+= --with-fp-layout=nothing
174 endif
175
176 ifneq ($(CONFIG_PACKAGE_collectd-mod-postgresql),)
177   CONFIGURE_ARGS+= --with-libpq="$(STAGING_DIR)/usr/"
178 endif
179
180 ifneq ($(CONFIG_PACKAGE_collectd-mod-mysql),)
181   CONFIGURE_ARGS+= --with-libmysql="$(STAGING_DIR)/usr/"
182 endif
183
184 # exception: mod-netlink needs libnetlink from iproute
185 ifneq ($(CONFIG_PACKAGE_collectd-mod-netlink),)
186   CONFIGURE_ARGS+= --with-libnetlink="$(STAGING_DIR)/usr"
187 endif
188
189 # exception: mod-onewire needs libow-capi
190 ifneq ($(CONFIG_PACKAGE_collectd-mod-onewire),)
191   CONFIGURE_ARGS+= --with-libowcapi="$(STAGING_DIR)/usr"
192 endif
193
194 # exception: mod-rrdtool needs rrdtool-1.0.x
195 ifneq ($(CONFIG_PACKAGE_collectd-mod-rrdtool),)
196   CONFIGURE_ARGS+= --with-librrd="$(STAGING_DIR)/usr/lib/rrdtool-1.0"
197 endif
198
199 define Package/collectd/conffiles
200 /etc/collectd.conf
201 endef
202
203 define Package/collectd/install
204         $(INSTALL_DIR) $(1)/usr/sbin
205         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/collectd $(1)/usr/sbin/
206         $(INSTALL_DIR) $(1)/usr/share/collectd
207         $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/collectd/types.db $(1)/usr/share/collectd/
208         $(INSTALL_DIR) $(1)/etc
209         $(INSTALL_CONF) ./files/collectd.conf $(1)/etc/
210         $(INSTALL_DIR) $(1)/etc/init.d
211         $(INSTALL_BIN) ./files/collectd.init $(1)/etc/init.d/collectd
212 endef
213
214 # 1: plugin name
215 # 2: plugin title/description
216 # 3: files
217 # 4: extra dependency
218 define BuildPlugin
219
220   PKG_CONFIG_DEPENDS+= CONFIG_PACKAGE_collectd-mod-$(1)
221
222   define Package/collectd-mod-$(1)
223   $$(call Package/collectd/Default)
224     TITLE:=$(2) plugin
225     DEPENDS:= collectd $(4)
226   endef
227
228   define Package/collectd-mod-$(1)/install
229         $(INSTALL_DIR) $$(1)/usr/lib/collectd
230         for m in $(3); do \
231                 $(CP) \
232                         $(PKG_INSTALL_DIR)/usr/lib/collectd/$$$$$$$${m}.so \
233                         $$(1)/usr/lib/collectd/ ; \
234         done
235   endef
236
237   $$(eval $$(call BuildPackage,collectd-mod-$(1)))
238
239 endef
240
241 $(eval $(call BuildPackage,collectd))
242
243 #$(eval $(call BuildPlugin,NAME,DESCRIPTION,FILES,DEPENDENCIES))
244 $(eval $(call BuildPlugin,apache,apache status input,apache,+PACKAGE_collectd-mod-apache:libcurl))
245 $(eval $(call BuildPlugin,apcups,apcups status input,apcups,))
246 $(eval $(call BuildPlugin,ascent,ascent status input,ascent,+PACKAGE_collectd-mod-ascent:libcurl +PACKAGE_collectd-mod-ascent:libxml2))
247 $(eval $(call BuildPlugin,bind,BIND server/zone input,bind,+PACKAGE_collectd-mod-bind:libcurl +PACKAGE_collectd-mod-bind:libxml2))
248 $(eval $(call BuildPlugin,conntrack,connection tracking table size input,conntrack,))
249 $(eval $(call BuildPlugin,contextswitch,context switch input,contextswitch,))
250 $(eval $(call BuildPlugin,cpu,CPU input,cpu,))
251 $(eval $(call BuildPlugin,csv,CSV output,csv,))
252 $(eval $(call BuildPlugin,curl,cURL input,curl,+PACKAGE_collectd-mod-curl:libcurl))
253 $(eval $(call BuildPlugin,dbi,relational database input,dbi,+PACKAGE_collectd-mod-dbi:libdbi))
254 $(eval $(call BuildPlugin,df,disk space input,df,))
255 $(eval $(call BuildPlugin,disk,disk usage/timing input,disk,))
256 $(eval $(call BuildPlugin,dns,DNS traffic input,dns,+PACKAGE_collectd-mod-dns:libpcap))
257 $(eval $(call BuildPlugin,email,email output,email,))
258 $(eval $(call BuildPlugin,exec,process exec input,exec,))
259 $(eval $(call BuildPlugin,filecount,file count input,filecount,))
260 $(eval $(call BuildPlugin,fscache,file-system based caching framework input,fscache,))
261 $(eval $(call BuildPlugin,interface,network interfaces input,interface,))
262 $(eval $(call BuildPlugin,iptables,iptables status input,iptables,+PACKAGE_collectd-mod-iptables:iptables @(!LINUX_2_4||BROKEN)))
263 $(eval $(call BuildPlugin,irq,interrupt usage input,irq,))
264 $(eval $(call BuildPlugin,load,system load input,load,))
265 $(eval $(call BuildPlugin,logfile,log files output,logfile,))
266 $(eval $(call BuildPlugin,madwifi,MadWifi status input,madwifi,))
267 $(eval $(call BuildPlugin,mysql,MySQL status input,mysql,+PACKAGE_collectd-mod-mysql:libmysqlclient))
268 $(eval $(call BuildPlugin,memory,physical memory usage input,memory,))
269 $(eval $(call BuildPlugin,netlink,netlink input,netlink,+PACKAGE_collectd-mod-netlink:ip @(!LINUX_2_4||BROKEN)))
270 $(eval $(call BuildPlugin,network,network input/output,network))
271 $(eval $(call BuildPlugin,nginx,nginx status input,nginx,+PACKAGE_collectd-mod-nginx:libcurl))
272 $(eval $(call BuildPlugin,ntpd,NTP daemon status input,ntpd,))
273 $(eval $(call BuildPlugin,nut,UPS monitoring input,nut,@BROKEN))
274 $(eval $(call BuildPlugin,olsrd,OLSRd status input,olsrd,))
275 $(eval $(call BuildPlugin,onewire,onewire sensor input,onewire,+PACKAGE_collectd-mod-onewire:libow-capi @BROKEN))
276 $(eval $(call BuildPlugin,openvpn,OpenVPN traffic/compression input,openvpn,))
277 $(eval $(call BuildPlugin,ping,ping status input,ping,+PACKAGE_collectd-mod-ping:liboping))
278 $(eval $(call BuildPlugin,postgresql,PostgreSQL status input,postgresql,+PACKAGE_collectd-mod-postgresql:libpq))
279 $(eval $(call BuildPlugin,powerdns,PowerDNS server status input,powerdns,))
280 $(eval $(call BuildPlugin,processes,process status input,processes,))
281 $(eval $(call BuildPlugin,protocols,network protocols input,protocols,))
282 $(eval $(call BuildPlugin,rrdtool,RRDtool output,rrdtool,+PACKAGE_collectd-mod-rrdtool:librrd1))
283 $(eval $(call BuildPlugin,sensors,lm_sensors input,sensors,+PACKAGE_collectd-mod-sensors:libsensors @BROKEN))
284 $(eval $(call BuildPlugin,snmp,SNMP input,snmp,+PACKAGE_collectd-mod-snmp:libnetsnmp))
285 $(eval $(call BuildPlugin,syslog,syslog output,syslog,))
286 $(eval $(call BuildPlugin,tail,tail input,tail,))
287 $(eval $(call BuildPlugin,table,table-like structured file input,table,))
288 $(eval $(call BuildPlugin,teamspeak2,TeamSpeak2 input,teamspeak2,))
289 $(eval $(call BuildPlugin,ted,The Energy Detective input,ted,@((!TARGET_avr32)||BROKEN))) # fails on avr32 because of warnings treated as errors
290 $(eval $(call BuildPlugin,tcpconns,TCP connection tracking input,tcpconns,))
291 $(eval $(call BuildPlugin,thermal,system temperatures input,thermal,))
292 $(eval $(call BuildPlugin,unixsock,unix socket output,unixsock,))
293 $(eval $(call BuildPlugin,uptime,uptime status input,uptime,))
294 $(eval $(call BuildPlugin,users,user logged in status input,users,))
295 $(eval $(call BuildPlugin,vmem,virtual memory usage input,vmem,))
296 $(eval $(call BuildPlugin,wireless,wireless status input,wireless,))
297 $(eval $(call BuildPlugin,write-http,HTTP POST output,write_http,+PACKAGE_collectd-mod-write-http:libcurl))