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