Bug 1262735 - Copy libgcc from the GCC used to build clang instead of building a new GCC. r=ehsan
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 08 Apr 2016 13:14:07 +0900
changeset 330794 4f51ad2ba462dae3bba8b7814d331b20880a99a7
parent 330793 aacb077966095faae51be77616408d1fa9073a5f
child 330795 db468dad3a35866dc24a45f2b9cbd744e2b9f77e
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1262735
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1262735 - Copy libgcc from the GCC used to build clang instead of building a new GCC. r=ehsan Since build-clang.py requires a gcc_dir to be set, and we're using GCC from there to build clang, we might as well copy libgcc from there instead of building a fresh GCC. On the taskcluster job building clang, GCC comes from a tooltool package that is already the result of build-gcc anyways.
build/build-clang/build-clang.py
--- a/build/build-clang/build-clang.py
+++ b/build/build-clang/build-clang.py
@@ -109,39 +109,31 @@ def copy_dir_contents(src, dest):
 def mkdir_p(path):
     try:
         os.makedirs(path)
     except OSError as e:
         if e.errno != errno.EEXIST or not os.path.isdir(path):
             raise
 
 
-def build_and_use_libgcc(env, clang_dir):
-    with updated_env(env):
-        tempdir = tempfile.mkdtemp()
-        gcc_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)),
-                               "..", "unix", "build-gcc")
-        run_in(gcc_dir, ["./build-gcc.sh", tempdir, "libgcc"])
-        run_in(tempdir, ["tar", "-xf", "gcc.tar.xz"])
-        libgcc_dir = glob.glob(os.path.join(tempdir,
-                                            "gcc", "lib", "gcc",
-                                            "x86_64-unknown-linux-gnu",
+def install_libgcc(gcc_dir, clang_dir):
+        libgcc_dir = glob.glob(os.path.join(gcc_dir, "lib", "gcc",
+                                            "x86_64-*linux-gnu",
                                             "[0-9]*"))[0]
         clang_lib_dir = os.path.join(clang_dir, "lib", "gcc",
                                      "x86_64-unknown-linux-gnu",
                                      os.path.basename(libgcc_dir))
         mkdir_p(clang_lib_dir)
         copy_dir_contents(libgcc_dir, clang_lib_dir)
-        libgcc_dir = os.path.join(tempdir, "gcc", "lib64")
+        libgcc_dir = os.path.join(gcc_dir, "lib64")
         clang_lib_dir = os.path.join(clang_dir, "lib")
         copy_dir_contents(libgcc_dir, clang_lib_dir)
-        include_dir = os.path.join(tempdir, "gcc", "include")
+        include_dir = os.path.join(gcc_dir, "include")
         clang_include_dir = os.path.join(clang_dir, "include")
         copy_dir_contents(include_dir, clang_include_dir)
-        shutil.rmtree(tempdir)
 
 
 def svn_co(source_dir, url, directory, revision):
     run_in(source_dir, ["svn", "co", "-r", revision, url, directory])
 
 
 def svn_update(directory, revision):
     run_in(directory, ["svn", "update", "-r", revision])
@@ -390,18 +382,14 @@ if __name__ == "__main__":
                 [stage2_inst_dir + "/bin/%s%s" %
                     (cc_name, exe_ext)] + extra_cflags2,
                 [stage2_inst_dir + "/bin/%s%s" %
                     (cxx_name, exe_ext)] + extra_cxxflags2,
                 llvm_source_dir, stage3_dir, build_libcxx,
                 build_type, assertions, python_path)
 
     if is_linux():
-        final_stage_inst_dir = final_stage_dir + '/clang'
-        build_and_use_libgcc(
-            {"CC": cc + " %s" % ' '.join(extra_cflags),
-             "CXX": cxx + " %s" % ' '.join(extra_cxxflags)},
-            final_stage_inst_dir)
+        install_libgcc(gcc_dir, final_stage_dir + '/clang')
 
     if is_darwin() or is_windows():
         build_tar_package("tar", "clang.tar.bz2", final_stage_dir, "clang")
     else:
         build_tar_package("tar", "clang.tar.xz", final_stage_dir, "clang")