# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php82-spx
_extname=spx
pkgver=0.4.16
pkgrel=0
pkgdesc="A simple & straight-to-the-point PHP 8.2 profiling extension with its built-in web UI"
url="https://github.com/NoiseByNorthwest/php-spx"
arch="x86_64 aarch64"
license="GPL-3.0-or-later"
_phpv=82
_php=php$_phpv
depends="$_php-common"
makedepends="$_php-dev zlib-dev"
checkdepends="$_php-cgi"
source="php-$_extname-$pkgver.tar.gz::https://github.com/NoiseByNorthwest/php-spx/archive/v$pkgver.tar.gz"
builddir="$srcdir/php-$_extname-$pkgver"

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

check() {
	TEST_PHP_CGI_EXECUTABLE=/usr/bin/php-cgi$_phpv \
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS=--show-diff
	$_php -d extension=modules/$_extname.so --ri $_extname
}

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

sha512sums="
9679ac1c527139e3f6cd22925ec2035ff0b829da7e506244d220c36480f79a23851de01ba6c164e59f7cb52a133683f1ba5bada7fd485abd55b364839026e1c9  php-spx-0.4.16.tar.gz
"
