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