| 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 """Windows can't run .sh files, so this is a Python implementation of | 6 """Windows can't run .sh files, so this is a Python implementation of |
| 7 update.sh. This script should replace update.sh on all platforms eventually.""" | 7 update.sh. This script should replace update.sh on all platforms eventually.""" |
| 8 | 8 |
| 9 import argparse | 9 import argparse |
| 10 import contextlib | 10 import contextlib |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 binutils_incdir = '' | 408 binutils_incdir = '' |
| 409 if sys.platform.startswith('linux'): | 409 if sys.platform.startswith('linux'): |
| 410 binutils_incdir = os.path.join(BINUTILS_DIR, 'Linux_x64/Release/include') | 410 binutils_incdir = os.path.join(BINUTILS_DIR, 'Linux_x64/Release/include') |
| 411 | 411 |
| 412 # If building at head, define a macro that plugins can use for #ifdefing | 412 # If building at head, define a macro that plugins can use for #ifdefing |
| 413 # out code that builds at head, but not at LLVM_WIN_REVISION or vice versa. | 413 # out code that builds at head, but not at LLVM_WIN_REVISION or vice versa. |
| 414 if use_head_revision: | 414 if use_head_revision: |
| 415 cflags += ['-DLLVM_FORCE_HEAD_REVISION'] | 415 cflags += ['-DLLVM_FORCE_HEAD_REVISION'] |
| 416 cxxflags += ['-DLLVM_FORCE_HEAD_REVISION'] | 416 cxxflags += ['-DLLVM_FORCE_HEAD_REVISION'] |
| 417 | 417 |
| 418 deployment_env = os.environ.copy() | 418 deployment_env = None |
| 419 if deployment_target: | 419 if deployment_target: |
| 420 deployment_env = os.environ.copy() |
| 420 deployment_env['MACOSX_DEPLOYMENT_TARGET'] = deployment_target | 421 deployment_env['MACOSX_DEPLOYMENT_TARGET'] = deployment_target |
| 421 | 422 |
| 422 cmake_args = base_cmake_args + [ | 423 cmake_args = base_cmake_args + [ |
| 423 '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir, | 424 '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir, |
| 424 '-DCMAKE_C_FLAGS=' + ' '.join(cflags), | 425 '-DCMAKE_C_FLAGS=' + ' '.join(cflags), |
| 425 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags), | 426 '-DCMAKE_CXX_FLAGS=' + ' '.join(cxxflags), |
| 426 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(ldflags), | 427 '-DCMAKE_EXE_LINKER_FLAGS=' + ' '.join(ldflags), |
| 427 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(ldflags), | 428 '-DCMAKE_SHARED_LINKER_FLAGS=' + ' '.join(ldflags), |
| 428 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(ldflags), | 429 '-DCMAKE_MODULE_LINKER_FLAGS=' + ' '.join(ldflags), |
| 429 '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'), | 430 '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'), |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 stderr = None | 527 stderr = None |
| 527 else: | 528 else: |
| 528 try: | 529 try: |
| 529 stderr = os.fdopen(os.dup(sys.stdin.fileno())) | 530 stderr = os.fdopen(os.dup(sys.stdin.fileno())) |
| 530 except: | 531 except: |
| 531 stderr = sys.stderr | 532 stderr = sys.stderr |
| 532 return subprocess.call( | 533 return subprocess.call( |
| 533 [os.path.join(os.path.dirname(__file__), 'update.sh')] + sys.argv[1:], | 534 [os.path.join(os.path.dirname(__file__), 'update.sh')] + sys.argv[1:], |
| 534 stderr=stderr) | 535 stderr=stderr) |
| 535 | 536 |
| 537 # Don't buffer stdout, so that print statements are immediately flushed. |
| 538 sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) |
| 539 |
| 536 parser = argparse.ArgumentParser(description='Build Clang.') | 540 parser = argparse.ArgumentParser(description='Build Clang.') |
| 537 parser.add_argument('--bootstrap', action='store_true', | 541 parser.add_argument('--bootstrap', action='store_true', |
| 538 help='first build clang with CC, then with itself.') | 542 help='first build clang with CC, then with itself.') |
| 539 parser.add_argument('--if-needed', action='store_true', | 543 parser.add_argument('--if-needed', action='store_true', |
| 540 help="run only if the script thinks clang is needed") | 544 help="run only if the script thinks clang is needed") |
| 541 parser.add_argument('--force-local-build', action='store_true', | 545 parser.add_argument('--force-local-build', action='store_true', |
| 542 help="don't try to download prebuild binaries") | 546 help="don't try to download prebuild binaries") |
| 543 parser.add_argument('--print-revision', action='store_true', | 547 parser.add_argument('--print-revision', action='store_true', |
| 544 help='print current clang revision and exit.') | 548 help='print current clang revision and exit.') |
| 545 parser.add_argument('--run-tests', action='store_true', | 549 parser.add_argument('--run-tests', action='store_true', |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 # Use a real revision number rather than HEAD to make sure that the stamp | 588 # Use a real revision number rather than HEAD to make sure that the stamp |
| 585 # file logic works. | 589 # file logic works. |
| 586 LLVM_WIN_REVISION = GetSvnRevision(LLVM_REPO_URL) | 590 LLVM_WIN_REVISION = GetSvnRevision(LLVM_REPO_URL) |
| 587 PACKAGE_VERSION = LLVM_WIN_REVISION + '-0' | 591 PACKAGE_VERSION = LLVM_WIN_REVISION + '-0' |
| 588 | 592 |
| 589 return UpdateClang(args) | 593 return UpdateClang(args) |
| 590 | 594 |
| 591 | 595 |
| 592 if __name__ == '__main__': | 596 if __name__ == '__main__': |
| 593 sys.exit(main()) | 597 sys.exit(main()) |
| OLD | NEW |