# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php82-pecl-decimal
_extname=decimal
pkgver=1.5.0
pkgrel=1
pkgdesc="Correctly-rounded arbitrary precision decimal floating-point arithmetic in PHP 8.2 - PECL"
url="https://pecl.php.net/package/decimal"
arch="all"
license="MIT"
_phpv=82
_php=php$_phpv
depends="$_php-common"
makedepends="$_php-dev mpdecimal-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

install_if="php-$_extname php$_phpv"

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

check() {
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test TESTS=--show-diff
}

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

sha512sums="
06806cb9c5ebae3abed1d41d021be63bb6ab44878e3034c4661a13d22ffab12b9804bc9196c10bdc9416d2559719b31a7fef73e3948c1ea94d3447c6a4b6c086  php-pecl-decimal-1.5.0.tgz
"
