Bug 1409707 - [Wayland] - provide library shell, r=jhorak
authorMartin Stransky <stransky@redhat.com>
Wed, 18 Oct 2017 14:34:27 +0200
changeset 451090 9865d21055082ef4290f470423c2c73fd793ab17
parent 451089 27e396761ed3bfa9e00b5ec532e2a07ba791c086
child 451091 d282f520d2e3a72b61740fe0d4e01b8151eead54
push id8543
push userryanvm@gmail.com
push dateTue, 16 Jan 2018 14:33:22 +0000
treeherdermozilla-beta@a6525ed16a32 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjhorak
bugs1409707
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1409707 - [Wayland] - provide library shell, r=jhorak We don't add build-time dependency on Wayland libraries; that allows Wayland enabled Firefox builds to run on systems without Wayland support. We also can't dlsym() Wayland symbols directly from libwayland-client.so library as we miss global data entries referenced by code at wayland-client.h then. As a partial solution (for glibc systems only) we create dummy libwayland-client.so library implementation and place it *after* Gtk+ 3.0 libraries at linking time. It fixes build-time dependencies (we link against our libwayland-client.so library). Run-time dependency is resolved by ld.so - when Gtk+ 3.0 libraries are linked with system libwayland-client.so library, wayland symbols are pulled from there instead from our dummy libwayland-client.so library. When Gtk+ 3.0 is not linked with system libwayland-client.so it means we're running on system without Wayland support. Our dummy libwayland-client.so implementation is used (symbols are pulled run-time from there) and Firefox Wayland support is disabled then. MozReview-Commit-ID: IyaePwp4MxV
browser/installer/package-manifest.in
toolkit/library/moz.build
widget/gtk/moz.build
widget/gtk/mozwayland/moz.build
widget/gtk/mozwayland/mozwayland.c
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -98,16 +98,19 @@
 #endif
 #endif
 #ifdef MOZ_ICU_DATA_ARCHIVE
 @RESPATH@/@ICU_DATA_FILE@
 #endif
 #ifdef MOZ_GTK3
 @BINPATH@/@DLL_PREFIX@mozgtk@DLL_SUFFIX@
 @BINPATH@/gtk2/@DLL_PREFIX@mozgtk@DLL_SUFFIX@
