custom-pkgbuilds/nginx-mainline-mod-lua-git/PKGBUILD
2025-01-08 17:18:59 -03:00

50 lines
1.3 KiB
Bash

# Maintainer: Lain Iwakura <lain@serialexperiments.club
# Contributor: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
pkgname=nginx-mainline-mod-lua-git
_modname="lua"
pkgver=v0.10.16.r379.g950b1fb2
pkgrel=1
epoch=1
pkgdesc='Lua script engine module for mainline nginx'
arch=('i686' 'x86_64')
depends=('nginx-mainline' 'nginx-mainline-mod-ndk' 'luajit' 'lua-resty-core' 'pcre')
makedepends=('nginx-mainline-src')
url="https://github.com/openresty/lua-nginx-module"
license=('BSD')
source=(git+https://github.com/openresty/$_modname-nginx-module/)
sha256sums=('SKIP')
pkgver() {
cd "$_modname-nginx-module"
git describe --long | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare() {
mkdir -p build
cd build
ln -sf /usr/src/nginx/auto
ln -sf /usr/src/nginx/src
}
build() {
cd build
export LUAJIT_INC=$(pkg-config luajit --variable=includedir)
export LUAJIT_LIB=$(pkg-config luajit --variable=libdir)
export NGINX_USE_HTTP2=1
nginx -V 2>&1 |
grep -o -- '--prefix=.*$' |
xargs printf '%s\0' |
sed -z '/^--with-ld-opt=/{s/-Wl,/\0-E,/;s/-Wl,/-lpcre \0/}' |
xargs -0 /usr/src/nginx/configure \
--add-dynamic-module=../$_modname-nginx-module
make modules
}
package() {
cd build/objs
for mod in *.so; do
install -Dm755 $mod "$pkgdir"/usr/lib/nginx/modules/$mod
done
}