# Contributor: Andy Postnikov <apostnikov@gmail.com>
# Contributor: MPThLee <mpthlee@gmail.com>
# Maintainer: MPThLee <mpthlee@gmail.com>

pkgname=php82-pecl-luasandbox
_extname=LuaSandbox
pkgver=4.1.2
pkgrel=0
pkgdesc="LuaSandbox PHP 8.2 extension - PECL"
url="https://pecl.php.net/package/LuaSandbox"
arch="all"
license="MIT"
_phpv=82
_php=php$_phpv
_luaver="5.1"
depends="$_php-common"
makedepends="$_php-dev lua$_luaver-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir"/$_extname-$pkgver

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=php-config$_phpv
	make
}

check() {
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS=--show-diff
	$_php -dextension=modules/luasandbox.so --ri luasandbox
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/$_php/conf.d
	install -d $_confdir
	echo "extension=luasandbox" > $_confdir/luasandbox.ini
}

sha512sums="
c1ae280d4fdb97f0bb50b3fad464d9178494f54065be901f6b0a5de5bfe7742c6ef054c94cbcec77a1d153b07bbb88fa0ed6d07b0279df45bcd5d6457fdc470d  php-pecl-LuaSandbox-4.1.2.tgz
"
