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

pkgname=php82-pecl-uploadprogress
_extname=uploadprogress
pkgver=2.0.2
pkgrel=2
pkgdesc="PHP 8.2 extension to track progress of a file upload - PECL"
url="https://pecl.php.net/package/uploadprogress"
arch="all"
license="PHP-3.01"
_phpv=82
_php=php$_phpv
depends="$_php-common"
makedepends="$_php-dev"
subpackages="$pkgname-doc::noarch"
source="php-pecl-$_extname-$pkgver.tar.gz::https://pecl.php.net/get/uploadprogress-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

install_if="php-$_extname php$_phpv"

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 -d extension=modules/$_extname.so --ri $_extname
}

package() {
	make INSTALL_ROOT="$pkgdir" install

	local confdir="$pkgdir/etc/$_php/conf.d"
	mkdir -p "$confdir"
	echo "extension=$_extname" > "$confdir"/$_extname.ini

	local docdir="$pkgdir"/usr/share/doc/$pkgname
	install -Dm644 -t $docdir README.md
	cp -r examples/. $docdir/examples
}

sha512sums="
b9ee5a09c3de78d58abd34da2d25d7b0cad38416309a9a69192f07e0c3fe2259de261bb3dee571e64e042753f861738ebcd67fa7fafeb595ec32ed3034c773cd  php-pecl-uploadprogress-2.0.2.tar.gz
"
