Bug 1255185 - Move --with-external-source-dir to moz.configure. r=chmanchester
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 10 Mar 2016 07:15:01 +0900
changeset 311790 a959b172be4ce33c2de022e84902d222876d847d
parent 311789 72e0643586509c61b8090e5f93f7b4185976d8dc
child 311791 ec4475ef7e31ec2e9488d0c756ccb9475b941f57
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
bugs1255185
milestone48.0a1
Bug 1255185 - Move --with-external-source-dir to moz.configure. r=chmanchester
build/moz.configure/init.configure
build/moz.configure/old.configure
old-configure.in
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -213,29 +213,39 @@ def application(app, 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):
+option('--with-external-source-dir', env='EXTERNAL_SOURCE_DIR', nargs=1,
+       help='External directory containing additional build files')
+
+@depends('--enable-project', '--with-external-source-dir',
+         check_build_environment, '--help')
+def include_project_configure(project, external_source_dir, build_env, help):
     if not project:
         error('--enable-project is required.')
 
-    path = os.path.join(build_env['TOPSRCDIR'], project[0], 'moz.configure')
+    base_dir = build_env['TOPSRCDIR']
+    if external_source_dir:
+        set_config('EXTERNAL_SOURCE_DIR', external_source_dir[0])
+        base_dir = os.path.join(base_dir, external_source_dir[0])
+
+    path = os.path.join(base_dir, project[0], 'moz.configure')
     if not os.path.exists(path):
         error('Cannot find project %s' % project[0])
     return path
 
-@depends('--enable-project', '--help')
-def build_project(project, help):
-    return project[0]
+@depends(include_project_configure, check_build_environment, '--help')
+def build_project(include_project_configure, build_env, help):
+    return os.path.dirname(os.path.relpath(include_project_configure,
+                                           build_env['TOPSRCDIR']))
 
 
 # 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
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -56,21 +56,21 @@ 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_project,
-         extra_old_configure_args)
+         extra_old_configure_args, '--with-external-source-dir')
 @advanced
 def prepare_configure(old_configure, mozconfig, autoconf, build_env, shell,
                       python, compile_env, build_project,
-                      extra_old_configure_args):
+                      extra_old_configure_args, external_source_dir):
     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
@@ -124,16 +124,18 @@ def prepare_configure(old_configure, moz
             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_project, file=out)
+        if external_source_dir:
+            print(external_source_dir.format('EXTERNAL_SOURCE_DIR'), file=out)
 
     if extra_old_configure_args:
         cmd += extra_old_configure_args
 
     return cmd
 
 
 @template
@@ -313,17 +315,16 @@ def old_configure_options(*options):
     '--with-crashreporter-enable-percent',
     '--with-cross-lib',
     '--with-debug-label',
     '--with-default-mozilla-five-home',
     '--with-distribution-id',
     '--with-doc-include-dirs',
     '--with-doc-input-dirs',
     '--with-doc-output-dir',
-    '--with-external-source-dir',
     '--with-float-abi',
     '--with-fpu',
     '--with-gl-provider',
     '--with-gonk',
     '--with-gonk-toolchain-prefix',
     '--with-google-api-keyfile',
     '--with-google-oauth-api-keyfile',
     '--with-gradle',
--- a/old-configure.in
+++ b/old-configure.in
@@ -3678,56 +3678,25 @@ case "${target}" in
         if test "$COMPILE_ENVIRONMENT"; then
             MOZ_MEMORY=1
         fi
         MOZ_RAW=1
         ;;
 
 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_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)
 
-AC_MSG_CHECKING([for application to build])
-if test -z "$MOZ_BUILD_APP"; then
-  AC_MSG_RESULT([browser])
-  MOZ_BUILD_APP=browser
-else
-  # "mobile" no longer exists.
-  if test "$MOZ_BUILD_APP" = "mobile" ; then
-    AC_MSG_RESULT([none])
-    AC_MSG_ERROR([--enable-application=mobile is no longer supported.])
-  fi
-  # Support comm-central.
-  if test -n "$EXTERNAL_SOURCE_DIR" ; then
-    MOZ_BUILD_APP="$EXTERNAL_SOURCE_DIR/$MOZ_BUILD_APP"
-    MOZ_BUILD_APP=`${PYTHON} -c "import mozpack.path as mozpath; print(mozpath.relpath(\"${MOZ_BUILD_APP}\", \"${srcdir}\"))"`
-  fi
-  # We have a valid application only if it has a build.mk file in its top
-  # directory.
-  if test ! -f "${srcdir}/${MOZ_BUILD_APP}/build.mk" ; then
-    AC_MSG_RESULT([none])
-    AC_MSG_ERROR([--enable-application value not recognized (${MOZ_BUILD_APP}/build.mk does not exist).])
-  else
-    AC_MSG_RESULT([$MOZ_BUILD_APP])
-  fi
-fi
-
 # The app update channel is 'default' when not supplied. The value is used in
 # the application's confvars.sh so it must be set before confvars.sh is called.
 MOZ_ARG_ENABLE_STRING([update-channel],
 [  --enable-update-channel=CHANNEL
                           Select application update channel (default=default)],
     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
 
 if test -z "$MOZ_UPDATE_CHANNEL"; then