php81: libxml2 2.13 compatibility

This commit is contained in:
Piotr Kwiecinski 2024-08-09 14:19:35 +02:00
parent 61682297ce
commit fa088a9477
No known key found for this signature in database
GPG Key ID: EC0DE1CB9D5258B4
3 changed files with 126 additions and 6 deletions

View File

@ -5,12 +5,28 @@ let
version = "8.1.29"; version = "8.1.29";
hash = "sha256-h6YDEyY/L1M/GA5xknLKXkfNmITU7DyTcgGY6v+uCCc="; hash = "sha256-h6YDEyY/L1M/GA5xknLKXkfNmITU7DyTcgGY6v+uCCc=";
extraPatches = [ extraPatches = [
# Fix build with libxml 2.12+. # Fix build with libxml2 2.12+.
# Patch from https://github.com/php/php-src/commit/0a39890c967aa57225bb6bdf4821aff7a3a3c082 # Patch from https://github.com/php/php-src/commit/0a39890c967aa57225bb6bdf4821aff7a3a3c082
(fetchpatch { (fetchpatch {
url = "https://github.com/php/php-src/commit/0a39890c967aa57225bb6bdf4821aff7a3a3c082.patch"; url = "https://github.com/php/php-src/commit/0a39890c967aa57225bb6bdf4821aff7a3a3c082.patch";
hash = "sha256-HvpTL7aXO9gr4glFdhqUWQPrG8TYTlvbNINq33M3zS0="; hash = "sha256-HvpTL7aXO9gr4glFdhqUWQPrG8TYTlvbNINq33M3zS0=";
}) })
# Fix tests with libxml2 2.12
(fetchpatch {
url = "https://github.com/php/php-src/commit/061058a9b1bbd90d27d97d79aebcf2b5029767b0.patch";
hash = "sha256-0hOlAG+pOYp/gUU0MUMZvzWpgr0ncJi5GB8IeNxxyEU=";
excludes = [
"NEWS"
];
})
# Backport of PHP_LIBXML_IGNORE_DEPRECATIONS_START and PHP_LIBXML_IGNORE_DEPRECATIONS_END
# Required for libxml2 2.13 compatibility patch.
./php81-fix-libxml2-2.13-compatibility.patch
# Fix build with libxml2 2.13+. Has to be applied after libxml2 2.12 patch.
(fetchpatch {
url = "https://github.com/php/php-src/commit/9b4f6b09d58a4e54ee60443bf9a8b166852c03e0.patch";
hash = "sha256-YC3I0BQi3o3+VmRu/UqpqPpaSC+ekPqzbORTHftbPvY=";
})
]; ];
}); });
in in

View File

