Bug 1306650 - part 5 - modify clang-cl toolchain config to look for just cl.exe; r=ehsan

We cannot depend on a fixed location for cl.exe in a taskcluster world.
We therefore need to make our build-clang.py script accomodate relative
path names for cc/cxx and assume those are binaries that should be
looked up on PATH.

We also need to modify the Linux build script so that the virtualenv is
used to look up the new 'which' package.
This commit is contained in:
Nathan Froyd 2016-10-26 16:18:24 -04:00
parent 684ffb2f54
commit 27dc2c9c56
3 changed files with 23 additions and 17 deletions

View File

@ -15,6 +15,7 @@ import glob
import errno
from contextlib import contextmanager
import sys
import which
DEBUG = os.getenv("DEBUG")
@ -201,6 +202,22 @@ def build_one_stage(cc, cxx, src_dir, stage_dir, build_libcxx,
install_libgcc(gcc_dir, inst_dir)
def get_compiler(config, key):
if key not in config:
raise ValueError("Config file needs to set %s" % key)
f = config[key]
if os.path.isabs(f):
if not os.path.exists(f):
raise ValueError("%s must point to an existing path" % key)
return f
# Assume that we have the name of some program that should be on PATH.
try:
return which.which(f)
except which.WhichError:
raise ValueError("%s not found on PATH" % f)
if __name__ == "__main__":
# The directories end up in the debug info, so the easy way of getting
# a reproducible build is to run it in a know absolute directory.
@ -284,20 +301,8 @@ if __name__ == "__main__":
raise ValueError("gcc_dir must point to an existing path")
if is_linux() and gcc_dir is None:
raise ValueError("Config file needs to set gcc_dir")
cc = None
if "cc" in config:
cc = config["cc"]
if not os.path.exists(cc):
raise ValueError("cc must point to an existing path")
else:
raise ValueError("Config file needs to set cc")
cxx = None
if "cxx" in config:
cxx = config["cxx"]
if not os.path.exists(cxx):
raise ValueError("cxx must point to an existing path")
else:
raise ValueError("Config file needs to set cxx")
cc = get_compiler(config, "cc")
cxx = get_compiler(config, "cxx")
if not os.path.exists(source_dir):
os.makedirs(source_dir)

View File

@ -9,8 +9,8 @@
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/trunk",
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/trunk",
"python_path": "c:/mozilla-build/python/python.exe",
"cc": "c:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/BIN/amd64_x86/cl.exe",
"cxx": "c:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/BIN/amd64_x86/cl.exe",
"cc": "cl.exe",
"cxx": "cl.exe",
"patches": {
}
}

View File

@ -20,7 +20,8 @@ $HOME_DIR/tooltool.py -m browser/config/tooltool-manifests/linux64/releng.manife
set +x
cd build/build-clang
./build-clang.py -c clang-static-analysis-linux64.json
# |mach python| sets up a virtualenv for us!
../../mach python ./build-clang.py -c clang-static-analysis-linux64.json
set -x