commit:     6ca8aa633a5153a232f2885d80e84474bd02befc
Author:     Lothar Serra Mari <mail <AT> serra <DOT> me>
AuthorDate: Wed Nov 27 13:29:41 2024 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Mon Mar 17 01:43:08 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6ca8aa63

dev-php/pecl-imagick: Add support for PHP 8.4

The applied compatibility patch replacing the removed php_strtolower()
function with zend_str_tolower() is safe to use in all supported PHP
versions since it got introduced in PHP 5.4.

Signed-off-by: Lothar Serra Mari <mail <AT> serra.me>
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../files/pecl-imagick-3.7.0-php8.4.patch          | 40 ++++++++++++++++++++++
 dev-php/pecl-imagick/pecl-imagick-3.7.0-r4.ebuild  | 39 +++++++++++++++++++++
 2 files changed, 79 insertions(+)

diff --git a/dev-php/pecl-imagick/files/pecl-imagick-3.7.0-php8.4.patch 
b/dev-php/pecl-imagick/files/pecl-imagick-3.7.0-php8.4.patch
new file mode 100644
index 000000000000..189e745e759f
--- /dev/null
+++ b/dev-php/pecl-imagick/files/pecl-imagick-3.7.0-php8.4.patch
@@ -0,0 +1,40 @@
+From 65e27f2bc02e7e8f1bf64e26e359e42a1331fca1 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Michael=20Vo=C5=99=C3=AD=C5=A1ek?= <[email protected]>
+Date: Wed, 25 Sep 2024 10:56:28 +0200
+Subject: [PATCH] Fix removed "php_strtolower" for PHP 8.4
+
+---
+ imagick.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/imagick.c b/imagick.c
+index 1b765389..ebab7ae7 100644
+--- a/imagick.c
++++ b/imagick.c
+@@ -610,7 +610,7 @@ static zval *php_imagick_read_property(zend_object 
*object, zend_string *member,
+                                       if (format) {
+                                               retval = rv;
+                                               ZVAL_STRING(retval, format);
+-                                              
php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
++                                              
zend_str_tolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
+                                               
IMAGICK_FREE_MAGICK_MEMORY(format);
+                                       } else {
+                                               retval = rv;
+@@ -683,7 +683,7 @@ static zval *php_imagick_read_property(zval *object, zval 
*member, int type, voi
+                                       if (format) {
+                                               retval = rv;
+                                               ZVAL_STRING(retval, format);
+-                                              
php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
++                                              
zend_str_tolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
+                                               
IMAGICK_FREE_MAGICK_MEMORY(format);
+                                       } else {
+                                               retval = rv;
+@@ -766,7 +766,7 @@ static zval *php_imagick_read_property(zval *object, zval 
*member, int type, con
+ 
+                                       if (format) {
+                                               ZVAL_STRING(retval, format, 1);
+-                                              
php_strtolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
++                                              
zend_str_tolower(Z_STRVAL_P(retval), Z_STRLEN_P(retval));
+                                               
IMAGICK_FREE_MAGICK_MEMORY(format);
+                                       } else {
+                                               ZVAL_STRING(retval, "", 1);

diff --git a/dev-php/pecl-imagick/pecl-imagick-3.7.0-r4.ebuild 
b/dev-php/pecl-imagick/pecl-imagick-3.7.0-r4.ebuild
new file mode 100644
index 000000000000..c3424b9887ff
--- /dev/null
+++ b/dev-php/pecl-imagick/pecl-imagick-3.7.0-r4.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PHP_EXT_NAME="imagick"
+USE_PHP="php8-1 php8-2 php8-3 php8-4"
+
+# https://github.com/Imagick/imagick/issues/626
+PHP_EXT_NEEDED_USE="-debug"
+
+inherit php-ext-pecl-r3
+
+KEYWORDS="~amd64 ~arm ~arm64 ~x86"
+
+DESCRIPTION="PHP wrapper for the ImageMagick library"
+HOMEPAGE="https://pecl.php.net/package/imagick 
https://github.com/Imagick/imagick";
+LICENSE="PHP-3.01"
+SLOT="0"
+IUSE="examples test"
+RESTRICT="!test? ( test )"
+
+# imagemagick[-openmp] is needed wrt bug 547922 and upstream
+# https://github.com/Imagick/imagick#openmp
+RDEPEND="media-gfx/imagemagick:=[-openmp]"
+DEPEND="
+       ${RDEPEND}
+       test? ( media-gfx/imagemagick:=[hdri,jpeg,png,svg,truetype,xml] )
+"
+
+PATCHES="${FILESDIR}/${PN}-3.7.0-php8.3.patch
+                ${FILESDIR}/${PN}-3.7.0-php8.4.patch"
+
+PHP_EXT_ECONF_ARGS="--with-imagick=${EPREFIX}/usr"
+
+src_install() {
+       php-ext-pecl-r3_src_install
+       php-ext-source-r3_addtoinifiles "imagick.skip_version_check" "1"
+}

Reply via email to