summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 4fc36ee6d37147b91037182dfa804d6cb9dbf4bb (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
# Maintainer: Manuel Hüsers <aur@huesers.de>

pkgname=nginx-mod-traffic-accounting
pkgver=2.0+18+g46aae3e
pkgrel=1

_modname="traffic-accounting-nginx-module"

pkgdesc='Monitor the incoming and outgoing traffic metrics in realtime for NGINX'
arch=('x86_64')
makedepends=('nginx-src')
depends=('nginx')
url="https://github.com/Lax/${_modname}"
license=('BSD')

source=(
	"https://github.com/Lax/${_modname}/archive/v${pkgver%%+*}/${_modname}-${pkgver%%+*}.tar.gz"
	"d53a4a6.patch"
	"server_addr.patch"
	"succ_collect.patch"
)
sha256sums=('8c99c5313e5c822aa5683691c8a0641499b2fa8c67f9e55652817042e21f5986'
            '9bad093fba01d67098d98122202693ffba20feb20668f73e7712d9d9b9915bf1'
            'e25f170801179e067c7186f1e27fcb3f4273ac5683f6a4962dee821d5eddc8d0'
            'e9075be4a309948eaddaed2ceb038dcbf1d3aed92fcfe6c068e415ef6461696d')

prepare() {
	mkdir -p build
	cd build
	ln -sf /usr/src/nginx/auto
	ln -sf /usr/src/nginx/src

	cd "../${_modname}-${pkgver%%+*}"
	patch -Np1 -i '../d53a4a6.patch'
	patch -Np1 -i '../server_addr.patch'
	patch -Np1 -i '../succ_collect.patch'
}

build() {
	cd build
	/usr/src/nginx/configure --with-compat --with-stream --add-dynamic-module="../${_modname}-${pkgver%%+*}"
	make modules
}

package() {
	install -Dm644 "$srcdir"/"${_modname}-${pkgver%%+*}"/LICENSE \
	               "$pkgdir"/usr/share/licenses/$pkgname/LICENSE

	cd build/objs
	for mod in ngx_*.so; do
		install -Dm755 $mod "$pkgdir"/usr/lib/nginx/modules/$mod
	done
}