Bug 957865 - Adjust clang build script/patches for r200213. r=rail
authorChristian Holler <choller@mozilla.com>
Fri, 28 Mar 2014 19:06:13 +0100
changeset 175991 7dbc40da9c8fa514fd069974796eaf33a26dc600
parent 175990 32f04076b6b59d90f5a6de45d513b275926c2af0
child 175992 24123c2951c53062dd277a721ecf6ee7a42ef587
push id26505
push userphilringnalda@gmail.com
push dateSat, 29 Mar 2014 16:01:43 +0000
treeherdermozilla-central@8da3aabb044f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrail
bugs957865
milestone31.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 957865 - Adjust clang build script/patches for r200213. r=rail
build/unix/build-clang/build-clang.py
build/unix/build-clang/clang-trunk.json
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
@@ -33,17 +33,17 @@ def patch(patch, srcdir):
 
 
 def build_package(package_source_dir, package_build_dir, configure_args,
                   make_args):
     if not os.path.exists(package_build_dir):
         os.mkdir(package_build_dir)
     run_in(package_build_dir,
            ["%s/configure" % package_source_dir] + configure_args)
-    run_in(package_build_dir, ["make", "-j8"] + make_args)
+    run_in(package_build_dir, ["make", "-j4"] + make_args)
     run_in(package_build_dir, ["make", "install"])
 
 
 def with_env(env, f):
     old_env = os.environ.copy()
     os.environ.update(env)
     f()
     os.environ.clear()
@@ -54,19 +54,19 @@ def build_tar_package(tar, name, base, d
     name = os.path.realpath(name)
     run_in(base, [tar, "-cjf", name, directory])
 
 
 def svn_co(url, directory, revision):
     check_run(["svn", "co", "-r", revision, url, directory])
 
 
-def build_one_stage(env, stage_dir, llvm_source_dir):
+def build_one_stage(env, stage_dir, llvm_source_dir, gcc_toolchain_dir):
     def f():
-        build_one_stage_aux(stage_dir, llvm_source_dir)
+        build_one_stage_aux(stage_dir, llvm_source_dir, gcc_toolchain_dir)
     with_env(env, f)
 
 
 def build_tooltool_manifest(llvm_revision):
     basedir = os.path.split(os.path.realpath(sys.argv[0]))[0]
     tooltool = basedir + '/tooltool.py'
     setup = basedir + '/setup.sh'
     manifest = 'clang.manifest'
@@ -94,17 +94,17 @@ def get_platform():
     else:
         raise NotImplementedError("Not supported platform")
 
 
 def is_darwin():
     return platform.system() == "Darwin"
 
 
-def build_one_stage_aux(stage_dir, llvm_source_dir):
+def build_one_stage_aux(stage_dir, llvm_source_dir, gcc_toolchain_dir):
     os.mkdir(stage_dir)
 
     build_dir = stage_dir + "/build"
     inst_dir = stage_dir + "/clang"
 
     targets = ["x86", "x86_64"]
     # The Darwin equivalents of binutils appear to have intermittent problems
     # with objects in compiler-rt that are compiled for arm.  Since the arm
@@ -112,33 +112,36 @@ def build_one_stage_aux(stage_dir, llvm_
     # arm support on Linux.
     if not is_darwin():
         targets.append("arm")
 
     configure_opts = ["--enable-optimized",
                       "--enable-targets=" + ",".join(targets),
                       "--disable-assertions",
                       "--prefix=%s" % inst_dir,
-                      "--with-gcc-toolchain=/tools/gcc-4.7.3-0moz1"]
+                      "--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.
     # We use a directory in /builds/slave because the mozilla infrastructure
     # cleans it up automatically.
     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"
 
+    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,
                         type=argparse.FileType('r'),
                         help="Clang configuration file")
 
@@ -170,21 +173,26 @@ if __name__ == "__main__":
     if is_darwin():
         extra_cflags = ""
         extra_cxxflags = ""
         cc = "/usr/bin/clang"
         cxx = "/usr/bin/clang++"
     else:
         extra_cflags = "-static-libgcc"
         extra_cxxflags = "-static-libgcc -static-libstdc++"
-        cc = "/usr/bin/gcc"
-        cxx = "/usr/bin/g++"
+        cc = gcc_dir + "/bin/gcc"
+        cxx = gcc_dir + "/bin/g++"
 
-    build_one_stage({"CC": cc, "CXX": cxx}, stage1_dir, llvm_source_dir)
+    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)
 
     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},
-        stage2_dir, llvm_source_dir)
+        stage2_dir, llvm_source_dir, gcc_dir)
 
     build_tar_package("tar", "clang.tar.bz2", stage2_dir, "clang")
     build_tooltool_manifest(llvm_revision)
--- a/build/unix/build-clang/clang-trunk.json
+++ b/build/unix/build-clang/clang-trunk.json
@@ -1,11 +1,11 @@
 {
-    "llvm_revision": "185949",
+    "llvm_revision": "200213",
     "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",
     "patches": {
         "macosx64": ["llvm-debug-frame.patch"],
-        "linux64": ["llvm-debug-frame.patch", "no-sse-on-linux.patch"],
-        "linux32": ["llvm-debug-frame.patch", "no-sse-on-linux.patch"]
+        "linux64": ["llvm-debug-frame.patch", "no-sse-on-linux-trunk.patch"],
+        "linux32": ["llvm-debug-frame.patch", "no-sse-on-linux-trunk.patch"]
     }
 }
new file mode 100644
--- /dev/null
+++ b/build/unix/build-clang/no-sse-on-linux-trunk.patch
@@ -0,0 +1,13 @@
+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)