Bug 1182727 - Part 12: Allow dumping out what the command is doing; r=rail

This commit is contained in:
Ehsan Akhgari 2015-09-13 18:57:38 -04:00
parent d79abf9bfc
commit 783d0ffb78
5 changed files with 32 additions and 4 deletions

View File

@ -26,6 +26,8 @@ build-clang.py accepts a JSON config format with the following fields:
* libcxx_repo: SVN path to the libcxx repo.
* python_path: Path to the Python 2.7 installation on the machine building clang.
* gcc_dir: Path to the gcc toolchain installation, only required on Linux.
* cc: Path to the bootsraping C Compiler.
* cxx: Path to the bootsraping C++ Compiler.
* patches: Optional list of patches to apply per platform. Supported platforms: macosx64, linux32, linux64. The default is Release.
* build_type: The type of build to make. Supported types: Release, Debug, RelWithDebInfo or MinSizeRel.
* build_libcxx: Whether to build with libcxx. The default is false.

View File

@ -14,17 +14,27 @@ import tempfile
import glob
import errno
from contextlib import contextmanager
import sys
DEBUG = os.getenv("DEBUG")
def check_run(args):
global DEBUG
if DEBUG:
print >> sys.stderr, ' '.join(args)
r = subprocess.call(args)
assert r == 0
def run_in(path, args):
d = os.getcwd()
global DEBUG
if DEBUG:
print >> sys.stderr, 'cd "%s"' % path
os.chdir(path)
check_run(args)
if DEBUG:
print >> sys.stderr, 'cd "%s"' % d
os.chdir(d)
@ -232,6 +242,20 @@ if __name__ == "__main__":
raise ValueError("gcc_dir must point to an existing path")
if not is_darwin() 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")
if not os.path.exists(source_dir):
os.makedirs(source_dir)
@ -265,15 +289,11 @@ if __name__ == "__main__":
extra_cxxflags = "-stdlib=libc++"
extra_cflags2 = ""
extra_cxxflags2 = "-stdlib=libc++"
cc = "/usr/bin/clang"
cxx = "/usr/bin/clang++"
else:
extra_cflags = "-static-libgcc"
extra_cxxflags = "-static-libgcc -static-libstdc++"
extra_cflags2 = "-fPIC --gcc-toolchain=%s" % gcc_dir
extra_cxxflags2 = "-fPIC --gcc-toolchain=%s" % gcc_dir
cc = gcc_dir + "/bin/gcc"
cxx = gcc_dir + "/bin/g++"
if os.environ.has_key('LD_LIBRARY_PATH'):
os.environ['LD_LIBRARY_PATH'] = '%s/lib64/:%s' % (gcc_dir, os.environ['LD_LIBRARY_PATH']);

View File

@ -10,6 +10,8 @@
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/trunk",
"python_path": "/usr/bin/python2.7",
"gcc_dir": "/home/worker/workspace/build/src/gcc",
"cc": "/home/worker/workspace/build/src/gcc/bin/gcc",
"cxx": "/home/worker/workspace/build/src/gcc/bin/g++",
"patches": {
"macosx64": ["llvm-debug-frame.patch"],
"linux64": ["llvm-debug-frame.patch"],

View File

@ -10,6 +10,8 @@
"libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/trunk",
"python_path": "/usr/local/bin/python2.7",
"gcc_dir": "/tools/gcc-4.7.3-0moz1",
"cc": "/home/worker/workspace/build/src/gcc/bin/gcc",
"cxx": "/home/worker/workspace/build/src/gcc/bin/g++",
"patches": {
"macosx64": ["llvm-debug-frame.patch"],
"linux64": ["llvm-debug-frame.patch"],

View File

@ -9,6 +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": "/usr/local/bin/python2.7",
"cc": "/usr/bin/clang",
"cxx": "/usr/bin/clang++",
"patches": {
"macosx64": ["llvm-debug-frame.patch"],
"linux64": ["llvm-debug-frame.patch"],