| 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 print 'Invalid --gcc-toolchain: "%s"' % args.gcc_toolchain | 430 print 'Invalid --gcc-toolchain: "%s"' % args.gcc_toolchain |
| 431 print '"%s" does not appear to be valid.' % cc | 431 print '"%s" does not appear to be valid.' % cc |
| 432 return 1 | 432 return 1 |
| 433 | 433 |
| 434 # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap | 434 # Set LD_LIBRARY_PATH to make auxiliary targets (tablegen, bootstrap |
| 435 # compiler, etc.) find the .so. | 435 # compiler, etc.) find the .so. |
| 436 libstdcpp = subprocess.check_output( | 436 libstdcpp = subprocess.check_output( |
| 437 [cxx, '-print-file-name=libstdc++.so.6']).rstrip() | 437 [cxx, '-print-file-name=libstdc++.so.6']).rstrip() |
| 438 os.environ['LD_LIBRARY_PATH'] = os.path.dirname(libstdcpp) | 438 os.environ['LD_LIBRARY_PATH'] = os.path.dirname(libstdcpp) |
| 439 | 439 |
| 440 cflags = cxxflags = ldflags = [] | 440 cflags = [] |
| 441 cxxflags = [] |
| 442 ldflags = [] |
| 441 | 443 |
| 442 base_cmake_args = ['-GNinja', | 444 base_cmake_args = ['-GNinja', |
| 443 '-DCMAKE_BUILD_TYPE=Release', | 445 '-DCMAKE_BUILD_TYPE=Release', |
| 444 '-DLLVM_ENABLE_ASSERTIONS=ON', | 446 '-DLLVM_ENABLE_ASSERTIONS=ON', |
| 445 '-DLLVM_ENABLE_THREADS=OFF', | 447 '-DLLVM_ENABLE_THREADS=OFF', |
| 446 '-DLLVM_ENABLE_TIMESTAMPS=OFF', | 448 '-DLLVM_ENABLE_TIMESTAMPS=OFF', |
| 447 ] | 449 ] |
| 448 | 450 |
| 449 if args.bootstrap: | 451 if args.bootstrap: |
| 450 print 'Building bootstrap compiler' | 452 print 'Building bootstrap compiler' |
| (...skipping 18 matching lines...) Expand all Loading... |
| 469 # compiler can start. | 471 # compiler can start. |
| 470 CopyFile(libstdcpp, os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'lib')) | 472 CopyFile(libstdcpp, os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'lib')) |
| 471 | 473 |
| 472 if sys.platform == 'win32': | 474 if sys.platform == 'win32': |
| 473 cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe') | 475 cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe') |
| 474 cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe') | 476 cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe') |
| 475 # CMake has a hard time with backslashes in compiler paths: | 477 # CMake has a hard time with backslashes in compiler paths: |
| 476 # https://stackoverflow.com/questions/13050827 | 478 # https://stackoverflow.com/questions/13050827 |
| 477 cc = cc.replace('\\', '/') | 479 cc = cc.replace('\\', '/') |
| 478 cxx = cxx.replace('\\', '/') | 480 cxx = cxx.replace('\\', '/') |
| 481 # If we're using VS 2015, tell the stage 1 compiler to act like it. |
| 482 if GetVSVersion().ShortName().startswith('2015'): |
| 483 cflags += ['-fms-compatibility-version=19'] |
| 484 cxxflags += ['-fms-compatibility-version=19'] |
| 479 else: | 485 else: |
| 480 cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang') | 486 cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang') |
| 481 cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang++') | 487 cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang++') |
| 482 | 488 |
| 483 if args.gcc_toolchain: | 489 if args.gcc_toolchain: |
| 484 # Tell the bootstrap compiler to use a specific gcc prefix to search | 490 # Tell the bootstrap compiler to use a specific gcc prefix to search |
| 485 # for standard library headers and shared object files. | 491 # for standard library headers and shared object files. |
| 486 cflags = ['--gcc-toolchain=' + args.gcc_toolchain] | 492 cflags = ['--gcc-toolchain=' + args.gcc_toolchain] |
| 487 cxxflags = ['--gcc-toolchain=' + args.gcc_toolchain] | 493 cxxflags = ['--gcc-toolchain=' + args.gcc_toolchain] |
| 488 print 'Building final compiler' | 494 print 'Building final compiler' |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 787 args.force_local_build = True | 793 args.force_local_build = True |
| 788 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): | 794 if 'OS=android' not in os.environ.get('GYP_DEFINES', ''): |
| 789 # Only build the Android ASan rt on ToT bots when targetting Android. | 795 # Only build the Android ASan rt on ToT bots when targetting Android. |
| 790 args.with_android = False | 796 args.with_android = False |
| 791 | 797 |
| 792 return UpdateClang(args) | 798 return UpdateClang(args) |
| 793 | 799 |
| 794 | 800 |
| 795 if __name__ == '__main__': | 801 if __name__ == '__main__': |
| 796 sys.exit(main()) | 802 sys.exit(main()) |
| OLD | NEW |