OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """This script is used to download prebuilt clang binaries. | 6 """This script is used to download prebuilt clang binaries. |
7 | 7 |
8 It is also used by package.py to build the prebuilt clang binaries.""" | 8 It is also used by package.py to build the prebuilt clang binaries.""" |
9 | 9 |
10 import argparse | 10 import argparse |
(...skipping 16 matching lines...) Expand all Loading... | |
27 # Do NOT CHANGE this if you don't know what you're doing -- see | 27 # Do NOT CHANGE this if you don't know what you're doing -- see |
28 # https://chromium.googlesource.com/chromium/src/+/master/docs/updating_clang.md | 28 # https://chromium.googlesource.com/chromium/src/+/master/docs/updating_clang.md |
29 # Reverting problematic clang rolls is safe, though. | 29 # Reverting problematic clang rolls is safe, though. |
30 CLANG_REVISION = '305735' | 30 CLANG_REVISION = '305735' |
31 | 31 |
32 use_head_revision = 'LLVM_FORCE_HEAD_REVISION' in os.environ | 32 use_head_revision = 'LLVM_FORCE_HEAD_REVISION' in os.environ |
33 if use_head_revision: | 33 if use_head_revision: |
34 CLANG_REVISION = 'HEAD' | 34 CLANG_REVISION = 'HEAD' |
35 | 35 |
36 # This is incremented when pushing a new build of Clang at the same revision. | 36 # This is incremented when pushing a new build of Clang at the same revision. |
37 CLANG_SUB_REVISION=1 | 37 CLANG_SUB_REVISION=2 |
Nico
2017/06/28 15:06:59
Be sure to push the new binaries to goma before la
| |
38 | 38 |
39 PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION) | 39 PACKAGE_VERSION = "%s-%s" % (CLANG_REVISION, CLANG_SUB_REVISION) |
40 | 40 |
41 # Path constants. (All of these should be absolute paths.) | 41 # Path constants. (All of these should be absolute paths.) |
42 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 42 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
43 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) | 43 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) |
44 THIRD_PARTY_DIR = os.path.join(CHROMIUM_DIR, 'third_party') | 44 THIRD_PARTY_DIR = os.path.join(CHROMIUM_DIR, 'third_party') |
45 LLVM_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm') | 45 LLVM_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm') |
46 LLVM_BOOTSTRAP_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-bootstrap') | 46 LLVM_BOOTSTRAP_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-bootstrap') |
47 LLVM_BOOTSTRAP_INSTALL_DIR = os.path.join(THIRD_PARTY_DIR, | 47 LLVM_BOOTSTRAP_INSTALL_DIR = os.path.join(THIRD_PARTY_DIR, |
48 'llvm-bootstrap-install') | 48 'llvm-bootstrap-install') |
49 LLVM_LTO_GOLD_PLUGIN_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-lto-gold-plugin') | 49 LLVM_LTO_LLD_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-lto-lld') |
50 CHROME_TOOLS_SHIM_DIR = os.path.join(LLVM_DIR, 'tools', 'chrometools') | 50 CHROME_TOOLS_SHIM_DIR = os.path.join(LLVM_DIR, 'tools', 'chrometools') |
51 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', | 51 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', |
52 'Release+Asserts') | 52 'Release+Asserts') |
53 COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, 'compiler-rt') | 53 COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, 'compiler-rt') |
54 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') | 54 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') |
55 LLD_DIR = os.path.join(LLVM_DIR, 'tools', 'lld') | 55 LLD_DIR = os.path.join(LLVM_DIR, 'tools', 'lld') |
56 # compiler-rt is built as part of the regular LLVM build on Windows to get | 56 # compiler-rt is built as part of the regular LLVM build on Windows to get |
57 # the 64-bit runtime, and out-of-tree elsewhere. | 57 # the 64-bit runtime, and out-of-tree elsewhere. |
58 # TODO(thakis): Try to unify this. | 58 # TODO(thakis): Try to unify this. |
59 if sys.platform == 'win32': | 59 if sys.platform == 'win32': |
60 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt') | 60 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt') |
61 else: | 61 else: |
62 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'compiler-rt') | 62 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'compiler-rt') |
63 LIBCXX_DIR = os.path.join(LLVM_DIR, 'projects', 'libcxx') | 63 LIBCXX_DIR = os.path.join(LLVM_DIR, 'projects', 'libcxx') |
64 LIBCXXABI_DIR = os.path.join(LLVM_DIR, 'projects', 'libcxxabi') | 64 LIBCXXABI_DIR = os.path.join(LLVM_DIR, 'projects', 'libcxxabi') |
65 LLVM_BUILD_TOOLS_DIR = os.path.abspath( | 65 LLVM_BUILD_TOOLS_DIR = os.path.abspath( |
66 os.path.join(LLVM_DIR, '..', 'llvm-build-tools')) | 66 os.path.join(LLVM_DIR, '..', 'llvm-build-tools')) |
67 STAMP_FILE = os.path.normpath( | 67 STAMP_FILE = os.path.normpath( |
68 os.path.join(LLVM_DIR, '..', 'llvm-build', 'cr_build_revision')) | 68 os.path.join(LLVM_DIR, '..', 'llvm-build', 'cr_build_revision')) |
69 BINUTILS_DIR = os.path.join(THIRD_PARTY_DIR, 'binutils', 'Linux_x64', 'Release') | |
70 BINUTILS_BIN_DIR = os.path.join(BINUTILS_DIR, 'bin') | |
71 BINUTILS_LIB_DIR = os.path.join(BINUTILS_DIR, 'lib') | |
72 BFD_PLUGINS_DIR = os.path.join(BINUTILS_LIB_DIR, 'bfd-plugins') | |
73 VERSION = '5.0.0' | 69 VERSION = '5.0.0' |
74 ANDROID_NDK_DIR = os.path.join( | 70 ANDROID_NDK_DIR = os.path.join( |
75 CHROMIUM_DIR, 'third_party', 'android_tools', 'ndk') | 71 CHROMIUM_DIR, 'third_party', 'android_tools', 'ndk') |
76 | 72 |
77 # URL for pre-built binaries. | 73 # URL for pre-built binaries. |
78 CDS_URL = os.environ.get('CDS_CLANG_BUCKET_OVERRIDE', | 74 CDS_URL = os.environ.get('CDS_CLANG_BUCKET_OVERRIDE', |
79 'https://commondatastorage.googleapis.com/chromium-browser-clang') | 75 'https://commondatastorage.googleapis.com/chromium-browser-clang') |
80 | 76 |
81 LLVM_REPO_URL='https://llvm.org/svn/llvm-project' | 77 LLVM_REPO_URL='https://llvm.org/svn/llvm-project' |
82 if 'LLVM_REPO_URL' in os.environ: | 78 if 'LLVM_REPO_URL' in os.environ: |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 cxxflags = [] | 478 cxxflags = [] |
483 ldflags = [] | 479 ldflags = [] |
484 | 480 |
485 base_cmake_args = ['-GNinja', | 481 base_cmake_args = ['-GNinja', |
486 '-DCMAKE_BUILD_TYPE=Release', | 482 '-DCMAKE_BUILD_TYPE=Release', |
487 '-DLLVM_ENABLE_ASSERTIONS=ON', | 483 '-DLLVM_ENABLE_ASSERTIONS=ON', |
488 # Statically link MSVCRT to avoid DLL dependencies. | 484 # Statically link MSVCRT to avoid DLL dependencies. |
489 '-DLLVM_USE_CRT_RELEASE=MT', | 485 '-DLLVM_USE_CRT_RELEASE=MT', |
490 ] | 486 ] |
491 | 487 |
492 binutils_incdir = '' | |
493 if sys.platform.startswith('linux'): | |
494 binutils_incdir = os.path.join(BINUTILS_DIR, 'include') | |
495 | |
496 if args.bootstrap: | 488 if args.bootstrap: |
497 print 'Building bootstrap compiler' | 489 print 'Building bootstrap compiler' |
498 EnsureDirExists(LLVM_BOOTSTRAP_DIR) | 490 EnsureDirExists(LLVM_BOOTSTRAP_DIR) |
499 os.chdir(LLVM_BOOTSTRAP_DIR) | 491 os.chdir(LLVM_BOOTSTRAP_DIR) |
500 bootstrap_args = base_cmake_args + [ | 492 bootstrap_args = base_cmake_args + [ |
501 '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir, | |
502 '-DLLVM_TARGETS_TO_BUILD=host', | 493 '-DLLVM_TARGETS_TO_BUILD=host', |
503 '-DCMAKE_INSTALL_PREFIX=' + LLVM_BOOTSTRAP_INSTALL_DIR, | 494 '-DCMAKE_INSTALL_PREFIX=' + LLVM_BOOTSTRAP_INSTALL_DIR, |
504 '-DCMAKE_C_FLAGS=' + ' '.join(cflags), | 495 '-DCMAKE_C_FLAGS=' + ' '.join(cflags), |
505 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags), | 496 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags), |
506 ] | 497 ] |
507 if cc is not None: bootstrap_args.append('-DCMAKE_C_COMPILER=' + cc) | 498 if cc is not None: bootstrap_args.append('-DCMAKE_C_COMPILER=' + cc) |
508 if cxx is not None: bootstrap_args.append('-DCMAKE_CXX_COMPILER=' + cxx) | 499 if cxx is not None: bootstrap_args.append('-DCMAKE_CXX_COMPILER=' + cxx) |
509 RmCmakeCache('.') | 500 RmCmakeCache('.') |
510 RunCommand(['cmake'] + bootstrap_args + [LLVM_DIR], msvc_arch='x64') | 501 RunCommand(['cmake'] + bootstrap_args + [LLVM_DIR], msvc_arch='x64') |
511 RunCommand(['ninja'], msvc_arch='x64') | 502 RunCommand(['ninja'], msvc_arch='x64') |
(...skipping 18 matching lines...) Expand all Loading... | |
530 cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang') | 521 cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang') |
531 cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang++') | 522 cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang++') |
532 | 523 |
533 if args.gcc_toolchain: | 524 if args.gcc_toolchain: |
534 # Tell the bootstrap compiler to use a specific gcc prefix to search | 525 # Tell the bootstrap compiler to use a specific gcc prefix to search |
535 # for standard library headers and shared object files. | 526 # for standard library headers and shared object files. |
536 cflags = ['--gcc-toolchain=' + args.gcc_toolchain] | 527 cflags = ['--gcc-toolchain=' + args.gcc_toolchain] |
537 cxxflags = ['--gcc-toolchain=' + args.gcc_toolchain] | 528 cxxflags = ['--gcc-toolchain=' + args.gcc_toolchain] |
538 print 'Building final compiler' | 529 print 'Building final compiler' |
539 | 530 |
540 # Build LLVM gold plugin with LTO. That speeds up the linker by ~10%. | 531 # Build lld with LTO. That speeds up the linker by ~10%. |
541 # We only use LTO for Linux now. | 532 # We only use LTO for Linux now. |
542 if args.bootstrap and args.lto_gold_plugin: | 533 if args.bootstrap and args.lto_lld: |
543 print 'Building LTO LLVM Gold plugin' | 534 print 'Building LTO lld' |
544 if os.path.exists(LLVM_LTO_GOLD_PLUGIN_DIR): | 535 if os.path.exists(LLVM_LTO_LLD_DIR): |
545 RmTree(LLVM_LTO_GOLD_PLUGIN_DIR) | 536 RmTree(LLVM_LTO_LLD_DIR) |
546 EnsureDirExists(LLVM_LTO_GOLD_PLUGIN_DIR) | 537 EnsureDirExists(LLVM_LTO_LLD_DIR) |
547 os.chdir(LLVM_LTO_GOLD_PLUGIN_DIR) | 538 os.chdir(LLVM_LTO_LLD_DIR) |
548 | 539 |
549 # Create a symlink to LLVMgold.so build in the previous step so that ar | 540 ar = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-ar') |
550 # and ranlib could find it while linking LLVMgold.so with LTO. | 541 ranlib = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-ranlib') |
551 EnsureDirExists(BFD_PLUGINS_DIR) | |
552 RunCommand(['ln', '-sf', | |
553 os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'lib', 'LLVMgold.so'), | |
554 os.path.join(BFD_PLUGINS_DIR, 'LLVMgold.so')]) | |
555 | 542 |
556 # Link against binutils's copy of tcmalloc to speed up the linker by ~10%. | |
557 # In package.py we copy the .so into our package. | |
558 tcmalloc_ldflags = ['-L' + BINUTILS_LIB_DIR, '-ltcmalloc_minimal'] | |
559 # Make sure that tblgen and the test suite can find tcmalloc. | |
560 os.environ['LD_LIBRARY_PATH'] = \ | |
561 BINUTILS_LIB_DIR + os.pathsep + os.environ.get('LD_LIBRARY_PATH', '') | |
562 | |
563 lto_cflags = ['-flto=thin'] | |
564 lto_ldflags = ['-fuse-ld=lld'] | |
565 if args.gcc_toolchain: | |
566 # Tell the bootstrap compiler to use a specific gcc prefix to search | |
567 # for standard library headers and shared object files. | |
568 lto_cflags += ['--gcc-toolchain=' + args.gcc_toolchain] | |
569 lto_cmake_args = base_cmake_args + [ | 543 lto_cmake_args = base_cmake_args + [ |
570 '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir, | |
571 '-DCMAKE_C_COMPILER=' + cc, | 544 '-DCMAKE_C_COMPILER=' + cc, |
572 '-DCMAKE_CXX_COMPILER=' + cxx, | 545 '-DCMAKE_CXX_COMPILER=' + cxx, |
573 '-DCMAKE_C_FLAGS=' + ' '.join(lto_cflags), | 546 '-DCMAKE_AR=' + ar, |
574 '-DCMAKE_CXX_FLAGS=' + ' '.join(lto_cflags), | 547 '-DCMAKE_RANLIB=' + ranlib, |
Nico
2017/06/28 15:06:59
Why is this needed now when it wasn't previously?
pcc1
2017/06/28 17:46:46
The archiver needs to create symbol tables for arc
| |
575 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(lto_ldflags + tcmalloc_ldflags), | 548 '-DLLVM_ENABLE_LTO=thin', |
576 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(lto_ldflags), | 549 '-DLLVM_USE_LINKER=lld', |
577 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(lto_ldflags)] | 550 '-DCMAKE_C_FLAGS=' + ' '.join(cflags), |
578 | 551 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags)] |
579 # We need to use the proper binutils which support LLVM Gold plugin. | |
580 lto_env = os.environ.copy() | |
581 lto_env['PATH'] = BINUTILS_BIN_DIR + os.pathsep + lto_env.get('PATH', '') | |
582 | 552 |
583 RmCmakeCache('.') | 553 RmCmakeCache('.') |
584 RunCommand(['cmake'] + lto_cmake_args + [LLVM_DIR], env=lto_env) | 554 RunCommand(['cmake'] + lto_cmake_args + [LLVM_DIR]) |
585 RunCommand(['ninja', 'LLVMgold', 'lld'], env=lto_env) | 555 RunCommand(['ninja', 'lld']) |
586 | 556 |
587 | 557 |
588 # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is | 558 # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is |
589 # needed, on OS X it requires libc++. clang only automatically links to libc++ | 559 # needed, on OS X it requires libc++. clang only automatically links to libc++ |
590 # when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run | 560 # when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run |
591 # on OS X versions as old as 10.7. | 561 # on OS X versions as old as 10.7. |
592 deployment_target = '' | 562 deployment_target = '' |
593 | 563 |
594 if sys.platform == 'darwin' and args.bootstrap: | 564 if sys.platform == 'darwin' and args.bootstrap: |
595 # When building on 10.9, /usr/include usually doesn't exist, and while | 565 # When building on 10.9, /usr/include usually doesn't exist, and while |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
629 cmake_args = [] | 599 cmake_args = [] |
630 # TODO(thakis): Unconditionally append this to base_cmake_args instead once | 600 # TODO(thakis): Unconditionally append this to base_cmake_args instead once |
631 # compiler-rt can build with clang-cl on Windows (http://llvm.org/PR23698) | 601 # compiler-rt can build with clang-cl on Windows (http://llvm.org/PR23698) |
632 cc_args = base_cmake_args if sys.platform != 'win32' else cmake_args | 602 cc_args = base_cmake_args if sys.platform != 'win32' else cmake_args |
633 if cc is not None: cc_args.append('-DCMAKE_C_COMPILER=' + cc) | 603 if cc is not None: cc_args.append('-DCMAKE_C_COMPILER=' + cc) |
634 if cxx is not None: cc_args.append('-DCMAKE_CXX_COMPILER=' + cxx) | 604 if cxx is not None: cc_args.append('-DCMAKE_CXX_COMPILER=' + cxx) |
635 default_tools = ['plugins', 'blink_gc_plugin', 'translation_unit'] | 605 default_tools = ['plugins', 'blink_gc_plugin', 'translation_unit'] |
636 chrome_tools = list(set(default_tools + args.extra_tools)) | 606 chrome_tools = list(set(default_tools + args.extra_tools)) |
637 cmake_args += base_cmake_args + [ | 607 cmake_args += base_cmake_args + [ |
638 '-DLLVM_ENABLE_THREADS=OFF', | 608 '-DLLVM_ENABLE_THREADS=OFF', |
639 '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir, | |
640 '-DCMAKE_C_FLAGS=' + ' '.join(cflags), | 609 '-DCMAKE_C_FLAGS=' + ' '.join(cflags), |
641 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags), | 610 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags), |
642 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(ldflags), | 611 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(ldflags), |
643 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(ldflags), | 612 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(ldflags), |
644 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(ldflags), | 613 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(ldflags), |
645 '-DCMAKE_INSTALL_PREFIX=' + LLVM_BUILD_DIR, | 614 '-DCMAKE_INSTALL_PREFIX=' + LLVM_BUILD_DIR, |
646 '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'), | 615 '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'), |
647 '-DCHROMIUM_TOOLS=%s' % ';'.join(chrome_tools)] | 616 '-DCHROMIUM_TOOLS=%s' % ';'.join(chrome_tools)] |
648 | 617 |
649 EnsureDirExists(LLVM_BUILD_DIR) | 618 EnsureDirExists(LLVM_BUILD_DIR) |
650 os.chdir(LLVM_BUILD_DIR) | 619 os.chdir(LLVM_BUILD_DIR) |
651 RmCmakeCache('.') | 620 RmCmakeCache('.') |
652 RunCommand(['cmake'] + cmake_args + [LLVM_DIR], | 621 RunCommand(['cmake'] + cmake_args + [LLVM_DIR], |
653 msvc_arch='x64', env=deployment_env) | 622 msvc_arch='x64', env=deployment_env) |
654 | 623 |
655 if args.gcc_toolchain: | 624 if args.gcc_toolchain: |
656 # Copy in the right stdlibc++.so.6 so clang can start. | 625 # Copy in the right stdlibc++.so.6 so clang can start. |
657 if not os.path.exists(os.path.join(LLVM_BUILD_DIR, 'lib')): | 626 if not os.path.exists(os.path.join(LLVM_BUILD_DIR, 'lib')): |
658 os.mkdir(os.path.join(LLVM_BUILD_DIR, 'lib')) | 627 os.mkdir(os.path.join(LLVM_BUILD_DIR, 'lib')) |
659 libstdcpp = subprocess.check_output( | 628 libstdcpp = subprocess.check_output( |
660 [cxx] + cxxflags + ['-print-file-name=libstdc++.so.6']).rstrip() | 629 [cxx] + cxxflags + ['-print-file-name=libstdc++.so.6']).rstrip() |
661 CopyFile(libstdcpp, os.path.join(LLVM_BUILD_DIR, 'lib')) | 630 CopyFile(libstdcpp, os.path.join(LLVM_BUILD_DIR, 'lib')) |
662 | 631 |
663 RunCommand(['ninja'], msvc_arch='x64') | 632 RunCommand(['ninja'], msvc_arch='x64') |
664 | 633 |
665 # Copy LTO-optimized lld, if any. | 634 # Copy LTO-optimized lld, if any. |
666 if args.bootstrap and args.lto_gold_plugin: | 635 if args.bootstrap and args.lto_lld: |
667 CopyFile(os.path.join(LLVM_LTO_GOLD_PLUGIN_DIR, 'bin', 'lld'), | 636 CopyFile(os.path.join(LLVM_LTO_LLD_DIR, 'bin', 'lld'), |
668 os.path.join(LLVM_BUILD_DIR, 'bin')) | 637 os.path.join(LLVM_BUILD_DIR, 'bin')) |
669 | 638 |
670 if chrome_tools: | 639 if chrome_tools: |
671 # If any Chromium tools were built, install those now. | 640 # If any Chromium tools were built, install those now. |
672 RunCommand(['ninja', 'cr-install'], msvc_arch='x64') | 641 RunCommand(['ninja', 'cr-install'], msvc_arch='x64') |
673 | 642 |
674 if sys.platform == 'darwin': | 643 if sys.platform == 'darwin': |
675 # See http://crbug.com/256342 | 644 # See http://crbug.com/256342 |
676 RunCommand(['strip', '-x', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')]) | 645 RunCommand(['strip', '-x', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')]) |
677 elif sys.platform.startswith('linux'): | 646 elif sys.platform.startswith('linux'): |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
834 parser = argparse.ArgumentParser(description='Build Clang.') | 803 parser = argparse.ArgumentParser(description='Build Clang.') |
835 parser.add_argument('--bootstrap', action='store_true', | 804 parser.add_argument('--bootstrap', action='store_true', |
836 help='first build clang with CC, then with itself.') | 805 help='first build clang with CC, then with itself.') |
837 parser.add_argument('--if-needed', action='store_true', | 806 parser.add_argument('--if-needed', action='store_true', |
838 help="run only if the script thinks clang is needed") | 807 help="run only if the script thinks clang is needed") |
839 parser.add_argument('--force-local-build', action='store_true', | 808 parser.add_argument('--force-local-build', action='store_true', |
840 help="don't try to download prebuild binaries") | 809 help="don't try to download prebuild binaries") |
841 parser.add_argument('--gcc-toolchain', help='set the version for which gcc ' | 810 parser.add_argument('--gcc-toolchain', help='set the version for which gcc ' |
842 'version be used for building; --gcc-toolchain=/opt/foo ' | 811 'version be used for building; --gcc-toolchain=/opt/foo ' |
843 'picks /opt/foo/bin/gcc') | 812 'picks /opt/foo/bin/gcc') |
844 parser.add_argument('--lto-gold-plugin', action='store_true', | 813 parser.add_argument('--lto-lld', action='store_true', |
845 help='build LLVM Gold plugin with LTO') | 814 help='build lld with LTO') |
846 parser.add_argument('--llvm-force-head-revision', action='store_true', | 815 parser.add_argument('--llvm-force-head-revision', action='store_true', |
847 help=('use the revision in the repo when printing ' | 816 help=('use the revision in the repo when printing ' |
848 'the revision')) | 817 'the revision')) |
849 parser.add_argument('--print-revision', action='store_true', | 818 parser.add_argument('--print-revision', action='store_true', |
850 help='print current clang revision and exit.') | 819 help='print current clang revision and exit.') |
851 parser.add_argument('--print-clang-version', action='store_true', | 820 parser.add_argument('--print-clang-version', action='store_true', |
852 help='print current clang version (e.g. x.y.z) and exit.') | 821 help='print current clang version (e.g. x.y.z) and exit.') |
853 parser.add_argument('--run-tests', action='store_true', | 822 parser.add_argument('--run-tests', action='store_true', |
854 help='run tests after building; only for local builds') | 823 help='run tests after building; only for local builds') |
855 parser.add_argument('--extra-tools', nargs='*', default=[], | 824 parser.add_argument('--extra-tools', nargs='*', default=[], |
856 help='select additional chrome tools to build') | 825 help='select additional chrome tools to build') |
857 parser.add_argument('--without-android', action='store_false', | 826 parser.add_argument('--without-android', action='store_false', |
858 help='don\'t build Android ASan runtime (linux only)', | 827 help='don\'t build Android ASan runtime (linux only)', |
859 dest='with_android', | 828 dest='with_android', |
860 default=sys.platform.startswith('linux')) | 829 default=sys.platform.startswith('linux')) |
861 args = parser.parse_args() | 830 args = parser.parse_args() |
862 | 831 |
863 if args.lto_gold_plugin and not args.bootstrap: | 832 if args.lto_lld and not args.bootstrap: |
864 print '--lto-gold-plugin requires --bootstrap' | 833 print '--lto-lld requires --bootstrap' |
865 return 1 | 834 return 1 |
866 if args.lto_gold_plugin and not sys.platform.startswith('linux'): | 835 if args.lto_lld and not sys.platform.startswith('linux'): |
867 print '--lto-gold-plugin is only effective on Linux. Ignoring the option.' | 836 print '--lto-lld is only effective on Linux. Ignoring the option.' |
868 args.lto_gold_plugin = False | 837 args.lto_lld = False |
869 | 838 |
870 if args.if_needed: | 839 if args.if_needed: |
871 # TODO(thakis): Can probably remove this and --if-needed altogether. | 840 # TODO(thakis): Can probably remove this and --if-needed altogether. |
872 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): | 841 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): |
873 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' | 842 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' |
874 return 0 | 843 return 0 |
875 | 844 |
876 # Get svn if we're going to use it to check the revision or do a local build. | 845 # Get svn if we're going to use it to check the revision or do a local build. |
877 if (use_head_revision or args.llvm_force_head_revision or | 846 if (use_head_revision or args.llvm_force_head_revision or |
878 args.force_local_build): | 847 args.force_local_build): |
(...skipping 25 matching lines...) Expand all Loading... | |
904 args.force_local_build = True | 873 args.force_local_build = True |
905 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): | 874 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): |
906 # Only build the Android ASan rt on ToT bots when targetting Android. | 875 # Only build the Android ASan rt on ToT bots when targetting Android. |
907 args.with_android = False | 876 args.with_android = False |
908 | 877 |
909 return UpdateClang(args) | 878 return UpdateClang(args) |
910 | 879 |
911 | 880 |
912 if __name__ == '__main__': | 881 if __name__ == '__main__': |
913 sys.exit(main()) | 882 sys.exit(main()) |
OLD | NEW |