| 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 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 30 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
| 31 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) | 31 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) |
| 32 LLVM_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm') | 32 LLVM_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm') |
| 33 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', | 33 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', |
| 34 'Release+Asserts') | 34 'Release+Asserts') |
| 35 COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, '32bit-compiler-rt') | 35 COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, '32bit-compiler-rt') |
| 36 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') | 36 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') |
| 37 LLD_DIR = os.path.join(LLVM_DIR, 'tools', 'lld') | 37 LLD_DIR = os.path.join(LLVM_DIR, 'tools', 'lld') |
| 38 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt') | 38 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt') |
| 39 STAMP_FILE = os.path.join(LLVM_BUILD_DIR, 'cr_build_revision') | 39 STAMP_FILE = os.path.join(LLVM_BUILD_DIR, 'cr_build_revision') |
| 40 VERSION = '3.7.0' |
| 40 | 41 |
| 41 LLVM_REPO_URL='https://llvm.org/svn/llvm-project' | 42 LLVM_REPO_URL='https://llvm.org/svn/llvm-project' |
| 42 if 'LLVM_REPO_URL' in os.environ: | 43 if 'LLVM_REPO_URL' in os.environ: |
| 43 LLVM_REPO_URL = os.environ['LLVM_REPO_URL'] | 44 LLVM_REPO_URL = os.environ['LLVM_REPO_URL'] |
| 44 | 45 |
| 45 | 46 |
| 46 def ReadStampFile(): | 47 def ReadStampFile(): |
| 47 """Return the contents of the stamp file, or '' if it doesn't exist.""" | 48 """Return the contents of the stamp file, or '' if it doesn't exist.""" |
| 48 try: | 49 try: |
| 49 with open(STAMP_FILE, 'r') as f: | 50 with open(STAMP_FILE, 'r') as f: |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 if not os.path.exists(COMPILER_RT_BUILD_DIR): | 212 if not os.path.exists(COMPILER_RT_BUILD_DIR): |
| 212 os.makedirs(COMPILER_RT_BUILD_DIR) | 213 os.makedirs(COMPILER_RT_BUILD_DIR) |
| 213 os.chdir(COMPILER_RT_BUILD_DIR) | 214 os.chdir(COMPILER_RT_BUILD_DIR) |
| 214 RunCommand(GetVSVersion().SetupScript('x86') + | 215 RunCommand(GetVSVersion().SetupScript('x86') + |
| 215 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', | 216 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', |
| 216 '-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR]) | 217 '-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR]) |
| 217 RunCommand(GetVSVersion().SetupScript('x86') + ['&&', 'ninja', 'compiler-rt']) | 218 RunCommand(GetVSVersion().SetupScript('x86') + ['&&', 'ninja', 'compiler-rt']) |
| 218 | 219 |
| 219 # TODO(hans): Make this (and the .gypi file) version number independent. | 220 # TODO(hans): Make this (and the .gypi file) version number independent. |
| 220 asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', 'clang', | 221 asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', 'clang', |
| 221 '3.6.0', 'lib', 'windows') | 222 VERSION, 'lib', 'windows') |
| 222 asan_rt_lib_dst_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', | 223 asan_rt_lib_dst_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', |
| 223 '3.6.0', 'lib', 'windows') | 224 VERSION, 'lib', 'windows') |
| 224 CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir, | 225 CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir, |
| 225 r'^.*-i386\.lib$') | 226 r'^.*-i386\.lib$') |
| 226 | |
| 227 # TODO(hans): Remove when LLVM_WIN_REVISION is updated. | |
| 228 # Old versions of compiler-rt will leave the asan dll in bin/ | |
| 229 asan_rt_bin_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'bin') | |
| 230 CopyDirectoryContents(asan_rt_bin_src_dir, asan_rt_lib_dst_dir, | |
| 231 r'^.*-i386\.dll$') | |
| 232 | |
| 233 CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir, | 227 CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir, |
| 234 r'^.*-i386\.dll$') | 228 r'^.*-i386\.dll$') |
| 235 | 229 |
| 236 CopyFile(os.path.join(asan_rt_lib_src_dir, '..', '..', 'asan_blacklist.txt'), | 230 CopyFile(os.path.join(asan_rt_lib_src_dir, '..', '..', 'asan_blacklist.txt'), |
| 237 os.path.join(asan_rt_lib_dst_dir, '..', '..')) | 231 os.path.join(asan_rt_lib_dst_dir, '..', '..')) |
| 238 | 232 |
| 239 # Make an extra copy of the sanitizer headers, to be put on the include path | 233 # Make an extra copy of the sanitizer headers, to be put on the include path |
| 240 # of the fallback compiler. | 234 # of the fallback compiler. |
| 241 sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', '3.6.0', | 235 sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', VERSION, |
| 242 'include', 'sanitizer') | 236 'include', 'sanitizer') |
| 243 aux_sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', | 237 aux_sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', |
| 244 '3.6.0', 'include_sanitizer', | 238 VERSION, 'include_sanitizer', |
| 245 'sanitizer') | 239 'sanitizer') |
| 246 if not os.path.exists(aux_sanitizer_include_dir): | 240 if not os.path.exists(aux_sanitizer_include_dir): |
| 247 os.makedirs(aux_sanitizer_include_dir) | 241 os.makedirs(aux_sanitizer_include_dir) |
| 248 for _, _, files in os.walk(sanitizer_include_dir): | 242 for _, _, files in os.walk(sanitizer_include_dir): |
| 249 for f in files: | 243 for f in files: |
| 250 CopyFile(os.path.join(sanitizer_include_dir, f), | 244 CopyFile(os.path.join(sanitizer_include_dir, f), |
| 251 aux_sanitizer_include_dir) | 245 aux_sanitizer_include_dir) |
| 252 | 246 |
| 253 WriteStampFile(LLVM_WIN_REVISION) | 247 WriteStampFile(LLVM_WIN_REVISION) |
| 254 print 'Clang update was successful.' | 248 print 'Clang update was successful.' |
| (...skipping 24 matching lines...) Expand all Loading... |
| 279 | 273 |
| 280 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): | 274 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): |
| 281 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' | 275 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' |
| 282 return 0 | 276 return 0 |
| 283 | 277 |
| 284 return UpdateClang() | 278 return UpdateClang() |
| 285 | 279 |
| 286 | 280 |
| 287 if __name__ == '__main__': | 281 if __name__ == '__main__': |
| 288 sys.exit(main()) | 282 sys.exit(main()) |
| OLD | NEW |