Bug 1123386 - Part 1: Update the clang build script for the most recent clang; r=rail
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 18 Jan 2015 20:44:05 -0500
changeset 252676 40798fb2a58f3bb44eb8f747f789a140f6e90ac3
parent 252675 150f2d5b21c0666464b017ce5b3599279302b352
child 252677 5bd2edcc7779c01cf82cc65344ea97cfd08926f2
push id62212
push usereakhgari@mozilla.com
push dateTue, 14 Jul 2015 02:52:47 +0000
treeherdermozilla-inbound@07ee075d8e6c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrail
bugs1123386
milestone42.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 1123386 - Part 1: Update the clang build script for the most recent clang; r=rail
build/unix/build-clang/build-clang.py
build/unix/build-clang/clang-trunk.json
build/unix/build-clang/llvm-debug-frame.patch
build/unix/build-clang/no-sse-on-linux-trunk.patch
--- a/build/unix/build-clang/build-clang.py
+++ b/build/unix/build-clang/build-clang.py
@@ -1,9 +1,9 @@
-#!/usr/bin/python
+#!/usr/bin/python2.7
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 import os
 import os.path
 import shutil
 import subprocess
@@ -92,16 +92,18 @@ def build_one_stage_aux(stage_dir, llvm_
     # support is only necessary for iOS (which we don't support), only enable
     # arm support on Linux.
     if not is_darwin():
         targets.append("arm")
 
     configure_opts = ["--enable-optimized",
                       "--enable-targets=" + ",".join(targets),
                       "--disable-assertions",
+                      "--disable-libedit",
+                      "--with-python=/usr/local/bin/python2.7",
                       "--prefix=%s" % inst_dir,
                       "--with-gcc-toolchain=%s" % gcc_toolchain_dir,
                       "--disable-compiler-version-checks"]
     build_package(llvm_source_dir, build_dir, configure_opts, [])
 
 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.
@@ -110,16 +112,17 @@ if __name__ == "__main__":
     base_dir = "/builds/slave/moz-toolchain"
 
     source_dir = base_dir + "/src"
     build_dir = base_dir + "/build"
 
     llvm_source_dir = source_dir + "/llvm"
     clang_source_dir = source_dir + "/clang"
     compiler_rt_source_dir = source_dir + "/compiler-rt"
+    libcxx_source_dir = source_dir + "/libcxx"
 
     gcc_dir = "/tools/gcc-4.7.3-0moz1"
 
     if is_darwin():
         os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.7'
 
     parser = argparse.ArgumentParser()
     parser.add_argument('-c', '--config', required=True,
@@ -127,52 +130,63 @@ if __name__ == "__main__":
                         help="Clang configuration file")
 
     args = parser.parse_args()
     config = json.load(args.config)
     llvm_revision = config["llvm_revision"]
     llvm_repo = config["llvm_repo"]
     clang_repo = config["clang_repo"]
     compiler_repo = config["compiler_repo"]
+    libcxx_repo = config["libcxx_repo"]
 
     if not os.path.exists(source_dir):
         os.makedirs(source_dir)
         svn_co(llvm_repo, llvm_source_dir, llvm_revision)
         svn_co(clang_repo, clang_source_dir, llvm_revision)
         svn_co(compiler_repo, compiler_rt_source_dir, llvm_revision)
+        svn_co(libcxx_repo, libcxx_source_dir, llvm_revision)
         os.symlink("../../clang", llvm_source_dir + "/tools/clang")
         os.symlink("../../compiler-rt",
                    llvm_source_dir + "/projects/compiler-rt")
+        os.symlink("../../libcxx",
+                   llvm_source_dir + "/projects/libcxx")
         for p in config.get("patches", {}).get(get_platform(), []):
             patch(p, source_dir)
 
     if os.path.exists(build_dir):
         shutil.rmtree(build_dir)
     os.makedirs(build_dir)
 
     stage1_dir = build_dir + '/stage1'
     stage1_inst_dir = stage1_dir + '/clang'
 
     if is_darwin():
         extra_cflags = ""
-        extra_cxxflags = ""
+        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_cflags = ""
+        extra_cxxflags = ""
+        extra_cflags2 = "-static-libgcc"
+        extra_cxxflags2 = "-static-libgcc -static-libstdc++"
         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']);
     else:
         os.environ['LD_LIBRARY_PATH'] = '%s/lib64/' % gcc_dir
 
-    build_one_stage({"CC": cc, "CXX": cxx}, stage1_dir, llvm_source_dir, gcc_dir)
+    build_one_stage(
+        {"CC": cc + " %s" % extra_cflags,
+         "CXX": cxx + " %s" % extra_cxxflags},
+        stage1_dir, llvm_source_dir, gcc_dir)
 
     stage2_dir = build_dir + '/stage2'
     build_one_stage(
-        {"CC": stage1_inst_dir + "/bin/clang %s" % extra_cflags,
-         "CXX": stage1_inst_dir + "/bin/clang++ %s" % extra_cxxflags},
+        {"CC": stage1_inst_dir + "/bin/clang %s" % extra_cflags2,
+         "CXX": stage1_inst_dir + "/bin/clang++ %s" % extra_cxxflags2},
         stage2_dir, llvm_source_dir, gcc_dir)
 
     build_tar_package("tar", "clang.tar.bz2", stage2_dir, "clang")
--- a/build/unix/build-clang/clang-trunk.json
+++ b/build/unix/build-clang/clang-trunk.json
@@ -1,11 +1,12 @@
 {
-    "llvm_revision": "200213",
+    "llvm_revision": "241406",
     "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",
+    "libcxx_repo": "https://llvm.org/svn/llvm-project/libcxx/trunk",
     "patches": {
         "macosx64": ["llvm-debug-frame.patch"],
-        "linux64": ["llvm-debug-frame.patch", "no-sse-on-linux-trunk.patch"],
-        "linux32": ["llvm-debug-frame.patch", "no-sse-on-linux-trunk.patch"]
+        "linux64": ["llvm-debug-frame.patch"],
+        "linux32": ["llvm-debug-frame.patch"]
     }
 }
--- a/build/unix/build-clang/llvm-debug-frame.patch
+++ b/build/unix/build-clang/llvm-debug-frame.patch
@@ -1,13 +1,13 @@
-diff --git a/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
-index d6d4510..c488d4a 100644
---- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
-+++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
-@@ -172,6 +172,8 @@ bool AsmPrinter::doInitialization(Module &M) {
-     OutStreamer.EmitFileDirective(M.getModuleIdentifier());
+Index: lib/CodeGen/AsmPrinter/AsmPrinter.cpp
+===================================================================
+--- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp	(revision 226419)
++++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp	(working copy)
+@@ -210,6 +210,8 @@
+     OutStreamer->EmitFileDirective(M.getModuleIdentifier());
    }
- 
-+  OutStreamer.EmitCFISections(true, true);
+
++  OutStreamer->EmitCFISections(true, true);
 +
    GCModuleInfo *MI = getAnalysisIfAvailable<GCModuleInfo>();
    assert(MI && "AsmPrinter didn't require GCModuleInfo?");
-   for (GCModuleInfo::iterator I = MI->begin(), E = MI->end(); I != E; ++I)
+   for (auto &I : *MI)
deleted file mode 100644
--- a/build/unix/build-clang/no-sse-on-linux-trunk.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-Index: lib/Driver/Tools.cpp
-===================================================================
---- a/clang/lib/Driver/Tools.cpp	(revision 199443)
-+++ b/clang/lib/Driver/Tools.cpp	(working copy)
-@@ -1226,7 +1226,7 @@
-   // All x86 devices running Android have core2 as their common
-   // denominator. This makes a better choice than pentium4.
-   if (Triple.getEnvironment() == llvm::Triple::Android)
--    return "core2";
-+    return "686";
- 
-   // Everything else goes to x86-64 in 64-bit mode.
-   if (Is64Bit)