Chromium Code Reviews| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 if not vs_version: | 125 if not vs_version: |
| 126 # TODO(hans): Find a less hacky way to find the MSVS installation. | 126 # TODO(hans): Find a less hacky way to find the MSVS installation. |
| 127 sys.path.append(os.path.join(CHROMIUM_DIR, 'tools', 'gyp', 'pylib')) | 127 sys.path.append(os.path.join(CHROMIUM_DIR, 'tools', 'gyp', 'pylib')) |
| 128 import gyp.MSVSVersion | 128 import gyp.MSVSVersion |
| 129 # We request VS 2013 because Clang won't build with 2010, and 2013 will be | 129 # We request VS 2013 because Clang won't build with 2010, and 2013 will be |
| 130 # the default for Chromium soon anyway. | 130 # the default for Chromium soon anyway. |
| 131 vs_version = gyp.MSVSVersion.SelectVisualStudioVersion('2013') | 131 vs_version = gyp.MSVSVersion.SelectVisualStudioVersion('2013') |
| 132 return vs_version | 132 return vs_version |
| 133 | 133 |
| 134 | 134 |
| 135 def CopyDirectoryContents(src, dst, filename_filter=None): | |
|
hans
2014/08/29 16:31:06
Maybe define this with CopyFile above, and give it
| |
| 136 if not os.path.exists(dst): | |
| 137 os.makedirs(dst) | |
| 138 for root, _, files in os.walk(src): | |
| 139 for f in files: | |
| 140 if filename_filter and not re.match(filename_filter, f): | |
| 141 continue | |
| 142 CopyFile(os.path.join(root, f), dst) | |
| 143 | |
| 144 | |
| 135 def UpdateClang(): | 145 def UpdateClang(): |
| 136 print 'Updating Clang to %s...' % (LLVM_WIN_REVISION) | 146 print 'Updating Clang to %s...' % (LLVM_WIN_REVISION) |
| 137 if LLVM_WIN_REVISION != 'HEAD' and ReadStampFile() == LLVM_WIN_REVISION: | 147 if LLVM_WIN_REVISION != 'HEAD' and ReadStampFile() == LLVM_WIN_REVISION: |
| 138 print 'Already up to date.' | 148 print 'Already up to date.' |
| 139 return 0 | 149 return 0 |
| 140 | 150 |
| 141 AddCMakeToPath() | 151 AddCMakeToPath() |
| 142 ClobberChromiumBuildFiles() | 152 ClobberChromiumBuildFiles() |
| 143 | 153 |
| 144 # Reset the stamp file in case the build is unsuccessful. | 154 # Reset the stamp file in case the build is unsuccessful. |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 160 # Do an x86 build of compiler-rt to get the 32-bit ASan run-time. | 170 # Do an x86 build of compiler-rt to get the 32-bit ASan run-time. |
| 161 # TODO(hans): Remove once the regular build above produces this. | 171 # TODO(hans): Remove once the regular build above produces this. |
| 162 if not os.path.exists(COMPILER_RT_BUILD_DIR): | 172 if not os.path.exists(COMPILER_RT_BUILD_DIR): |
| 163 os.makedirs(COMPILER_RT_BUILD_DIR) | 173 os.makedirs(COMPILER_RT_BUILD_DIR) |
| 164 os.chdir(COMPILER_RT_BUILD_DIR) | 174 os.chdir(COMPILER_RT_BUILD_DIR) |
| 165 RunCommand(GetVSVersion().SetupScript('x86') + | 175 RunCommand(GetVSVersion().SetupScript('x86') + |
| 166 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', | 176 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', |
| 167 '-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR]) | 177 '-DLLVM_ENABLE_ASSERTIONS=ON', LLVM_DIR]) |
| 168 RunCommand(GetVSVersion().SetupScript('x86') + ['&&', 'ninja', 'compiler-rt']) | 178 RunCommand(GetVSVersion().SetupScript('x86') + ['&&', 'ninja', 'compiler-rt']) |
| 169 | 179 |
| 180 asan_rt_bin_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'bin') | |
| 181 asan_rt_bin_dst_dir = os.path.join(LLVM_BUILD_DIR, 'bin') | |
| 182 CopyDirectoryContents(asan_rt_bin_src_dir, asan_rt_bin_dst_dir, | |
| 183 r'^.*-i386\.dll$') | |
| 184 | |
| 170 # TODO(hans): Make this (and the .gypi file) version number independent. | 185 # TODO(hans): Make this (and the .gypi file) version number independent. |
| 171 asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', 'clang', | 186 asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', 'clang', |
| 172 '3.6.0', 'lib', 'windows') | 187 '3.6.0', 'lib', 'windows') |
| 173 asan_rt_lib_dst_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', | 188 asan_rt_lib_dst_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', |
| 174 '3.6.0', 'lib', 'windows') | 189 '3.6.0', 'lib', 'windows') |
| 175 | 190 CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir, |
| 176 if not os.path.exists(asan_rt_lib_dst_dir): | 191 r'^.*-i386\.lib$') |
| 177 os.makedirs(asan_rt_lib_dst_dir) | |
| 178 for root, _, files in os.walk(asan_rt_lib_src_dir): | |
| 179 for f in files: | |
| 180 if re.match(r'^.*-i386\.lib$', f): | |
| 181 CopyFile(os.path.join(root, f), asan_rt_lib_dst_dir) | |
| 182 | 192 |
| 183 CopyFile(os.path.join(asan_rt_lib_src_dir, '..', '..', 'asan_blacklist.txt'), | 193 CopyFile(os.path.join(asan_rt_lib_src_dir, '..', '..', 'asan_blacklist.txt'), |
| 184 os.path.join(asan_rt_lib_dst_dir, '..', '..')) | 194 os.path.join(asan_rt_lib_dst_dir, '..', '..')) |
| 185 | 195 |
| 186 # Make an extra copy of the sanitizer headers, to be put on the include path | 196 # Make an extra copy of the sanitizer headers, to be put on the include path |
| 187 # of the fallback compiler. | 197 # of the fallback compiler. |
| 188 sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', '3.6.0', | 198 sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', '3.6.0', |
| 189 'include', 'sanitizer') | 199 'include', 'sanitizer') |
| 190 aux_sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', | 200 aux_sanitizer_include_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', |
| 191 '3.6.0', 'include_sanitizer', | 201 '3.6.0', 'include_sanitizer', |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 | 236 |
| 227 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): | 237 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): |
| 228 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' | 238 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' |
| 229 return 0 | 239 return 0 |
| 230 | 240 |
| 231 return UpdateClang() | 241 return UpdateClang() |
| 232 | 242 |
| 233 | 243 |
| 234 if __name__ == '__main__': | 244 if __name__ == '__main__': |
| 235 sys.exit(main()) | 245 sys.exit(main()) |
| OLD | NEW |