Merge pull request #334411 from piotrkwiecinski/php81-libxml-2.13

php81: libxml 2.13 compatibility
This commit is contained in:
Pol Dellaiera 2024-08-14 16:52:44 +02:00 committed by GitHub
commit 29aa9e9b12
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 126 additions and 6 deletions

View File

@ -5,12 +5,28 @@ let
version = "8.1.29";
hash = "sha256-h6YDEyY/L1M/GA5xknLKXkfNmITU7DyTcgGY6v+uCCc=";
extraPatches = [
# Fix build with libxml 2.12+.
# Fix build with libxml2 2.12+.
# Patch from https://github.com/php/php-src/commit/0a39890c967aa57225bb6bdf4821aff7a3a3c082
(fetchpatch {
url = "https://github.com/php/php-src/commit/0a39890c967aa57225bb6bdf4821aff7a3a3c082.patch";
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

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

@ -387,7 +387,7 @@ in {
"--enable-dom"
];
# 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
# Part of 8.3.1RC1+, 8.2.14RC1+
(fetchpatch {
@ -397,6 +397,14 @@ in {
"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") [
# Fixes compatibility with libxml2 2.13. Part of 8.3.10RC1+, 8.2.22RC1+
(fetchpatch {
@ -630,7 +638,24 @@ in {
configureFlags = [
"--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+
(fetchpatch {
url = "https://github.com/php/php-src/commit/4fe821311cafb18ca8bdf20b9d796c48a13ba552.diff?full_index=1";
@ -660,7 +685,24 @@ in {
];
doCheck = stdenv.isDarwin; # TODO: a couple tests still fail on *-linux
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+
(fetchpatch {
url = "https://github.com/php/php-src/commit/4fe821311cafb18ca8bdf20b9d796c48a13ba552.diff?full_index=1";
@ -705,7 +747,24 @@ in {
"--enable-xml"
];
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+
(fetchpatch {
url = "https://github.com/php/php-src/commit/4fe821311cafb18ca8bdf20b9d796c48a13ba552.diff?full_index=1";
@ -735,7 +794,24 @@ in {
configureFlags = [
"--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+
(fetchpatch {
url = "https://github.com/php/php-src/commit/4fe821311cafb18ca8bdf20b9d796c48a13ba552.diff?full_index=1";