From d4bfbdcfb4210c182f022da0f07fcc3235c496ef Mon Sep 17 00:00:00 2001 From: Philippe Normand Date: Mon, 23 Dec 2024 14:58:31 +0100 Subject: [PATCH] wpe: Fix build for version 2.44 Part-of: --- .../ext/wpe/wpe-extension/gstwpeextension.c | 16 ++++++++++++++++ .../ext/wpe/wpe-extension/meson.build | 14 +++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/ext/wpe/wpe-extension/gstwpeextension.c b/subprojects/gst-plugins-bad/ext/wpe/wpe-extension/gstwpeextension.c index 96009dddba..eed2659b84 100644 --- a/subprojects/gst-plugins-bad/ext/wpe/wpe-extension/gstwpeextension.c +++ b/subprojects/gst-plugins-bad/ext/wpe/wpe-extension/gstwpeextension.c @@ -45,6 +45,18 @@ G_MODULE_EXPORT void extension_initialize (WebKitWebExtension * extension); static WebKitWebExtension *global_extension = NULL; +#ifndef WEBKIT_CHECK_VERSION +#define WEBKIT_MAJOR_VERSION (WPE_VERSION_MAJOR) +#define WEBKIT_MINOR_VERSION (WPE_VERSION_MINOR) +#define WEBKIT_MICRO_VERSION (WPE_VERSION_MICRO) +#define WEBKIT_CHECK_VERSION(major, minor, micro) \ + (WEBKIT_MAJOR_VERSION > (major) || \ + (WEBKIT_MAJOR_VERSION == (major) && WEBKIT_MINOR_VERSION > (minor)) || \ + (WEBKIT_MAJOR_VERSION == (major) && WEBKIT_MINOR_VERSION == (minor) && \ + WEBKIT_MICRO_VERSION >= (micro))) +#endif + +#if !USE_WPE2 || WEBKIT_CHECK_VERSION(2, 46, 0) static void console_message_cb (WebKitWebPage * page, WebKitConsoleMessage * console_message, gpointer data) @@ -55,13 +67,17 @@ console_message_cb (WebKitWebPage * page, NULL); g_free (message); } +#endif static void web_page_created_callback (WebKitWebExtension * extension, WebKitWebPage * web_page, gpointer data) { + // WebKitConsoleMessage comes and goes. +#if !USE_WPE2 || WEBKIT_CHECK_VERSION(2, 46, 0) g_signal_connect (web_page, "console-message-sent", G_CALLBACK (console_message_cb), NULL); +#endif } void diff --git a/subprojects/gst-plugins-bad/ext/wpe/wpe-extension/meson.build b/subprojects/gst-plugins-bad/ext/wpe/wpe-extension/meson.build index 232ce05573..b12e16686c 100644 --- a/subprojects/gst-plugins-bad/ext/wpe/wpe-extension/meson.build +++ b/subprojects/gst-plugins-bad/ext/wpe/wpe-extension/meson.build @@ -1,7 +1,19 @@ + +# Some WPE versions (hello 2.38) don't export versioning macros for the WebProcess extension. +wpe_version = wpewebkit_dep.version().split('.') +wpe_version_major = wpe_version[0] +wpe_version_minor = wpe_version[1] +wpe_version_micro = wpe_version[2] + +version_c_args = ['-DWPE_VERSION_MAJOR=' + wpe_version_major, + '-DWPE_VERSION_MINOR=' + wpe_version_minor, + '-DWPE_VERSION_MICRO=' + wpe_version_micro + ] + library('gstwpeextension', ['gstwpeextension.c', 'gstwpeaudiosink.c', 'gstwpebusmsgforwarder.c'], dependencies : [wpewebkit_dep, gst_dep, gstbase_dep, giounix_dep], - c_args : ['-DHAVE_CONFIG_H=1'] + gst_wpe_c_args, + c_args : ['-DHAVE_CONFIG_H=1'] + gst_wpe_c_args + version_c_args, include_directories : [configinc], install : true, install_dir : wpe_extension_install_dir)