Bug 1299083 - Add cairo-gtk3-wayland toolkit target to enable Gtk/Wayland build, r=glandium
authorMartin Stransky <stransky@redhat.com>
Thu, 06 Apr 2017 10:40:27 +0200
changeset 351557 a0d700792ad3
parent 351556 b86a04a468b3
child 351558 b8145a0cff58
push id31614
push userkwierso@gmail.com
push date2017-04-06 21:52 +0000
treeherdermozilla-central@668135e4b3a2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1299083
milestone55.0a1
Bug 1299083 - Add cairo-gtk3-wayland toolkit target to enable Gtk/Wayland build, r=glandium

This compile time option only allows to explicitly enable/disable
build of Wayland related parts of Firefox.
We target Gtk/Wayland in stable Gtk+ 3.22 and later.

MozReview-Commit-ID: LfQfEkYfHf8
toolkit/moz.configure
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -112,18 +112,18 @@ set_config('L10NBASEDIR', l10n_base)
 # Default toolkit
 # ==============================================================
 # Normally, we'd want to use the `default` field on the option, but that
 # requires --target to be resolved at --help time, which requires to run
 # config.guess, which we want to avoid. Even better, we could actually set
 # `choices` depending on the target, but that doesn't pan out for the same
 # reason.
 option('--enable-default-toolkit', nargs=1,
-       choices=('cairo-windows', 'cairo-gtk3', 'cairo-cocoa', 'cairo-uikit',
-                'cairo-android', 'cairo-gonk'),
+       choices=('cairo-windows', 'cairo-gtk3', 'cairo-gtk3-wayland',
+                'cairo-cocoa', 'cairo-uikit', 'cairo-android', 'cairo-gonk'),
        help='Select default toolkit')
 
 @depends('--enable-default-toolkit', target)
 def toolkit(value, target):
     # Define possible choices for each platform. The default is the first one
     # listed when there are several.
     os = target.os
     if target.os == 'WINNT':
@@ -135,31 +135,36 @@ def toolkit(value, target):
     elif target.os == 'Android':
         if value.origin == 'implied':
             # Trust values coming from imply_option() (used in
             # b2g/moz.configure).
             platform_choices = tuple(value)
         else:
             platform_choices = ('cairo-android',)
     else:
-        platform_choices = ('cairo-gtk3',)
+        platform_choices = ('cairo-gtk3', 'cairo-gtk3-wayland')
 
     if value:
         if value[0] not in platform_choices:
             die('`%s` is not a valid value for --enable-default-toolkit on %s\n'
                 'Valid values: %s', value[0], os, ', '.join(platform_choices))
         return value[0]
 
     return platform_choices[0]
 
+@depends(toolkit)
+def wayland(toolkit):
+    return toolkit == 'cairo-gtk3-wayland'
 
 @depends(toolkit)
 def toolkit(toolkit):
     if toolkit == 'cairo-gtk2-x11':
         widget_toolkit = 'gtk2'
+    elif toolkit == 'cairo-gtk3-wayland' :
+        widget_toolkit = 'gtk3'
     else:
         widget_toolkit = toolkit.replace('cairo-', '')
     return widget_toolkit
 
 set_config('MOZ_WIDGET_TOOLKIT', toolkit)
 add_old_configure_assignment('MOZ_WIDGET_TOOLKIT', toolkit)
 
 @depends(toolkit)
@@ -194,16 +199,24 @@ def x11(value, toolkit):
     return True if value and toolkit in x11_toolkits else None
 
 set_config('MOZ_ENABLE_XREMOTE', x11)
 set_define('MOZ_ENABLE_XREMOTE', x11)
 set_config('MOZ_X11', x11)
 set_define('MOZ_X11', x11)
 add_old_configure_assignment('MOZ_X11', x11)
 
+# Wayland support
+# ==============================================================
+wayland_headers = pkg_check_modules('MOZ_WAYLAND', 'gtk+-wayland-3.0 >= 3.22',
+                                    when=wayland)
+
+set_config('MOZ_WAYLAND', depends_if(wayland_headers)(lambda _: True))
+set_define('MOZ_WAYLAND', depends_if(wayland_headers)(lambda _: True))
+
 # GL Provider
 # ==============================================================
 option('--with-gl-provider', nargs=1, help='Set GL provider backend type')
 
 @depends('--with-gl-provider')
 def gl_provider(value):
     if value:
         return value[0]