# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php82-pecl-ds
_extname=ds
pkgver=1.5.0
pkgrel=0
pkgdesc="PHP 8.2 extension for efficient Data Structures - PECL"
url="https://pecl.php.net/package/ds"
arch="all"
license="MIT"
_phpv=82
_php=php$_phpv
depends="$_php-common"
makedepends="$_php-dev"
checkdepends="composer
	$_php-curl $_php-iconv $_php-mbstring $_php-openssl $_php-phar
	$_php-dom $_php-opcache $_php-tokenizer $_php-xml $_php-xmlwriter
	"
_commit=daf9b1eca375030e3a6196e7ec7381e8b0686e91
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz
	php-pecl-$_extname-$pkgver-composer.json::https://github.com/php-ds/ext-ds/raw/v$pkgver/composer.json
	php-pecl-$_extname-$pkgver-phpunit.xml::https://github.com/php-ds/ext-ds/raw/v$pkgver/phpunit.xml
	"
builddir="$srcdir/$_extname-$pkgver"

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

check() {
	local _testphp="$_php -d extension=$builddir/modules/$_extname.so"
	$_testphp --ri $_extname
	mkdir -p tests
	cd tests
	cp "$srcdir"/php-pecl-$_extname-$pkgver-composer.json composer.json
	cp "$srcdir"/php-pecl-$_extname-$pkgver-phpunit.xml phpunit.xml
	$_testphp /usr/bin/composer.phar install --prefer-dist --no-interaction
	$_testphp vendor/bin/phpunit
}

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

sha512sums="
12c8d617c0a41df68c157a3f9304763464ab2d8d1f8ada668de53a879f78dabd08c22caa35cd893ee64a267c7bda578d6202846c3dfc237916ee326ab6f02747  php-pecl-ds-1.5.0.tgz
eb7f2071b6b99586ecaec33f5338d730835bd152d10a56b686a092b320035506d60c0752b23e8793205822a2d1bb559f7d6fedb0de9666404dcd68818a520d17  php-pecl-ds-1.5.0-composer.json
32fed119d6fbe0541468987cd73c6104f848e2c1616cd71b068c6d0d480a476edff24f031153d6695c4b3c0d63352c652cf61d902031e1d761a120ad8525afd0  php-pecl-ds-1.5.0-phpunit.xml
"
