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