# Contributor: Fabio Ribeiro <fabiorphp@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php82-pecl-redis
_extname=redis
pkgver=6.1.0_rc1
_pkgver=${pkgver/_rc/RC}
pkgrel=0
pkgdesc="PHP 8.2 extension for interfacing with Redis - PECL"
url="https://pecl.php.net/package/redis"
arch="all"
license="PHP-3.01"
_phpv=82
_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="
1e20abc5378ec57dedb8adadeb86c7f16208d795b7b9e5c92cd358baf83cd75b951ac906c9d72595e88f6e04ef634231d230826d8bd34609dddc53007861ce31  php-pecl-redis-6.1.0RC1.tgz
"
