summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 3387430eabcbc4be09774c21a0fded7725e4ca71 (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
# Contributor: Massimiliano Torromeo
# PKGBUILD adapted from nginx-mod-echo

pkgname=nginx-mod-http-knock
pkgver=r11.3afcd02
pkgrel=1
_commit=3afcd025ad3eda80fbe21eb606d1ce14ae614d4c # pin last commit
pkgdesc='Nginx module ngx_http_knock_module to guard websites with a secret handshake'
arch=('x86_64')
url="https://github.com/PhillipTaylor/ngx_http_knock_module"
license=('MIT')
makedepends=('nginx' 'nginx-src' 'git')
source=("$pkgname::git+$url.git#commit=$_commit")
sha256sums=('62ab79a3e46adbf44d427c3dbe99ac16853aa2c45a6e14b8d88cb92a3765fe2e')

pkgver() {
    cd $pkgname
    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-ld-opt="$LDFLAGS" \
        --with-compat \
        --add-dynamic-module=../$pkgname
    make modules
}

package() {
    local _nginx_version=$(nginx -v 2>&1 | sed 's|^.*/||')
    depends+=("nginx=${_nginx_version}")

    install -Dm644 $pkgname/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE

    cd build/objs
    install -Dm755 -t "$pkgdir"/usr/lib/nginx/modules/$mod *.so
}