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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 LLVM_BOOTSTRAP_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-bootstrap') | 45 LLVM_BOOTSTRAP_DIR = os.path.join(THIRD_PARTY_DIR, 'llvm-bootstrap') |
46 LLVM_BOOTSTRAP_INSTALL_DIR = os.path.join(THIRD_PARTY_DIR, | 46 LLVM_BOOTSTRAP_INSTALL_DIR = os.path.join(THIRD_PARTY_DIR, |
47 'llvm-bootstrap-install') | 47 'llvm-bootstrap-install') |
48 CHROME_TOOLS_SHIM_DIR = os.path.join(LLVM_DIR, 'tools', 'chrometools') | 48 CHROME_TOOLS_SHIM_DIR = os.path.join(LLVM_DIR, 'tools', 'chrometools') |
49 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', | 49 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', |
50 'Release+Asserts') | 50 'Release+Asserts') |
51 COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, '32bit-compiler-rt') | 51 COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, '32bit-compiler-rt') |
52 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') | 52 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') |
53 LLD_DIR = os.path.join(LLVM_DIR, 'tools', 'lld') | 53 LLD_DIR = os.path.join(LLVM_DIR, 'tools', 'lld') |
54 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt') | 54 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt') |
55 LIBCXX_DIR = os.path.join(LLVM_DIR, 'projects', 'libcxx') | |
56 LIBCXXABI_DIR = os.path.join(LLVM_DIR, 'projects', 'libcxxabi') | |
57 LLVM_BUILD_TOOLS_DIR = os.path.abspath( | 55 LLVM_BUILD_TOOLS_DIR = os.path.abspath( |
58 os.path.join(LLVM_DIR, '..', 'llvm-build-tools')) | 56 os.path.join(LLVM_DIR, '..', 'llvm-build-tools')) |
59 STAMP_FILE = os.path.join(LLVM_DIR, '..', 'llvm-build', 'cr_build_revision') | 57 STAMP_FILE = os.path.join(LLVM_DIR, '..', 'llvm-build', 'cr_build_revision') |
60 BINUTILS_DIR = os.path.join(THIRD_PARTY_DIR, 'binutils') | 58 BINUTILS_DIR = os.path.join(THIRD_PARTY_DIR, 'binutils') |
61 VERSION = '3.7.0' | 59 VERSION = '3.7.0' |
62 | 60 |
63 # URL for pre-built binaries. | 61 # URL for pre-built binaries. |
64 CDS_URL = 'https://commondatastorage.googleapis.com/chromium-browser-clang' | 62 CDS_URL = 'https://commondatastorage.googleapis.com/chromium-browser-clang' |
65 | 63 |
66 LLVM_REPO_URL='https://llvm.org/svn/llvm-project' | 64 LLVM_REPO_URL='https://llvm.org/svn/llvm-project' |
(...skipping 28 matching lines...) Expand all Loading... |
95 """Return the contents of the stamp file, or '' if it doesn't exist.""" | 93 """Return the contents of the stamp file, or '' if it doesn't exist.""" |
96 try: | 94 try: |
97 with open(STAMP_FILE, 'r') as f: | 95 with open(STAMP_FILE, 'r') as f: |
98 return f.read(); | 96 return f.read(); |
99 except IOError: | 97 except IOError: |
100 return '' | 98 return '' |
101 | 99 |
102 | 100 |
103 def WriteStampFile(s): | 101 def WriteStampFile(s): |
104 """Write s to the stamp file.""" | 102 """Write s to the stamp file.""" |
105 if not os.path.exists(os.path.dirname(STAMP_FILE)): | 103 if not os.path.exists(LLVM_BUILD_DIR): |
106 os.makedirs(os.path.dirname(STAMP_FILE)) | 104 os.makedirs(LLVM_BUILD_DIR) |
107 with open(STAMP_FILE, 'w') as f: | 105 with open(STAMP_FILE, 'w') as f: |
108 f.write(s) | 106 f.write(s) |
109 | 107 |
110 | 108 |
111 def GetSvnRevision(svn_repo): | 109 def GetSvnRevision(svn_repo): |
112 """Returns current revision of the svn repo at svn_repo.""" | 110 """Returns current revision of the svn repo at svn_repo.""" |
113 svn_info = subprocess.check_output('svn info ' + svn_repo, shell=True) | 111 svn_info = subprocess.check_output(['svn', 'info', svn_repo], shell=True) |
114 m = re.search(r'Revision: (\d+)', svn_info) | 112 m = re.search(r'Revision: (\d+)', svn_info) |
115 return m.group(1) | 113 return m.group(1) |
116 | 114 |
117 | 115 |
118 def RmTree(dir): | 116 def RmTree(dir): |
119 """Delete dir.""" | 117 """Delete dir.""" |
120 def ChmodAndRetry(func, path, _): | 118 def ChmodAndRetry(func, path, _): |
121 # Subversion can leave read-only files around. | 119 # Subversion can leave read-only files around. |
122 if not os.access(path, os.W_OK): | 120 if not os.access(path, os.W_OK): |
123 os.chmod(path, stat.S_IWUSR) | 121 os.chmod(path, stat.S_IWUSR) |
124 return func(path) | 122 return func(path) |
125 raise | 123 raise |
126 | 124 |
127 shutil.rmtree(dir, onerror=ChmodAndRetry) | 125 shutil.rmtree(dir, onerror=ChmodAndRetry) |
128 | 126 |
129 | 127 |
130 def RunCommand(command, env=None, fail_hard=True): | 128 def RunCommand(command, fail_hard=True): |
131 """Run command and return success (True) or failure; or if fail_hard is | 129 """Run command and return success (True) or failure; or if fail_hard is |
132 True, exit on failure.""" | 130 True, exit on failure.""" |
133 | 131 |
134 print 'Running %s' % (str(command)) | 132 print 'Running %s' % (str(command)) |
135 if subprocess.call(' '.join(command), env=env, shell=True) == 0: | 133 if subprocess.call(command, shell=True) == 0: |
136 return True | 134 return True |
137 print 'Failed.' | 135 print 'Failed.' |
138 if fail_hard: | 136 if fail_hard: |
139 sys.exit(1) | 137 sys.exit(1) |
140 return False | 138 return False |
141 | 139 |
142 | 140 |
143 def CopyFile(src, dst): | 141 def CopyFile(src, dst): |
144 """Copy a file from src to dst.""" | 142 """Copy a file from src to dst.""" |
145 shutil.copy(src, dst) | 143 shutil.copy(src, dst) |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 if not os.path.exists(cmake_dir): | 214 if not os.path.exists(cmake_dir): |
217 if not os.path.exists(LLVM_BUILD_TOOLS_DIR): | 215 if not os.path.exists(LLVM_BUILD_TOOLS_DIR): |
218 os.makedirs(LLVM_BUILD_TOOLS_DIR) | 216 os.makedirs(LLVM_BUILD_TOOLS_DIR) |
219 # The cmake archive is smaller than 20 MB, small enough to keep in memory: | 217 # The cmake archive is smaller than 20 MB, small enough to keep in memory: |
220 with contextlib.closing(cStringIO.StringIO()) as f: | 218 with contextlib.closing(cStringIO.StringIO()) as f: |
221 DownloadUrl(CDS_URL + '/tools/' + zip_name, f) | 219 DownloadUrl(CDS_URL + '/tools/' + zip_name, f) |
222 f.seek(0) | 220 f.seek(0) |
223 if zip_name.endswith('.zip'): | 221 if zip_name.endswith('.zip'): |
224 zipfile.ZipFile(f).extractall(path=LLVM_BUILD_TOOLS_DIR) | 222 zipfile.ZipFile(f).extractall(path=LLVM_BUILD_TOOLS_DIR) |
225 else: | 223 else: |
226 tarfile.open(mode='r:gz', fileobj=f).extractall(path= | 224 tarfile.open(mode='r:gz', fileobj=f).extractall(path=LLVM_BUILD_DIR) |
227 LLVM_BUILD_TOOLS_DIR) | |
228 os.environ['PATH'] = cmake_dir + os.pathsep + os.environ.get('PATH', '') | 225 os.environ['PATH'] = cmake_dir + os.pathsep + os.environ.get('PATH', '') |
229 | 226 |
230 vs_version = None | 227 vs_version = None |
231 def GetVSVersion(): | 228 def GetVSVersion(): |
232 global vs_version | 229 global vs_version |
233 if vs_version: | 230 if vs_version: |
234 return vs_version | 231 return vs_version |
235 | 232 |
236 # Try using the toolchain in depot_tools. | 233 # Try using the toolchain in depot_tools. |
237 # This sets environment variables used by SelectVisualStudioVersion below. | 234 # This sets environment variables used by SelectVisualStudioVersion below. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 WriteStampFile(PACKAGE_VERSION) | 272 WriteStampFile(PACKAGE_VERSION) |
276 return 0 | 273 return 0 |
277 except urllib2.HTTPError: | 274 except urllib2.HTTPError: |
278 print 'Did not find prebuilt clang %s, building locally' % cds_file | 275 print 'Did not find prebuilt clang %s, building locally' % cds_file |
279 | 276 |
280 AddCMakeToPath() | 277 AddCMakeToPath() |
281 | 278 |
282 DeleteChromeToolsShim(); | 279 DeleteChromeToolsShim(); |
283 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR) | 280 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR) |
284 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR) | 281 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR) |
285 if sys.platform == 'win32': | 282 Checkout('LLD', LLVM_REPO_URL + '/lld/trunk', LLD_DIR) |
286 Checkout('LLD', LLVM_REPO_URL + '/lld/trunk', LLD_DIR) | |
287 Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR) | 283 Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR) |
288 if sys.platform == 'darwin': | |
289 # clang needs a libc++ checkout, else -stdlib=libc++ won't find includes | |
290 # (i.e. this is needed for bootstrap builds). | |
291 Checkout('libcxx', LLVM_REPO_URL + '/libcxx/trunk', LIBCXX_DIR) | |
292 # While we're bundling our own libc++ on OS X, we need to compile libc++abi | |
293 # into it too (since OS X 10.6 doesn't have libc++abi.dylib either). | |
294 Checkout('libcxxabi', LLVM_REPO_URL + '/libcxxabi/trunk', LIBCXXABI_DIR) | |
295 | |
296 CreateChromeToolsShim(); | 284 CreateChromeToolsShim(); |
297 | 285 |
298 cc, cxx = None, None | 286 # If building at head, define a macro that plugins can use for #ifdefing |
299 cflags = cxxflags = ldflags = '' | 287 # out code that builds at head, but not at CLANG_REVISION or vice versa. |
| 288 cflags = cxxflags = '' |
300 | 289 |
301 # LLVM uses C++11 starting in llvm 3.5. On Linux, this means libstdc++4.7+ is | 290 # If building at head, define a macro that plugins can use for #ifdefing |
302 # needed, on OS X it requires libc++. clang only automatically links to libc++ | 291 # out code that builds at head, but not at LLVM_WIN_REVISION or vice versa. |
303 # when targeting OS X 10.9+, so add stdlib=libc++ explicitly so clang can run | 292 if use_head_revision: |
304 # on OS X versions as old as 10.7. | 293 cflags += ' -DLLVM_FORCE_HEAD_REVISION' |
305 # TODO(thakis): Some bots are still on 10.6 (nacl...), so for now bundle | 294 cxxflags += ' -DLLVM_FORCE_HEAD_REVISION' |
306 # libc++.dylib. Remove this once all bots are on 10.7+, then use | |
307 # -DLLVM_ENABLE_LIBCXX=ON and change deployment_target to 10.7. | |
308 deployment_target = '' | |
309 | |
310 if sys.platform == 'darwin': | |
311 # When building on 10.9, /usr/include usually doesn't exist, and while | |
312 # Xcode's clang automatically sets a sysroot, self-built clangs don't. | |
313 cflags = "-isysroot " + subprocess.check_output( | |
314 ['xcrun', '--show-sdk-path']).rstrip() | |
315 cxxflags = '-stdlib=libc++ -nostdinc++ -I%s %s' % ( | |
316 os.path.join(LIBCXX_DIR, 'include'), cflags) | |
317 if args.bootstrap: | |
318 deployment_target = '10.6' | |
319 | 295 |
320 base_cmake_args = ['-GNinja', | 296 base_cmake_args = ['-GNinja', |
321 '-DCMAKE_BUILD_TYPE=Release', | 297 '-DCMAKE_BUILD_TYPE=Release', |
322 '-DLLVM_ENABLE_ASSERTIONS=ON', | 298 '-DLLVM_ENABLE_ASSERTIONS=ON', |
323 '-DLLVM_ENABLE_THREADS=OFF', | 299 '-DLLVM_ENABLE_THREADS=OFF', |
324 ] | 300 ] |
325 | 301 |
| 302 cc, cxx = None, None |
326 if args.bootstrap: | 303 if args.bootstrap: |
327 print 'Building bootstrap compiler' | 304 print 'Building bootstrap compiler' |
328 if not os.path.exists(LLVM_BOOTSTRAP_DIR): | 305 if not os.path.exists(LLVM_BOOTSTRAP_DIR): |
329 os.makedirs(LLVM_BOOTSTRAP_DIR) | 306 os.makedirs(LLVM_BOOTSTRAP_DIR) |
330 os.chdir(LLVM_BOOTSTRAP_DIR) | 307 os.chdir(LLVM_BOOTSTRAP_DIR) |
331 bootstrap_args = base_cmake_args + [ | 308 bootstrap_args = base_cmake_args + [ |
332 '-DLLVM_TARGETS_TO_BUILD=host', | 309 '-DLLVM_TARGETS_TO_BUILD=host', |
333 '-DCMAKE_INSTALL_PREFIX=' + LLVM_BOOTSTRAP_INSTALL_DIR, | 310 '-DCMAKE_INSTALL_PREFIX=' + LLVM_BOOTSTRAP_INSTALL_DIR, |
334 '-DCMAKE_C_FLAGS=' + cflags, | 311 '-DCMAKE_C_FLAGS=' + cflags, |
335 '-DCMAKE_CXX_FLAGS=' + cxxflags, | 312 '-DCMAKE_CXX_FLAGS=' + cxxflags, |
(...skipping 10 matching lines...) Expand all Loading... |
346 # TODO(thakis): Set these to clang / clang++ on posix once this script | 323 # TODO(thakis): Set these to clang / clang++ on posix once this script |
347 # is used on posix. | 324 # is used on posix. |
348 cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe') | 325 cc = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe') |
349 cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe') | 326 cxx = os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'bin', 'clang-cl.exe') |
350 # CMake has a hard time with backslashes in compiler paths: | 327 # CMake has a hard time with backslashes in compiler paths: |
351 # https://stackoverflow.com/questions/13050827 | 328 # https://stackoverflow.com/questions/13050827 |
352 cc = cc.replace('\\', '/') | 329 cc = cc.replace('\\', '/') |
353 cxx = cxx.replace('\\', '/') | 330 cxx = cxx.replace('\\', '/') |
354 print 'Building final compiler' | 331 print 'Building final compiler' |
355 | 332 |
356 if sys.platform == 'darwin': | |
357 # Build libc++.dylib while some bots are still on OS X 10.6. | |
358 RmTree(os.path.join(LLVM_BUILD_DIR, 'libcxxbuild')) | |
359 libcxxflags = "-O3 -std=c++11 -fstrict-aliasing" | |
360 | |
361 # libcxx and libcxxabi both have a file stdexcept.cpp, so put their .o files | |
362 # into different subdirectories. | |
363 os.makedirs(os.path.join(LLVM_BUILD_DIR, 'libcxxbuild', 'libcxx')) | |
364 os.chdir(os.path.join(LLVM_BUILD_DIR, 'libcxxbuild', 'libcxx')) | |
365 RunCommand(['c++', '-c', cxxflags, libcxxflags, | |
366 os.path.join(LIBCXX_DIR, 'src', '*.cpp')]) | |
367 | |
368 os.makedirs(os.path.join(LLVM_BUILD_DIR, 'libcxxbuild', 'libcxxabi')) | |
369 os.chdir(os.path.join(LLVM_BUILD_DIR, 'libcxxbuild', 'libcxxabi')) | |
370 RunCommand(['c++', '-c', cxxflags, libcxxflags, | |
371 os.path.join(LIBCXXABI_DIR, 'src', '*.cpp'), | |
372 '-I' + os.path.join(LIBCXXABI_DIR, 'include')]) | |
373 | |
374 os.chdir(os.path.join(LLVM_BUILD_DIR, 'libcxxbuild')) | |
375 libdir = os.path.join(LIBCXX_DIR, 'lib') | |
376 RunCommand(['cc', 'libcxx/*.o', 'libcxxabi/*.o', '-o', 'libc++.1.dylib', | |
377 '-dynamiclib', '-nodefaultlibs', '-current_version', '1', | |
378 '-compatibility_version', '1', '-lSystem', '-install_name', | |
379 '@executable_path/libc++.dylib', | |
380 '-Wl,-unexported_symbols_list,' + libdir + '/libc++unexp.exp', | |
381 '-Wl,-force_symbols_not_weak_list,' + libdir + '/notweak.exp', | |
382 '-Wl,-force_symbols_weak_list,' + libdir + '/weak.exp']) | |
383 if os.path.exists('libc++.dylib'): | |
384 os.remove('libc++.dylib') | |
385 os.symlink('libc++.1.dylib', 'libc++.dylib') | |
386 ldflags += '-stdlib=libc++ -L' + os.path.join(LLVM_BUILD_DIR, 'libcxxbuild') | |
387 | |
388 # Build clang. | 333 # Build clang. |
389 binutils_incdir = '' | 334 binutils_incdir = '' |
390 if sys.platform.startswith('linux'): | 335 if sys.platform.startswith('linux'): |
391 binutils_incdir = os.path.join(BINUTILS_DIR, 'Linux_x64/Release/include') | 336 binutils_incdir = os.path.join(BINUTILS_DIR, 'Linux_x64/Release/include') |
392 | 337 |
393 # If building at head, define a macro that plugins can use for #ifdefing | |
394 # out code that builds at head, but not at LLVM_WIN_REVISION or vice versa. | |
395 if use_head_revision: | |
396 cflags += ' -DLLVM_FORCE_HEAD_REVISION' | |
397 cxxflags += ' -DLLVM_FORCE_HEAD_REVISION' | |
398 | |
399 deployment_env = os.environ.copy() | |
400 if deployment_target: | |
401 deployment_env['MACOSX_DEPLOYMENT_TARGET'] = deployment_target | |
402 | |
403 cmake_args = base_cmake_args + [ | 338 cmake_args = base_cmake_args + [ |
404 '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir, | 339 '-DLLVM_BINUTILS_INCDIR=' + binutils_incdir, |
405 '-DCMAKE_C_FLAGS=' + cflags, | 340 '-DCMAKE_C_FLAGS=' + cflags, |
406 '-DCMAKE_CXX_FLAGS=' + cxxflags, | 341 '-DCMAKE_CXX_FLAGS=' + cxxflags, |
407 '-DCMAKE_EXE_LINKER_FLAGS="' + ldflags, | |
408 '-DCMAKE_SHARED_LINKER_FLAGS="' + ldflags, | |
409 '-DCMAKE_MODULE_LINKER_FLAGS="' + ldflags, | |
410 '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'), | 342 '-DCHROMIUM_TOOLS_SRC=%s' % os.path.join(CHROMIUM_DIR, 'tools', 'clang'), |
411 '-DCHROMIUM_TOOLS=%s' % ';'.join(args.tools)] | 343 '-DCHROMIUM_TOOLS=%s' % ';'.join(args.tools)] |
412 # TODO(thakis): Append this to base_cmake_args instead once compiler-rt | 344 # TODO(thakis): Append this to base_cmake_args instead once compiler-rt |
413 # can build with clang-cl (http://llvm.org/PR23698) | 345 # can build with clang-cl (http://llvm.org/PR23698) |
414 if cc is not None: cmake_args.append('-DCMAKE_C_COMPILER=' + cc) | 346 if cc is not None: cmake_args.append('-DCMAKE_C_COMPILER=' + cc) |
415 if cxx is not None: cmake_args.append('-DCMAKE_CXX_COMPILER=' + cxx) | 347 if cxx is not None: cmake_args.append('-DCMAKE_CXX_COMPILER=' + cxx) |
416 | 348 |
417 if not os.path.exists(LLVM_BUILD_DIR): | 349 if not os.path.exists(LLVM_BUILD_DIR): |
418 os.makedirs(LLVM_BUILD_DIR) | 350 os.makedirs(LLVM_BUILD_DIR) |
419 os.chdir(LLVM_BUILD_DIR) | 351 os.chdir(LLVM_BUILD_DIR) |
420 RunCommand(GetVSVersion().SetupScript('x64') + ['&&', 'cmake'] + cmake_args + | 352 RunCommand(GetVSVersion().SetupScript('x64') + |
421 [LLVM_DIR], env=deployment_env) | 353 ['&&', 'cmake'] + cmake_args + [LLVM_DIR]) |
422 RunCommand(GetVSVersion().SetupScript('x64') + ['&&', 'ninja', 'all']) | 354 RunCommand(GetVSVersion().SetupScript('x64') + ['&&', 'ninja', 'all']) |
423 | 355 |
424 # TODO(thakis): Run `strip bin/clang` on posix (with -x on darwin) | |
425 | |
426 if sys.platform == 'darwin': | |
427 CopyFile(os.path.join(LLVM_BUILD_DIR, 'libc++.1.dylib'), | |
428 os.path.join(LLVM_BUILD_DIR, 'bin')) | |
429 | |
430 # Do an x86 build of compiler-rt to get the 32-bit ASan run-time. | 356 # Do an x86 build of compiler-rt to get the 32-bit ASan run-time. |
431 # TODO(hans): Remove once the regular build above produces this. | 357 # TODO(hans): Remove once the regular build above produces this. |
432 if not os.path.exists(COMPILER_RT_BUILD_DIR): | 358 if not os.path.exists(COMPILER_RT_BUILD_DIR): |
433 os.makedirs(COMPILER_RT_BUILD_DIR) | 359 os.makedirs(COMPILER_RT_BUILD_DIR) |
434 os.chdir(COMPILER_RT_BUILD_DIR) | 360 os.chdir(COMPILER_RT_BUILD_DIR) |
435 # TODO(thakis): Add this once compiler-rt can build with clang-cl (see | 361 # TODO(thakis): Add this once compiler-rt can build with clang-cl (see |
436 # above). | 362 # above). |
437 #if args.bootstrap: | 363 #if args.bootstrap: |
438 # The bootstrap compiler produces 64-bit binaries by default. | 364 # The bootstrap compiler produces 64-bit binaries by default. |
439 #cflags += ' -m32' | 365 #cflags += ' -m32' |
440 #cxxflags += ' -m32' | 366 #cxxflags += ' -m32' |
441 compiler_rt_args = base_cmake_args + [ | 367 compiler_rt_args = base_cmake_args + [ |
442 '-DCMAKE_C_FLAGS=' + cflags, | 368 '-DCMAKE_C_FLAGS=' + cflags, |
443 '-DCMAKE_CXX_FLAGS=' + cxxflags] | 369 '-DCMAKE_CXX_FLAGS=' + cxxflags] |
444 RunCommand(GetVSVersion().SetupScript('x86') + ['&&', 'cmake'] + | 370 RunCommand(GetVSVersion().SetupScript('x86') + |
445 compiler_rt_args + [LLVM_DIR], env=deployment_env) | 371 ['&&', 'cmake'] + compiler_rt_args + [LLVM_DIR]) |
446 RunCommand(GetVSVersion().SetupScript('x86') + ['&&', 'ninja', 'compiler-rt']) | 372 RunCommand(GetVSVersion().SetupScript('x86') + ['&&', 'ninja', 'compiler-rt']) |
447 | 373 |
448 # TODO(hans): Make this (and the .gypi and .isolate files) version number | 374 # TODO(hans): Make this (and the .gypi and .isolate files) version number |
449 # independent. | 375 # independent. |
450 asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', 'clang', | 376 asan_rt_lib_src_dir = os.path.join(COMPILER_RT_BUILD_DIR, 'lib', 'clang', |
451 VERSION, 'lib', 'windows') | 377 VERSION, 'lib', 'windows') |
452 asan_rt_lib_dst_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', | 378 asan_rt_lib_dst_dir = os.path.join(LLVM_BUILD_DIR, 'lib', 'clang', |
453 VERSION, 'lib', 'windows') | 379 VERSION, 'lib', 'windows') |
454 CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir, | 380 CopyDirectoryContents(asan_rt_lib_src_dir, asan_rt_lib_dst_dir, |
455 r'^.*-i386\.lib$') | 381 r'^.*-i386\.lib$') |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 # Use a real revision number rather than HEAD to make sure that the stamp | 491 # Use a real revision number rather than HEAD to make sure that the stamp |
566 # file logic works. | 492 # file logic works. |
567 LLVM_WIN_REVISION = GetSvnRevision(LLVM_REPO_URL) | 493 LLVM_WIN_REVISION = GetSvnRevision(LLVM_REPO_URL) |
568 PACKAGE_VERSION = LLVM_WIN_REVISION + '-0' | 494 PACKAGE_VERSION = LLVM_WIN_REVISION + '-0' |
569 | 495 |
570 return UpdateClang(args) | 496 return UpdateClang(args) |
571 | 497 |
572 | 498 |
573 if __name__ == '__main__': | 499 if __name__ == '__main__': |
574 sys.exit(main()) | 500 sys.exit(main()) |
OLD | NEW |