aboutsummaryrefslogtreecommitdiffstats
path: root/community/collectd/APKBUILD
blob: 0190f9dcecadd6212ab6edc4dc78515a08bd94bd (plain) (blame)
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=collectd
pkgver=5.12.0
pkgrel=5
pkgdesc="The system statistics collection daemon"
url="https://collectd.org/"
# mips64, s390x and riscv64 blocked by polkit -> libvirt
arch="all !mips64 !s390x !riscv64"
license="GPL-2.0-or-later"
pkgusers="collectd"
pkggroups="collectd"
makedepends="
	autoconf
	automake
	curl-dev
	eudev-dev
	hiredis-dev
	iptables-dev
	libatasmart-dev
	libgcrypt-dev
	liboping-dev
	libpcap-dev
	libpq-dev
	libtool
	libvirt-dev
	libxml2-dev
	lm-sensors-dev
	lua-dev
	mariadb-connector-c-dev
	mosquitto-dev
	net-snmp-dev
	openipmi-dev
	openldap-dev
	perl-dev
	python3-dev
	riemann-c-client-dev
	rrdtool-dev
	yajl-dev
	zlib-dev
	"
subpackages="
	$pkgname-dev
	$pkgname-doc
	$pkgname-openrc
	$pkgname-libs
	$pkgname-perl
	$pkgname-utils
	$pkgname-plugins-all:_all:noarch
	"
install="$pkgname.pre-install $pkgname.post-upgrade"
source="https://storage.googleapis.com/collectd-tarballs/collectd-$pkgver.tar.bz2
	collectd.initd
	gnu_source.patch
	"
options="!check"  # test_common fails

# secfixes:
#   5.5.2-r0:
#     - CVE-2016-6254

# <subpackage>[:<libname>...]
_plugins="
	apache
	apcups
	ascent
	battery
	bind
	ceph
	chrony
	curl:curl*
	disk
	dns
	email
	exec
	hddtemp
	infiniband
	ipmi
	iptables
	log_logstash
	lua
	madwifi
	mbmon
	mcelog
	memcached
	mqtt
	multimeter
	mysql
	network
	nginx
	olsrd
	openldap
	openvpn
	ovs:ovs_*
	pcie_errors
	ping
	postgresql
	powerdns
	python
	redis
	rrdtool:rrd*
	sensors
	serial
	smart
	snmp:snmp*
	statsd
	sysevent
	teamspeak2
	ted
	virt
	vserver
	wireless
	write_http
	write_redis
	write_riemann
	write_stackdriver
	zookeeper
	"
case "$CARCH" in
	x86 | x86_64) _plugins="$_plugins
		turbostat
		"
	;;
esac
for _i in $_plugins; do
	subpackages="$subpackages $pkgname-${_i%%:*}:_plugin"
done

prepare() {
	default_prepare

	autoreconf -vif
}

build() {
	./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-bind \
		--disable-werror \
		--with-perl-bindings=INSTALLDIRS=vendor
	make

	# disable plugins by default since its in a subpackage
	sed -i -e 's/^LoadPlugin network/#LoadPlugin network/' \
		-e 's/^LoadPlugin rrdtool/#LoadPlugin rrdtool/' \
		src/collectd.conf
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install

	chown root:collectd "$pkgdir"/etc/collectd/collectd.conf
	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"

	amove usr/lib/collectd/perl.so
	amove usr/lib/perl*
	amove usr/share/perl*
}

utils() {
	pkgdesc="$pkgname utilities"

	amove usr/bin/*
}

_all() {
	pkgdesc="Meta package for all collectd plugins"
	depends=""

	local plugin; for plugin in $_plugins; do
		depends="$depends $pkgname-${plugin%%:*}"
	done

	mkdir -p "$subpkgdir"
}

_plugin() {
	local name="${subpkgname#$pkgname-}"
	pkgdesc="$name pluin for collectd"
	depends="collectd"

	local libnames=$(printf '%s\n' $_plugins | grep "^$name:" | cut -d: -f2- | tr : ' ')
	local libname

	for libname in ${libnames:-$name}; do
		amove usr/lib/collectd/$libname.so
	done
}

sha512sums="7a15e4c0ae587db4987d673a790a4f3bea1cab29ce24a506fb21fa7bd2f60bfec70867eaa1c1395cb5b0e0ae81a024fb6109b064da0ef50e7c146d2198871c70  collectd-5.12.0.tar.bz2
a286c2164af196154d017658d6e5aa3cc4f76dadf90b68c3021418979d9f0377776bb990d737ae5c916c04475725365aea8b78e3bc5e2f3679d5a99f8b9af13e  collectd.initd
3078e43fc1aa5e5d5f7042472f465cc3b077c59f43a9867ade038e59bb210f26f53bb9a1e1e8a198ca53939a4b2e03a1f05628aa54f826746f970faa36acff6a  gnu_source.patch"