| 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 14 matching lines...) Expand all Loading... |
| 25 LLVM_WIN_REVISION = '217738' | 25 LLVM_WIN_REVISION = '217738' |
| 26 | 26 |
| 27 # Path constants. (All of these should be absolute paths.) | 27 # Path constants. (All of these should be absolute paths.) |
| 28 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) | 28 THIS_DIR = os.path.abspath(os.path.dirname(__file__)) |
| 29 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) | 29 CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..')) |
| 30 LLVM_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm') | 30 LLVM_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm') |
| 31 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', | 31 LLVM_BUILD_DIR = os.path.join(CHROMIUM_DIR, 'third_party', 'llvm-build', |
| 32 'Release+Asserts') | 32 'Release+Asserts') |
| 33 COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, '32bit-compiler-rt') | 33 COMPILER_RT_BUILD_DIR = os.path.join(LLVM_BUILD_DIR, '32bit-compiler-rt') |
| 34 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') | 34 CLANG_DIR = os.path.join(LLVM_DIR, 'tools', 'clang') |
| 35 LLD_DIR = os.path.join(LLVM_DIR, 'tools', 'lld') |
| 35 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt') | 36 COMPILER_RT_DIR = os.path.join(LLVM_DIR, 'projects', 'compiler-rt') |
| 36 STAMP_FILE = os.path.join(LLVM_BUILD_DIR, 'cr_build_revision') | 37 STAMP_FILE = os.path.join(LLVM_BUILD_DIR, 'cr_build_revision') |
| 37 | 38 |
| 38 LLVM_REPO_URL='https://llvm.org/svn/llvm-project' | 39 LLVM_REPO_URL='https://llvm.org/svn/llvm-project' |
| 39 if 'LLVM_REPO_URL' in os.environ: | 40 if 'LLVM_REPO_URL' in os.environ: |
| 40 LLVM_REPO_URL = os.environ['LLVM_REPO_URL'] | 41 LLVM_REPO_URL = os.environ['LLVM_REPO_URL'] |
| 41 | 42 |
| 42 | 43 |
| 43 def ReadStampFile(): | 44 def ReadStampFile(): |
| 44 """Return the contents of the stamp file, or '' if it doesn't exist.""" | 45 """Return the contents of the stamp file, or '' if it doesn't exist.""" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 return 0 | 173 return 0 |
| 173 | 174 |
| 174 AddCMakeToPath() | 175 AddCMakeToPath() |
| 175 ClobberChromiumBuildFiles() | 176 ClobberChromiumBuildFiles() |
| 176 | 177 |
| 177 # Reset the stamp file in case the build is unsuccessful. | 178 # Reset the stamp file in case the build is unsuccessful. |
| 178 WriteStampFile('') | 179 WriteStampFile('') |
| 179 | 180 |
| 180 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR) | 181 Checkout('LLVM', LLVM_REPO_URL + '/llvm/trunk', LLVM_DIR) |
| 181 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR) | 182 Checkout('Clang', LLVM_REPO_URL + '/cfe/trunk', CLANG_DIR) |
| 183 Checkout('LLD', LLVM_REPO_URL + '/lld/trunk', LLD_DIR) |
| 182 Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR) | 184 Checkout('compiler-rt', LLVM_REPO_URL + '/compiler-rt/trunk', COMPILER_RT_DIR) |
| 183 | 185 |
| 184 if not os.path.exists(LLVM_BUILD_DIR): | 186 if not os.path.exists(LLVM_BUILD_DIR): |
| 185 os.makedirs(LLVM_BUILD_DIR) | 187 os.makedirs(LLVM_BUILD_DIR) |
| 186 os.chdir(LLVM_BUILD_DIR) | 188 os.chdir(LLVM_BUILD_DIR) |
| 187 | 189 |
| 188 RunCommand(GetVSVersion().SetupScript('x64') + | 190 RunCommand(GetVSVersion().SetupScript('x64') + |
| 189 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', | 191 ['&&', 'cmake', '-GNinja', '-DCMAKE_BUILD_TYPE=Release', |
| 190 '-DLLVM_ENABLE_ASSERTIONS=ON', SubversionCmakeArg(), LLVM_DIR]) | 192 '-DLLVM_ENABLE_ASSERTIONS=ON', SubversionCmakeArg(), LLVM_DIR]) |
| 191 RunCommand(GetVSVersion().SetupScript('x64') + ['&&', 'ninja', 'all']) | 193 RunCommand(GetVSVersion().SetupScript('x64') + ['&&', 'ninja', 'all']) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 | 261 |
| 260 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): | 262 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): |
| 261 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' | 263 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' |
| 262 return 0 | 264 return 0 |
| 263 | 265 |
| 264 return UpdateClang() | 266 return UpdateClang() |
| 265 | 267 |
| 266 | 268 |
| 267 if __name__ == '__main__': | 269 if __name__ == '__main__': |
| 268 sys.exit(main()) | 270 sys.exit(main()) |
| OLD | NEW |