Bug 1254873 - Make --disable-js-shell the default for non-js-standalone builds
The implementation is a bit circumvoluted, but we do need to share
options between the top-level and js/src configures, possibly with
different defaults, and to properly pass things down from one to
the other. Until we are further down the road and can actually merge
both configures, this is a necessary evil.
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -223,13 +223,32 @@ def include_project_configure(project, b
if not project:
error('--enable-project is required.')
path = os.path.join(build_env['TOPSRCDIR'], project[0], 'moz.configure')
if not os.path.exists(path):
error('Cannot find project %s' % project[0])
return path
-include(include_project_configure)
+@depends('--enable-project', '--help')
+def build_project(project, help):
+ return project[0]
+
+
+# This is temporary until js/src/configure and configure are merged.
+@depends(build_project)
+def extra_old_configure_args(build_project):
+ if build_project != 'js':
+ return []
+ return False
-@depends('--enable-project')
-def build_app(project):
- return project[0]
+# Use instead of option() in js/moz.configure
+@template
+def js_option(*args, **kwargs):
+ opt = option(*args, **kwargs)
+
+ @depends(opt.option, extra_old_configure_args)
+ def js_option(value, extra_old_configure_args):
+ if extra_old_configure_args is not False:
+ extra_old_configure_args.append(value.format(opt.option))
+
+
+include(include_project_configure)
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -55,20 +55,22 @@ def autoconf(mozconfig, autoconf):
set_config('AUTOCONF', autoconf)
return autoconf
option(env='OLD_CONFIGURE', nargs=1, help='Path to the old configure script')
@depends('OLD_CONFIGURE', mozconfig, autoconf, check_build_environment, shell,
- virtualenv_python, compile_environment, build_app)
+ virtualenv_python, compile_environment, build_project,
+ extra_old_configure_args)
@advanced
def prepare_configure(old_configure, mozconfig, autoconf, build_env, shell,
- python, compile_env, build_app):
+ python, compile_env, build_project,
+ extra_old_configure_args):
import glob
import itertools
import subprocess
import sys
# Import getmtime without overwriting the sandbox os.path.
from os.path import getmtime
from mozbuild.shellutil import quote
@@ -121,17 +123,20 @@ def prepare_configure(old_configure, moz
print("%s=%s" % (key, quote(value)), file=out)
for t in ('env', 'vars'):
for key in mozconfig[t]['removed'].keys():
print("unset %s" % key, file=out)
print('PYTHON=%s' % quote(python), file=out)
if compile_env:
print('COMPILE_ENVIRONMENT=1', file=out)
- print('MOZ_BUILD_APP=%s' % build_app, file=out)
+ print('MOZ_BUILD_APP=%s' % build_project, file=out)
+
+ if extra_old_configure_args:
+ cmd += extra_old_configure_args
return cmd
@template
def old_configure_options(*options):
for opt in options:
option(opt, nargs='*', help='Help missing for old configure options')
--- a/js/moz.configure
+++ b/js/moz.configure
@@ -1,12 +1,20 @@
# -*- 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('--disable-js-shell', help='Do not build the JS shell')
+# /!\ Use js_option() instead of option() in this file. /!\
+# =========================================================
+
+@depends(build_project, '--help')
+def js_shell_default(build_project, help):
+ return build_project == 'js'
+
+js_option('--disable-js-shell', default=js_shell_default,
+ help='Do not build the JS shell')
@depends('--disable-js-shell')
def js_shell(value):
if not value:
set_config('JS_DISABLE_SHELL', '1')
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -1,5 +1,7 @@
# -*- 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/.
+
+include('../js/moz.configure')