Bug 1182727 - Part 4: Add support for configurable three stage builds; r=rail

This adds a stages config option, which can be used to select 1, 2, and
3 stage builds.  It also marks the default trunk configuration to do 3
stage builds, and defaults to that.
This commit is contained in:
Ehsan Akhgari 2015-07-10 23:11:11 -04:00
parent 9eef0798b0
commit 4dcd441cee
2 changed files with 33 additions and 9 deletions

View File

@ -55,7 +55,9 @@ def updated_env(env):
def build_tar_package(tar, name, base, directory):
name = os.path.realpath(name)
run_in(base, [tar, "-cJf", name, directory])
run_in(base, [tar,
"-c -%s -f" % "J" if ".xz" in name else "j",
name, directory])
def copy_dir_contents(src, dest):
@ -202,6 +204,11 @@ if __name__ == "__main__":
clang_repo = config["clang_repo"]
compiler_repo = config["compiler_repo"]
libcxx_repo = config["libcxx_repo"]
stages = 3
if "stages" in config:
stages = int(config["stages"])
if stages not in (1, 2, 3):
raise ValueError("We only know how to build 1, 2, or 3 stages")
if not os.path.exists(source_dir):
os.makedirs(source_dir)
@ -228,6 +235,8 @@ if __name__ == "__main__":
stage1_dir = build_dir + '/stage1'
stage1_inst_dir = stage1_dir + '/clang'
final_stage_dir = stage1_dir
if is_darwin():
extra_cflags = ""
extra_cxxflags = "-stdlib=libc++"
@ -255,17 +264,31 @@ if __name__ == "__main__":
"CXX": cxx + " %s" % extra_cxxflags},
llvm_source_dir, stage1_dir, build_libcxx)
stage2_dir = build_dir + '/stage2'
build_one_stage(
{"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)
if stages > 1:
stage2_dir = build_dir + '/stage2'
stage2_inst_dir = stage2_dir + '/clang'
final_stage_dir = stage2_dir
build_one_stage(
{"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)
if stages > 2:
stage3_dir = build_dir + '/stage3'
final_stage_dir = stage3_dir
build_one_stage(
{"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)
if not is_darwin():
stage2_inst_dir = stage2_dir + '/clang'
final_stage_inst_dir = final_stage_dir + '/clang'
build_and_use_libgcc(
{"CC": cc + " %s" % extra_cflags,
"CXX": cxx + " %s" % extra_cxxflags},
stage2_inst_dir)
final_stage_inst_dir)
build_tar_package("tar", "clang.tar.xz", stage2_dir, "clang")
if is_darwin():
build_tar_package("tar", "clang.tar.bz2", final_stage_dir, "clang")
else:
build_tar_package("tar", "clang.tar.xz", final_stage_dir, "clang")

View File

@ -1,5 +1,6 @@
{
"llvm_revision": "247539",
"stages": "3",
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/trunk",
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/trunk",
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/trunk",