OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2015 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 """This script will check out llvm and clang, and then package the results up | 6 """This script will check out llvm and clang, and then package the results up |
7 to a tgz file.""" | 7 to a tgz file.""" |
8 | 8 |
9 import argparse | 9 import argparse |
10 import fnmatch | 10 import fnmatch |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 want.extend(['bin/libc++.1.dylib', | 142 want.extend(['bin/libc++.1.dylib', |
143 # Copy only the OSX (ASan and profile) and iossim (ASan) | 143 # Copy only the OSX (ASan and profile) and iossim (ASan) |
144 # runtime libraries: | 144 # runtime libraries: |
145 'lib/clang/*/lib/darwin/*asan_osx*', | 145 'lib/clang/*/lib/darwin/*asan_osx*', |
146 'lib/clang/*/lib/darwin/*asan_iossim*', | 146 'lib/clang/*/lib/darwin/*asan_iossim*', |
147 'lib/clang/*/lib/darwin/*profile_osx*', | 147 'lib/clang/*/lib/darwin/*profile_osx*', |
148 ]) | 148 ]) |
149 elif sys.platform.startswith('linux'): | 149 elif sys.platform.startswith('linux'): |
150 # Copy only | 150 # Copy only |
151 # lib/clang/*/lib/linux/libclang_rt.{[atm]san,san,ubsan,profile}-*.a , | 151 # lib/clang/*/lib/linux/libclang_rt.{[atm]san,san,ubsan,profile}-*.a , |
152 # but not dfsan. | 152 # but not dfsan. Also, copy LLVM Gold plugin. |
153 want.extend(['lib/clang/*/lib/linux/*[atm]san*', | 153 want.extend(['lib/clang/*/lib/linux/*[atm]san*', |
154 'lib/clang/*/lib/linux/*ubsan*', | 154 'lib/clang/*/lib/linux/*ubsan*', |
155 'lib/clang/*/lib/linux/*libclang_rt.san*', | 155 'lib/clang/*/lib/linux/*libclang_rt.san*', |
156 'lib/clang/*/lib/linux/*profile*', | 156 'lib/clang/*/lib/linux/*profile*', |
157 'lib/clang/*/msan_blacklist.txt', | 157 'lib/clang/*/msan_blacklist.txt', |
158 'lib/LLVMgold.so', | |
158 ]) | 159 ]) |
159 elif sys.platform == 'win32': | 160 elif sys.platform == 'win32': |
160 want.extend(['lib/clang/*/lib/windows/clang_rt.asan*.dll', | 161 want.extend(['lib/clang/*/lib/windows/clang_rt.asan*.dll', |
161 'lib/clang/*/lib/windows/clang_rt.asan*.lib', | 162 'lib/clang/*/lib/windows/clang_rt.asan*.lib', |
162 'lib/clang/*/include_sanitizer/*', | 163 'lib/clang/*/include_sanitizer/*', |
163 ]) | 164 ]) |
164 if args.gcc_toolchain is not None: | 165 if args.gcc_toolchain is not None: |
165 # Copy the stdlibc++.so.6 we linked Clang against so it can run. | 166 # Copy the stdlibc++.so.6 we linked Clang against so it can run. |
166 want.append('lib/libstdc++.so.6') | 167 want.append('lib/libstdc++.so.6') |
167 | 168 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 shutil.copytree(os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'include', 'c++'), | 203 shutil.copytree(os.path.join(LLVM_BOOTSTRAP_INSTALL_DIR, 'include', 'c++'), |
203 os.path.join(pdir, 'include', 'c++')) | 204 os.path.join(pdir, 'include', 'c++')) |
204 | 205 |
205 # Copy buildlog over. | 206 # Copy buildlog over. |
206 shutil.copy('buildlog.txt', pdir) | 207 shutil.copy('buildlog.txt', pdir) |
207 | 208 |
208 # Create archive. | 209 # Create archive. |
209 tar_entries = ['bin', 'lib', 'buildlog.txt'] | 210 tar_entries = ['bin', 'lib', 'buildlog.txt'] |
210 if sys.platform == 'darwin': | 211 if sys.platform == 'darwin': |
211 tar_entries += ['include'] | 212 tar_entries += ['include'] |
212 with tarfile.open(pdir + '.tgz', 'w:gz') as tar: | 213 tar_mode = 'w:gz' |
214 tar_ext = '.tgz' | |
215 # On Linux, we use xz for compression that is about 35% more efficient | |
216 # than gzip on Clang toolchain archives. | |
217 if sys.platform.startswith('linux'): | |
218 tar_mode = 'w' | |
219 tar_ext = '.tar' | |
220 with tarfile.open(pdir + tar_ext, tar_mode) as tar: | |
213 for entry in tar_entries: | 221 for entry in tar_entries: |
214 tar.add(os.path.join(pdir, entry), arcname=entry, filter=PrintTarProgress) | 222 tar.add(os.path.join(pdir, entry), arcname=entry, filter=PrintTarProgress) |
223 if sys.platform.startswith('linux'): | |
224 subprocess.call(['xz', '-z', '-9', pdir+tar_ext]) | |
225 tar_ext = '.tar.xz' | |
215 | 226 |
216 if sys.platform == 'darwin': | 227 if sys.platform == 'darwin': |
217 platform = 'Mac' | 228 platform = 'Mac' |
218 elif sys.platform == 'win32': | 229 elif sys.platform == 'win32': |
219 platform = 'Win' | 230 platform = 'Win' |
220 else: | 231 else: |
221 platform = 'Linux_x64' | 232 platform = 'Linux_x64' |
222 | 233 |
223 print 'To upload, run:' | 234 print 'To upload, run:' |
224 print ('gsutil cp -a public-read %s.tgz ' | 235 print ('gsutil cp -a public-read %s%s ' |
225 'gs://chromium-browser-clang/%s/%s.tgz') % (pdir, platform, pdir) | 236 'gs://chromium-browser-clang/%s/%s%s') % |
237 (pdir, tar_ext, platform, pdir, tar_ext) | |
226 | 238 |
227 # Zip up gold plugin on Linux. | 239 # Zip up gold plugin on Linux. |
hans
2015/10/05 20:53:57
Bundling the plugin makes this code unnecessary.
| |
228 if sys.platform.startswith('linux'): | 240 if sys.platform.startswith('linux'): |
229 golddir = 'llvmgold-' + stamp | 241 golddir = 'llvmgold-' + stamp |
230 shutil.rmtree(golddir, ignore_errors=True) | 242 shutil.rmtree(golddir, ignore_errors=True) |
231 os.makedirs(os.path.join(golddir, 'lib')) | 243 os.makedirs(os.path.join(golddir, 'lib')) |
232 shutil.copy(os.path.join(LLVM_RELEASE_DIR, 'lib', 'LLVMgold.so'), | 244 shutil.copy(os.path.join(LLVM_RELEASE_DIR, 'lib', 'LLVMgold.so'), |
233 os.path.join(golddir, 'lib')) | 245 os.path.join(golddir, 'lib')) |
234 with tarfile.open(golddir + '.tgz', 'w:gz') as tar: | 246 with tarfile.open(golddir + '.tgz', 'w:gz') as tar: |
235 tar.add(os.path.join(golddir, 'lib'), arcname='lib', | 247 tar.add(os.path.join(golddir, 'lib'), arcname='lib', |
236 filter=PrintTarProgress) | 248 filter=PrintTarProgress) |
237 print ('gsutil cp -a public-read %s.tgz ' | 249 print ('gsutil cp -a public-read %s.tgz ' |
238 'gs://chromium-browser-clang/%s/%s.tgz') % (golddir, platform, | 250 'gs://chromium-browser-clang/%s/%s.tgz') % (golddir, platform, |
239 golddir) | 251 golddir) |
240 | 252 |
241 # FIXME: Warn if the file already exists on the server. | 253 # FIXME: Warn if the file already exists on the server. |
242 | 254 |
243 | 255 |
244 if __name__ == '__main__': | 256 if __name__ == '__main__': |
245 sys.exit(main()) | 257 sys.exit(main()) |
OLD | NEW |