# Contributor: Fabio Ribeiro <fabiorphp@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php84-pecl-redis
_extname=redis
pkgver=6.2.0
_pkgver=${pkgver/_rc/RC}
pkgrel=0
pkgdesc="PHP 8.4 extension for interfacing with Redis - PECL"
url="https://pecl.php.net/package/redis"
arch="all"
license="PHP-3.01"
_phpv=84
_php=php$_phpv
depends="$_php-pecl-igbinary $_php-pecl-msgpack $_php-session"
makedepends="$_php-dev lz4-dev zstd-dev"
source="php-pecl-$_extname-$_pkgver.tgz::https://pecl.php.net/get/$_extname-$_pkgver.tgz"
builddir="$srcdir/$_extname-$_pkgver"
provides="$_php-redis=$pkgver-r$pkgrel" # for backward compatibility
replaces="$_php-redis" # for backward compatibility

install_if="php-$_extname php$_phpv"

build() {
	phpize$_phpv
	./configure --prefix=/usr --with-php-config=php-config$_phpv \
		--enable-redis-igbinary \
		--enable-redis-lz4 --with-liblz4 \
		--enable-redis-lzf \
		--enable-redis-msgpack \
		--enable-redis-zstd
	make
}

check() {
	# Need running redis server
	$_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/20_$_extname.ini
}

sha512sums="
fd4d79cd4f7a3d25c865ae52daea4e6d9e805f55c3b7004633ac23ed6724a30b85ed3034bddee86c42146b39215309cb9c96f5659b248e6b859295cdf10e02f1  php-pecl-redis-6.2.0.tgz
"
