aboutsummaryrefslogtreecommitdiffstats
path: root/main/ulogd/APKBUILD
blob: 47e58965ab89710b6ff6a7e66aab3e910c4e39ae (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
# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Leonardo Arena <rnalrd@alpinelinux.org>
pkgname=ulogd
pkgver=2.0.7
pkgrel=5
pkgdesc="A userspace logging daemon for netfilter/iptables related logging"
url="http://netfilter.org/projects/ulogd/index.html"
arch="all"
license="GPL-2.0-only"
makedepends="libmnl-dev libpcap-dev libnetfilter_acct-dev bsd-compat-headers
	libnfnetlink-dev libnetfilter_conntrack-dev libnetfilter_log-dev
	pkgconfig mariadb-connector-c-dev openssl-dev postgresql-dev zlib-dev linux-headers
	autoconf automake libtool jansson-dev sqlite-dev"
subpackages="
	$pkgname-doc
	$pkgname-openrc
	"
source="https://www.netfilter.org/projects/ulogd/files/ulogd-$pkgver.tar.bz2
	musl-fixes.patch
	ulogd.initd
	ulogd.confd
	ulogd.logrotate
	"

_modules="mysql pgsql json xml sqlite3"
for _module in $_modules; do
	subpackages="$subpackages $pkgname-$_module:_plugin"
done

build() {
	cd "$builddir"
	export CFLAGS="$CFLAGS -D_GNU_SOURCE"
	autoreconf -vif
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--with-pgsql \
		--with-mysql
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install
	install -Dm644 ulogd.conf "$pkgdir"/etc/ulogd.conf
	install -m755 -D "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.logrotate "$pkgdir"/etc/logrotate.d/$pkgname
	install -dm755 "$pkgdir"/usr/share/doc/ulogd
	install -Dm644 ulogd.conf "$pkgdir"/usr/share/doc/ulogd/ulogd.conf.sample
	install -Dm644 doc/ulogd.sgml "$pkgdir"/usr/share/doc/ulogd/ulogd.sgml
	install -dm0755 "$pkgdir"/usr/share/ulogd
	for file in $(ls doc/*.sql)
	do
		install -Dm644 $file "$pkgdir"/usr/share/ulogd/$file
	done
}

_plugin() {
	plugin="${subpkgname##*-}"
	depends="$pkgname=$pkgver-r$pkgrel"
	pkgdesc="$plugin output for $pkgname"

	mkdir -p "$subpkgdir"/usr/lib/ulogd
	mv "$pkgdir"/usr/lib/ulogd/ulogd_output_"$(echo $plugin | tr '[a-z]' '[A-Z]')".so \
		"$subpkgdir"/usr/lib/ulogd

	# Move the .sql files to their plugins to subpackage
	case "$plugin" in
		pgsql|mysql)
			mkdir -p "$subpkgdir"/usr/share/ulogd/doc
			mv "$pkgdir"/usr/share/ulogd/doc/"$plugin"* "$subpkgdir"/usr/share/ulogd/doc
			;;
	esac
}
sha512sums="1ad12bcf91bebe8bf8580de38693318cdabd17146f1f65acf714334885cf13adf5f783abdf2dd67474ef12f82d2cfb84dd4859439bc7af10a0df58e4c7e48b09  ulogd-2.0.7.tar.bz2
f65e051520645c5e1618b1ef9d570ebac77ec8d05972c9b58ca93475a9612a725b26634a71e9fb8e117ae004a2dc13da2a1368b549d2808bd299e39b8f8d6bab  musl-fixes.patch
ab60e367a18d6dafcf5ee22562e303d74944f97b1e42717607db85f11d15d94be3e0e9aaa422c2bac13cdeee1aabc550f751f3e6419b1c7b16d86d0ee8fad55a  ulogd.initd
bdae1ff90c671b6847dfda1947a33e24bfbe16ad963f85769d923ba33021bc4ca315fd410b46fac102f0a24e879e4be4ad7bb5978c5a6755e74e6b5d7c3e18ee  ulogd.confd
76d426411786010b73900b41cf2537c704cf48abbe464d10760d44420fd46fea72ae84f6b52c7c338f39630666ebe06ef05287d18e7dd7c5662bb72af0491b0e  ulogd.logrotate"