wpe: Fix build for version 2.44
authorPhilippe Normand <philn@igalia.com>
Mon, 23 Dec 2024 13:58:31 +0000 (14:58 +0100)
committerPhilippe Normand <philn@igalia.com>
Mon, 23 Dec 2024 17:54:28 +0000 (18:54 +0100)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8203>

subprojects/gst-plugins-bad/ext/wpe/wpe-extension/gstwpeextension.c
subprojects/gst-plugins-bad/ext/wpe/wpe-extension/meson.build

index 96009dddba290676a94777262c442a72f26ab7af..eed2659b844745e2f8040d22d81a46a2debb6439 100644 (file)
@@ -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
index 232ce05573526d7a44771548fe094a334b8259eb..b12e16686c360d26eb280989684e42fa718c9b37 100644 (file)
@@ -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)