# Contributor: Fabio Ribeiro <fabiorphp@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php83-pecl-mailparse
_extname=mailparse
pkgver=3.1.6
pkgrel=1
pkgdesc="PHP 8.3 extension for parsing and working with email messages - PECL"
url="https://pecl.php.net/package/mailparse"
arch="all"
license="PHP-3.01"
_phpv=83
_php=php$_phpv
depends="$_php-mbstring"
makedepends="$_php-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() {
	# Tests require mbstring extension which is not bundled
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=/usr/lib/$_php/modules/mbstring.so \
		-d extension=modules/$_extname.so" TESTS=--show-diff
}

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

sha512sums="
4bb629c2fc2aa7e9ab74f004222b6cfca13a7f0c3cb5152b67423bea4fff8dca5b4442ac2ddfea1127dfc893141eedae3e22b3f05f1b2368c4a4d0267a090388  php-pecl-mailparse-3.1.6.tgz
"
