Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(483)

Side by Side Diff: infra/bots/assets/clang_linux/create.py

Issue 2324503002: clang_linux: also build an MSAN libc++ (Closed)
Patch Set: version Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « infra/bots/assets/clang_linux/VERSION ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2016 Google Inc. 3 # Copyright 2016 Google Inc.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license that can be 5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file. 6 # found in the LICENSE file.
7 7
8 8
9 """Create a Clang toolchain for Linux hosts.""" 9 """Create a Clang toolchain for Linux hosts."""
10 10
11 11
12 import argparse 12 import argparse
13 import os 13 import os
14 import subprocess 14 import subprocess
15 import tempfile 15 import tempfile
16 16
17 REPO = "https://llvm.googlesource.com/" 17 REPO = "https://llvm.googlesource.com/"
18 BRANCH = "release_39" 18 BRANCH = "release_39"
19 19
20 def create_asset(target_dir): 20 def create_asset(target_dir):
21 # Build Clang, lld, compiler-rt (sanitizer support) and libc++.
21 os.chdir(tempfile.mkdtemp()) 22 os.chdir(tempfile.mkdtemp())
22 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "llvm"]) 23 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "llvm"])
23 os.chdir("llvm/tools") 24 os.chdir("llvm/tools")
24 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "clang"]) 25 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "clang"])
25 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "lld"]) 26 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "lld"])
26 os.chdir("../projects") 27 os.chdir("../projects")
27 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "compiler-rt"]) 28 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "compiler-rt"])
28 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "libcxx"]) 29 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "libcxx"])
29 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "libcxxabi"]) 30 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "libcxxabi"])
30 os.chdir("..") 31 os.chdir("..")
31 os.mkdir("out") 32 os.mkdir("out")
32 os.chdir("out") 33 os.chdir("out")
33 subprocess.check_call(["cmake", "..", "-G", "Ninja", 34 subprocess.check_call(["cmake", "..", "-G", "Ninja",
34 "-DCMAKE_BUILD_TYPE=MinSizeRel", 35 "-DCMAKE_BUILD_TYPE=MinSizeRel",
35 "-DCMAKE_INSTALL_PREFIX=" + target_dir, 36 "-DCMAKE_INSTALL_PREFIX=" + target_dir,
36 "-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON", 37 "-DLLVM_INSTALL_TOOLCHAIN_ONLY=ON",
37 "-DLLVM_ENABLE_TERMINFO=OFF"]) 38 "-DLLVM_ENABLE_TERMINFO=OFF"])
38 subprocess.check_call(["cmake", "--build", "."]) 39 subprocess.check_call(["ninja", "install"])
39 subprocess.check_call(["cmake", "--build", ".", "--target", "install"]) 40
41 # Copy a couple extra files we need.
40 subprocess.check_call(["cp", "bin/llvm-symbolizer", target_dir + "/bin"]) 42 subprocess.check_call(["cp", "bin/llvm-symbolizer", target_dir + "/bin"])
41
42 libstdcpp = subprocess.check_output(["c++", 43 libstdcpp = subprocess.check_output(["c++",
43 "-print-file-name=libstdc++.so.6"]) 44 "-print-file-name=libstdc++.so.6"])
44 subprocess.check_call(["cp", libstdcpp.strip(), target_dir + "/lib"]) 45 subprocess.check_call(["cp", libstdcpp.strip(), target_dir + "/lib"])
45 46
47 # Finally, build libc++ for MSAN bots using the Clang we just built.
48 os.mkdir("../msan_out")
49 os.chdir("../msan_out")
50 subprocess.check_call(["cmake", "..", "-G", "Ninja",
51 "-DCMAKE_BUILD_TYPE=MinSizeRel",
52 "-DCMAKE_C_COMPILER=" + target_dir + "/bin/clang",
53 "-DCMAKE_CXX_COMPILER=" + target_dir + "/bin/clang++",
54 "-DLLVM_USE_SANITIZER=MemoryWithOrigins"])
55 subprocess.check_call(["ninja", "cxx"])
56 subprocess.check_call(["cp", "-r", "lib", target_dir + "/msan"])
57
46 58
47 def main(): 59 def main():
48 parser = argparse.ArgumentParser() 60 parser = argparse.ArgumentParser()
49 parser.add_argument('--target_dir', '-t', required=True) 61 parser.add_argument('--target_dir', '-t', required=True)
50 args = parser.parse_args() 62 args = parser.parse_args()
51 create_asset(args.target_dir) 63 create_asset(args.target_dir)
52 64
53 65
54 if __name__ == '__main__': 66 if __name__ == '__main__':
55 main() 67 main()
OLDNEW
« no previous file with comments | « infra/bots/assets/clang_linux/VERSION ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698