aboutsummaryrefslogtreecommitdiffstats
path: root/main/collectd/APKBUILD
blob: 94a26326c1f6caf75584f9977b2bfacb5c3d6ef2 (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
112
113
114
115
116
117
118
119
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=collectd
pkgver=5.5.2
pkgrel=0
pkgdesc="The system statistics collection daemon"
url="http://collectd.org"
arch="all"
license="GPL2"
depends=""
makedepends="curl-dev net-snmp-dev postgresql-dev perl-dev python-dev
	libgcrypt-dev mariadb-dev zlib-dev openssl-dev iptables-dev
	rrdtool-dev yajl-dev libvirt-dev lm_sensors-dev libxml2-dev
	hiredis-dev
	autoconf automake libtool"
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-virt $pkgname-redis"

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

_builddir="$srcdir"/$pkgname-$pkgver

# security fixes:
#   5.5.2-r0:
#   -  CVE-2016-6254

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
	autoreconf -vif || return 1
	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 \
		--enable-bind \
		|| 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

	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; }
redis()		{ _plugin redis; }
virt()		{ _plugin virt; provides="$pkgname-libvirt"; }

md5sums="40b83343f72089e0330f53965f1140bd  collectd-5.5.2.tar.bz2
4c0b185623baebc4f4b71b3b47383b3a  gnu_source.patch
8015a61e7cda7abdf60e63eeff2923d2  collectd.initd"
sha256sums="017f3a4062187e594d8ab6af685655fb82a8a942dc574668e68242bdb8ba820f  collectd-5.5.2.tar.bz2
5f177512b28b5955231457a8c4468e28dfb667986affebd30c1cba01980e6bff  gnu_source.patch
7d7b20cb0c804d56d4e7ffe60b975b82c194898160674be2de49d1489589f6a3  collectd.initd"
sha512sums="9d311db4f3677b95e3a47c03af01bdf1127957f6fccb6c601455632d0ea3b39e3f4cd9a6f8f510083e208714bbb0da2e04aaa574a90b0ad6fe984506675475b3  collectd-5.5.2.tar.bz2
34b65fc2c21980e047e3d803a8293e8b523ad06e725113065787f1ce3ea81c5ce3e907845b03192770972ece3d8b79dc884c9e7782d428416ee418bc0658daae  gnu_source.patch
296b9f58df7b0da5b2fbf8c6e77cbd08c6673da28e98e67a34cb52dffc26c45d54a95f0bc51a16729d1844752636419fae98a4d3fd744b736568dfc23fab4296  collectd.initd"