aboutsummaryrefslogtreecommitdiffstats
path: root/main/syslog-ng/APKBUILD
blob: b9d8b8f41cb1d98fff5402f78258a760286d28e0 (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
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
# Contributor: jv <jens@eisfair.org>
# Contributor: Adrian Guenter <adrian@gntr.me>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: jv <jens@eisfair.org>
pkgname=syslog-ng
pkgver=3.19.1
pkgrel=1
pkgdesc="Next generation logging daemon"
url="http://www.balabit.com"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	curl-dev
	eventlog-dev
	file
	geoip-dev
	glib-dev
	hiredis-dev
	ivykis-dev>=0.42.3
	libdbi-dev
	json-c-dev
	openssl-dev
	pcre-dev
	python2-dev
	rabbitmq-c-dev
	"
install="$pkgname.post-install $pkgname.post-upgrade"
subpackages="
	$pkgname-scl::noarch
	$pkgname-dev
	$pkgname-doc
	$pkgname-openrc
	$pkgname-python2:_python2
	"
source="https://github.com/balabit/syslog-ng/releases/download/syslog-ng-$pkgver/syslog-ng-$pkgver.tar.gz
	$pkgname.conf
	$pkgname.logrotate
	$pkgname.initd
	"
builddir="$srcdir/$pkgname-$pkgver"

_modules="
	add-contextual-data
	amqp:afamqp
	examples
	geoip:geoip-plugin
	graphite
	http
	json:json-plugin
	map-value-pairs
	redis
	sql:afsql
	stardate
	stomp:afstomp
	tags-parser
	xml
	"
for _i in $_modules; do
	subpackages="$subpackages $pkgname-${_i%%:*}:_module"
done

prepare() {
	cd "$builddir"
	default_prepare

	# Remove bundled libraries
	rm -rf lib/ivykis
	rm -rf modules/afamqp/rabbitmq-c
	rm -rf modules/afmongodb/mongo-c-driver
}

build() {
	cd "$builddir"

	./configure \
		--prefix=/usr \
		--sysconfdir=/etc/syslog-ng \
		--localstatedir=/run \
		--enable-extra-warnings \
		--enable-ipv6 \
		--enable-manpages \
		\
		--enable-sql \
		--disable-linux-caps \
		--disable-mongodb \
		--enable-json \
		--enable-amqp \
		--enable-stomp \
		--disable-smtp \
		--enable-http \
		--enable-redis \
		--enable-geoip \
		--disable-geoip2 \
		--disable-riemann \
		--disable-systemd \
		--enable-python \
		--disable-java \
		--disable-java-modules \
		--enable-native \
		\
		--with-ivykis=system \
		--with-jsonc=system \
		--with-librabbitmq-client=system
	make
}

package() {
	cd "$builddir"

	make -j1 DESTDIR="$pkgdir" install

	cd "$pkgdir"

	rm -rf run usr/lib/$pkgname/libtest

	# getent module doesn't build properly as musl doesn't support reentrant
	# getprotoby[number|name] funcs. The provided compat lib only patches
	# solaris, which does provide reentrant versions under a different sig
	rm -f usr/lib/$pkgname/libtfgetent.so

	install -m 644 "$srcdir"/$pkgname.conf etc/$pkgname/$pkgname.conf
	install -D -m 755 "$srcdir"/$pkgname.initd etc/init.d/$pkgname
	install -D -m 644 "$srcdir"/$pkgname.logrotate etc/logrotate.d/$pkgname

	install -d -m 755 etc/$pkgname/conf.d
	install -d -m 700 "$pkgdir"/var/lib/syslog-ng
}

scl() {
	pkgdesc="$pkgdesc (configuration library)"
	depends="$pkgname=$pkgver-r$pkgrel"

	_submv usr/share/syslog-ng/include/scl
}

dev() {
	default_dev

	_submv usr/share/syslog-ng/tools \
		usr/share/syslog-ng/xsd
}

_python2() {
	pkgdesc="$pkgdesc (python2 module)"

	_submv usr/lib/syslog-ng/libmod-python.so \
		usr/lib/python2.7
}

_module() {
	local name="${subpkgname#$pkgname-}"
	pkgdesc="$pkgdesc (${name//-/ } module)"

	local libname=$(printf '%s\n' $_modules | grep "^$name:" | cut -d: -f2)
	local soname="lib${libname:-$name}.so"

	_submv usr/lib/syslog-ng/$soname
}

_submv() {
	local path; for path in "$@"; do
		mkdir -p "$subpkgdir/${path%/*}"
		mv "$pkgdir"/$path "$subpkgdir"/${path%/*}/
	done
}

sha512sums="f625073bafa9378109d5be34591247766a62cb5a76e814f42bfbf03472e96ebe2833f19779812abfdd950a3498115f57b97c1427c280ee0dab21d3e2eb92ca57  syslog-ng-3.19.1.tar.gz
2c9d51ece6f7fd8a7654f33c0f340447c2ef1865b0e4134537732576659c947699badbf33c6514995aa0a53fd729d0798e5637b9badc71fddd2f220dd09b99ea  syslog-ng.conf
1825b85fb584c5cecf0ad370e81a7473b5c973ce10adce386d1ba5f68432abe4e2f54c937d7d94edb22dbd9031eff483bd113bc3244ce0d0072cf4bf4ab5c2cc  syslog-ng.logrotate
873fef8815131f0acc618fa4911cd1eda59e260adc1eaae6eb91034900ce789f05ee48fa8afa4a87763026c18c87aef351e7ea76e0cbb46bcd5297f9ca14d527  syslog-ng.initd"