Bug 1256988 - Move --with-gonk to moz.configure draft
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 16 Mar 2016 11:55:38 +0900
changeset 341002 84c09d4275229750fd5fa589ae48dd24d1fe987e
parent 340909 18ab2e214acef4166c25b8c18e2ee6c67f1526a1
child 341003 6138b08758037aa113175582c0fe8f6644e042c4
push id13117
push userbmo:mh+mozilla@glandium.org
push dateWed, 16 Mar 2016 11:04:10 +0000
bugs1256988
milestone48.0a1
Bug 1256988 - Move --with-gonk to moz.configure
b2g/moz.configure
build/moz.configure/init.configure
build/moz.configure/old.configure
js/src/old-configure.in
old-configure.in
--- a/b2g/moz.configure
+++ b/b2g/moz.configure
@@ -1,7 +1,14 @@
 # -*- 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')
+def gonkdir(value):
+    return value[0] if value else ''
+
+
 include('../toolkit/moz.configure')
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -548,9 +548,25 @@ 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))
 
 
+# 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:
+        add_old_configure_assignment('gonkdir', value)
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -328,17 +328,16 @@ def old_configure_options(*options):
     '--with-default-mozilla-five-home',
     '--with-distribution-id',
     '--with-doc-include-dirs',
     '--with-doc-input-dirs',
     '--with-doc-output-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',
     '--with-intl-api',
     '--with-ios-sdk',
     '--with-java-bin-path',
     '--with-jitreport-granularity',
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -84,21 +84,16 @@ else
   AC_DEFINE(JS_STANDALONE)
   DIST="$MOZ_BUILD_ROOT/dist"
 fi
 AC_SUBST(JS_STANDALONE)
 BUILDING_JS=1
 AC_SUBST(BUILDING_JS)
 AC_SUBST(autoconfmk)
 
-MOZ_ARG_WITH_STRING(gonk,
-[  --with-gonk=DIR
-               location of gonk dir],
-    gonkdir=$withval)
-
 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
 [  --with-gonk-toolchain-prefix=DIR
                           prefix to gonk toolchain commands],
     gonk_toolchain_prefix=$withval)
 
 if test -n "$gonkdir" ; then
     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
     dnl Default to ICS
--- a/old-configure.in
+++ b/old-configure.in
@@ -114,27 +114,25 @@ if test -n "$MOZTTDIR" -a ! -d "$MOZTTDI
     AC_MSG_ERROR([MOZTTDIR '$MOZTTDIR' isn't a valid directory])
 fi
 
 AC_SUBST(MOZTTDIR)
 if test -n "$MOZTTDIR" ; then
     AC_DEFINE(PACKAGE_MOZTT)
 fi
 
-MOZ_ARG_WITH_STRING(gonk,
-[  --with-gonk=DIR
-               location of gonk dir],
-    gonkdir=$withval)
-
 MOZ_ARG_WITH_STRING(gonk-toolchain-prefix,
 [  --with-gonk-toolchain-prefix=DIR
                           prefix to gonk toolchain commands],
     gonk_toolchain_prefix=$withval)
 
 if test -n "$gonkdir" ; then
+    dnl export for js/src/configure. We can't pass the option down normally,
+    dnl because it's a `--enable-project=b2g`-only option.
+    export gonkdir
     kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"`
     android_source="$gonkdir"
     ANDROID_SOURCE="$android_source"
     ANDROID_NDK="${ANDROID_SOURCE}/ndk"
     dnl Default to ICS
     ANDROID_VERSION=15
     if test -n "${PLATFORM_SDK_VERSION}"; then
         ANDROID_VERSION="${PLATFORM_SDK_VERSION}"