OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """ | 5 """ |
6 From a system-installed copy of the toolchain, packages all the required bits | 6 From a system-installed copy of the toolchain, packages all the required bits |
7 into a .zip file. | 7 into a .zip file. |
8 | 8 |
9 It assumes default install locations for tools, in particular: | 9 It assumes default install locations for tools, in particular: |
10 - C:\Program Files (x86)\Microsoft Visual Studio 12.0\... | 10 - C:\Program Files (x86)\Microsoft Visual Studio 12.0\... |
11 - C:\Program Files (x86)\Windows Kits\8.0\... | 11 - C:\Program Files (x86)\Windows Kits\8.1\... |
12 | 12 |
13 1. Start from a fresh Win7 VM image. | 13 1. Start from a fresh Win7 VM image. |
14 2. Install VS Pro. Deselect everything except MFC. | 14 2. Install VS Pro. Deselect everything except MFC. |
15 3. Install Windows 8 SDK. Select only the Windows SDK and Debugging Tools for | 15 3. Install Windows 8 SDK. Select only the Windows SDK and Debugging Tools for |
16 Windows. | 16 Windows. |
17 4. Run this script, which will build a <sha1>.zip. | 17 4. Run this script, which will build a <sha1>.zip. |
18 | 18 |
19 Express is not yet supported by this script, but patches welcome (it's not too | 19 Express is not yet supported by this script, but patches welcome (it's not too |
20 useful as the resulting zip can't be redistributed, and most will presumably | 20 useful as the resulting zip can't be redistributed, and most will presumably |
21 have a Pro license anyway). | 21 have a Pro license anyway). |
22 """ | 22 """ |
23 | 23 |
24 import os | 24 import os |
25 import shutil | 25 import shutil |
26 import sys | 26 import sys |
27 import tempfile | 27 import tempfile |
28 import zipfile | 28 import zipfile |
29 | 29 |
30 import get_toolchain_if_necessary | 30 import get_toolchain_if_necessary |
31 import toolchain2013 # pylint: disable=F0401 | 31 import toolchain2013 # pylint: disable=F0401 |
32 | 32 |
33 | 33 |
34 def BuildFileList(): | 34 def BuildFileList(): |
35 result = [] | 35 result = [] |
36 | 36 |
37 # Subset of VS corresponding roughly to VC. | 37 # Subset of VS corresponding roughly to VC. |
38 vs_path = r'C:\Program Files (x86)\Microsoft Visual Studio 12.0' | 38 vs_path = r'C:\Program Files (x86)\Microsoft Visual Studio 12.0' |
39 for path in [ | 39 for path in [ |
40 'DIA SDK/bin', | 40 'DIA SDK/bin', |
41 'DIA SDK/idl', | 41 'DIA SDK/idl', |
42 'DIA SDK/include', | 42 'DIA SDK/include', |
43 'DIA SDK/lib', | 43 'DIA SDK/lib', |
44 'VC/atlmfc', | 44 'VC/atlmfc', |
45 'VC/bin', | 45 'VC/bin', |
46 'VC/crt', | 46 'VC/crt', |
47 'VC/include', | 47 'VC/include', |
48 'VC/lib', | 48 'VC/lib', |
49 'VC/redist', | 49 'VC/redist', |
(...skipping 24 matching lines...) Expand all Loading... |
74 with open(final_from, 'rb') as unpatched_f: | 74 with open(final_from, 'rb') as unpatched_f: |
75 unpatched_contents = unpatched_f.read() | 75 unpatched_contents = unpatched_f.read() |
76 os.write(handle, | 76 os.write(handle, |
77 unpatched_contents.replace('warning(disable: 4127)', | 77 unpatched_contents.replace('warning(disable: 4127)', |
78 'warning(disable: 4127 4702)')) | 78 'warning(disable: 4127 4702)')) |
79 result.append((patched, dest)) | 79 result.append((patched, dest)) |
80 else: | 80 else: |
81 result.append((final_from, dest)) | 81 result.append((final_from, dest)) |
82 | 82 |
83 # Just copy the whole SDK. | 83 # Just copy the whole SDK. |
84 sdk_path = r'C:\Program Files (x86)\Windows Kits\8.0' | 84 sdk_path = r'C:\Program Files (x86)\Windows Kits\8.1' |
85 for root, _, files in os.walk(sdk_path): | 85 for root, _, files in os.walk(sdk_path): |
86 for f in files: | 86 for f in files: |
87 combined = os.path.normpath(os.path.join(root, f)) | 87 combined = os.path.normpath(os.path.join(root, f)) |
88 to = os.path.join('win8sdk', combined[len(sdk_path) + 1:]) | 88 to = os.path.join('win8sdk', combined[len(sdk_path) + 1:]) |
89 result.append((combined, to)) | 89 result.append((combined, to)) |
90 | 90 |
91 # Generically drop all arm stuff that we don't need. | 91 # Generically drop all arm stuff that we don't need. |
92 return [(f, t) for f, t in result if 'arm\\' not in f.lower()] | 92 return [(f, t) for f, t in result if 'arm\\' not in f.lower()] |
93 | 93 |
94 | 94 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 sys.stdout.write('\rWrote to %s.%s\n' % (output, ' '*50)) | 146 sys.stdout.write('\rWrote to %s.%s\n' % (output, ' '*50)) |
147 sys.stdout.flush() | 147 sys.stdout.flush() |
148 | 148 |
149 RenameToSha1(output) | 149 RenameToSha1(output) |
150 | 150 |
151 return 0 | 151 return 0 |
152 | 152 |
153 | 153 |
154 if __name__ == '__main__': | 154 if __name__ == '__main__': |
155 sys.exit(main()) | 155 sys.exit(main()) |
OLD | NEW |