9
|
1 # Copyright 1999-2008 Gentoo Foundation
|
|
2 # Distributed under the terms of the GNU General Public License v2
|
|
3 # $Header: $
|
|
4
|
|
5 inherit eutils linux-info flag-o-matic
|
|
6
|
|
7 DESCRIPTION="A small daemon which collects system performance statistics"
|
|
8 HOMEPAGE="http://collectd.org/"
|
|
9
|
|
10 SRC_URI="${HOMEPAGE}/files/${P}.tar.bz2"
|
|
11 LICENSE="GPL-2"
|
|
12
|
|
13 SLOT="0"
|
|
14
|
|
15 KEYWORDS="~x86 ~amd64"
|
|
16 IUSE="
|
|
17 apache2
|
|
18 lighttpd
|
|
19 nginx
|
|
20 apcups
|
|
21 hddtemp
|
|
22 network
|
|
23 dns
|
|
24 email
|
|
25 qemu
|
|
26 xen
|
|
27 vserver
|
|
28 memcache
|
|
29 mysql
|
|
30 nfs
|
|
31 ntp
|
|
32 nut
|
|
33 perl
|
|
34 rrdtool
|
|
35 lm_sensors
|
|
36 snmp
|
|
37 syslog
|
|
38 hal
|
|
39 ithreads
|
|
40 "
|
|
41
|
|
42 DEPEND="
|
|
43 apache2? ( >=net-misc/curl-7.17.0 )
|
|
44 lighttpd? ( >=net-misc/curl-7.17.0 )
|
|
45 nginx? ( >=net-misc/curl-7.17.0 )
|
|
46 dns? ( >=net-libs/libpcap-0.9.8 )
|
|
47 qemu? ( >=app-emulation/libvirt-0.3.3 )
|
|
48 xen? ( >=app-emulation/libvirt-0.3.3 )
|
|
49 mysql? ( >=virtual/mysql-5.0 )
|
|
50 perl? ( >=dev-lang/perl-5.8.8-r4 )
|
|
51 nut? ( >=sys-power/nut-2.2.0 )
|
|
52 rrdtool? ( >=net-analyzer/rrdtool-1.2.27 )
|
|
53 lm_sensors? ( >=sys-apps/lm_sensors-2.10.4 )
|
|
54 snmp? ( >=net-analyzer/net-snmp-5.4.1-r3 )
|
|
55 hal? ( >=sys-apps/hal-0.5.9.1-r3 )
|
|
56
|
|
57 >=dev-libs/libxml2-2.6.31
|
|
58 "
|
|
59
|
|
60 RDEPEND="
|
|
61 ${DEPEND}
|
|
62 apcups? ( >=sys-power/apcupsd-3.14.2 )
|
|
63 hddtemp? ( >=app-admin/hddtemp-0.3_beta15-r3 )
|
|
64 memcache? ( >=net-misc/memcached-1.2.2-r2 )
|
|
65 ntp? ( >=net-misc/ntp-4.2.4_p4 )
|
|
66 syslog? ( virtual/logger )
|
|
67 !hal? ( >=sys-apps/dmidecode-2.9 )
|
|
68 "
|
|
69
|
|
70 pkg_setup()
|
|
71 {
|
|
72 linux-info_pkg_setup
|
|
73 }
|
|
74
|
|
75 src_compile()
|
|
76 {
|
|
77 local myconf
|
|
78 local disabled_plugins
|
|
79
|
|
80 ### NEEDS TO BE FIXED PROBABLY
|
|
81 append-flags -I/usr/src/linux/include
|
|
82
|
|
83 #################################################
|
|
84
|
|
85 myconf="${myconf}
|
|
86 --without-libiptc
|
|
87 --with-liboconfig
|
|
88 --with-libpthread
|
|
89 --without-libstatgrab
|
|
90 --without-libxmms
|
|
91 "
|
|
92
|
|
93 ### no checks
|
|
94 myconf="${myconf} --enable-csv"
|
|
95 myconf="${myconf} --enable-df"
|
|
96 myconf="${myconf} --enable-logfile"
|
|
97 myconf="${myconf} --enable-uuid" ## Depends on hal or dmidecode
|
|
98
|
|
99 ### procfs dependents
|
|
100 if ( linux_chkconfig_present PROC_FS ); then
|
|
101 myconf="${myconf} --enable-battery"
|
|
102 if ( !(linux_chkconfig_present ACPI_BATTERY) ); then
|
|
103 ewarn "ACPI_BATTERY needs to be enabled in your kernel for the battery plug-in to work correctly"
|
|
104 fi
|
|
105 myconf="${myconf} --enable-cpu"
|
|
106 myconf="${myconf} --enable-cpufreq"
|
|
107 if ( !(linux_chkconfig_present CPU_FREQ) ); then
|
|
108 ewarn "CPU_FREQ needs to be enabled in your kernel for the cpufreq plug-in to work correctly"
|
|
109 fi
|
|
110 myconf="${myconf} --enable-disk"
|
|
111 myconf="${myconf} --enable-entropy"
|
|
112 myconf="${myconf} --enable-irq"
|
|
113 myconf="${myconf} --enable-load"
|
|
114 myconf="${myconf} --enable-memory"
|
|
115 myconf="${myconf} --enable-processes"
|
|
116 myconf="${myconf} --enable-serial"
|
|
117 if ( !(linux_chkconfig_present SERIAL_CORE) ); then
|
|
118 ewarn "SERIAL_CORE needs to be enabled in your kernel for the serial plug-in to work correctly"
|
|
119 fi
|
|
120 myconf="${myconf} --enable-swap"
|
|
121 if ( !(linux_chkconfig_present SWAP) ); then
|
|
122 ewarn "SWAP needs to be enabled in your kernel for the swap plug-in to work correctly"
|
|
123 fi
|
|
124 myconf="${myconf} --enable-users"
|
|
125
|
|
126 ### Network
|
|
127 myconf="${myconf} $(use_enable network interface)"
|
|
128 #myconf="${myconf} $(use_enable network netlink) $(use_with network libnetlink)" ## BREAKS
|
|
129 myconf="${myconf} --disable-netlink --without-libnetlink"
|
|
130 disabled_plugins="${disabled_plugins} netlink"
|
|
131 myconf="${myconf} $(use_enable network)"
|
|
132 myconf="${myconf} $(use_enable network ping) $(use_with network liboping)"
|
|
133 myconf="${myconf} $(use_enable network tcpconns)"
|
|
134 myconf="${myconf} $(use_enable network unixsock)"
|
|
135 myconf="${myconf} $(use_enable network wireless)" ## NEEDS KERNEL CHECK
|
|
136
|
|
137 if ( use network ); then
|
|
138 myconf="${myconf} $(use_enable dns) $(use_with dns libpcap)"
|
|
139 myconf="${myconf} $(use_enable nfs)"
|
|
140 myconf="${myconf} $(use_enable ntp ntpd)"
|
|
141 myconf="${myconf} $(use_enable snmp) $(use_with snmp libnetsnmp)"
|
|
142 myconf="${myconf} $(use_enable vserver)"
|
|
143 myconf="${myconf} $(use_enable vserver ipvs)" #NEEDS CFLAGS -I -- FIX LATER
|
|
144 if ( (use vserver) && !(linux_chkconfig_present IP_VS) ); then
|
|
145 ewarn "IP_VS should to be enabled in your kernel when the USE flag vserver is enabled"
|
|
146 fi
|
|
147 else
|
|
148 myconf="${myconf} \
|
|
149 --disable-dns --without-libpcap
|
|
150 --disable-nfs
|
|
151 --disable-ntpd
|
|
152 --disable-snmp
|
|
153 --disable-vserver
|
|
154 --disable-ipvs
|
|
155 "
|
|
156 if ( use dns ); then die "The USE flag dns requires that the USE flag network is enabled"; fi
|
|
157 if ( use nfs ); then die "The USE flag nfs requires that the USE flag network is enabled"; fi
|
|
158 if ( use ntp ); then die "The USE flag ntp requires that the USE flag network is enabled"; fi
|
|
159 if ( use snmp ); then die "The USE flag snmp requires that the USE flag network is enabled"; fi
|
|
160 if ( use vserver ); then die "The USE flag vserver requires that the USE flag network is enabled"; fi
|
|
161 fi
|
|
162 else
|
|
163 ### Network
|
|
164 ## if ( use network ); then die "${P} requires that PROC_FS is enabled in the kernel for the USE flag network"; fi
|
|
165
|
|
166 die "${P} requires that PROC_FS is enabled in your kernel" ## UPDATE LATER
|
|
167 fi
|
|
168
|
|
169 ### Web Servers
|
|
170 if ( use apache2 || use lighttpd || use nginx );
|
|
171 then myconf="${myconf} --with-libcurl"
|
|
172 else myconf="${myconf} --without-libcurl"
|
|
173 fi
|
|
174
|
|
175 if ( use apache2 || use lighttpd );
|
|
176 then myconf="${myconf} --enable-apache"
|
|
177 else myconf="${myconf} --disable-apache"
|
|
178 fi
|
|
179
|
|
180 myconf="${myconf} $(use_enable nginx)"
|
|
181
|
|
182 ### APC UPS
|
|
183 myconf="${myconf} $(use_enable apcups)"
|
|
184
|
|
185 ### Apple
|
|
186 myconf="${myconf} --disable-apple_sensors" ## DISABLED
|
|
187 disabled_plugins="${disabled_plugins} apple_sensors"
|
|
188
|
|
189 ### Email
|
|
190 myconf="${myconf} $(use_enable email)"
|
|
191
|
|
192 ### hddtemp
|
|
193 myconf="${myconf} $(use_enable hddtemp)"
|
|
194
|
|
195 ### Virtualization -- NEEDS KERNEL CHECK
|
|
196 if ( use qemu || use xen )
|
|
197 then
|
|
198 myconf="${myconf} --enable-libvirt";
|
|
199 if (built_with_use libvirt qemu); then die "USE flag qemu requires that libvirt was compiled with the USE flag qemu"; fi
|
|
200 if (built_with_use libvirt xen); then die "USE flag xen requires that libvirt was compiled with the USE flag xen"; fi
|
|
201 else
|
|
202 myconf="${myconf} --disable-libvirt";
|
|
203 fi
|
|
204
|
|
205 ### Memcached
|
|
206 myconf="${myconf} $(use_enable memcache memcached)"
|
|
207
|
|
208 ### Mysql
|
|
209 myconf="${myconf} $(use_enable mysql) $(use_with mysql libmysql)"
|
|
210
|
|
211 ### Network UPS
|
|
212 myconf="${myconf} $(use_enable nut) $(use_with nut libupsclient)"
|
|
213
|
|
214 ### Perl
|
|
215 if (use perl); then
|
|
216 myconf="${myconf} $(use_with perl libperl)"
|
|
217 myconf="${myconf} $(use_with perl perl-bindings)"
|
|
218 if (use ithreads); then
|
|
219 if (built_with_use perl ithreads); then myconf="${myconf} --enable-perl"
|
|
220 else die "The perl plug-in requires that libperl was compiled with the USE flag ithreads"; fi
|
|
221 else
|
|
222 myconf="${myconf} --disable-perl"
|
|
223 einfo
|
|
224 einfo "The perl plug-in requires the ithreads USE flag."
|
|
225 fi
|
|
226
|
|
227 fi
|
|
228
|
|
229 ### RRDtool
|
|
230 myconf="${myconf} $(use_enable rrdtool) $(use_with rrdtool)"
|
|
231
|
|
232 ### lm_sensors
|
|
233 myconf="${myconf} $(use_enable lm_sensors sensors) $(use_with lm_sensors lm-sensors)"
|
|
234
|
|
235 ### Syslog
|
|
236 myconf="${myconf} $(use_enable syslog)"
|
|
237
|
|
238 ### DISABLED
|
|
239 myconf="${myconf} --disable-exec" ## NEEDS USERS
|
|
240 disabled_plugins="${disabled_plugins} exec"
|
|
241 myconf="${myconf} --disable-iptables" ## BREAKS
|
|
242 disabled_plugins="${disabled_plugins} iptables"
|
|
243 myconf="${myconf} --disable-mbmon" ## COULD NOT FIND DAEMON
|
|
244 disabled_plugins="${disabled_plugins} mbmon"
|
|
245 myconf="${myconf} --disable-multimeter" ## DISABLED
|
|
246 disabled_plugins="${disabled_plugins} multimeter"
|
|
247 myconf="${myconf} --disable-tape" ## SOLARIS ???
|
|
248 disabled_plugins="${disabled_plugins} tape"
|
|
249 myconf="${myconf} --disable-xmms" ## NOT IN GENTOO
|
|
250 disabled_plugins="${disabled_plugins} xmms"
|
|
251
|
|
252 einfo
|
|
253 einfo "The following plug-ins have been disabled in the ebuild"
|
|
254 einfo ${disabled_plugins}
|
|
255 einfo
|
|
256
|
|
257 ### Configure
|
|
258 econf \
|
|
259 ${myconf} \
|
|
260 --localstatedir=/var \
|
|
261 || die "econf failed"
|
|
262
|
|
263 ### Build
|
|
264 emake \
|
|
265 || die "emake failed"
|
|
266 }
|
|
267
|
|
268 src_install()
|
|
269 {
|
|
270 emake \
|
|
271 DESTDIR="${D}" \
|
|
272 install || die "emake install failed"
|
|
273
|
|
274 ### Documentation
|
|
275 docinto contrib/SpamAssassin
|
|
276 dodoc contrib/SpamAssassin/* \
|
|
277 || die "dodoc contrib failed"
|
|
278
|
|
279 docinto contrib/examples
|
|
280 dodoc contrib/examples/* \
|
|
281 || die "dodoc contrib failed"
|
|
282
|
|
283 docinto contrib/iptables
|
|
284 dodoc contrib/iptables/* \
|
|
285 || die "dodoc contrib failed"
|
|
286 docinto contrib
|
|
287
|
|
288 docinto contrib
|
|
289 dodoc contrib/README contrib/*\.[a-z]* \
|
|
290 || die "dodoc contrib failed"
|
|
291
|
|
292 dodoc AUTHORS ChangeLog NEWS README TODO \
|
|
293 || die "dodoc failed"
|
|
294
|
|
295
|
|
296 keepdir /var/lib/collectd \
|
|
297 || die "keepdir failed"
|
|
298
|
|
299 newinitd "${FILESDIR}/${P}.initd" collectd \
|
|
300 || die "newinitd failed"
|
|
301
|
|
302 newconfd "${FILESDIR}/${P}.confd" collectd \
|
|
303 || die "newconfd failed"
|
|
304 }
|
|
305
|
|
306 pkg_postinst()
|
|
307 {
|
|
308 einfo
|
|
309 einfo "collectd introduced some changes in the new 4.x series."
|
|
310 einfo "For further information, read http://collectd.org/migrate-v3-v4.shtml"
|
|
311 einfo "The migration script can be found at:"
|
|
312 einfo "/usr/share/doc/${P}/contrib/migrate-3-4.px.bz2"
|
|
313 einfo
|
|
314 }
|