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

Side by Side Diff: tools/clang/scripts/update.py

Issue 2166823003: Roll clang 274369:274369. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « tools/clang/scripts/package.py ('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 # 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
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 = '274369' 30 CLANG_REVISION = '274369'
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=5
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,
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 return 1 430 return 1
431 431
432 DownloadHostGcc(args) 432 DownloadHostGcc(args)
433 AddCMakeToPath() 433 AddCMakeToPath()
434 AddGnuWinToPath() 434 AddGnuWinToPath()
435 435
436 DeleteChromeToolsShim() 436 DeleteChromeToolsShim()
437 437
438 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR) 438 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR)
439 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR) 439 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR)
440 if sys.platform == 'win32' or use_head_revision: 440 if (sys.platform == 'win32' or sys.platform.startswith('linux')
441 or use_head_revision):
441 Checkout('LLD', LLVM_REPO_URL + '/lld/trunk', LLD_DIR) 442 Checkout('LLD', LLVM_REPO_URL + '/lld/trunk', LLD_DIR)
442 Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR) 443 Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR)
443 if sys.platform == 'darwin': 444 if sys.platform == 'darwin':
444 # clang needs a libc++ checkout, else -stdlib=libc++ won't find includes 445 # clang needs a libc++ checkout, else -stdlib=libc++ won't find includes
445 # (i.e. this is needed for bootstrap builds). 446 # (i.e. this is needed for bootstrap builds).
446 Checkout('libcxx', LLVM_REPO_URL + '/libcxx/trunk', LIBCXX_DIR) 447 Checkout('libcxx', LLVM_REPO_URL + '/libcxx/trunk', LIBCXX_DIR)
447 # We used to check out libcxxabi on OS X; we no longer need that. 448 # We used to check out libcxxabi on OS X; we no longer need that.
448 if os.path.exists(LIBCXXABI_DIR): 449 if os.path.exists(LIBCXXABI_DIR):
449 RmTree(LIBCXXABI_DIR) 450 RmTree(LIBCXXABI_DIR)
450 451
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 523
523 if args.gcc_toolchain: 524 if args.gcc_toolchain:
524 # 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
525 # for standard library headers and shared object files. 526 # for standard library headers and shared object files.
526 cflags = ['--gcc-toolchain=' + args.gcc_toolchain] 527 cflags = ['--gcc-toolchain=' + args.gcc_toolchain]
527 cxxflags = ['--gcc-toolchain=' + args.gcc_toolchain] 528 cxxflags = ['--gcc-toolchain=' + args.gcc_toolchain]
528 print 'Building final compiler' 529 print 'Building final compiler'
529 530
530 # Build LLVM gold plugin with LTO. That speeds up the linker by ~10%. 531 # Build LLVM gold plugin with LTO. That speeds up the linker by ~10%.
531 # We only use LTO for Linux now. 532 # We only use LTO for Linux now.
532 if args.bootstrap and args.lto_gold_plugin: 533 if args.bootstrap and args.lto:
533 print 'Building LTO LLVM Gold plugin' 534 print 'Building LTO LLVM Gold plugin'
534 if os.path.exists(LLVM_LTO_GOLD_PLUGIN_DIR): 535 if os.path.exists(LLVM_LTO_GOLD_PLUGIN_DIR):
535 RmTree(LLVM_LTO_GOLD_PLUGIN_DIR) 536 RmTree(LLVM_LTO_GOLD_PLUGIN_DIR)
536 EnsureDirExists(LLVM_LTO_GOLD_PLUGIN_DIR) 537 EnsureDirExists(LLVM_LTO_GOLD_PLUGIN_DIR)
537 os.chdir(LLVM_LTO_GOLD_PLUGIN_DIR) 538 os.chdir(LLVM_LTO_GOLD_PLUGIN_DIR)
538 539
539 # Create a symlink to LLVMgold.so build in the previous step so that ar
540 # and ranlib could find it while linking LLVMgold.so with LTO.
541 EnsureDirExists(BFD_PLUGINS_DIR)
542 RunCommand(['ln', '-sf',
543 os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'lib', 'LLVMgold.so'),
544 os.path.join(BFD_PLUGINS_DIR, 'LLVMgold.so')])
545
546 lto_cflags = ['-flto'] 540 lto_cflags = ['-flto']
547 lto_ldflags = ['-fuse-ld=gold'] 541 lto_cxxflags = ['-flto']
542 lto_ldflags = ['-fuse-ld=lld']
548 if args.gcc_toolchain: 543 if args.gcc_toolchain:
549 # Tell the bootstrap compiler to use a specific gcc prefix to search 544 # Tell the bootstrap compiler to use a specific gcc prefix to search
550 # for standard library headers and shared object files. 545 # for standard library headers and shared object files.
551 lto_cflags += ['--gcc-toolchain=' + args.gcc_toolchain] 546 lto_cflags += ['--gcc-toolchain=' + args.gcc_toolchain]
552 lto_cmake_args = base_cmake_args + [ 547 lto_cmake_args = base_cmake_args + [
553 '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir, 548 '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir,
554 '-DCMAKE_C_COMPILER=' + cc, 549 '-DCMAKE_C_COMPILER=' + cc,
555 '-DCMAKE_CXX_COMPILER=' + cxx, 550 '-DCMAKE_CXX_COMPILER=' + cxx,
556 '-DCMAKE_C_FLAGS=' + ' '.join(lto_cflags), 551 '-DCMAKE_C_FLAGS=' + ' '.join(lto_cflags),
557 '-DCMAKE_CXX_FLAGS=' + ' '.join(lto_cflags), 552 '-DCMAKE_CXX_FLAGS=' + ' '.join(lto_cxxflags),
558 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(lto_ldflags), 553 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(lto_ldflags),
559 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(lto_ldflags), 554 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(lto_ldflags),
560 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(lto_ldflags)] 555 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(lto_ldflags)]
561 556
562 # We need to use the proper binutils which support LLVM Gold plugin. 557 # We need to use the proper binutils which support LTO.
563 lto_env = os.environ.copy() 558 lto_env = os.environ.copy()
564 lto_env['PATH'] = BINUTILS_BIN_DIR + os.pathsep + lto_env.get('PATH', '') 559 lto_env['PATH'] = BINUTILS_BIN_DIR + os.pathsep + lto_env.get('PATH', '')
565
566 RmCmakeCache('.') 560 RmCmakeCache('.')
567 RunCommand(['cmake'] + lto_cmake_args + [LLVM_DIR], env=lto_env) 561 RunCommand(['cmake'] + lto_cmake_args + [LLVM_DIR], env=lto_env)
568 RunCommand(['ninja', 'LLVMgold'], env=lto_env) 562 RunCommand(['ninja', 'LLVMgold'], env=lto_env)
569 563
570 564
571 # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is 565 # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is
572 # needed, on OS X it requires libc++. clang only automatically links to libc++ 566 # needed, on OS X it requires libc++. clang only automatically links to libc++
573 # when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run 567 # when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run
574 # on OS X versions as old as 10.7. 568 # on OS X versions as old as 10.7.
575 deployment_target = '' 569 deployment_target = ''
(...skipping 14 matching lines...) Expand all
590 # Build clang. 584 # Build clang.
591 585
592 # If building at head, define a macro that plugins can use for #ifdefing 586 # If building at head, define a macro that plugins can use for #ifdefing
593 # out code that builds at head, but not at CLANG_REVISION or vice versa. 587 # out code that builds at head, but not at CLANG_REVISION or vice versa.
594 if use_head_revision: 588 if use_head_revision:
595 cflags += ['-DLLVM_FORCE_HEAD_REVISION'] 589 cflags += ['-DLLVM_FORCE_HEAD_REVISION']
596 cxxflags += ['-DLLVM_FORCE_HEAD_REVISION'] 590 cxxflags += ['-DLLVM_FORCE_HEAD_REVISION']
597 591
598 CreateChromeToolsShim() 592 CreateChromeToolsShim()
599 593
600 deployment_env = None 594 llvm_build_cflags = cflags
595 llvm_build_cxxflags = cxxflags
596 llvm_build_ldflags = ldflags
597 llvm_build_env = None
598 if sys.platform != 'win32':
599 # On Windows, the line below might add some Unicode entries
600 # and that will fail if passed into popen. See
601 # http://stackoverflow.com/questions/12253014/why-does-popen-fail-on-windows -if-the-env-parameter-contains-a-unicode-object
602 # Since we don't need to add anything into environment on Windows,
603 # just workaround this, until we moved into Python 3, where it's
604 # supposedly fixed.
605 llvm_build_env = os.environ.copy()
601 if deployment_target: 606 if deployment_target:
602 deployment_env = os.environ.copy() 607 llvm_build_env['MACOSX_DEPLOYMENT_TARGET'] = deployment_target
603 deployment_env['MACOSX_DEPLOYMENT_TARGET'] = deployment_target 608 if args.lto:
609 # Put proper binutils for building with LTO
610 llvm_build_env['PATH'] = (BINUTILS_BIN_DIR + os.pathsep +
611 llvm_build_env.get('PATH', ''))
612 llvm_build_cflags += ['-flto']
613 llvm_build_cxxflags += ['-flto']
614 llvm_build_ldflags += ['-fuse-ld=lld']
604 615
605 cmake_args = [] 616 cmake_args = []
606 # TODO(thakis): Unconditionally append this to base_cmake_args instead once 617 # TODO(thakis): Unconditionally append this to base_cmake_args instead once
607 # compiler-rt can build with clang-cl on Windows (http://llvm.org/PR23698) 618 # compiler-rt can build with clang-cl on Windows (http://llvm.org/PR23698)
608 cc_args = base_cmake_args if sys.platform != 'win32' else cmake_args 619 cc_args = base_cmake_args if sys.platform != 'win32' else cmake_args
609 if cc is not None: cc_args.append('-DCMAKE_C_COMPILER=' + cc) 620 if cc is not None: cc_args.append('-DCMAKE_C_COMPILER=' + cc)
610 if cxx is not None: cc_args.append('-DCMAKE_CXX_COMPILER=' + cxx) 621 if cxx is not None: cc_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
611 cmake_args += base_cmake_args + [ 622 cmake_args += base_cmake_args + [
612 '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir, 623 '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir,
613 '-DCMAKE_C_FLAGS=' + ' '.join(cflags), 624 '-DCMAKE_C_FLAGS=' + ' '.join(llvm_build_cflags),
614 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags), 625 '-DCMAKE_CXX_FLAGS=' + ' '.join(llvm_build_cxxflags),
615 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(ldflags), 626 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(llvm_build_ldflags),
616 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(ldflags), 627 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(llvm_build_ldflags),
617 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(ldflags), 628 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(llvm_build_ldflags),
618 '-DCMAKE_INSTALL_PREFIX=' + LLVM_BUILD_DIR, 629 '-DCMAKE_INSTALL_PREFIX=' + LLVM_BUILD_DIR,
619 # TODO(thakis): Remove this once official builds pass -Wl,--build-id 630 # TODO(thakis): Remove this once official builds pass -Wl,--build-id
620 # explicitly, https://crbug.com/622775 631 # explicitly, https://crbug.com/622775
621 '-DENABLE_LINKER_BUILD_ID=ON', 632 '-DENABLE_LINKER_BUILD_ID=ON',
622 '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'), 633 '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'),
623 '-DCHROMIUM_TOOLS=%s' % ';'.join(args.tools)] 634 '-DCHROMIUM_TOOLS=%s' % ';'.join(args.tools)]
624 635
625 EnsureDirExists(LLVM_BUILD_DIR) 636 EnsureDirExists(LLVM_BUILD_DIR)
626 os.chdir(LLVM_BUILD_DIR) 637 os.chdir(LLVM_BUILD_DIR)
627 RmCmakeCache('.') 638 RmCmakeCache('.')
628 RunCommand(['cmake'] + cmake_args + [LLVM_DIR], 639 RunCommand(['cmake'] + cmake_args + [LLVM_DIR],
629 msvc_arch='x64', env=deployment_env) 640 msvc_arch='x64', env=llvm_build_env)
630 641
631 if args.gcc_toolchain: 642 if args.gcc_toolchain:
632 # Copy in the right stdlibc++.so.6 so clang can start. 643 # Copy in the right stdlibc++.so.6 so clang can start.
633 if not os.path.exists(os.path.join(LLVM_BUILD_DIR, 'lib')): 644 if not os.path.exists(os.path.join(LLVM_BUILD_DIR, 'lib')):
634 os.mkdir(os.path.join(LLVM_BUILD_DIR, 'lib')) 645 os.mkdir(os.path.join(LLVM_BUILD_DIR, 'lib'))
635 libstdcpp = subprocess.check_output( 646 libstdcpp = subprocess.check_output(
636 [cxx] + cxxflags + ['-print-file-name=libstdc++.so.6']).rstrip() 647 [cxx] + cxxflags + ['-print-file-name=libstdc++.so.6']).rstrip()
637 CopyFile(libstdcpp, os.path.join(LLVM_BUILD_DIR, 'lib')) 648 CopyFile(libstdcpp, os.path.join(LLVM_BUILD_DIR, 'lib'))
638 649
639 RunCommand(['ninja'], msvc_arch='x64') 650 RunCommand(['ninja'], msvc_arch='x64')
(...skipping 19 matching lines...) Expand all
659 RmTree(COMPILER_RT_BUILD_DIR) 670 RmTree(COMPILER_RT_BUILD_DIR)
660 os.makedirs(COMPILER_RT_BUILD_DIR) 671 os.makedirs(COMPILER_RT_BUILD_DIR)
661 os.chdir(COMPILER_RT_BUILD_DIR) 672 os.chdir(COMPILER_RT_BUILD_DIR)
662 # TODO(thakis): Add this once compiler-rt can build with clang-cl (see 673 # TODO(thakis): Add this once compiler-rt can build with clang-cl (see
663 # above). 674 # above).
664 #if args.bootstrap and sys.platform == 'win32': 675 #if args.bootstrap and sys.platform == 'win32':
665 # The bootstrap compiler produces 64-bit binaries by default. 676 # The bootstrap compiler produces 64-bit binaries by default.
666 #cflags += ['-m32'] 677 #cflags += ['-m32']
667 #cxxflags += ['-m32'] 678 #cxxflags += ['-m32']
668 compiler_rt_args = base_cmake_args + [ 679 compiler_rt_args = base_cmake_args + [
669 '-DCMAKE_C_FLAGS=' + ' '.join(cflags), 680 '-DCMAKE_C_FLAGS=' + ' '.join(llvm_build_cflags),
670 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags)] 681 '-DCMAKE_CXX_FLAGS=' + ' '.join(llvm_build_cxxflags)]
671 if sys.platform != 'win32': 682 if sys.platform != 'win32':
672 compiler_rt_args += ['-DLLVM_CONFIG_PATH=' + 683 compiler_rt_args += ['-DLLVM_CONFIG_PATH=' +
673 os.path.join(LLVM_BUILD_DIR, 'bin', 'llvm-config'), 684 os.path.join(LLVM_BUILD_DIR, 'bin', 'llvm-config'),
674 '-DSANITIZER_MIN_OSX_VERSION="10.7"'] 685 '-DSANITIZER_MIN_OSX_VERSION="10.7"']
675 # compiler-rt is part of the llvm checkout on Windows but a stand-alone 686 # compiler-rt is part of the llvm checkout on Windows but a stand-alone
676 # directory elsewhere, see the TODO above COMPILER_RT_DIR. 687 # directory elsewhere, see the TODO above COMPILER_RT_DIR.
677 RmCmakeCache('.') 688 RmCmakeCache('.')
678 RunCommand(['cmake'] + compiler_rt_args + 689 RunCommand(['cmake'] + compiler_rt_args +
679 [LLVM_DIR if sys.platform == 'win32' else COMPILER_RT_DIR], 690 [LLVM_DIR if sys.platform == 'win32' else COMPILER_RT_DIR],
680 msvc_arch='x86', env=deployment_env) 691 msvc_arch='x86', env=llvm_build_env)
681 RunCommand(['ninja', 'compiler-rt'], msvc_arch='x86') 692 RunCommand(['ninja', 'compiler-rt'], msvc_arch='x86')
682 693
683 # Copy select output to the main tree. 694 # Copy select output to the main tree.
684 # TODO(hans): Make this (and the .gypi and .isolate files) version number 695 # TODO(hans): Make this (and the .gypi and .isolate files) version number
685 # independent. 696 # independent.
686 if sys.platform == 'win32': 697 if sys.platform == 'win32':
687 platform = 'windows' 698 platform = 'windows'
688 elif sys.platform == 'darwin': 699 elif sys.platform == 'darwin':
689 platform = 'darwin' 700 platform = 'darwin'
690 else: 701 else:
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 parser = argparse.ArgumentParser(description='Build Clang.') 812 parser = argparse.ArgumentParser(description='Build Clang.')
802 parser.add_argument('--bootstrap', action='store_true', 813 parser.add_argument('--bootstrap', action='store_true',
803 help='first build clang with CC, then with itself.') 814 help='first build clang with CC, then with itself.')
804 parser.add_argument('--if-needed', action='store_true', 815 parser.add_argument('--if-needed', action='store_true',
805 help="run only if the script thinks clang is needed") 816 help="run only if the script thinks clang is needed")
806 parser.add_argument('--force-local-build', action='store_true', 817 parser.add_argument('--force-local-build', action='store_true',
807 help="don't try to download prebuild binaries") 818 help="don't try to download prebuild binaries")
808 parser.add_argument('--gcc-toolchain', help='set the version for which gcc ' 819 parser.add_argument('--gcc-toolchain', help='set the version for which gcc '
809 'version be used for building; --gcc-toolchain=/opt/foo ' 820 'version be used for building; --gcc-toolchain=/opt/foo '
810 'picks /opt/foo/bin/gcc') 821 'picks /opt/foo/bin/gcc')
811 parser.add_argument('--lto-gold-plugin', action='store_true', 822 parser.add_argument('--lto', action='store_true',
812 help='build LLVM Gold plugin with LTO') 823 help='build Clang toolchain with LTO')
813 parser.add_argument('--llvm-force-head-revision', action='store_true', 824 parser.add_argument('--llvm-force-head-revision', action='store_true',
814 help=('use the revision in the repo when printing ' 825 help=('use the revision in the repo when printing '
815 'the revision')) 826 'the revision'))
816 parser.add_argument('--print-revision', action='store_true', 827 parser.add_argument('--print-revision', action='store_true',
817 help='print current clang revision and exit.') 828 help='print current clang revision and exit.')
818 parser.add_argument('--print-clang-version', action='store_true', 829 parser.add_argument('--print-clang-version', action='store_true',
819 help='print current clang version (e.g. x.y.z) and exit.') 830 help='print current clang version (e.g. x.y.z) and exit.')
820 parser.add_argument('--run-tests', action='store_true', 831 parser.add_argument('--run-tests', action='store_true',
821 help='run tests after building; only for local builds') 832 help='run tests after building; only for local builds')
822 parser.add_argument('--tools', nargs='*', 833 parser.add_argument('--tools', nargs='*',
823 help='select which chrome tools to build', 834 help='select which chrome tools to build',
824 default=['plugins', 'blink_gc_plugin']) 835 default=['plugins', 'blink_gc_plugin'])
825 parser.add_argument('--without-android', action='store_false', 836 parser.add_argument('--without-android', action='store_false',
826 help='don\'t build Android ASan runtime (linux only)', 837 help='don\'t build Android ASan runtime (linux only)',
827 dest='with_android', 838 dest='with_android',
828 default=sys.platform.startswith('linux')) 839 default=sys.platform.startswith('linux'))
829 args = parser.parse_args() 840 args = parser.parse_args()
830 841
831 if args.lto_gold_plugin and not args.bootstrap: 842 if args.lto and not args.bootstrap:
832 print '--lto-gold-plugin requires --bootstrap' 843 print '--lto requires --bootstrap'
833 return 1 844 return 1
834 if args.lto_gold_plugin and not sys.platform.startswith('linux'): 845 if args.lto and not sys.platform.startswith('linux'):
835 print '--lto-gold-plugin is only effective on Linux. Ignoring the option.' 846 print '--lto is only effective on Linux. Ignoring the option.'
836 args.lto_gold_plugin = False 847 args.lto = False
837 848
838 if args.if_needed: 849 if args.if_needed:
839 is_clang_required = False 850 is_clang_required = False
840 # clang is always used on Mac and Linux. 851 # clang is always used on Mac and Linux.
841 if sys.platform == 'darwin' or sys.platform.startswith('linux'): 852 if sys.platform == 'darwin' or sys.platform.startswith('linux'):
842 is_clang_required = True 853 is_clang_required = True
843 # clang requested via $GYP_DEFINES. 854 # clang requested via $GYP_DEFINES.
844 if re.search(r'\b(clang|asan|lsan|msan|tsan)=1', 855 if re.search(r'\b(clang|asan|lsan|msan|tsan)=1',
845 os.environ.get('GYP_DEFINES', '')): 856 os.environ.get('GYP_DEFINES', '')):
846 is_clang_required = True 857 is_clang_required = True
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 args.force_local_build = True 891 args.force_local_build = True
881 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): 892 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''):
882 # Only build the Android ASan rt on ToT bots when targetting Android. 893 # Only build the Android ASan rt on ToT bots when targetting Android.
883 args.with_android = False 894 args.with_android = False
884 895
885 return UpdateClang(args) 896 return UpdateClang(args)
886 897
887 898
888 if __name__ == '__main__': 899 if __name__ == '__main__':
889 sys.exit(main()) 900 sys.exit(main())
OLDNEW
« no previous file with comments | « tools/clang/scripts/package.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698