Skip to content

Commit

Permalink
webkit2-gtk: fix build with libxml2 2.12+
Browse files Browse the repository at this point in the history
  • Loading branch information
kencu committed Mar 1, 2024
1 parent 4c4a6fb commit 915fbf4
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
4 changes: 4 additions & 0 deletions www/webkit2-gtk/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ patchfiles-append patch-webkit2gtk-specify-installed-dylibs.diff
# Backport https://github.com/WebKit/WebKit/commit/b83958928838b8a997c12a8de06f89377df0a903
patchfiles-append patch-icu-68-true-false.diff

# API changed with libxml2 2.12+
# https://github.com/WebKit/WebKit/commit/1bad176b2496579d760852c80cff3ad9fb7c3a4b
patchfiles-append patch-webkit2-gtk-fixes-for-libxml2-2.12.0.diff

# Reduce compilation warnings
configure.cppflags-append \
-Wno-deprecated-declarations
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
From 1bad176b2496579d760852c80cff3ad9fb7c3a4b 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
---
Source/WebCore/xml/XSLTProcessor.h | 4 ++++
Source/WebCore/xml/XSLTProcessorLibxslt.cpp | 4 ++++
2 files changed, 8 insertions(+)

diff --git Source/WebCore/xml/XSLTProcessor.h Source/WebCore/xml/XSLTProcessor.h
index 21bb45b5cbe16..5cf20557918fa 100644
--- Source/WebCore/xml/XSLTProcessor.h
+++ Source/WebCore/xml/XSLTProcessor.h
@@ -61,7 +61,11 @@ class XSLTProcessor : public RefCounted<XSLTProcessor> {

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 Source/WebCore/xml/XSLTProcessorLibxslt.cpp Source/WebCore/xml/XSLTProcessorLibxslt.cpp
index a65691087e3c5..9f6b363dfc6c9 100644
--- Source/WebCore/xml/XSLTProcessorLibxslt.cpp
+++ 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)

0 comments on commit 915fbf4

Please sign in to comment.