Bug 1260066 - Move add_old_configure_arg to the global scope. r?nalexander draft
authorMike Hommey <mh+mozilla@glandium.org>
Mon, 28 Mar 2016 07:12:42 +0900
changeset 345025 d5534df8ca17bea71780ea162ca9480da32de072
parent 345024 67514b1a7f0f164ff3f152989583b8534570060a
child 345026 5a5675ddac5b5d1e605c5ae093f3de2564fc9e36
push id13998
push userbmo:mh+mozilla@glandium.org
push dateSun, 27 Mar 2016 22:56:08 +0000
reviewersnalexander
bugs1260066
milestone48.0a1
Bug 1260066 - Move add_old_configure_arg to the global scope. r?nalexander We've done this for set_config, set_define, imply_option, and add_old_configure_assignment. Do it for add_old_configure_arg as well.
build/moz.configure/init.configure
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -143,19 +143,20 @@ def add_old_configure_assignment(var, va
             assignments.append('%s=' % var)
         else:
             if isinstance(value, (list, tuple)):
                 value = ' '.join(quote(v) for v in value)
             assignments.append('%s=%s' % (var, quote(value)))
 
 @template
 def add_old_configure_arg(arg):
-    @depends(extra_old_configure_args)
-    def add_arg(args):
-        args.append(arg)
+    @depends(extra_old_configure_args, arg)
+    def add_arg(args, arg):
+        if arg:
+            args.append(arg)
 
 
 option(env='PYTHON', nargs=1, help='Python interpreter')
 
 # Setup python virtualenv
 # ==============================================================
 @depends('PYTHON', check_build_environment, mozconfig)
 @imports('os')
@@ -465,27 +466,33 @@ def host(value, shell):
 @depends('--target', host, shell)
 @checking('for target system type', lambda t: t.alias)
 def target(value, host, shell):
     if not value:
         return host
     return split_triplet(config_sub(shell, value[0]))
 
 
+# Autoconf needs these set
+@depends(host)
+def host_for_old_configure(host):
+    return '--host=%s' % host.alias
+
+add_old_configure_arg(host_for_old_configure)
+
 @depends(host, target)
-def host_and_target_for_old_configure(host, target):
-    # Autoconf needs these set
-    add_old_configure_arg('--host=%s' % host.alias)
-
+def target_for_old_configure(host, target):
     target_alias = target.alias
     # old-configure does plenty of tests against $target and $target_os
     # and expects darwin for iOS, so make it happy.
     if target.os == 'iOS':
         target_alias = target_alias.replace('-ios', '-darwin')
-    add_old_configure_arg('--target=%s' % target_alias)
+    return '--target=%s' % target_alias
+
+add_old_configure_arg(target_for_old_configure)
 
 
 # These variables are for compatibility with the current moz.builds and
 # old-configure. Eventually, we'll want to canonicalize better.
 @depends(target)
 def target_variables(target):
     if target.kernel == 'kFreeBSD':
         os_target = 'GNU/kFreeBSD'
@@ -686,17 +693,19 @@ add_old_configure_assignment('RELEASE_BU
 # Use instead of option() in js/moz.configure
 @template
 def js_option(*args, **kwargs):
     opt = option(*args, **kwargs)
 
     @depends(opt.option, build_project)
     def js_option(value, build_project):
         if build_project != 'js':
-            add_old_configure_arg(value.format(opt.option))
+            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):