+#ifdef MOZ_WAYLAND
+@BINPATH@/@DLL_PREFIX@mozwayland@DLL_SUFFIX@
+#endif
 #endif
 
 ; We don't have a complete view of which dlls to expect when doing an artifact
 ; build because we haven't run all of configure, so we trust what's in
 ; dist/bin, because everything there was extracted from our original build's
 ; package.
 #if defined(MOZ_ARTIFACT_BUILDS) && defined(XP_WIN)
 @BINPATH@/*.dll
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -136,16 +136,21 @@ if CONFIG['USE_ICU']:
         'icu',
     ]
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
     USE_LIBS += [
         'mozgtk_stub',
     ]
 
+if CONFIG['MOZ_WAYLAND']:
+    USE_LIBS += [
+        'mozwayland',
+    ]
+
 if CONFIG['MOZ_JPROF']:
     USE_LIBS += [
         'jprof',
     ]
 
 if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT'] or \
         CONFIG['MOZ_TREE_FREETYPE']:
     USE_LIBS += [
--- a/widget/gtk/moz.build
+++ b/widget/gtk/moz.build
@@ -11,16 +11,22 @@ with Files("*CompositorWidget*"):
     BUG_COMPONENT = ("Core", "Graphics")
 
 with Files("*WindowSurface*"):
     BUG_COMPONENT = ("Core", "Graphics")
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gtk3':
     DIRS += ['mozgtk']
 
+if CONFIG['MOZ_WAYLAND']:
+    if CONFIG['GLIB_LIBS']:
+        DIRS += ['mozwayland']
+    else:
+        error('We support Wayland on glibc systems only, see Bug 1409707 for reference.')
+
 EXPORTS += [
     'mozcontainer.h',
     'nsGTKToolkit.h',
     'nsIImageToPixbuf.h',
 ]
 
 EXPORTS.mozilla += [
     'WidgetUtilsGtk.h'
new file mode 100644
--- /dev/null
+++ b/widget/gtk/mozwayland/moz.build
@@ -0,0 +1,13 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+SOURCES += [
+    'mozwayland.c',
+]
+
+SharedLibrary('mozwayland')
+
+CFLAGS += CONFIG['TK_CFLAGS']
new file mode 100644
--- /dev/null
+++ b/widget/gtk/mozwayland/mozwayland.c
@@ -0,0 +1,273 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:expandtab:shiftwidth=4:tabstop=4:
+ */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/Types.h"
+#include <gtk/gtk.h>
+#include <gdk/gdkwayland.h>
+
+const struct wl_interface wl_buffer_interface;
+const struct wl_interface wl_callback_interface;
+const struct wl_interface wl_data_device_interface;
+const struct wl_interface wl_data_device_manager_interface;
+const struct wl_interface wl_keyboard_interface;
+const struct wl_interface wl_region_interface;
+const struct wl_interface wl_registry_interface;
+const struct wl_interface wl_shm_interface;
+const struct wl_interface wl_shm_pool_interface;
+const struct wl_interface wl_seat_interface;
+const struct wl_interface wl_surface_interface;
+const struct wl_interface wl_subsurface_interface;
+const struct wl_interface wl_subcompositor_interface;
+
+MOZ_EXPORT void
+wl_event_queue_destroy(struct wl_event_queue *queue)
+{
+}
+
+MOZ_EXPORT void
+wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...)
+{
+}
+
+MOZ_EXPORT void
+wl_proxy_marshal_array(struct wl_proxy *p, uint32_t opcode,
+		       union wl_argument *args)
+{
+}
+
+MOZ_EXPORT struct wl_proxy *
+wl_proxy_create(struct wl_proxy *factory,
+		const struct wl_interface *interface)
+{
+    return NULL;
+}
+
+MOZ_EXPORT void *
+wl_proxy_create_wrapper(void *proxy)
+{
+    return NULL;
+}
+
+MOZ_EXPORT void
+wl_proxy_wrapper_destroy(void *proxy_wrapper)
+{
+}
+
+MOZ_EXPORT struct wl_proxy *
+wl_proxy_marshal_constructor(struct wl_proxy *proxy,
+			     uint32_t opcode,
+			     const struct wl_interface *interface,
+			     ...)
+{
+   return NULL;
+}
+
+MOZ_EXPORT struct wl_proxy *
+wl_proxy_marshal_constructor_versioned(struct wl_proxy *proxy,
+				       uint32_t opcode,
+				       const struct wl_interface *interface,
+				       uint32_t version,
+				       ...)
+{
+   return NULL;
+}
+
+MOZ_EXPORT struct wl_proxy *
+wl_proxy_marshal_array_constructor(struct wl_proxy *proxy,
+				   uint32_t opcode, union wl_argument *args,
+				   const struct wl_interface *interface)
+{
+   return NULL;
+}
+
+MOZ_EXPORT struct wl_proxy *
+wl_proxy_marshal_array_constructor_versioned(struct wl_proxy *proxy,
+					     uint32_t opcode,
+					     union wl_argument *args,
+					     const struct wl_interface *interface,
+					     uint32_t version)
+{
+  return NULL;
+}
+
+MOZ_EXPORT void
+wl_proxy_destroy(struct wl_proxy *proxy)
+{
+}
+
+MOZ_EXPORT int
+wl_proxy_add_listener(struct wl_proxy *proxy,
+		      void (**implementation)(void), void *data)
+{
+   return -1;
+}
+
+MOZ_EXPORT const void *
+wl_proxy_get_listener(struct wl_proxy *proxy)
+{
+   return NULL;
+}
+
+MOZ_EXPORT int
+wl_proxy_add_dispatcher(struct wl_proxy *proxy,
+			wl_dispatcher_func_t dispatcher_func,
+			const void * dispatcher_data, void *data)
+{
+   return -1;
+}
+
+MOZ_EXPORT void
+wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data)
+{
+}
+
+MOZ_EXPORT void *
+wl_proxy_get_user_data(struct wl_proxy *proxy)
+{
+   return NULL;
+}
+
+MOZ_EXPORT uint32_t
+wl_proxy_get_version(struct wl_proxy *proxy)
+{
+   return -1;
+}
+
+MOZ_EXPORT uint32_t
+wl_proxy_get_id(struct wl_proxy *proxy)
+{
+   return -1;
+}
+
+MOZ_EXPORT const char *
+wl_proxy_get_class(struct wl_proxy *proxy)
+{
+   return NULL;
+}
+
+MOZ_EXPORT void
+wl_proxy_set_queue(struct wl_proxy *proxy, struct wl_event_queue *queue)
+{
+}
+
+MOZ_EXPORT struct wl_display *
+wl_display_connect(const char *name)
+{
+   return NULL;
+}
+
+MOZ_EXPORT struct wl_display *
+wl_display_connect_to_fd(int fd)
+{
+   return NULL;
+}
+
+MOZ_EXPORT void
+wl_display_disconnect(struct wl_display *display)
+{
+}
+
+MOZ_EXPORT int
+wl_display_get_fd(struct wl_display *display)
+{
+   return -1;
+}
+
+MOZ_EXPORT int
+wl_display_dispatch(struct wl_display *display)
+{
+   return -1;
+}
+
+MOZ_EXPORT int
+wl_display_dispatch_queue(struct wl_display *display,
+			  struct wl_event_queue *queue)
+{
+   return -1;
+}
+
+MOZ_EXPORT int
+wl_display_dispatch_queue_pending(struct wl_display *display,
+				  struct wl_event_queue *queue)
+{
+   return -1;
+}
+
+MOZ_EXPORT int
+wl_display_dispatch_pending(struct wl_display *display)
+{
+   return -1;
+}
+
+MOZ_EXPORT int
+wl_display_get_error(struct wl_display *display)
+{
+   return -1;
+}
+
+MOZ_EXPORT uint32_t
+wl_display_get_protocol_error(struct wl_display *display,
+			      const struct wl_interface **interface,
+			      uint32_t *id)
+{
+   return -1;
+}
+
+MOZ_EXPORT int
+wl_display_flush(struct wl_display *display)
+{
+   return -1;
+}
+
+MOZ_EXPORT int
+wl_display_roundtrip_queue(struct wl_display *display,
+			   struct wl_event_queue *queue)
+{
+  return -1;
+}
+
+MOZ_EXPORT int
+wl_display_roundtrip(struct wl_display *display)
+{
+   return -1;
+}
+
+MOZ_EXPORT struct wl_event_queue *
+wl_display_create_queue(struct wl_display *display)
+{
+   return NULL;
+}
+
+MOZ_EXPORT int
+wl_display_prepare_read_queue(struct wl_display *display,
+			      struct wl_event_queue *queue)
+{
+   return -1;
+}
+
+MOZ_EXPORT int
+wl_display_prepare_read(struct wl_display *display)
+{
+   return -1;
+}
+
+MOZ_EXPORT void
+wl_display_cancel_read(struct wl_display *display)
+{
+}
+
+MOZ_EXPORT int
+wl_display_read_events(struct wl_display *display)
+{
+   return -1;
+}
+
+MOZ_EXPORT void
+wl_log_set_handler_client(wl_log_func_t handler)
+{
+}
+