comparison app-admin/collectd/collectd-4.3.1.ebuild @ 2:0ea7846e04f1

new ebuild: collectd
author holger@hoho.dyndns.org
date Tue, 25 Mar 2008 20:50:34 +0100
parents
children
comparison
equal deleted inserted replaced
1:dab1199d9829 2:0ea7846e04f1
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-3"
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 mykern
79 local disabled_plugins
80
81 ### NEEDS TO BE FIXED PROBABLY
82 append-flags -I/usr/src/linux/include
83
84 ### Kernel options
85 if (linux_chkconfig_present PROC_FS); then
86 mykern="$(mykern) proc_fs"
87 fi
88
89 if (linux_chkconfig_present IP_VS); then
90 mykern="$(mykern) ip_vs"
91 fi
92
93 #################################################
94
95 myconf="${myconf}
96 --without-libiptc
97 --with-liboconfig
98 --with-libpthread
99 --without-libstatgrab
100 --without-libxmms
101 "
102
103 ### no checks
104 myconf="${myconf} --enable-csv"
105 myconf="${myconf} --enable-df"
106 myconf="${myconf} --enable-logfile"
107 myconf="${myconf} --enable-uuid" ## Depends on hal or dmidecode
108
109 ### procfs dependents
110 if ( hasq proc_fs ${mykern} ); then
111 myconf="${myconf} --enable-battery" ## NEEDS KERNEL CHECK
112 myconf="${myconf} --enable-cpu"
113 myconf="${myconf} --enable-cpufreq" ## NEEDS KERNEL CHECK
114 myconf="${myconf} --enable-disk"
115 myconf="${myconf} --enable-entropy"
116 myconf="${myconf} --enable-irq"
117 myconf="${myconf} --enable-load"
118 myconf="${myconf} --enable-memory"
119 myconf="${myconf} --enable-processes"
120 myconf="${myconf} --enable-serial"
121 myconf="${myconf} --enable-swap"
122 myconf="${myconf} --enable-users" ## NEEDS KERNEL CHECK
123
124 ### Network
125 myconf="${myconf} $(use_enable network interface)"
126 #myconf="${myconf} $(use_enable network netlink) $(use_with network libnetlink)" ## BREAKS
127 myconf="${myconf} --disable-netlink --without-libnetlink"
128 disabled_plugins="${disabled_plugins} netlink"
129 myconf="${myconf} $(use_enable network)"
130 myconf="${myconf} $(use_enable network ping) $(use_with network liboping)"
131 myconf="${myconf} $(use_enable network tcpconns)"
132 myconf="${myconf} $(use_enable network unixsock)"
133 myconf="${myconf} $(use_enable network wireless)" ## NEEDS KERNEL CHECK
134
135 if ( use network ); then
136 myconf="${myconf} $(use_enable dns) $(use_with dns libpcap)"
137 myconf="${myconf} $(use_enable nfs)"
138 myconf="${myconf} $(use_enable ntp ntpd)"
139 myconf="${myconf} $(use_enable snmp) $(use_with snmp libnetsnmp)"
140
141 if ( hasq ip_vs ${mykern} ); then
142 myconf="${myconf} $(use_enable vserver)"
143 myconf="${myconf} $(use_enable vserver ipvs)" #NEEDS CFLAGS -I -- FIX LATER
144 else
145 if ( use vserver ); then die "${P} requires that IP_VS is enabled in the kernel for the USE flag vserver"; fi
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
157 if ( use dns ); then die "USE flag dns requires USE flag network"; fi
158 if ( use nfs ); then die "USE flag nfs requires USE flag network"; fi
159 if ( use ntp ); then die "USE flag ntp requires USE flag network"; fi
160 if ( use snmp ); then die "USE flag snmp requires USE flag network"; fi
161 if ( use vserver ); then die "USE flag vserver requires USE flag network"; fi
162 fi
163 else
164 ### Network
165 if ( use network ); then die "${P} requires that PROC_FS is enabled in the kernel for the USE flag network"; fi
166
167 die "${P} requires that PROC_FS is enabled in the kernel" ## UPDATE LATER
168 fi
169
170 ### Web Servers
171 if ( use apache2 || use lighttpd || use nginx );
172 then myconf="${myconf} --with-libcurl"
173 else myconf="${myconf} --without-libcurl"
174 fi
175
176 if ( use apache2 || use lighttpd );
177 then myconf="${myconf} --enable-apache"
178 else myconf="${myconf} --disable-apache"
179 fi
180
181 myconf="${myconf} $(use_enable nginx)"
182
183 ### APC UPS
184 myconf="${myconf} $(use_enable apcups)"
185
186 ### Apple
187 myconf="${myconf} --disable-apple_sensors" ## DISABLED
188 disabled_plugins="${disabled_plugins} apple_sensors"
189
190 ### Email
191 myconf="${myconf} $(use_enable email)"
192
193 ### hddtemp
194 myconf="${myconf} $(use_enable hddtemp)"
195
196 ### Virtualization -- NEEDS KERNEL CHECK
197 if ( use qemu || use xen )
198 then
199 myconf="${myconf} --enable-libvirt";
200 if (built_with_use libvirt qemu); then die "USE flag qemu requires that libvirt was compiled with the USE flag qemu"; fi
201 if (built_with_use libvirt xen); then die "USE flag xen requires that libvirt was compiled with the USE flag xen"; fi
202 else
203 myconf="${myconf} --disable-libvirt";
204 fi
205
206 ### Memcached
207 myconf="${myconf} $(use_enable memcache memcached)"
208
209 ### Mysql
210 myconf="${myconf} $(use_enable mysql) $(use_with mysql libmysql)"
211
212 ### Network UPS
213 myconf="${myconf} $(use_enable nut) $(use_with nut libupsclient)"
214
215 ### Perl
216 if (use perl); then
217 myconf="${myconf} $(use_with perl libperl)"
218 myconf="${myconf} $(use_with perl perl-bindings)"
219 if (use ithreads); then
220 if (built_with_use perl ithreads); then myconf="${myconf} --enable-perl"
221 else die "The perl plug-in requires that libperl was compiled with the USE flag ithreads"; fi
222 else
223 myconf="${myconf} --disable-perl"
224 einfo
225 einfo "The perl plug-in requires the ithreads USE flag."
226 fi
227
228 fi
229
230 ### RRDtool
231 myconf="${myconf} $(use_enable rrdtool) $(use_with rrdtool)"
232
233 ### lm_sensors
234 myconf="${myconf} $(use_enable lm_sensors sensors) $(use_with lm_sensors lm-sensors)"
235
236 ### Syslog
237 myconf="${myconf} $(use_enable syslog)"
238
239 ### DISABLED
240 myconf="${myconf} --disable-exec" ## NEEDS USERS
241 disabled_plugins="${disabled_plugins} exec"
242 myconf="${myconf} --disable-iptables" ## BREAKS
243 disabled_plugins="${disabled_plugins} iptables"
244 myconf="${myconf} --disable-mbmon" ## COULD NOT FIND DAEMON
245 disabled_plugins="${disabled_plugins} mbmon"
246 myconf="${myconf} --disable-multimeter" ## DISABLED
247 disabled_plugins="${disabled_plugins} multimeter"
248 myconf="${myconf} --disable-tape" ## SOLARIS ???
249 disabled_plugins="${disabled_plugins} tape"
250 myconf="${myconf} --disable-xmms" ## NOT IN GENTOO
251 disabled_plugins="${disabled_plugins} xmms"
252
253 einfo
254 einfo "The following plug-ins have been disabled in the ebuild"
255 einfo ${disabled_plugins}
256 einfo
257
258 ### Configure
259 econf \
260 ${myconf} \
261 --localstatedir=/var \
262 || die "econf failed"
263
264 einfo
265 einfo "The above plug-ins have been configured"
266 einfo
267 ebeep 3
268
269 ### Build
270 emake \
271 || die "emake failed"
272 }
273
274 src_install()
275 {
276 emake \
277 DESTDIR="${D}" \
278 install || die "emake install failed"
279
280 ### Documentation
281 docinto contrib/SpamAssassin
282 dodoc contrib/SpamAssassin/* \
283 || die "dodoc contrib failed"
284
285 docinto contrib/examples
286 dodoc contrib/examples/* \
287 || die "dodoc contrib failed"
288
289 docinto contrib/iptables
290 dodoc contrib/iptables/* \
291 || die "dodoc contrib failed"
292 docinto contrib
293
294 docinto contrib
295 dodoc contrib/README contrib/*\.[a-z]* \
296 || die "dodoc contrib failed"
297
298 dodoc AUTHORS ChangeLog NEWS README TODO \
299 || die "dodoc failed"
300
301
302 keepdir /var/lib/collectd \
303 || die "keepdir failed"
304
305 newinitd "${FILESDIR}/${P}.initd" collectd \
306 || die "newinitd failed"
307
308 newconfd "${FILESDIR}/${P}.confd" collectd \
309 || die "newconfd failed"
310 }
311
312 pkg_postinst()
313 {
314 einfo "collectd introduced some changes in the new 4.x series."
315 einfo "For further information, read http://collectd.org/migrate-v3-v4.shtml"
316 einfo "The migration script can be found at:"
317 einfo "/usr/share/doc/${P}/contrib/migrate-3-4.px.bz2"
318 }