@ -0,0 +1,28 @@
diff --git a/ext/libxml/php_libxml.h b/ext/libxml/php_libxml.h
index a1011f0b17..7a7622c482 100644
--- a/ext/libxml/php_libxml.h
+++ b/ext/libxml/php_libxml.h
@@ -119,6 +119,23 @@ PHP_LIBXML_API void php_libxml_shutdown(void);
ZEND_TSRMLS_CACHE_EXTERN()
#endif
+#if defined(__clang__)
+# define PHP_LIBXML_IGNORE_DEPRECATIONS_START \
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
+# define PHP_LIBXML_IGNORE_DEPRECATIONS_END \
+ _Pragma("clang diagnostic pop")
+#elif defined(__GNUC__)
+# define PHP_LIBXML_IGNORE_DEPRECATIONS_START \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+# define PHP_LIBXML_IGNORE_DEPRECATIONS_END \
+ _Pragma("GCC diagnostic pop")
+#else
+# define PHP_LIBXML_IGNORE_DEPRECATIONS_START
+# define PHP_LIBXML_IGNORE_DEPRECATIONS_END
+#endif
+
/* Other extension may override the global state options, these global options
* are copied initially to ctxt->options. Set the options to a known good value.
* See libxml2 globals.c and parserInternals.c.

View File

@ -383,7 +383,7 @@ in {
"--enable-dom" "--enable-dom"
]; ];
# Add a PHP lower version bound constraint to avoid applying the patch on older PHP versions. # Add a PHP lower version bound constraint to avoid applying the patch on older PHP versions.
patches = lib.optionals ((lib.versions.majorMinor php.version == "8.2" && lib.versionOlder php.version "8.2.14" && lib.versionAtLeast php.version "8.2.7") || (lib.versions.majorMinor php.version == "8.1" && lib.versionAtLeast php.version "8.1.27")) [ patches = lib.optionals ((lib.versions.majorMinor php.version == "8.2" && lib.versionOlder php.version "8.2.14" && lib.versionAtLeast php.version "8.2.7") || (lib.versions.majorMinor php.version == "8.1")) [
# Fix tests with libxml 2.12 # Fix tests with libxml 2.12
# Part of 8.3.1RC1+, 8.2.14RC1+ # Part of 8.3.1RC1+, 8.2.14RC1+
(fetchpatch { (fetchpatch {
@ -393,6 +393,14 @@ in {
"NEWS" "NEWS"
]; ];
}) })
] ++ lib.optionals (lib.versions.majorMinor php.version == "8.1") [
# Backport of PHP_LIBXML_IGNORE_DEPRECATIONS_START and PHP_LIBXML_IGNORE_DEPRECATIONS_END
../development/interpreters/php/php81-fix-libxml2-2.13-compatibility.patch
# Fix build with libxml2 2.13+. Has to be applied after libxml2 2.12 patch.
(fetchpatch {
url = "https://github.com/php/php-src/commit/9b4f6b09d58a4e54ee60443bf9a8b166852c03e0.patch";
hash = "sha256-YC3I0BQi3o3+VmRu/UqpqPpaSC+ekPqzbORTHftbPvY=";
})
] ++ lib.optionals (lib.versions.majorMinor php.version == "8.2" && lib.versionOlder php.version "8.2.22") [ ] ++ lib.optionals (lib.versions.majorMinor php.version == "8.2" && lib.versionOlder php.version "8.2.22") [
# Fixes compatibility with libxml2 2.13. Part of 8.3.10RC1+, 8.2.22RC1+ # Fixes compatibility with libxml2 2.13. Part of 8.3.10RC1+, 8.2.22RC1+
(fetchpatch { (fetchpatch {
@ -617,7 +625,24 @@ in {
configureFlags = [ configureFlags = [
"--enable-simplexml" "--enable-simplexml"
]; ];
patches = lib.optionals (lib.versions.majorMinor php.version == "8.2" && lib.versionOlder php.version "8.2.22") [ patches = lib.optionals (lib.versions.majorMinor php.version == "8.1") [
# Fix tests with libxml2 2.12
(fetchpatch {
url = "https://github.com/php/php-src/commit/061058a9b1bbd90d27d97d79aebcf2b5029767b0.patch";
hash = "sha256-0hOlAG+pOYp/gUU0MUMZvzWpgr0ncJi5GB8IeNxxyEU=";
excludes = [
"NEWS"
];
})
# Backport of PHP_LIBXML_IGNORE_DEPRECATIONS_START and PHP_LIBXML_IGNORE_DEPRECATIONS_END
# Required for libxml2 2.13 compatibility patch.
../development/interpreters/php/php81-fix-libxml2-2.13-compatibility.patch
# Fix build with libxml2 2.13+. Has to be applied after libxml2 2.12 patch.
(fetchpatch {
url = "https://github.com/php/php-src/commit/9b4f6b09d58a4e54ee60443bf9a8b166852c03e0.patch";
hash = "sha256-YC3I0BQi3o3+VmRu/UqpqPpaSC+ekPqzbORTHftbPvY=";
})
] ++ lib.optionals (lib.versions.majorMinor php.version == "8.2" && lib.versionOlder php.version "8.2.22") [
# Fixes compatibility with libxml2 2.13. Part of 8.3.10RC1+, 8.2.22RC1+ # Fixes compatibility with libxml2 2.13. Part of 8.3.10RC1+, 8.2.22RC1+
(fetchpatch { (fetchpatch {
url = "https://github.com/php/php-src/commit/4fe821311cafb18ca8bdf20b9d796c48a13ba552.diff?full_index=1"; url = "https://github.com/php/php-src/commit/4fe821311cafb18ca8bdf20b9d796c48a13ba552.diff?full_index=1";
@ -647,7 +672,24 @@ in {
]; ];
doCheck = stdenv.isDarwin; # TODO: a couple tests still fail on *-linux doCheck = stdenv.isDarwin; # TODO: a couple tests still fail on *-linux
internalDeps = [ php.extensions.session ]; internalDeps = [ php.extensions.session ];
patches = lib.optionals (lib.versions.majorMinor php.version == "8.2" && lib.versionOlder php.version "8.2.22") [ patches = lib.optionals (lib.versions.majorMinor php.version == "8.1") [
# Fix tests with libxml2 2.12
(fetchpatch {
url = "https://github.com/php/php-src/commit/061058a9b1bbd90d27d97d79aebcf2b5029767b0.patch";
hash = "sha256-0hOlAG+pOYp/gUU0MUMZvzWpgr0ncJi5GB8IeNxxyEU=";
excludes = [
"NEWS"
];
})
# Backport of PHP_LIBXML_IGNORE_DEPRECATIONS_START and PHP_LIBXML_IGNORE_DEPRECATIONS_END
# Required for libxml2 2.13 compatibility patch.
../development/interpreters/php/php81-fix-libxml2-2.13-compatibility.patch
# Fix build with libxml2 2.13+. Has to be applied after libxml2 2.12 patch.
(fetchpatch {
url = "https://github.com/php/php-src/commit/9b4f6b09d58a4e54ee60443bf9a8b166852c03e0.patch";
hash = "sha256-YC3I0BQi3o3+VmRu/UqpqPpaSC+ekPqzbORTHftbPvY=";
})
] ++ lib.optionals (lib.versions.majorMinor php.version == "8.2" && lib.versionOlder php.version "8.2.22") [
# Fixes compatibility with libxml2 2.13. Part of 8.3.10RC1+, 8.2.22RC1+ # Fixes compatibility with libxml2 2.13. Part of 8.3.10RC1+, 8.2.22RC1+
(fetchpatch { (fetchpatch {
url = "https://github.com/php/php-src/commit/4fe821311cafb18ca8bdf20b9d796c48a13ba552.diff?full_index=1"; url = "https://github.com/php/php-src/commit/4fe821311cafb18ca8bdf20b9d796c48a13ba552.diff?full_index=1";
@ -692,7 +734,24 @@ in {
"--enable-xml" "--enable-xml"
]; ];
doCheck = false; doCheck = false;
patches = lib.optionals (lib.versions.majorMinor php.version == "8.2" && lib.versionOlder php.version "8.2.22") [ patches = lib.optionals (lib.versions.majorMinor php.version == "8.1") [
# Fix tests with libxml2 2.12
(fetchpatch {
url = "https://github.com/php/php-src/commit/061058a9b1bbd90d27d97d79aebcf2b5029767b0.patch";
hash = "sha256-0hOlAG+pOYp/gUU0MUMZvzWpgr0ncJi5GB8IeNxxyEU=";
excludes = [
"NEWS"
];
})
# Backport of PHP_LIBXML_IGNORE_DEPRECATIONS_START and PHP_LIBXML_IGNORE_DEPRECATIONS_END
# Required for libxml2 2.13 compatibility patch.
../development/interpreters/php/php81-fix-libxml2-2.13-compatibility.patch
# Fix build with libxml2 2.13+. Has to be applied after libxml2 2.12 patch.
(fetchpatch {
url = "https://github.com/php/php-src/commit/9b4f6b09d58a4e54ee60443bf9a8b166852c03e0.patch";
hash = "sha256-YC3I0BQi3o3+VmRu/UqpqPpaSC+ekPqzbORTHftbPvY=";
})
] ++ lib.optionals (lib.versions.majorMinor php.version == "8.2" && lib.versionOlder php.version "8.2.22") [
# Fixes compatibility with libxml2 2.13. Part of 8.3.10RC1+, 8.2.22RC1+ # Fixes compatibility with libxml2 2.13. Part of 8.3.10RC1+, 8.2.22RC1+
(fetchpatch { (fetchpatch {
url = "https://github.com/php/php-src/commit/4fe821311cafb18ca8bdf20b9d796c48a13ba552.diff?full_index=1"; url = "https://github.com/php/php-src/commit/4fe821311cafb18ca8bdf20b9d796c48a13ba552.diff?full_index=1";
@ -722,7 +781,24 @@ in {
configureFlags = [ configureFlags = [
"--enable-xmlwriter" "--enable-xmlwriter"
]; ];
patches = lib.optionals (lib.versions.majorMinor php.version == "8.2" && lib.versionOlder php.version "8.2.22") [ patches = lib.optionals (lib.versions.majorMinor php.version == "8.1") [
# Fix tests with libxml2 2.12
(fetchpatch {
url = "https://github.com/php/php-src/commit/061058a9b1bbd90d27d97d79aebcf2b5029767b0.patch";
hash = "sha256-0hOlAG+pOYp/gUU0MUMZvzWpgr0ncJi5GB8IeNxxyEU=";
excludes = [
"NEWS"
];
})
# Backport of PHP_LIBXML_IGNORE_DEPRECATIONS_START and PHP_LIBXML_IGNORE_DEPRECATIONS_END
# Required for libxml2 2.13 compatibility patch.
../development/interpreters/php/php81-fix-libxml2-2.13-compatibility.patch
# Fix build with libxml2 2.13+. Has to be applied after libxml2 2.12 patch.
(fetchpatch {
url = "https://github.com/php/php-src/commit/9b4f6b09d58a4e54ee60443bf9a8b166852c03e0.patch";
hash = "sha256-YC3I0BQi3o3+VmRu/UqpqPpaSC+ekPqzbORTHftbPvY=";
})
] ++ lib.optionals (lib.versions.majorMinor php.version == "8.2" && lib.versionOlder php.version "8.2.22") [
# Fixes compatibility with libxml2 2.13. Part of 8.3.10RC1+, 8.2.22RC1+ # Fixes compatibility with libxml2 2.13. Part of 8.3.10RC1+, 8.2.22RC1+
(fetchpatch { (fetchpatch {
url = "https://github.com/php/php-src/commit/4fe821311cafb18ca8bdf20b9d796c48a13ba552.diff?full_index=1"; url = "https://github.com/php/php-src/commit/4fe821311cafb18ca8bdf20b9d796c48a13ba552.diff?full_index=1";