Make it possible to build a Windows SDK package without arm libs

Not everyone builds Chromium for arm so then it's practical to be
able to use a smaller SDK package without arm support included.

This also removes some samples that should not be needed.

Recipe-Nontrivial-Roll: chromiumos
Change-Id: I10f64d8907600fe79d3051083d100a7562d3a797
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/1752202
Commit-Queue: Daniel Bratell <bratell@opera.com>
Reviewed-by: Bruce Dawson <brucedawson@chromium.org>
changes/02/1752202/6
Daniel Bratell 6 years ago committed by Commit Bot
parent 08233ee499
commit f411acf552

@ -92,7 +92,7 @@ def BuildRepackageFileList(src_dir):
return result return result
def BuildFileList(override_dir): def BuildFileList(override_dir, include_arm):
result = [] result = []
# Subset of VS corresponding roughly to VC. # Subset of VS corresponding roughly to VC.
@ -144,12 +144,15 @@ def BuildFileList(override_dir):
('VC/redist/MSVC/14.*.*/x64/Microsoft.VC*.CRT', 'VC/bin/amd64'), ('VC/redist/MSVC/14.*.*/x64/Microsoft.VC*.CRT', 'VC/bin/amd64'),
('VC/redist/MSVC/14.*.*/x64/Microsoft.VC*.CRT', 'win_sdk/bin/x64'), ('VC/redist/MSVC/14.*.*/x64/Microsoft.VC*.CRT', 'win_sdk/bin/x64'),
('VC/redist/MSVC/14.*.*/debug_nonredist/x64/Microsoft.VC*.DebugCRT', 'sys64'), ('VC/redist/MSVC/14.*.*/debug_nonredist/x64/Microsoft.VC*.DebugCRT', 'sys64'),
]
if include_arm:
paths += [
('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', 'sysarm64'), ('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', 'sysarm64'),
('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', 'VC/bin/amd64_arm64'), ('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', 'VC/bin/amd64_arm64'),
('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', 'VC/bin/arm64'), ('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', 'VC/bin/arm64'),
('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', 'win_sdk/bin/arm64'), ('VC/redist/MSVC/14.*.*/arm64/Microsoft.VC*.CRT', 'win_sdk/bin/arm64'),
('VC/redist/MSVC/14.*.*/debug_nonredist/arm64/Microsoft.VC*.DebugCRT', 'sysarm64'), ('VC/redist/MSVC/14.*.*/debug_nonredist/arm64/Microsoft.VC*.DebugCRT', 'sysarm64'),
] ]
else: else:
raise ValueError('VS_VERSION %s' % VS_VERSION) raise ValueError('VS_VERSION %s' % VS_VERSION)
@ -238,8 +241,16 @@ def BuildFileList(override_dir):
# Needed to let debug binaries run. # Needed to let debug binaries run.
'ucrtbased.dll', 'ucrtbased.dll',
] ]
cpu_pairs = [
('x86', 'sys32'),
('x64', 'sys64'),
]
if include_arm:
cpu_pairs += [
('arm64', 'sysarm64'),
]
for system_crt_file in system_crt_files: for system_crt_file in system_crt_files:
for cpu_pair in [('x86', 'sys32'), ('x64', 'sys64'), ('arm64', 'sysarm64')]: for cpu_pair in cpu_pairs:
target_cpu, dest_dir = cpu_pair target_cpu, dest_dir = cpu_pair
src_path = os.path.join(sdk_path, 'bin', WIN_VERSION, target_cpu, 'ucrt') src_path = os.path.join(sdk_path, 'bin', WIN_VERSION, target_cpu, 'ucrt')
result.append((os.path.join(src_path, system_crt_file), result.append((os.path.join(src_path, system_crt_file),
@ -247,12 +258,16 @@ def BuildFileList(override_dir):
# Generically drop all arm stuff that we don't need, and # Generically drop all arm stuff that we don't need, and
# drop .msi files because we don't need installers, and drop windows.winmd # drop .msi files because we don't need installers, and drop windows.winmd
# because it is unneeded and is different on every machine. # because it is unneeded and is different on every machine and drop
return [(f, t) for f, t in result if 'arm\\' not in f.lower() and # samples since those are not used by any tools.
not f.lower().endswith('.msi') and def is_skippable(f):
not f.lower().endswith('.msm') and return ('arm\\' in f.lower() or
not f.lower().endswith('windows.winmd')] (not include_arm and 'arm64\\' in f.lower()) or
'samples\\' in f.lower() or
f.lower().endswith(('.msi',
'.msm',
'windows.winmd')))
return [(f, t) for f, t in result if not is_skippable(f)]
def GenerateSetEnvCmd(target_dir): def GenerateSetEnvCmd(target_dir):
"""Generate a batch file that gyp expects to exist to set up the compiler """Generate a batch file that gyp expects to exist to set up the compiler
@ -395,7 +410,7 @@ def GenerateSetEnvCmd(target_dir):
f) f)
def AddEnvSetup(files): def AddEnvSetup(files, include_arm):
"""We need to generate this file in the same way that the "from pieces" """We need to generate this file in the same way that the "from pieces"
script does, so pull that in here.""" script does, so pull that in here."""
tempdir = tempfile.mkdtemp() tempdir = tempfile.mkdtemp()
@ -407,8 +422,9 @@ def AddEnvSetup(files):
'win_sdk\\bin\\SetEnv.x86.json')) 'win_sdk\\bin\\SetEnv.x86.json'))
files.append((os.path.join(tempdir, 'win_sdk', 'bin', 'SetEnv.x64.json'), files.append((os.path.join(tempdir, 'win_sdk', 'bin', 'SetEnv.x64.json'),
'win_sdk\\bin\\SetEnv.x64.json')) 'win_sdk\\bin\\SetEnv.x64.json'))
files.append((os.path.join(tempdir, 'win_sdk', 'bin', 'SetEnv.arm64.json'), if include_arm:
'win_sdk\\bin\\SetEnv.arm64.json')) files.append((os.path.join(tempdir, 'win_sdk', 'bin', 'SetEnv.arm64.json'),
'win_sdk\\bin\\SetEnv.arm64.json'))
vs_version_file = os.path.join(tempdir, 'VS_VERSION') vs_version_file = os.path.join(tempdir, 'VS_VERSION')
with open(vs_version_file, 'wb') as version: with open(vs_version_file, 'wb') as version:
print(VS_VERSION, file=version) print(VS_VERSION, file=version)
@ -444,6 +460,9 @@ def main():
parser.add_option('-d', '--dryrun', action='store_true', dest='dryrun', parser.add_option('-d', '--dryrun', action='store_true', dest='dryrun',
default=False, default=False,
help='scan for file existence and prints statistics') help='scan for file existence and prints statistics')
parser.add_option('--noarm', action='store_false', dest='arm',
default=True,
help='Avoids arm parts of the SDK')
parser.add_option('--override', action='store', type='string', parser.add_option('--override', action='store', type='string',
dest='override_dir', default=None, dest='override_dir', default=None,
help='Specify alternate bin/include/lib directory') help='Specify alternate bin/include/lib directory')
@ -481,9 +500,9 @@ def main():
VC_TOOLS = 'VC' VC_TOOLS = 'VC'
print('Building file list for VS %s Windows %s...' % (VS_VERSION, WIN_VERSION)) print('Building file list for VS %s Windows %s...' % (VS_VERSION, WIN_VERSION))
files = BuildFileList(options.override_dir) files = BuildFileList(options.override_dir, options.arm)
AddEnvSetup(files) AddEnvSetup(files, options.arm)
if False: if False:
for f in files: for f in files:

Loading…
Cancel
Save