Bug 1254410 - Include app-specific configure files according to --enable-application/--enable-project. r=chmanchester
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 08 Mar 2016 13:49:35 +0900
changeset 311172 4d6b7026be7ec000043471a50e3f63671b912176
parent 311171 4547c228e98816aa3f6e8b5cdb248cc7e80065ee
child 311173 078fdc1a2e270bb42e9b28f40f24efe4fbe75fa3
push id9480
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 17:12:58 +0000
treeherdermozilla-aurora@0d6a91c76a9e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1254410
milestone48.0a1
Bug 1254410 - Include app-specific configure files according to --enable-application/--enable-project. r=chmanchester Because --enable-application is the current way to do things, transpose it to configure.py, but since --enable-application=js doesn't make sense, make it an alias of a new --enable-project option. This only partially moves --enable-application out of old-configure.in because there are a lot of other things intertwined with it.
b2g/dev/moz.configure
b2g/graphene/moz.configure
b2g/moz.configure
browser/moz.configure
build/moz.configure/init.configure
build/moz.configure/old.configure
embedding/ios/moz.configure
extensions/moz.configure
js/moz.configure
js/src/configure.in
mobile/android/b2gdroid/moz.configure
mobile/android/moz.configure
moz.configure
old-configure.in
toolkit/moz.configure
new file mode 100644
--- /dev/null
+++ b/b2g/dev/moz.configure
@@ -0,0 +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('../../toolkit/moz.configure')
new file mode 100644
--- /dev/null
+++ b/b2g/graphene/moz.configure
@@ -0,0 +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('../../toolkit/moz.configure')
new file mode 100644
--- /dev/null
+++ b/b2g/moz.configure
@@ -0,0 +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('../toolkit/moz.configure')
new file mode 100644
--- /dev/null
+++ b/browser/moz.configure
@@ -0,0 +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('../toolkit/moz.configure')
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -193,8 +193,43 @@ def mozconfig_options(mozconfig):
         # old-configure.in, which will be tedious but necessary until we
         # can discriminate what old-configure.in supports.
 
 del command_line_helper
 
 
 option(env='MOZILLABUILD', nargs=1,
        help='Path to Mozilla Build (Windows-only)')
+
+
+option('--enable-application', nargs=1, env='MOZ_BUILD_APP',
+       help='Application to build. Same as --enable-project.')
+
+@depends('--enable-application', '--help')
+def application(app, help):
+    if app:
+        imply_option(app.format('--enable-project'))
+
+
+@depends(check_build_environment, '--help')
+def default_project(build_env, help):
+    if build_env['TOPOBJDIR'].endswith('/js/src'):
+        return 'js'
+    return 'browser'
+
+option('--enable-project', nargs=1, default=default_project,
+       help='Project to build')
+
+@depends('--enable-project', check_build_environment, '--help')
+def include_project_configure(project, build_env, help):
+    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')
+def build_app(project):
+    return project[0]
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -55,20 +55,20 @@ 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)
+         virtualenv_python, compile_environment, build_app)
 @advanced
 def prepare_configure(old_configure, mozconfig, autoconf, build_env, shell,
-                      python, compile_env):
+                      python, compile_env, build_app):
     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,16 +121,17 @@ 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)
 
     return cmd
 
 
 @template
 def old_configure_options(*options):
     for opt in options:
         option(opt, nargs='*', help='Help missing for old configure options')
@@ -145,17 +146,16 @@ def old_configure_options(*options):
 @old_configure_options(
     '--cache-file',
     '--enable-accessibility',
     '--enable-address-sanitizer',
     '--enable-alsa',
     '--enable-android-apz',
     '--enable-android-omx',
     '--enable-android-resource-constrained',
-    '--enable-application',
     '--enable-approximate-location',
     '--enable-b2g-bt',
     '--enable-b2g-camera',
     '--enable-b2g-ril',
     '--enable-bundled-fonts',
     '--enable-callgrind',
     '--enable-chrome-format',
     '--enable-clang-plugin',
new file mode 100644
--- /dev/null
+++ b/embedding/ios/moz.configure
@@ -0,0 +1,5 @@
+# -*- 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/.
new file mode 100644
--- /dev/null
+++ b/extensions/moz.configure
@@ -0,0 +1,5 @@
+# -*- 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/.
new file mode 100644
--- /dev/null
+++ b/js/moz.configure
@@ -0,0 +1,5 @@
+# -*- 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/.
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -16,9 +16,11 @@ dnl autoconf, but doesn't call any autoc
 dnl below ensures the script that follows is output by autoconf.
 divert(0)dnl
 #!/bin/sh
 
 SRCDIR=$(dirname $0)
 TOPSRCDIR="$SRCDIR"/../..
 export OLD_CONFIGURE="$SRCDIR"/old-configure
 
+set -- "$@" --enable-project=js
+
 which python2.7 > /dev/null && exec python2.7 "$TOPSRCDIR/configure.py" "$@" || exec python "$TOPSRCDIR/configure.py" "$@"
new file mode 100644
--- /dev/null
+++ b/mobile/android/b2gdroid/moz.configure
@@ -0,0 +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('../../../toolkit/moz.configure')
new file mode 100644
--- /dev/null
+++ b/mobile/android/moz.configure
@@ -0,0 +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('../../toolkit/moz.configure')
--- a/moz.configure
+++ b/moz.configure
@@ -1,16 +1,23 @@
 # -*- 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('build/moz.configure/init.configure')
 
+# Note:
+# - Gecko-specific options and rules should go in toolkit/moz.configure.
+# - Firefox-specific options and rules should go in browser/moz.configure.
+# - Fennec-specific options and rules should go in
+#   mobile/android/moz.configure.
+# - Spidermonkey-specific options and rules should go in js/moz.configure.
+# - etc.
 
 option('--enable-artifact-builds', env='MOZ_ARTIFACT_BUILDS',
        help='Download and use prebuilt binary artifacts.')
 
 @depends('--enable-artifact-builds')
 def artifact_builds(value):
     if value:
         imply_option('--disable-compile-environment')
--- a/old-configure.in
+++ b/old-configure.in
@@ -3684,24 +3684,16 @@ case "${target}" in
 esac
 
 MOZ_ARG_WITH_STRING(external-source-dir,
 [  --with-external-source-dir=dir
                           External directory containing additional build files.],
 [ EXTERNAL_SOURCE_DIR=$withval])
 AC_SUBST(EXTERNAL_SOURCE_DIR)
 
-MOZ_ARG_ENABLE_STRING(application,
-[  --enable-application=APP
-                          Options include:
-                            browser (Firefox)
-                            xulrunner
-                            tools/update-packaging (AUS-related packaging tools)],
-[ MOZ_BUILD_APP=$enableval ] )
-
 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
   XULRUNNER_STUB_NAME=$withval)
 
 if test -z "$XULRUNNER_STUB_NAME"; then
   XULRUNNER_STUB_NAME=xulrunner-stub
 fi
 AC_SUBST(XULRUNNER_STUB_NAME)
new file mode 100644
--- /dev/null
+++ b/toolkit/moz.configure
@@ -0,0 +1,5 @@
+# -*- 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/.