Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Side by Side Diff: win_toolchain/package_from_installed.py

Issue 1660723002: Updates to package VS 2015 to not require UCRT (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: CR fixes Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « win_toolchain/get_toolchain_if_necessary.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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\10\... 11 - C:\Program Files (x86)\Windows Kits\10\...
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 10 SDK. Select only the Windows SDK and Debugging Tools for 15 3. Install Windows 10 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 glob
24 import optparse 25 import optparse
25 import os 26 import os
26 import platform 27 import platform
27 import shutil 28 import shutil
28 import sys 29 import sys
29 import tempfile 30 import tempfile
30 import zipfile 31 import zipfile
31 32
32 import get_toolchain_if_necessary 33 import get_toolchain_if_necessary
33 34
(...skipping 26 matching lines...) Expand all
60 ('VC/redist/Debug_NonRedist/x86/Microsoft.VC120.DebugCRT', 'sys32'), 61 ('VC/redist/Debug_NonRedist/x86/Microsoft.VC120.DebugCRT', 'sys32'),
61 ('VC/redist/Debug_NonRedist/x86/Microsoft.VC120.DebugMFC', 'sys32'), 62 ('VC/redist/Debug_NonRedist/x86/Microsoft.VC120.DebugMFC', 'sys32'),
62 ('VC/redist/x64/Microsoft.VC120.CRT', 'sys64'), 63 ('VC/redist/x64/Microsoft.VC120.CRT', 'sys64'),
63 ('VC/redist/x64/Microsoft.VC120.MFC', 'sys64'), 64 ('VC/redist/x64/Microsoft.VC120.MFC', 'sys64'),
64 ('VC/redist/Debug_NonRedist/x64/Microsoft.VC120.DebugCRT', 'sys64'), 65 ('VC/redist/Debug_NonRedist/x64/Microsoft.VC120.DebugCRT', 'sys64'),
65 ('VC/redist/Debug_NonRedist/x64/Microsoft.VC120.DebugMFC', 'sys64'), 66 ('VC/redist/Debug_NonRedist/x64/Microsoft.VC120.DebugMFC', 'sys64'),
66 ] 67 ]
67 elif VS_VERSION == '2015': 68 elif VS_VERSION == '2015':
68 paths += [ 69 paths += [
69 ('VC/redist/x86/Microsoft.VC140.CRT', 'sys32'), 70 ('VC/redist/x86/Microsoft.VC140.CRT', 'sys32'),
71 ('VC/redist/x86/Microsoft.VC140.CRT', 'win_sdk/bin/x86'),
70 ('VC/redist/x86/Microsoft.VC140.MFC', 'sys32'), 72 ('VC/redist/x86/Microsoft.VC140.MFC', 'sys32'),
71 ('VC/redist/debug_nonredist/x86/Microsoft.VC140.DebugCRT', 'sys32'), 73 ('VC/redist/debug_nonredist/x86/Microsoft.VC140.DebugCRT', 'sys32'),
72 ('VC/redist/debug_nonredist/x86/Microsoft.VC140.DebugMFC', 'sys32'), 74 ('VC/redist/debug_nonredist/x86/Microsoft.VC140.DebugMFC', 'sys32'),
73 ('VC/redist/x64/Microsoft.VC140.CRT', 'sys64'), 75 ('VC/redist/x64/Microsoft.VC140.CRT', 'sys64'),
76 ('VC/redist/x64/Microsoft.VC140.CRT', 'VC/bin/amd64_x86'),
77 ('VC/redist/x64/Microsoft.VC140.CRT', 'VC/bin/amd64'),
78 ('VC/redist/x64/Microsoft.VC140.CRT', 'win_sdk/bin/x64'),
74 ('VC/redist/x64/Microsoft.VC140.MFC', 'sys64'), 79 ('VC/redist/x64/Microsoft.VC140.MFC', 'sys64'),
75 ('VC/redist/debug_nonredist/x64/Microsoft.VC140.DebugCRT', 'sys64'), 80 ('VC/redist/debug_nonredist/x64/Microsoft.VC140.DebugCRT', 'sys64'),
76 ('VC/redist/debug_nonredist/x64/Microsoft.VC140.DebugMFC', 'sys64'), 81 ('VC/redist/debug_nonredist/x64/Microsoft.VC140.DebugMFC', 'sys64'),
77 ] 82 ]
78 else: 83 else:
79 raise ValueError('VS_VERSION %s' % VS_VERSION) 84 raise ValueError('VS_VERSION %s' % VS_VERSION)
80 85
81 if VS_VERSION == '2013': 86 if VS_VERSION == '2013':
82 vs_path = r'C:\Program Files (x86)\Microsoft Visual Studio 12.0' 87 vs_path = r'C:\Program Files (x86)\Microsoft Visual Studio 12.0'
83 else: 88 else:
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 'Windows6.1-KB2999226-x64.msu', 149 'Windows6.1-KB2999226-x64.msu',
145 'Windows8-RT-KB2999226-x64.msu', 150 'Windows8-RT-KB2999226-x64.msu',
146 'Windows8.1-KB2999226-x64.msu', 151 'Windows8.1-KB2999226-x64.msu',
147 ] 152 ]
148 153
149 for installer in universal_runtime_installers: 154 for installer in universal_runtime_installers:
150 result.append((os.path.join(os.environ['userprofile'], 'downloads', 155 result.append((os.path.join(os.environ['userprofile'], 'downloads',
151 installer), 156 installer),
152 os.path.join('installers', installer))) 157 os.path.join('installers', installer)))
153 158
154 system_crt_files = [ 159 if VS_VERSION == '2015':
155 # Needed to let debug binaries run. 160 # Copy the x86 ucrt DLLs to all directories with 32-bit binaries that are
156 'ucrtbased.dll', 161 # added to the path by SetEnv.cmd, and to sys32.
157 ] 162 ucrt_paths = glob.glob(os.path.join(sdk_path, r'redist\ucrt\dlls\x86\*'))
158 bitness = platform.architecture()[0] 163 for ucrt_path in ucrt_paths:
159 # When running 64-bit python the x64 DLLs will be in System32 164 ucrt_file = os.path.split(ucrt_path)[1]
160 x64_path = 'System32' if bitness == '64bit' else 'Sysnative' 165 for dest_dir in [ r'win_sdk\bin\x86', 'sys32' ]:
161 x64_path = os.path.join(r'C:\Windows', x64_path) 166 result.append((ucrt_path, os.path.join(dest_dir, ucrt_file)))
162 for system_crt_file in system_crt_files: 167 # Copy the x64 ucrt DLLs to all directories with 64-bit binaries that are
scottmg 2016/02/03 04:12:00 nit; add a blank line before this comment
brucedawson 2016/02/03 06:32:15 Done.
163 result.append((os.path.join(r'C:\Windows\SysWOW64', system_crt_file), 168 # added to the path by SetEnv.cmd, and to sys64.
164 os.path.join('sys32', system_crt_file))) 169 ucrt_paths = glob.glob(os.path.join(sdk_path, r'redist\ucrt\dlls\x64\*'))
165 result.append((os.path.join(x64_path, system_crt_file), 170 for ucrt_path in ucrt_paths:
166 os.path.join('sys64', system_crt_file))) 171 ucrt_file = os.path.split(ucrt_path)[1]
172 for dest_dir in [ r'VC\bin\amd64_x86', r'VC\bin\amd64',
173 r'win_sdk\bin\x64', 'sys64']:
174 result.append((ucrt_path, os.path.join(dest_dir, ucrt_file)))
175
176 system_crt_files = [
177 # Needed to let debug binaries run.
178 'ucrtbased.dll',
179 ]
180 bitness = platform.architecture()[0]
181 # When running 64-bit python the x64 DLLs will be in System32
182 x64_path = 'System32' if bitness == '64bit' else 'Sysnative'
183 x64_path = os.path.join(r'C:\Windows', x64_path)
184 for system_crt_file in system_crt_files:
185 result.append((os.path.join(r'C:\Windows\SysWOW64', system_crt_file),
186 os.path.join('sys32', system_crt_file)))
187 result.append((os.path.join(x64_path, system_crt_file),
188 os.path.join('sys64', system_crt_file)))
167 189
168 # Generically drop all arm stuff that we don't need, and 190 # Generically drop all arm stuff that we don't need, and
169 # drop .msi files because we don't need installers. 191 # drop .msi files because we don't need installers.
170 return [(f, t) for f, t in result if 'arm\\' not in f.lower() and 192 return [(f, t) for f, t in result if 'arm\\' not in f.lower() and
171 'arm64\\' not in f.lower() and 193 'arm64\\' not in f.lower() and
172 not f.lower().endswith('.msi')] 194 not f.lower().endswith('.msi')]
173 195
174 196
175 def GenerateSetEnvCmd(target_dir): 197 def GenerateSetEnvCmd(target_dir):
176 """Generate a batch file that gyp expects to exist to set up the compiler 198 """Generate a batch file that gyp expects to exist to set up the compiler
177 environment. 199 environment.
178 200
179 This is normally generated by a full install of the SDK, but we 201 This is normally generated by a full install of the SDK, but we
180 do it here manually since we do not do a full install.""" 202 do it here manually since we do not do a full install."""
181 with open(os.path.join( 203 with open(os.path.join(
182 target_dir, r'win_sdk\bin\SetEnv.cmd'), 'w') as f: 204 target_dir, r'win_sdk\bin\SetEnv.cmd'), 'w') as f:
183 f.write('@echo off\n' 205 f.write('@echo off\n'
184 ':: Generated by win_toolchain\\package_from_installed.py.\n' 206 ':: Generated by win_toolchain\\package_from_installed.py.\n'
185 # Common to x86 and x64 207 # Common to x86 and x64
186 'set VSINSTALLDIR=%~dp0..\\..\\\n' 208 'set VSINSTALLDIR=%~dp0..\\..\\\n'
187 'set VCINSTALLDIR=%~dp0..\\..\\VC\\\n' 209 'set VCINSTALLDIR=%~dp0..\\..\\VC\\\n'
188 'set PATH=%~dp0..\\..\\Common7\\IDE;%PATH%\n'
189 'set INCLUDE=%~dp0..\\..\\win_sdk\\Include\\WINVERSION\\um;' 210 'set INCLUDE=%~dp0..\\..\\win_sdk\\Include\\WINVERSION\\um;'
190 '%~dp0..\\..\\win_sdk\\Include\\WINVERSION\\shared;' 211 '%~dp0..\\..\\win_sdk\\Include\\WINVERSION\\shared;'
191 '%~dp0..\\..\\win_sdk\\Include\\WINVERSION\\winrt;'.replace( 212 '%~dp0..\\..\\win_sdk\\Include\\WINVERSION\\winrt;'.replace(
192 'WINVERSION', WIN_VERSION)) 213 'WINVERSION', WIN_VERSION))
193 if VS_VERSION == '2015': 214 if VS_VERSION == '2015':
194 f.write('%~dp0..\\..\\win_sdk\\Include\\WINVERSION\\ucrt;'.replace( 215 f.write('%~dp0..\\..\\win_sdk\\Include\\WINVERSION\\ucrt;'.replace(
195 'WINVERSION', WIN_VERSION)) 216 'WINVERSION', WIN_VERSION))
196 f.write('%~dp0..\\..\\VC\\include;' 217 f.write('%~dp0..\\..\\VC\\include;'
197 '%~dp0..\\..\\VC\\atlmfc\\include\n') 218 '%~dp0..\\..\\VC\\atlmfc\\include\n')
198 219
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 sys.stdout.write('\rWrote to %s.%s\n' % (output, ' '*50)) 342 sys.stdout.write('\rWrote to %s.%s\n' % (output, ' '*50))
322 sys.stdout.flush() 343 sys.stdout.flush()
323 344
324 RenameToSha1(output) 345 RenameToSha1(output)
325 346
326 return 0 347 return 0
327 348
328 349
329 if __name__ == '__main__': 350 if __name__ == '__main__':
330 sys.exit(main()) 351 sys.exit(main())
OLDNEW
« no previous file with comments | « win_toolchain/get_toolchain_if_necessary.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698