aboutsummaryrefslogtreecommitdiffstats
path: root/main/collectd/APKBUILD
blob: 7d1f26de46e79b7e7c618d7a93c60fa8eb5b56c1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=collectd
pkgver=5.4.1
pkgrel=4
pkgdesc="The system statistics collection daemon"
url="http://collectd.org"
arch="all"
license="GPL2"
depends=""
makedepends="pkgconfig curl-dev net-snmp-dev postgresql-dev perl-dev
	libgcrypt-dev mariadb-dev zlib-dev openssl-dev iptables-dev
	rrdtool-dev yajl-dev libvirt-dev lm_sensors-dev"
install=""
subpackages="$pkgname-dev $pkgname-doc $pkgname-perl $pkgname-snmp
	$pkgname-curl:_curl
	$pkgname-write_http $pkgname-nginx $pkgname-apache $pkgname-postgresql
	$pkgname-mysql $pkgname-network $pkgname-rrdtool $pkgname-sensors
	$pkgname-python:_python $pkgname-iptables:_ipt $pkgname-bind
	$pkgname-ascent $pkgname-libvirt"

source="http://collectd.org/files/collectd-$pkgver.tar.bz2
	fix-argmax.patch
	collectd.initd"

_builddir="$srcdir"/$pkgname-$pkgver
prepare() {
	cd "$_builddir"
	update_config_sub || return 1
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
	sed -i -e '/CFLAGS/s/-Werror//' configure src/Makefile.in \
		src/*/Makefile.in || return 1
}

build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc/collectd \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstate=/var \
		--with-libiptc \
		--enable-rrdtool \
		--enable-libvirt \
		|| return 1
	make || return 1
	# disable network plugin by default since its in a subpackage
	sed -i -e 's/^LoadPlugin network/#LoadPlugin network/' \
		src/collectd.conf
}

package() {
	cd "$_builddir"
	make DESTDIR="$pkgdir" install || return 1
	rm "$pkgdir"/usr/lib/*.la \
		"$pkgdir"/usr/lib/collectd/*.la || return 1

	find "$pkgdir" \( -name perllocal.pod -o -name .packlist \) -delete
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
}

perl() {
	pkgdesc="perl bindings to collectd"
	depends="perl"
	arch="noarch"
	install -d "$subpkgdir"/usr/lib/ "$subpkgdir"/usr/share
	mv "$pkgdir"/usr/lib/perl* "$subpkgdir"/usr/lib/
#	mv "$pkgdir"/usr/share/perl* "$subpkgdir"/usr/share/
}

_plugin() {
	local mod=$1
	local desc=${2:-$mod}
	pkgdesc="$desc pluin for collectd"
	depends="collectd"
	install -d "$subpkgdir"/usr/lib/collectd
	mv "$pkgdir"/usr/lib/collectd/$mod.so "$subpkgdir"/usr/lib/collectd/
}

snmp()		{ _plugin snmp; }
_curl()		{ _plugin 'curl*'; }
write_http()	{ _plugin write_http; }
nginx()		{ _plugin nginx; }
apache()	{ _plugin apache; }
postgresql()	{ _plugin postgresql; }
mysql()		{ _plugin mysql; }
network()	{ _plugin network; }
rrdtool()	{ _plugin 'rrd*'; }
sensors()	{ _plugin sensors; }
_python()	{ _plugin python; }
_ipt()		{ _plugin iptables; }
bind()		{ _plugin bind; }
ascent()	{ _plugin ascent; }
libvirt()	{ _plugin libvirt; }

md5sums="6f56c71c96573a7f4f7fb3bfab185974  collectd-5.4.1.tar.bz2
cd543f08b405c13b4734fa528cb6abef  fix-argmax.patch
13a36ae2f92634b5619ab94224e1b77d  collectd.initd"
sha256sums="75452129f271cb0aad28e57f12a49070618bbb7b6a9d64cf869e8766fa2f66e0  collectd-5.4.1.tar.bz2
5bf48d30d7d1d0e37d6dc56a8189c1b7de21d483c138c0c54c356304aa89b223  fix-argmax.patch
418d43a5ab08a8097dd2ac5c1e839df64032e96c295f89fa3b8df08a08c3dc35  collectd.initd"
sha512sums="96289f52d3d1da55c862ae9ee2f57972682d7eab87387e97efa41fb5197599e097abd71aed2fe014e26af37c9ae98471e06dd181c725849976242642ce5c9492  collectd-5.4.1.tar.bz2
c3f841874243a8236ac50e8fbaa419ff603e19ba5c7b8c2f0f5b2c03c7e301b6afd46224624a952cd1b3b86a6afeab61f509d674c04826dbcdb83461c47de3f4  fix-argmax.patch
fd3ba6914d1e95f255f43165f7d38405736799037d08300378678fa3a9c628b14b6a867d8e0367798cd488105547ef8eca4bef7e4b7de1814a12aa0072e4cbee  collectd.initd"