| OLD | NEW |
| 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 os.chdir(tempfile.mkdtemp()) | 21 os.chdir(tempfile.mkdtemp()) |
| 22 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "llvm"]) | 22 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "llvm"]) |
| 23 os.chdir("llvm/tools") | 23 os.chdir("llvm/tools") |
| 24 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "clang"]) | 24 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "clang"]) |
| 25 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "lld"]) |
| 25 os.chdir("../projects") | 26 os.chdir("../projects") |
| 26 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "compiler-rt"]) | 27 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "compiler-rt"]) |
| 27 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "libcxx"]) | 28 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "libcxx"]) |
| 28 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "libcxxabi"]) | 29 subprocess.check_call(["git", "clone", "-b", BRANCH, REPO + "libcxxabi"]) |
| 29 os.chdir("..") | 30 os.chdir("..") |
| 30 os.mkdir("out") | 31 os.mkdir("out") |
| 31 os.chdir("out") | 32 os.chdir("out") |
| 32 subprocess.check_call(["cmake", "..", "-G", "Ninja", | 33 subprocess.check_call(["cmake", "..", "-G", "Ninja", |
| 33 "-DCMAKE_BUILD_TYPE=MinSizeRel", | 34 "-DCMAKE_BUILD_TYPE=MinSizeRel", |
| 34 "-DCMAKE_INSTALL_PREFIX=" + target_dir, | 35 "-DCMAKE_INSTALL_PREFIX=" + target_dir, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 45 | 46 |
| 46 def main(): | 47 def main(): |
| 47 parser = argparse.ArgumentParser() | 48 parser = argparse.ArgumentParser() |
| 48 parser.add_argument('--target_dir', '-t', required=True) | 49 parser.add_argument('--target_dir', '-t', required=True) |
| 49 args = parser.parse_args() | 50 args = parser.parse_args() |
| 50 create_asset(args.target_dir) | 51 create_asset(args.target_dir) |
| 51 | 52 |
| 52 | 53 |
| 53 if __name__ == '__main__': | 54 if __name__ == '__main__': |
| 54 main() | 55 main() |
| OLD | NEW |