diff --git a/dev-lang/php/metadata.xml b/dev-lang/php/metadata.xml
index 7143eef2004bf..5783b3b852f78 100644
--- a/dev-lang/php/metadata.xml
+++ b/dev-lang/php/metadata.xml
@@ -17,6 +17,9 @@
Enable password hashing algorithm from app-crypt/argon2
+
+ Enable AVIF support in bundled libgd
+
Enable the BCMath Arbitrary Precision Mathematics extension
diff --git a/dev-lang/php/php-8.1.18.ebuild b/dev-lang/php/php-8.1.18-r1.ebuild
similarity index 99%
rename from dev-lang/php/php-8.1.18.ebuild
rename to dev-lang/php/php-8.1.18-r1.ebuild
index 7a0c8ba9fcf76..bdd36d3fc8f65 100644
--- a/dev-lang/php/php-8.1.18.ebuild
+++ b/dev-lang/php/php-8.1.18-r1.ebuild
@@ -33,8 +33,8 @@ IUSE="${IUSE}
${SAPIS/cli/+cli}
threads"
-IUSE="${IUSE} acl apparmor argon2 bcmath berkdb bzip2 calendar cdb cjk
- coverage +ctype curl debug
+IUSE="${IUSE} acl apparmor argon2 avif bcmath berkdb bzip2 calendar
+ cdb cjk coverage +ctype curl debug
enchant exif ffi +fileinfo +filter firebird
+flatfile ftp gd gdbm gmp +iconv imap inifile
intl iodbc ipv6 +jit kerberos ldap ldap-sasl libedit lmdb
@@ -49,6 +49,7 @@ IUSE="${IUSE} acl apparmor argon2 bcmath berkdb bzip2 calendar cdb cjk
# The Oracle instant client provides its own incompatible ldap library.
REQUIRED_USE="
|| ( cli cgi fpm apache2 embed phpdbg )
+ avif? ( gd zlib )
cli? ( ^^ ( readline libedit ) )
!cli? ( ?? ( readline libedit ) )
truetype? ( gd zlib )
@@ -82,6 +83,7 @@ COMMON_DEPEND="
fpm? ( acl? ( sys-apps/acl ) apparmor? ( sys-libs/libapparmor ) )
apache2? ( www-servers/apache[apache2_modules_unixd(+),threads=] )
argon2? ( app-crypt/argon2:= )
+ avif? ( media-libs/libavif:= )
berkdb? ( || ( sys-libs/db:5.3 sys-libs/db:4.8 ) )
bzip2? ( app-arch/bzip2:0= )
cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
@@ -262,6 +264,7 @@ src_configure() {
our_conf+=(
$(use_with apparmor fpm-apparmor)
$(use_with argon2 password-argon2 "${EPREFIX}/usr")
+ $(use_with avif)
$(use_enable bcmath)
$(use_with bzip2 bz2 "${EPREFIX}/usr")
$(use_enable calendar)
diff --git a/dev-lang/php/php-8.2.5.ebuild b/dev-lang/php/php-8.2.5-r1.ebuild
similarity index 99%
rename from dev-lang/php/php-8.2.5.ebuild
rename to dev-lang/php/php-8.2.5-r1.ebuild
index d8e80841110d3..7da6cd162462a 100644
--- a/dev-lang/php/php-8.2.5.ebuild
+++ b/dev-lang/php/php-8.2.5-r1.ebuild
@@ -34,8 +34,8 @@ IUSE="${IUSE}
${SAPIS/cli/+cli}
threads"
-IUSE="${IUSE} acl apparmor argon2 bcmath berkdb bzip2 calendar cdb cjk
- coverage +ctype curl debug
+IUSE="${IUSE} acl apparmor argon2 avif bcmath berkdb bzip2 calendar
+ cdb cjk coverage +ctype curl debug
enchant exif ffi +fileinfo +filter firebird
+flatfile ftp gd gdbm gmp +iconv imap inifile
intl iodbc +jit kerberos ldap ldap-sasl libedit lmdb
@@ -50,6 +50,7 @@ IUSE="${IUSE} acl apparmor argon2 bcmath berkdb bzip2 calendar cdb cjk
# The Oracle instant client provides its own incompatible ldap library.
REQUIRED_USE="
|| ( cli cgi fpm apache2 embed phpdbg )
+ avif? ( gd zlib )
cli? ( ^^ ( readline libedit ) )
!cli? ( ?? ( readline libedit ) )
truetype? ( gd zlib )
@@ -83,6 +84,7 @@ COMMON_DEPEND="
fpm? ( acl? ( sys-apps/acl ) apparmor? ( sys-libs/libapparmor ) selinux? ( sys-libs/libselinux ) )
apache2? ( www-servers/apache[apache2_modules_unixd(+),threads=] )
argon2? ( app-crypt/argon2:= )
+ avif? ( media-libs/libavif:= )
berkdb? ( || ( sys-libs/db:5.3 sys-libs/db:4.8 ) )
bzip2? ( app-arch/bzip2:0= )
cdb? ( || ( dev-db/cdb dev-db/tinycdb ) )
@@ -264,6 +266,7 @@ src_configure() {
our_conf+=(
$(use_with apparmor fpm-apparmor)
$(use_with argon2 password-argon2 "${EPREFIX}/usr")
+ $(use_with avif)
$(use_enable bcmath)
$(use_with bzip2 bz2 "${EPREFIX}/usr")
$(use_enable calendar)