summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ac9bcc82d82c552a73faa9f2d46c163833fcfa9a (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
# Maintainer: Jeremy Kescher <jeremy@kescher.at>

pkgname=nginx-mainline-mod-traffic-accounting-git
pkgver=r99.43c9b9d
pkgrel=2

_modname="traffic-accounting-nginx-module"

pkgdesc='Monitor the incoming and outgoing traffic metrics in realtime for NGINX (module for mainline nginx) (Git version)'
arch=('i686' 'x86_64' 'aarch64' 'armv7')
makedepends=('nginx-mainline-src')
depends=('nginx-mainline' 'brotli')
url="https://github.com/Lax/$_modname"
license=('BSD')

source=(
	"git+https://github.com/Lax/$_modname.git"
)

sha256sums=('SKIP')

pkgver() {
	cd "$_modname"
	printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

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

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

package() {
	install -Dm644 "$srcdir"/"$_modname"/LICENSE \
	               "$pkgdir"/usr/share/licenses/$pkgname/LICENSE

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