Bug 1416052 - Move config.guess logic to Python; r?build draft
authorGregory Szorc <gps@mozilla.com>
Thu, 09 Nov 2017 16:17:35 -0800
changeset 696113 21a3a09cd8e841b89cfb4b19f786b01286b7dda5
parent 696112 42c911ae9052e8f7bfd3327e58763d4a70d9f0b9
child 696114 59f510991c709d4c5796c64213651ec5c782f835
push id88642
push userbmo:gps@mozilla.com
push dateFri, 10 Nov 2017 07:41:10 +0000
reviewersbuild
bugs1416052
milestone58.0a1
Bug 1416052 - Move config.guess logic to Python; r?build Instead of evaluating config.guess in client.mk, we evaluate it in Python. The Python code also looks for CONFIG_GUESS in the mozconfig. This still happens in client.mk courtesy of evaling the mozconfig's relevant parts. Since it is related, we also set HOST_OS_ARCH in the environment. A side-effect of this change is that HOST_OS_ARCH will now be defined for the entirety of build process tree rather than just client.mk. I /think/ this is fine, as configure will define HOST_OS_ARCH and its value will override the environment variable. Differential Revision: https://phabricator.services.mozilla.com/D216 MozReview-Commit-ID: 87NmQiB2ccX
client.mk
python/mozbuild/mozbuild/controller/building.py
--- a/client.mk
+++ b/client.mk
@@ -29,28 +29,16 @@ endif
 CWD := $(CURDIR)
 
 ifeq "$(CWD)" "/"
 CWD   := /.
 endif
 
 PYTHON ?= $(shell which python2.7 > /dev/null 2>&1 && echo python2.7 || echo python)
 
-CONFIG_GUESS := $(shell $(TOPSRCDIR)/build/autoconf/config.guess)
-
-####################################
-# Sanity checks
-
-# Windows checks.
-ifneq (,$(findstring mingw,$(CONFIG_GUESS)))
-
-# Set this for baseconfig.mk
-HOST_OS_ARCH=WINNT
-endif
-
 ####################################
 # Load mozconfig Options
 
 # See build pages, http://www.mozilla.org/build/ for how to set up mozconfig.
 
 define CR
 
 
--- a/python/mozbuild/mozbuild/controller/building.py
+++ b/python/mozbuild/mozbuild/controller/building.py
@@ -1316,16 +1316,23 @@ class BuildDriver(MozbuildObject):
             install_test_files(mozpath.normpath(self.topsrcdir), self.topobjdir,
                                '_tests', test_objs)
 
     def _run_client_mk(self, target=None, line_handler=None, jobs=0,
                        verbose=None, keep_going=False, append_env=None):
         append_env = dict(append_env or {})
         append_env['TOPSRCDIR'] = self.topsrcdir
 
+        append_env['CONFIG_GUESS'] = self.resolve_config_guess()
+        # This is needed to trigger make validation in baseconfig.mk when
+        # that file is included by client.mk. Much of the validation in
+        # baseconfig.mk should probably be deferred to moz.configure.
+        if 'mingw' in append_env['CONFIG_GUESS']:
+            append_env['HOST_OS_ARCH'] = 'WINNT'
+
         return self._run_make(srcdir=True,
                               filename='client.mk',
                               allow_parallel=False,
                               ensure_exit_code=False,
                               print_directory=False,
                               target=target,
                               line_handler=line_handler,
                               log=False,