| 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 os | 9 import os |
| 10 import re | 10 import re |
| 11 import subprocess | 11 import subprocess |
| 12 import sys | 12 import sys |
| 13 | 13 |
| 14 # Do NOT CHANGE this if you don't know what you're doing -- see | 14 # Do NOT CHANGE this if you don't know what you're doing -- see |
| 15 # https://code.google.com/p/chromium/wiki/UpdatingClang | 15 # https://code.google.com/p/chromium/wiki/UpdatingClang |
| 16 # Reverting problematic clang rolls is safe, though. | 16 # Reverting problematic clang rolls is safe, though. |
| 17 # Note: this revision is only used for Windows. Other platforms use update.sh. | 17 # Note: this revision is only used for Windows. Other platforms use update.sh. |
| 18 LLVM_WINDOWS_REVISION = '201116' | 18 LLVM_WINDOWS_REVISION = '201117' |
| 19 | 19 |
| 20 # Path constants. (All of these should be absolute paths.) | 20 # Path constants. (All of these should be absolute paths.) |
| 21 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 21 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
| 22 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) | 22 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) |
| 23 LLVM_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm') | 23 LLVM_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm') |
| 24 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', | 24 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', |
| 25 'Release+Asserts') | 25 'Release+Asserts') |
| 26 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') | 26 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') |
| 27 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt') | 27 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt') |
| 28 STAMP_FILE = os.path.join(LLVM_BUILD_DIR, 'cr_build_revision') | 28 STAMP_FILE = os.path.join(LLVM_BUILD_DIR, 'cr_build_revision') |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR) | 124 Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR) |
| 125 | 125 |
| 126 if not os.path.exists(LLVM_BUILD_DIR): | 126 if not os.path.exists(LLVM_BUILD_DIR): |
| 127 os.makedirs(LLVM_BUILD_DIR) | 127 os.makedirs(LLVM_BUILD_DIR) |
| 128 os.chdir(LLVM_BUILD_DIR) | 128 os.chdir(LLVM_BUILD_DIR) |
| 129 | 129 |
| 130 if not re.search(r'cmake', os.environ['PATH'], flags=re.IGNORECASE): | 130 if not re.search(r'cmake', os.environ['PATH'], flags=re.IGNORECASE): |
| 131 # If CMake is not on the path, try looking in a standard location. | 131 # If CMake is not on the path, try looking in a standard location. |
| 132 os.environ['PATH'] += os.pathsep + 'C:\\Program Files (x86)\\CMake 2.8\\bin' | 132 os.environ['PATH'] += os.pathsep + 'C:\\Program Files (x86)\\CMake 2.8\\bin' |
| 133 | 133 |
| 134 RunCommand(GetVSVersion().SetupScript('x64') + | 134 # TODO(hans): Do an amd64 build once that supports building ASan runtime. |
| 135 RunCommand(GetVSVersion().SetupScript('x86') + |
| 135 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', | 136 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', |
| 136 '-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR]) | 137 '-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR]) |
| 137 | 138 |
| 138 RunCommand(GetVSVersion().SetupScript('x64') + ['&&', 'ninja', 'all']) | 139 RunCommand(GetVSVersion().SetupScript('x86') + ['&&', 'ninja', 'all']) |
| 139 | 140 |
| 140 WriteStampFile(LLVM_WINDOWS_REVISION) | 141 WriteStampFile(LLVM_WINDOWS_REVISION) |
| 141 print 'Clang update was successful.' | 142 print 'Clang update was successful.' |
| 142 return 0 | 143 return 0 |
| 143 | 144 |
| 144 | 145 |
| 145 def main(): | 146 def main(): |
| 146 if not sys.platform in ['win32', 'cygwin']: | 147 if not sys.platform in ['win32', 'cygwin']: |
| 147 # For non-Windows, fall back to update.sh. | 148 # For non-Windows, fall back to update.sh. |
| 148 # TODO(hans): Make update.py replace update.sh completely. | 149 # TODO(hans): Make update.py replace update.sh completely. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 162 | 163 |
| 163 if not re.search('clang=1', os.environ.get('GYP_DEFINES', '')): | 164 if not re.search('clang=1', os.environ.get('GYP_DEFINES', '')): |
| 164 print 'Skipping Clang update (clang=1 was not set in GYP_DEFINES).' | 165 print 'Skipping Clang update (clang=1 was not set in GYP_DEFINES).' |
| 165 return 0 | 166 return 0 |
| 166 | 167 |
| 167 return UpdateClang() | 168 return UpdateClang() |
| 168 | 169 |
| 169 | 170 |
| 170 if __name__ == '__main__': | 171 if __name__ == '__main__': |
| 171 sys.exit(main()) | 172 sys.exit(main()) |
| OLD | NEW |