Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php81: libxml 2.13 compatibility #334411

Merged
merged 1 commit into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion pkgs/development/interpreters/php/8.1.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

@jtojnar jtojnar Aug 24, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What commit does this come from? Edit: Found it, php/php-src@e2d9731

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtojnar I'll PR actual commit patch instead of file. I'm just waiting for build to finish.

# 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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
86 changes: 81 additions & 5 deletions pkgs/top-level/php-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,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 {
Expand All @@ -393,6 +393,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 {
Expand Down Expand Up @@ -617,7 +625,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 {
drupol marked this conversation as resolved.
Show resolved Hide resolved
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";
Expand Down Expand Up @@ -647,7 +672,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";
Expand Down Expand Up @@ -692,7 +734,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";
Expand Down Expand Up @@ -722,7 +781,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";
Expand Down