56
|
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="~amd64 ~x86"
|
|
16 HTTP_FLAGS="apache2 lighttpd nginx"
|
|
17 LIBVIRT_FLAGS="kvm openvz qemu xen"
|
|
18 IUSE="apcups dns email hal hddtemp ipmi ithreads lm_sensors
|
|
19 memcache mysql network nfs ntp nut perl rrdtool snmp
|
|
20 syslog vserver wifi ${HTTP_FLAGS} ${LIBVIRT_FLAGS}
|
|
21 "
|
|
22 HTTP_DEPEND="
|
|
23 apache2? ( >=net-misc/curl-7.17.0 )
|
|
24 lighttpd? ( >=net-misc/curl-7.17.0 )
|
|
25 nginx? ( >=net-misc/curl-7.17.0 )
|
|
26 "
|
|
27 LIBVIRT_DEPEND="
|
|
28 kvm? ( >=app-emulation/libvirt-0.3.3 )
|
|
29 openvz? ( >=app-emulation/libvirt-0.3.3 )
|
|
30 qemu? ( >=app-emulation/libvirt-0.3.3 )
|
|
31 xen? ( >=app-emulation/libvirt-0.3.3 )
|
|
32 "
|
|
33 COMMON_DEPEND="${HTTP_DEPEND} ${LIBVIRT_DEPEND}
|
|
34 dns? ( >=net-libs/libpcap-0.9.8 )
|
|
35 hal? ( >=sys-apps/hal-0.5.9.1-r3 )
|
|
36 ipmi? ( >=sys-libs/openipmi-2.0.11 )
|
|
37 lm_sensors? ( >=sys-apps/lm_sensors-2.10.4 )
|
|
38 mysql? ( >=virtual/mysql-5.0 )
|
|
39 perl? ( >=dev-lang/perl-5.8.8-r4 )
|
|
40 nut? ( >=sys-power/nut-2.2.0 )
|
|
41 rrdtool? ( >=net-analyzer/rrdtool-1.2.27 )
|
|
42 snmp? ( >=net-analyzer/net-snmp-5.4.1-r3 )
|
|
43 "
|
|
44 DEPEND="${COMMON_DEPEND}
|
|
45 sys-devel/libtool
|
|
46 >=dev-libs/libxml2-2.6.31
|
|
47 "
|
|
48 RDEPEND="${COMMON_DEPEND}
|
|
49 apcups? ( >=sys-power/apcupsd-3.14.2 )
|
|
50 !hal? ( >=sys-apps/dmidecode-2.9 )
|
|
51 hddtemp? ( >=app-admin/hddtemp-0.3_beta15-r3 )
|
|
52 memcache? ( >=net-misc/memcached-1.2.2-r2 )
|
|
53 ntp? ( >=net-misc/ntp-4.2.4_p4 )
|
|
54 syslog? ( virtual/logger )
|
|
55 "
|
|
56
|
|
57 pkg_setup()
|
|
58 {
|
|
59 linux-info_pkg_setup
|
|
60 local flag
|
|
61
|
|
62 (linux_chkconfig_present ACPI_BATTERY) \
|
|
63 || ewarn "ACPI_BATTERY needs to be enabled in your kernel for the battery plug-in to work correctly"
|
|
64 (linux_chkconfig_present CPU_FREQ) \
|
|
65 || ewarn "CPU_FREQ needs to be enabled in your kernel for the cpufreq plug-in to work correctly"
|
|
66 (linux_chkconfig_present SERIAL_CORE) \
|
|
67 || ewarn "SERIAL_CORE needs to be enabled in your kernel for the serial plug-in to work correctly"
|
|
68 (linux_chkconfig_present SWAP) \
|
|
69 || ewarn "SWAP needs to be enabled in your kernel for the swap plug-in to work correctly"
|
|
70 (use vserver) && !(linux_chkconfig_present IP_VS) \
|
|
71 && ewarn "IP_VS should to be enabled in your kernel when the USE flag vserver is enabled"
|
|
72
|
|
73 for flag in "${LIBVIRT_FLAGS}"; do
|
|
74 (use ${flag}) && !(built_with_use app-emulation/libvirt ${flag}) && \
|
|
75 die "USE flag ${flag} requires that libvirt was compiled with the USE flag ${flag}"
|
|
76 done
|
|
77
|
|
78 if (use perl); then
|
|
79 if (use ithreads); then
|
|
80 (built_with_use perl ithreads) \
|
|
81 || die "The perl plug-in requires that libperl was compiled with the USE flag ithreads"
|
|
82 else
|
|
83 ewarn "The perl plug-in requires the ithreads USE flag."
|
|
84 fi
|
|
85 fi
|
|
86
|
|
87 ((linux_chkconfig_present PROC_FS) && (linux_chkconfig_present SYSFS)) \
|
|
88 || die "${P} requires that PROC_FS and SYSFS are enabled in your kernel"
|
|
89 }
|
|
90
|
|
91 src_unpack()
|
|
92 {
|
|
93 unpack ${A}
|
|
94 cd "${S}"
|
|
95
|
|
96 ebegin "Applying sed no-automagic-patch"
|
|
97 sed -i -e '/^AC_PLUGIN/ s/\ [[].*[]],/[no],/' \
|
|
98 configure.in \
|
|
99 || die "sed no-automagic-patch failed"
|
|
100 eend 0
|
|
101
|
|
102 epatch "${FILESDIR}/${PN}-4.4.2-ipvs.patch"
|
|
103 epatch "${FILESDIR}/${PN}-4.4.2-localstatedir.patch"
|
|
104 epatch "${FILESDIR}/${PN}-4.4.2-libtool-compatibility.patch"
|
|
105
|
|
106 ebegin "Remove provided libtool/libltdl"
|
|
107 rm -R ./libltdl \
|
|
108 && rm config.guess config.sub install-sh ltmain.sh \
|
|
109 || die "removing libtool failed"
|
|
110 eend 0
|
|
111
|
|
112 eautoreconf || die "eautoreconf failed"
|
|
113 }
|
|
114
|
|
115 src_compile()
|
|
116 {
|
|
117 local flag
|
|
118 local myconf
|
|
119 local no_check_plugins="csv df logfile multimeter tail users uuid"
|
|
120 local proc_sys_fs_plugins="battery cpu cpufreq disk entropy irq load memory processes serial swap vmem"
|
|
121 local network_plugins="interface iptables network ping teamspeak2 tcpconns unixsock"
|
|
122
|
|
123 for flag in ${no_check_plugins} ${proc_sys_fs_plugins}; do
|
|
124 myconf+=" --enable-${flag}"
|
|
125 done
|
|
126
|
|
127 if (use network); then
|
|
128 for flag in ${network_plugins}; do
|
|
129 myconf+=" --enable-${flag}"
|
|
130 done
|
|
131 fi
|
|
132
|
|
133 myconf+="
|
|
134 $(( use apache2 || use lighttpd ) && echo --enable-apache)
|
|
135 $(use_enable apcups)
|
|
136 $(use_enable dns)
|
|
137 $(use_enable hddtemp)
|
|
138 $(use_enable email)
|
|
139 $(use_enable ipmi)
|
|
140 $(use_enable vserver ipvs)
|
|
141 $(( use kvm || use openvz || use qemu || use xen ) && echo --enable-libvirt)
|
|
142 $(use_enable memcache memcached)
|
|
143 $(use_enable mysql)
|
|
144 $(use_enable nfs)
|
|
145 $(use_enable nginx)
|
|
146 $(use_enable ntp ntpd)
|
|
147 $(use_enable nut)
|
|
148 $(use_enable dns powerdns)
|
|
149 $(use_enable snmp)
|
|
150 $(use_enable syslog)
|
|
151 $(use_enable rrdtool)
|
|
152 $(use_enable vserver)
|
|
153 $(use_enable lm_sensors sensors)
|
|
154 $(use_enable wifi wireless)"
|
|
155
|
|
156 myconf+="
|
|
157 $(use ithreads && use_enable perl)
|
|
158 $(use_with perl perl-bindings)"
|
|
159
|
|
160 KERNEL_DIR="${KERNEL_DIR}" econf \
|
|
161 --localstatedir=/var ${myconf} \
|
|
162 || die "econf failed"
|
|
163
|
|
164 emake || die "emake failed"
|
|
165 }
|
|
166
|
|
167 src_install()
|
|
168 {
|
|
169 emake DESTDIR="${D}" install || die "emake install failed"
|
|
170
|
|
171 dodoc AUTHORS ChangeLog NEWS README TODO || die "dodoc failed"
|
|
172
|
|
173 insinto /usr/share/doc/${PF}
|
|
174 doins -r contrib || die "doins contrib failed"
|
|
175
|
|
176 keepdir /var/lib/${PN} || die "keepdir failed"
|
|
177
|
|
178 newinitd "${FILESDIR}/${PN}-4.4.2.initd" ${PN} || die "newinitd failed"
|
|
179 newconfd "${FILESDIR}/${PN}-4.4.2.confd" ${PN} || die "newconfd failed"
|
|
180 }
|
|
181
|
|
182 pkg_postinst()
|
|
183 {
|
|
184 einfo
|
|
185 einfo "collectd introduced some changes in the new 4.x series."
|
|
186 einfo "For further information, read ${HOMEPAGE}/migrate-v3-v4.shtml"
|
|
187 einfo "The migration script can be found at:"
|
|
188 einfo "/usr/share/doc/${PF}/contrib/migrate-3-4.px"
|
|
189 einfo
|
|
190 }
|