Bug 1262019 - Make --with-gonk imply --enable-default-toolkit=cairo-gonk draft
authorMike Hommey <mh+mozilla@glandium.org>
Sat, 02 Apr 2016 09:55:34 +0900
changeset 347485 1e1753dc31afb2fc7142348919f4551e58106d83
parent 347484 ae2f8bdfec618098a37f4cab42a58f548e44f76e
child 517640 808c19d3c50cc3cb35eeb74cadea6ca17bf8fbc5
push id14592
push userbmo:mh+mozilla@glandium.org
push dateMon, 04 Apr 2016 23:32:36 +0000
bugs1262019
milestone48.0a1
Bug 1262019 - Make --with-gonk imply --enable-default-toolkit=cairo-gonk This removes the need for a dummy `gonkdir` function for the build_project != 'b2g' case.
b2g/moz.configure
build/moz.configure/init.configure
toolkit/moz.configure
--- a/b2g/moz.configure
+++ b/b2g/moz.configure
@@ -1,19 +1,27 @@
 # -*- Mode: python; c-basic-offset: 4; 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/.
 
 option('--with-gonk', nargs=1, help='Path to the gonk base directory')
 
-@depends('--with-gonk')
+@depends_if('--with-gonk')
 def gonkdir(value):
-    return value[0] if value else ''
+    return value[0]
+
+add_old_configure_assignment('gonkdir', gonkdir)
+
+@depends_if('--with-gonk')
+def gonk_toolkit(_):
+    return 'cairo-gonk'
+
+imply_option('--enable-default-toolkit', gonk_toolkit)
 
 
 option('--with-gonk-toolchain-prefix', nargs=1,
        help='Prefix to gonk toolchain commands')
 
 @depends_if('--with-gonk-toolchain-prefix')
 def gonk_toolchain_prefix(value):
     return value
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -730,27 +730,9 @@ def js_option(*args, **kwargs):
     @depends(opt.option, build_project)
     def js_option(value, build_project):
         if build_project != 'js':
             return value.format(opt.option)
 
     add_old_configure_arg(js_option)
 
 
-# This is overridden in b2g/moz.configure with an option. No other project
-# needs the option directly, but it's used to influence some other things in
-# toolkit/moz.configure (and possibly top-level moz.configure later on), so
-# define a dummy default here.
-@depends('--help')
-def gonkdir(help):
-    return ''
-
-
 include(include_project_configure)
-
-# By now, gonkdir is either the dummy function above or a real function
-# depending on --with-gonk from b2g/moz.configure.
-@depends(gonkdir)
-def gonkdir_for_old_configure(value):
-    if value:
-        return value
-
-add_old_configure_assignment('gonkdir', gonkdir_for_old_configure)
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -95,31 +95,32 @@ set_config('L10NBASEDIR', l10n_base)
 # `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-gtk2', 'cairo-gtk2-x11', 'cairo-gtk3',
                 'cairo-qt', 'cairo-cocoa', 'cairo-uikit', 'cairo-android',
                 'cairo-gonk'),
        help='Select default toolkit')
 
-@depends('--enable-default-toolkit', target, gonkdir)
-def toolkit(value, target, gonkdir):
+@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':
         platform_choices = ('cairo-windows',)
     elif target.os == 'OSX':
         platform_choices = ('cairo-cocoa',)
     elif target.os == 'iOS':
         platform_choices = ('cairo-uikit',)
     elif target.os == 'Android':
-        if gonkdir:
-            platform_choices = ('cairo-gonk',)
-            os = 'B2G'
+        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', 'cairo-gtk2', 'cairo-gtk2-x11',
                             'cairo-qt')
 
     if value:
         if value[0] not in platform_choices: