15
|
1 # Copyright 1999-2008 Gentoo Foundation
|
|
2 # Distributed under the terms of the GNU General Public License v2
|
|
3 # $Header: $
|
|
4
|
|
5 inherit autotools eutils flag-o-matic linux-info
|
|
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 apcups dns email hal hddtemp ithreads lighttpd lm_sensors memcache
|
|
18 mysql network nfs nginx ntp nut perl qemu rrdtool snmp syslog vserver xen
|
|
19 "
|
|
20
|
|
21 DEPEND="
|
|
22 apache2? ( >=net-misc/curl-7.17.0 )
|
|
23 lighttpd? ( >=net-misc/curl-7.17.0 )
|
|
24 nginx? ( >=net-misc/curl-7.17.0 )
|
|
25 dns? ( >=net-libs/libpcap-0.9.8 )
|
|
26 qemu? ( >=app-emulation/libvirt-0.3.3 )
|
|
27 xen? ( >=app-emulation/libvirt-0.3.3 )
|
|
28 mysql? ( >=virtual/mysql-5.0 )
|
|
29 perl? ( >=dev-lang/perl-5.8.8-r4 )
|
|
30 nut? ( >=sys-power/nut-2.2.0 )
|
|
31 rrdtool? ( >=net-analyzer/rrdtool-1.2.27 )
|
|
32 lm_sensors? ( >=sys-apps/lm_sensors-2.10.4 )
|
|
33 snmp? ( >=net-analyzer/net-snmp-5.4.1-r3 )
|
|
34 hal? ( >=sys-apps/hal-0.5.9.1-r3 )
|
|
35 >=dev-libs/libxml2-2.6.31
|
|
36 "
|
|
37
|
|
38 RDEPEND="
|
|
39 ${DEPEND}
|
|
40 apcups? ( >=sys-power/apcupsd-3.14.2 )
|
|
41 hddtemp? ( >=app-admin/hddtemp-0.3_beta15-r3 )
|
|
42 memcache? ( >=net-misc/memcached-1.2.2-r2 )
|
|
43 ntp? ( >=net-misc/ntp-4.2.4_p4 )
|
|
44 syslog? ( virtual/logger )
|
|
45 !hal? ( >=sys-apps/dmidecode-2.9 )
|
|
46 "
|
|
47
|
|
48 pkg_setup()
|
|
49 {
|
|
50 linux-info_pkg_setup
|
|
51
|
|
52 if ( !(linux_chkconfig_present ACPI_BATTERY) ); then einfo
|
|
53 ewarn "ACPI_BATTERY needs to be enabled in your kernel for the battery plug-in to work correctly"; fi
|
|
54 if ( !(linux_chkconfig_present CPU_FREQ) ); then einfo
|
|
55 ewarn "CPU_FREQ needs to be enabled in your kernel for the cpufreq plug-in to work correctly"; fi
|
|
56 if ( !(linux_chkconfig_present SERIAL_CORE) ); then einfo
|
|
57 ewarn "SERIAL_CORE needs to be enabled in your kernel for the serial plug-in to work correctly"; fi
|
|
58 if ( !(linux_chkconfig_present SWAP) ); then einfo
|
|
59 ewarn "SWAP needs to be enabled in your kernel for the swap plug-in to work correctly"; fi
|
|
60 if ( (use vserver) && !(linux_chkconfig_present IP_VS) ); then einfo
|
|
61 ewarn "IP_VS should to be enabled in your kernel when the USE flag vserver is enabled"; fi
|
|
62 if (use qemu && !(built_with_use libvirt qemu) ); then
|
|
63 die "USE flag qemu requires that libvirt was compiled with the USE flag qemu"; fi
|
|
64 if (use xen && !(built_with_use libvirt xen) ); then
|
|
65 die "USE flag xen requires that libvirt was compiled with the USE flag xen"; fi
|
|
66
|
|
67 if (use perl); then
|
|
68 if (use ithreads); then
|
|
69 (built_with_use perl ithreads) \
|
|
70 || die "The perl plug-in requires that libperl was compiled with the USE flag ithreads"
|
|
71 else
|
|
72 einfo
|
|
73 ewarn "The perl plug-in requires the ithreads USE flag."
|
|
74 fi
|
|
75 fi
|
|
76 einfo
|
|
77
|
|
78 if ( !(linux_chkconfig_present PROC_FS) ); then
|
|
79 ## if ( use network ); then
|
|
80 ## die "${P} requires that PROC_FS is enabled in the kernel for the USE flag network"; fi
|
|
81 die "${P} requires that PROC_FS is enabled in your kernel" ## UPDATE LATER
|
|
82 fi
|
|
83
|
|
84 if ( !(use network) ); then
|
|
85 if ( use dns ); then die "The USE flag dns requires that the USE flag network is enabled"; fi
|
|
86 if ( use email ); then die "The USE flag email requires that the USE flag network is enabled"; fi
|
|
87 if ( use nfs ); then die "The USE flag nfs requires that the USE flag network is enabled"; fi
|
|
88 if ( use ntp ); then die "The USE flag ntp requires that the USE flag network is enabled"; fi
|
|
89 if ( use snmp ); then die "The USE flag snmp requires that the USE flag network is enabled"; fi
|
|
90 if ( use vserver ); then die "The USE flag vserver requires that the USE flag network is enabled"; fi
|
|
91 fi
|
|
92 }
|
|
93
|
|
94 src_unpack() {
|
|
95 if [ "${A}" != "" ]; then
|
|
96 unpack ${A}
|
|
97 fi
|
|
98
|
|
99 cd ${S}
|
|
100
|
|
101 sed -i -e '/^AC_PLUGIN/ s/\ [[].*[]],/[no],/' \
|
|
102 configure.in \
|
|
103 || die "sed no-automagic-patch failed"
|
|
104
|
|
105 eautoreconf \
|
|
106 || die "eautoreconf failed"
|
|
107 }
|
|
108
|
|
109 src_compile()
|
|
110 {
|
|
111 local myconf
|
|
112 local disabled_plugins
|
|
113
|
|
114 ### NEEDS TO BE FIXED PROBABLY
|
|
115 append-flags -I/usr/src/linux/include
|
|
116
|
|
117 if ( use apache2 || use lighttpd );
|
|
118 then myconf="${myconf} --enable-apache"; fi
|
|
119 myconf="${myconf} $(use_enable apcups)"
|
|
120 myconf="${myconf} --disable-apple_sensors" ## DISABLED
|
|
121 disabled_plugins="${disabled_plugins} apple_sensors"
|
|
122 myconf="${myconf} --enable-battery" ## Kernel check PROCFS
|
|
123 myconf="${myconf} --enable-cpu" ## PROCFS
|
|
124 myconf="${myconf} --enable-cpufreq" ## Kernel check SYSFS
|
|
125 myconf="${myconf} --enable-csv" ## no checks
|
|
126 myconf="${myconf} --enable-df" ## no checks
|
|
127 myconf="${myconf} --enable-disk" ## PROCFS
|
|
128 myconf="${myconf} $(use network && use_enable dns)"
|
|
129 myconf="${myconf} $(use network && use_enable email)"
|
|
130 myconf="${myconf} --enable-entropy" ## PROCFS
|
|
131 myconf="${myconf} --disable-exec" ## NEEDS USERS
|
|
132 disabled_plugins="${disabled_plugins} exec"
|
|
133 myconf="${myconf} $(use_enable hddtemp)" ## PROCFS
|
|
134 myconf="${myconf} $(use_enable network interface)" ## PROCFS
|
|
135 myconf="${myconf} --disable-iptables" ## BREAKS
|
|
136 disabled_plugins="${disabled_plugins} iptables"
|
|
137 myconf="${myconf} $(use network && use_enable vserver ipvs)" ## Kernel check NEEDS CFLAGS -I -- FIX LATER
|
|
138 myconf="${myconf} --enable-irq" ## PROCFS
|
|
139 if ( use qemu || use xen ); then ## NEEDS KERNEL CHECK
|
|
140 myconf="${myconf} --enable-libvirt"; fi
|
|
141 myconf="${myconf} --enable-load" ## PROCFS
|
|
142 myconf="${myconf} --enable-logfile" ## no checks
|
|
143 myconf="${myconf} --disable-mbmon" ## COULD NOT FIND DAEMON
|
|
144 disabled_plugins="${disabled_plugins} mbmon"
|
|
145 myconf="${myconf} $(use_enable memcache memcached)"
|
|
146 myconf="${myconf} --enable-memory" ## PROCFS
|
|
147 myconf="${myconf} --enable-multimeter"
|
|
148 myconf="${myconf} $(use_enable mysql)"
|
|
149 myconf="${myconf} --disable-netlink" ## BREAKS
|
|
150 disabled_plugins="${disabled_plugins} netlink"
|
|
151 myconf="${myconf} $(use_enable network)" ## NO PROCFS
|
|
152 myconf="${myconf} $(use network && use_enable nfs)" ## PROCFS
|
|
153 myconf="${myconf} $(use_enable nginx)"
|
|
154 myconf="${myconf} $(use network && use_enable ntp ntpd)"
|
|
155 myconf="${myconf} $(use_enable nut)"
|
|
156 myconf="${myconf} $(use ithreads && use_enable perl)"
|
|
157 myconf="${myconf} $(use_with perl perl-bindings)"
|
|
158 myconf="${myconf} $(use_enable network ping)"
|
|
159 myconf="${myconf} --enable-processes" ## PROCFS
|
|
160 myconf="${myconf} $(use_enable rrdtool)"
|
|
161 myconf="${myconf} $(use_enable lm_sensors sensors)"
|
|
162 myconf="${myconf} --enable-serial" ## Kernel check PROCFS
|
|
163 myconf="${myconf} $(use network && use_enable snmp)"
|
|
164 myconf="${myconf} --enable-swap" ## Kernel check PROCFS
|
|
165 myconf="${myconf} $(use_enable syslog)"
|
|
166 myconf="${myconf} --disable-tape" ## SOLARIS ???
|
|
167 disabled_plugins="${disabled_plugins} tape"
|
|
168 myconf="${myconf} $(use_enable network tcpconns)" ## PROCFS
|
|
169 myconf="${myconf} $(use_enable network unixsock)"
|
|
170 myconf="${myconf} --enable-users"
|
|
171 myconf="${myconf} --enable-uuid" ## Depends on hal or dmidecode PROCFS
|
|
172 myconf="${myconf} $(use network && use_enable vserver)" ## PROCFS
|
|
173 myconf="${myconf} $(use_enable network wireless)" ## NEEDS KERNEL CHECK ## PROCFS
|
|
174 myconf="${myconf} --disable-xmms" ## NOT IN GENTOO
|
|
175 disabled_plugins="${disabled_plugins} xmms"
|
|
176
|
|
177 einfo
|
|
178 elog "The following plug-ins have been disabled in the ebuild"
|
|
179 elog ${disabled_plugins}
|
|
180 einfo
|
|
181
|
|
182 ### Configure
|
|
183 econf \
|
|
184 ${myconf} \
|
|
185 --localstatedir=/var \
|
|
186 || die "econf failed"
|
|
187
|
|
188 ### Build
|
|
189 emake \
|
|
190 || die "emake failed"
|
|
191 }
|
|
192
|
|
193 src_install()
|
|
194 {
|
|
195 emake \
|
|
196 DESTDIR="${D}" \
|
|
197 install || die "emake install failed"
|
|
198
|
|
199 ### Documentation
|
|
200 dodoc AUTHORS ChangeLog NEWS README TODO \
|
|
201 || die "dodoc failed"
|
|
202
|
|
203 docinto contrib/SpamAssassin
|
|
204 dodoc contrib/SpamAssassin/* \
|
|
205 || die "dodoc contrib failed"
|
|
206
|
|
207 docinto contrib/examples
|
|
208 dodoc contrib/examples/* \
|
|
209 || die "dodoc contrib failed"
|
|
210
|
|
211 docinto contrib/iptables
|
|
212 dodoc contrib/iptables/* \
|
|
213 || die "dodoc contrib failed"
|
|
214 docinto contrib
|
|
215
|
|
216 docinto contrib
|
|
217 dodoc contrib/README contrib/*\.[a-z]* \
|
|
218 || die "dodoc contrib failed"
|
|
219
|
|
220
|
|
221 keepdir /var/lib/collectd \
|
|
222 || die "keepdir failed"
|
|
223
|
|
224 newinitd "${FILESDIR}/${PN}-4.3.2.initd" ${PN} \
|
|
225 || die "newinitd failed"
|
|
226
|
|
227 newconfd "${FILESDIR}/${PN}-4.3.2.confd" ${PN} \
|
|
228 || die "newconfd failed"
|
|
229 }
|
|
230
|
|
231 pkg_postinst()
|
|
232 {
|
|
233 einfo
|
|
234 einfo "collectd introduced some changes in the new 4.x series."
|
|
235 einfo "For further information, read http://collectd.org/migrate-v3-v4.shtml"
|
|
236 einfo "The migration script can be found at:"
|
|
237 einfo "/usr/share/doc/${P}/contrib/migrate-3-4.px.bz2"
|
|
238 einfo
|
|
239 }
|