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

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

Issue 2963693002: Stop building the gold plugin and linking lld against tcmalloc. (Closed)
Patch Set: Add comment Created 3 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 = '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
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
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
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 # The linker expects all archive members to have symbol tables, so the
550 # and ranlib could find it while linking LLVMgold.so with LTO. 541 # archiver needs to be able to create symbol tables for bitcode files.
551 EnsureDirExists(BFD_PLUGINS_DIR) 542 # GNU ar and ranlib don't understand bitcode files, but llvm-ar and
552 RunCommand(['ln', '-sf', 543 # llvm-ranlib do, so use them.
553 os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'lib', 'LLVMgold.so'), 544 ar = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-ar')
554 os.path.join(BFD_PLUGINS_DIR, 'LLVMgold.so')]) 545 ranlib = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'llvm-ranlib')
555 546
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 + [ 547 lto_cmake_args = base_cmake_args + [
570 '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir,
571 '-DCMAKE_C_COMPILER=' + cc, 548 '-DCMAKE_C_COMPILER=' + cc,
572 '-DCMAKE_CXX_COMPILER=' + cxx, 549 '-DCMAKE_CXX_COMPILER=' + cxx,
573 '-DCMAKE_C_FLAGS=' + ' '.join(lto_cflags), 550 '-DCMAKE_AR=' + ar,
574 '-DCMAKE_CXX_FLAGS=' + ' '.join(lto_cflags), 551 '-DCMAKE_RANLIB=' + ranlib,
575 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(lto_ldflags + tcmalloc_ldflags), 552 '-DLLVM_ENABLE_LTO=thin',
576 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(lto_ldflags), 553 '-DLLVM_USE_LINKER=lld',
577 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(lto_ldflags)] 554 '-DCMAKE_C_FLAGS=' + ' '.join(cflags),
578 555 '-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 556
583 RmCmakeCache('.') 557 RmCmakeCache('.')
584 RunCommand(['cmake'] + lto_cmake_args + [LLVM_DIR], env=lto_env) 558 RunCommand(['cmake'] + lto_cmake_args + [LLVM_DIR])
585 RunCommand(['ninja', 'LLVMgold', 'lld'], env=lto_env) 559 RunCommand(['ninja', 'lld'])
586 560
587 561
588 # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is 562 # 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++ 563 # 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 564 # 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. 565 # on OS X versions as old as 10.7.
592 deployment_target = '' 566 deployment_target = ''
593 567
594 if sys.platform == 'darwin' and args.bootstrap: 568 if sys.platform == 'darwin' and args.bootstrap:
595 # When building on 10.9, /usr/include usually doesn't exist, and while 569 # 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
629 cmake_args = [] 603 cmake_args = []
630 # TODO(thakis): Unconditionally append this to base_cmake_args instead once 604 # 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) 605 # 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 606 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) 607 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) 608 if cxx is not None: cc_args.append('-DCMAKE_CXX_COMPILER=' + cxx)
635 default_tools = ['plugins', 'blink_gc_plugin', 'translation_unit'] 609 default_tools = ['plugins', 'blink_gc_plugin', 'translation_unit']
636 chrome_tools = list(set(default_tools + args.extra_tools)) 610 chrome_tools = list(set(default_tools + args.extra_tools))
637 cmake_args += base_cmake_args + [ 611 cmake_args += base_cmake_args + [
638 '-DLLVM_ENABLE_THREADS=OFF', 612 '-DLLVM_ENABLE_THREADS=OFF',
639 '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir,
640 '-DCMAKE_C_FLAGS=' + ' '.join(cflags), 613 '-DCMAKE_C_FLAGS=' + ' '.join(cflags),
641 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags), 614 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags),
642 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(ldflags), 615 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(ldflags),
643 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(ldflags), 616 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(ldflags),
644 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(ldflags), 617 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(ldflags),
645 '-DCMAKE_INSTALL_PREFIX=' + LLVM_BUILD_DIR, 618 '-DCMAKE_INSTALL_PREFIX=' + LLVM_BUILD_DIR,
646 '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'), 619 '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'),
647 '-DCHROMIUM_TOOLS=%s' % ';'.join(chrome_tools)] 620 '-DCHROMIUM_TOOLS=%s' % ';'.join(chrome_tools)]
648 621
649 EnsureDirExists(LLVM_BUILD_DIR) 622 EnsureDirExists(LLVM_BUILD_DIR)
650 os.chdir(LLVM_BUILD_DIR) 623 os.chdir(LLVM_BUILD_DIR)
651 RmCmakeCache('.') 624 RmCmakeCache('.')
652 RunCommand(['cmake'] + cmake_args + [LLVM_DIR], 625 RunCommand(['cmake'] + cmake_args + [LLVM_DIR],
653 msvc_arch='x64', env=deployment_env) 626 msvc_arch='x64', env=deployment_env)
654 627
655 if args.gcc_toolchain: 628 if args.gcc_toolchain:
656 # Copy in the right stdlibc++.so.6 so clang can start. 629 # Copy in the right stdlibc++.so.6 so clang can start.
657 if not os.path.exists(os.path.join(LLVM_BUILD_DIR, 'lib')): 630 if not os.path.exists(os.path.join(LLVM_BUILD_DIR, 'lib')):
658 os.mkdir(os.path.join(LLVM_BUILD_DIR, 'lib')) 631 os.mkdir(os.path.join(LLVM_BUILD_DIR, 'lib'))
659 libstdcpp = subprocess.check_output( 632 libstdcpp = subprocess.check_output(
660 [cxx] + cxxflags + ['-print-file-name=libstdc++.so.6']).rstrip() 633 [cxx] + cxxflags + ['-print-file-name=libstdc++.so.6']).rstrip()
661 CopyFile(libstdcpp, os.path.join(LLVM_BUILD_DIR, 'lib')) 634 CopyFile(libstdcpp, os.path.join(LLVM_BUILD_DIR, 'lib'))
662 635
663 RunCommand(['ninja'], msvc_arch='x64') 636 RunCommand(['ninja'], msvc_arch='x64')
664 637
665 # Copy LTO-optimized lld, if any. 638 # Copy LTO-optimized lld, if any.
666 if args.bootstrap and args.lto_gold_plugin: 639 if args.bootstrap and args.lto_lld:
667 CopyFile(os.path.join(LLVM_LTO_GOLD_PLUGIN_DIR, 'bin', 'lld'), 640 CopyFile(os.path.join(LLVM_LTO_LLD_DIR, 'bin', 'lld'),
668 os.path.join(LLVM_BUILD_DIR, 'bin')) 641 os.path.join(LLVM_BUILD_DIR, 'bin'))
669 642
670 if chrome_tools: 643 if chrome_tools:
671 # If any Chromium tools were built, install those now. 644 # If any Chromium tools were built, install those now.
672 RunCommand(['ninja', 'cr-install'], msvc_arch='x64') 645 RunCommand(['ninja', 'cr-install'], msvc_arch='x64')
673 646
674 if sys.platform == 'darwin': 647 if sys.platform == 'darwin':
675 # See http://crbug.com/256342 648 # See http://crbug.com/256342
676 RunCommand(['strip', '-x', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')]) 649 RunCommand(['strip', '-x', os.path.join(LLVM_BUILD_DIR, 'bin', 'clang')])
677 elif sys.platform.startswith('linux'): 650 elif sys.platform.startswith('linux'):
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 parser = argparse.ArgumentParser(description='Build Clang.') 807 parser = argparse.ArgumentParser(description='Build Clang.')
835 parser.add_argument('--bootstrap', action='store_true', 808 parser.add_argument('--bootstrap', action='store_true',
836 help='first build clang with CC, then with itself.') 809 help='first build clang with CC, then with itself.')
837 parser.add_argument('--if-needed', action='store_true', 810 parser.add_argument('--if-needed', action='store_true',
838 help="run only if the script thinks clang is needed") 811 help="run only if the script thinks clang is needed")
839 parser.add_argument('--force-local-build', action='store_true', 812 parser.add_argument('--force-local-build', action='store_true',
840 help="don't try to download prebuild binaries") 813 help="don't try to download prebuild binaries")
841 parser.add_argument('--gcc-toolchain', help='set the version for which gcc ' 814 parser.add_argument('--gcc-toolchain', help='set the version for which gcc '
842 'version be used for building; --gcc-toolchain=/opt/foo ' 815 'version be used for building; --gcc-toolchain=/opt/foo '
843 'picks /opt/foo/bin/gcc') 816 'picks /opt/foo/bin/gcc')
844 parser.add_argument('--lto-gold-plugin', action='store_true', 817 parser.add_argument('--lto-lld', action='store_true',
845 help='build LLVM Gold plugin with LTO') 818 help='build lld with LTO')
846 parser.add_argument('--llvm-force-head-revision', action='store_true', 819 parser.add_argument('--llvm-force-head-revision', action='store_true',
847 help=('use the revision in the repo when printing ' 820 help=('use the revision in the repo when printing '
848 'the revision')) 821 'the revision'))
849 parser.add_argument('--print-revision', action='store_true', 822 parser.add_argument('--print-revision', action='store_true',
850 help='print current clang revision and exit.') 823 help='print current clang revision and exit.')
851 parser.add_argument('--print-clang-version', action='store_true', 824 parser.add_argument('--print-clang-version', action='store_true',
852 help='print current clang version (e.g. x.y.z) and exit.') 825 help='print current clang version (e.g. x.y.z) and exit.')
853 parser.add_argument('--run-tests', action='store_true', 826 parser.add_argument('--run-tests', action='store_true',
854 help='run tests after building; only for local builds') 827 help='run tests after building; only for local builds')
855 parser.add_argument('--extra-tools', nargs='*', default=[], 828 parser.add_argument('--extra-tools', nargs='*', default=[],
856 help='select additional chrome tools to build') 829 help='select additional chrome tools to build')
857 parser.add_argument('--without-android', action='store_false', 830 parser.add_argument('--without-android', action='store_false',
858 help='don\'t build Android ASan runtime (linux only)', 831 help='don\'t build Android ASan runtime (linux only)',
859 dest='with_android', 832 dest='with_android',
860 default=sys.platform.startswith('linux')) 833 default=sys.platform.startswith('linux'))
861 args = parser.parse_args() 834 args = parser.parse_args()
862 835
863 if args.lto_gold_plugin and not args.bootstrap: 836 if args.lto_lld and not args.bootstrap:
864 print '--lto-gold-plugin requires --bootstrap' 837 print '--lto-lld requires --bootstrap'
865 return 1 838 return 1
866 if args.lto_gold_plugin and not sys.platform.startswith('linux'): 839 if args.lto_lld and not sys.platform.startswith('linux'):
867 print '--lto-gold-plugin is only effective on Linux. Ignoring the option.' 840 print '--lto-lld is only effective on Linux. Ignoring the option.'
868 args.lto_gold_plugin = False 841 args.lto_lld = False
869 842
870 if args.if_needed: 843 if args.if_needed:
871 # TODO(thakis): Can probably remove this and --if-needed altogether. 844 # TODO(thakis): Can probably remove this and --if-needed altogether.
872 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): 845 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).' 846 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).'
874 return 0 847 return 0
875 848
876 # Get svn if we're going to use it to check the revision or do a local build. 849 # 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 850 if (use_head_revision or args.llvm_force_head_revision or
878 args.force_local_build): 851 args.force_local_build):
(...skipping 25 matching lines...) Expand all
904 args.force_local_build = True 877 args.force_local_build = True
905 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): 878 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''):
906 # Only build the Android ASan rt on ToT bots when targetting Android. 879 # Only build the Android ASan rt on ToT bots when targetting Android.
907 args.with_android = False 880 args.with_android = False
908 881
909 return UpdateClang(args) 882 return UpdateClang(args)
910 883
911 884
912 if __name__ == '__main__': 885 if __name__ == '__main__':
913 sys.exit(main()) 886 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