Bug 1467327 - Use bootstrapped clang if no system clang is found. r=froydnj
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -633,32 +633,37 @@ def vc_compiler_path(host, target, vs_ma
paths = data.get(vc_target)
if not paths:
return
return paths
@depends(vc_compiler_path)
@imports('os')
+@imports(_from='os', _import='environ')
def toolchain_search_path(vc_compiler_path):
+ result = [environ.get('PATH')]
+
if vc_compiler_path:
- result = [os.environ.get('PATH')]
result.extend(vc_compiler_path)
- # Also add in the location to which `mach bootstrap` or
- # `mach artifact toolchain` installs clang.
- mozbuild_state_dir = os.environ.get('MOZBUILD_STATE_PATH',
- os.path.expanduser(os.path.join('~', '.mozbuild')))
- bootstrap_clang_path = os.path.join(mozbuild_state_dir, 'clang', 'bin')
- result.append(bootstrap_clang_path)
+ # Also add in the location to which `mach bootstrap` or
+ # `mach artifact toolchain` installs clang.
+ mozbuild_state_dir = environ.get('MOZBUILD_STATE_PATH',
+ os.path.expanduser(os.path.join('~', '.mozbuild')))
+ bootstrap_clang_path = os.path.join(mozbuild_state_dir, 'clang', 'bin')
+ result.append(bootstrap_clang_path)
+ if vc_compiler_path:
# We're going to alter PATH for good in windows.configure, but we also
- # need to do it for the valid_compiler() check below.
- os.environ['PATH'] = os.pathsep.join(result)
- return result
+ # need to do it for the valid_compiler() check below. This is only needed
+ # on Windows, where MSVC needs PATH set to find dlls.
+ environ['PATH'] = os.pathsep.join(result)
+
+ return result
@template
def default_c_compilers(host_or_target):
'''Template defining the set of default C compilers for the host and
target platforms.
`host_or_target` is either `host` or `target` (the @depends functions
from init.configure.