Bug 1182727 - Part 9: Make python_path configurable; r=rail

This commit is contained in:
Ehsan Akhgari 2015-09-11 09:26:24 -04:00
parent b279107ee2
commit 4d9a219994
4 changed files with 16 additions and 12 deletions

View File

@ -24,6 +24,7 @@ build-clang.py accepts a JSON config format with the following fields:
* clang_repo: SVN path to the Clang repo.
* compiler_repo: SVN path to the compiler-rt repo.
* libcxx_repo: SVN path to the libcxx repo.
* python_path: Path to the Python 2.7 installation on the machine building clang.
* 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

@ -119,9 +119,11 @@ def svn_update(directory, revision):
run_in(directory, ["svn", "update", "-r", revision])
def build_one_stage(env, src_dir, stage_dir, build_libcxx, build_type, assertions):
def build_one_stage(env, src_dir, stage_dir, build_libcxx, build_type, assertions,
python_path):
with updated_env(env):
build_one_stage_aux(src_dir, stage_dir, build_libcxx, build_type, assertions)
build_one_stage_aux(src_dir, stage_dir, build_libcxx, build_type,
assertions, python_path)
def get_platform():
@ -141,19 +143,14 @@ def is_darwin():
return platform.system() == "Darwin"
def build_one_stage_aux(src_dir, stage_dir, build_libcxx, build_type, assertions):
def build_one_stage_aux(src_dir, stage_dir, build_libcxx,
build_type, assertions, python_path):
if not os.path.exists(stage_dir):
os.mkdir(stage_dir)
build_dir = stage_dir + "/build"
inst_dir = stage_dir + "/clang"
global centOS6
if centOS6:
python_path = "/usr/bin/python2.7"
else:
python_path = "/usr/local/bin/python2.7"
run_cmake = True
if os.path.exists(build_dir):
run_cmake = False
@ -232,6 +229,10 @@ if __name__ == "__main__":
assertions = config["assertions"]
if assertions not in (True, False):
raise ValueError("Only boolean values are accepted for assertions.")
python_path = None
if "python_path" not in config:
raise ValueError("Config file needs to set python_path")
python_path = config["python_path"]
if not os.path.exists(source_dir):
os.makedirs(source_dir)
@ -284,7 +285,7 @@ if __name__ == "__main__":
{"CC": cc + " %s" % extra_cflags,
"CXX": cxx + " %s" % extra_cxxflags},
llvm_source_dir, stage1_dir, build_libcxx,
build_type, assertions)
build_type, assertions, python_path)
if stages > 1:
stage2_dir = build_dir + '/stage2'
@ -294,7 +295,7 @@ if __name__ == "__main__":
{"CC": stage1_inst_dir + "/bin/clang %s" % extra_cflags2,
"CXX": stage1_inst_dir + "/bin/clang++ %s" % extra_cxxflags2},
llvm_source_dir, stage2_dir, build_libcxx,
build_type, assertions)
build_type, assertions, python_path)
if stages > 2:
stage3_dir = build_dir + '/stage3'
@ -303,7 +304,7 @@ if __name__ == "__main__":
{"CC": stage2_inst_dir + "/bin/clang %s" % extra_cflags2,
"CXX": stage2_inst_dir + "/bin/clang++ %s" % extra_cxxflags2},
llvm_source_dir, stage3_dir, build_libcxx,
build_type, assertions)
build_type, assertions, python_path)
if not is_darwin():
final_stage_inst_dir = final_stage_dir + '/clang'

View File

@ -8,6 +8,7 @@
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/trunk",
"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",
"patches": {
"macosx64": ["llvm-debug-frame.patch"],
"linux64": ["llvm-debug-frame.patch"],

View File

@ -8,6 +8,7 @@
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/trunk",
"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",
"patches": {
"macosx64": ["llvm-debug-frame.patch"],
"linux64": ["llvm-debug-frame.patch"],