package/qt5/qt5webkit: fix WebCore compatibility issue with updated libxml2

qt5webkit build currently breaks on the following error:

XSLStyleSheetLibxslt.cpp:148:129: error: invalid conversion from ‘void (*)(void*, xmlError*)’ {aka ‘void (*)(void*, _xmlError*)’} to ‘xmlStructuredErrorFunc’ {aka ‘void (*)(void*, const _xmlError*)’} [-fpermissive]
  148 |     XMLDocumentParserScope scope(cachedResourceLoader(), XSLTProcessor::genericErrorFunc, XSLTProcessor::parseErrorFunc, console);
      |                                                                                                                                 ^
      |                                                                                                                                 |
      |                                                                                                                                 void (*)(void*, xmlError*) {aka void (*)(void*, _xmlError*)}

This error is due to an API update in libxml2, enforcing const on more
struct in version 2.12.0 (see [1]). Buildroot now tracks v2.12.5.
Upstream Webkit project has already issued the corresponding fix ([2]),
which updates corresponding internal prototypes depending on libxml2
version, but the qt5webkit version tracked in buildroot does not integrate
the corresponding Webkit version.

Fix this build issue by bringing the upstream patch "as is" from Webkit

No autobuilder references because this build error was hidden by
another build error fixed in a previous patch.

[1] https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.12.0
[2] 1bad176b24

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
(cherry picked from commit e24a117388)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
This commit is contained in:
Alexis Lothoré 2024-03-13 23:46:10 +01:00 committed by Peter Korsgaard
parent 4ec45eda0e
commit b72162e806

View File

@ -0,0 +1,61 @@
From df49bfc4c93001970c9b9266903ee7e8804fb576 Mon Sep 17 00:00:00 2001
From: Adrian Perez de Castro <aperez@igalia.com>
Date: Mon, 20 Nov 2023 07:42:30 -0800
Subject: [PATCH] Build fails with libxml2 version 2.12.0 due to API change
https://bugs.webkit.org/show_bug.cgi?id=265128
Reviewed by Philippe Normand.
Starting with libxml2 2.12.0, the API has changed the const-ness of the
xmlError pointers, which results in a build error due to a mismatched
type in the parsing error callback. This papers over the difference by
using preprocessor conditionals.
* Source/WebCore/xml/XSLTProcessor.h: Use const when building against
libxml2 2.12.0 or newer.
* Source/WebCore/xml/XSLTProcessorLibxslt.cpp:
(WebCore::XSLTProcessor::parseErrorFunc): Ditto.
Canonical link: https://commits.webkit.org/270977@main
Upstream: https://github.com/WebKit/WebKit/commit/1bad176b2496579d760852c80cff3ad9fb7c3a4b
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
---
Source/WebCore/xml/XSLTProcessor.h | 4 ++++
Source/WebCore/xml/XSLTProcessorLibxslt.cpp | 4 ++++
2 files changed, 8 insertions(+)
diff --git a/Source/WebCore/xml/XSLTProcessor.h b/Source/WebCore/xml/XSLTProcessor.h
index 21bb45b5cbe1..5cf20557918f 100644
--- a/Source/WebCore/xml/XSLTProcessor.h
+++ b/Source/WebCore/xml/XSLTProcessor.h
@@ -61,7 +61,11 @@ public:
void reset();
+#if LIBXML_VERSION >= 21200
+ static void parseErrorFunc(void* userData, const xmlError*);
+#else
static void parseErrorFunc(void* userData, xmlError*);
+#endif
static void genericErrorFunc(void* userData, const char* msg, ...);
// Only for libXSLT callbacks
diff --git a/Source/WebCore/xml/XSLTProcessorLibxslt.cpp b/Source/WebCore/xml/XSLTProcessorLibxslt.cpp
index a65691087e3c..9f6b363dfc6c 100644
--- a/Source/WebCore/xml/XSLTProcessorLibxslt.cpp
+++ b/Source/WebCore/xml/XSLTProcessorLibxslt.cpp
@@ -59,7 +59,11 @@ void XSLTProcessor::genericErrorFunc(void*, const char*, ...)
// It would be nice to do something with this error message.
}
+#if LIBXML_VERSION >= 21200
+void XSLTProcessor::parseErrorFunc(void* userData, const xmlError* error)
+#else
void XSLTProcessor::parseErrorFunc(void* userData, xmlError* error)
+#endif
{
PageConsoleClient* console = static_cast<PageConsoleClient*>(userData);
if (!console)
--
2.43.1