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

Side by Side Diff: tools/gn.py

Issue 2858623002: Remove MIPS support (Closed)
Patch Set: Merge and cleanup Created 3 years, 6 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 | « tools/gardening/lib/src/shard_data.dart ('k') | tools/gyp/configurations.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2016 The Dart project authors. All rights reserved. 2 # Copyright 2016 The Dart project 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 import argparse 6 import argparse
7 import multiprocessing 7 import multiprocessing
8 import os 8 import os
9 import shutil 9 import shutil
10 import subprocess 10 import subprocess
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 def merge(key, value): 68 def merge(key, value):
69 if type(value) is bool: 69 if type(value) is bool:
70 return '%s=%s' % (key, 'true' if value else 'false') 70 return '%s=%s' % (key, 'true' if value else 'false')
71 elif type(value) is int: 71 elif type(value) is int:
72 return '%s=%d' % (key, value) 72 return '%s=%d' % (key, value)
73 return '%s="%s"' % (key, value) 73 return '%s="%s"' % (key, value)
74 return [merge(x, y) for x, y in gn_args.iteritems()] 74 return [merge(x, y) for x, y in gn_args.iteritems()]
75 75
76 76
77 def HostCpuForArch(arch): 77 def HostCpuForArch(arch):
78 if arch in ['ia32', 'arm', 'armv6', 'armv5te', 'mips', 78 if arch in ['ia32', 'arm', 'armv6', 'armv5te',
79 'simarm', 'simarmv6', 'simarmv5te', 'simmips', 'simdbc', 79 'simarm', 'simarmv6', 'simarmv5te', 'simdbc',
80 'armsimdbc']: 80 'armsimdbc']:
81 return 'x86' 81 return 'x86'
82 if arch in ['x64', 'arm64', 'simarm64', 'simdbc64', 'armsimdbc64']: 82 if arch in ['x64', 'arm64', 'simarm64', 'simdbc64', 'armsimdbc64']:
83 return 'x64' 83 return 'x64'
84 84
85 85
86 def TargetCpuForArch(arch, target_os): 86 def TargetCpuForArch(arch, target_os):
87 if arch in ['ia32', 'simarm', 'simarmv6', 'simarmv5te', 'simmips']: 87 if arch in ['ia32', 'simarm', 'simarmv6', 'simarmv5te']:
88 return 'x86' 88 return 'x86'
89 if arch in ['simarm64']: 89 if arch in ['simarm64']:
90 return 'x64' 90 return 'x64'
91 if arch == 'mips':
92 return 'mipsel'
93 if arch == 'simdbc': 91 if arch == 'simdbc':
94 return 'arm' if target_os == 'android' else 'x86' 92 return 'arm' if target_os == 'android' else 'x86'
95 if arch == 'simdbc64': 93 if arch == 'simdbc64':
96 return 'arm64' if target_os == 'android' else 'x64' 94 return 'arm64' if target_os == 'android' else 'x64'
97 if arch == 'armsimdbc': 95 if arch == 'armsimdbc':
98 return 'arm' 96 return 'arm'
99 if arch == 'armsimdbc64': 97 if arch == 'armsimdbc64':
100 return 'arm64' 98 return 'arm64'
101 return arch 99 return arch
102 100
(...skipping 17 matching lines...) Expand all
120 118
121 119
122 def UseSanitizer(args): 120 def UseSanitizer(args):
123 return args.asan or args.msan or args.tsan 121 return args.asan or args.msan or args.tsan
124 122
125 123
126 def DontUseClang(args, target_os, host_cpu, target_cpu): 124 def DontUseClang(args, target_os, host_cpu, target_cpu):
127 # We don't have clang on Windows. 125 # We don't have clang on Windows.
128 return (target_os == 'win' 126 return (target_os == 'win'
129 # TODO(zra): Experiment with using clang for the arm cross-builds. 127 # TODO(zra): Experiment with using clang for the arm cross-builds.
130 or (target_os == 'linux' 128 or (target_os == 'linux' and target_cpu.startswith('arm'))
131 and (target_cpu.startswith('arm') or
132 target_cpu.startswith('mips'))
133 # TODO(zra): Only use clang when a sanitizer build is specified until 129 # TODO(zra): Only use clang when a sanitizer build is specified until
134 # clang bugs in tcmalloc inline assembly for ia32 are fixed. 130 # clang bugs in tcmalloc inline assembly for ia32 are fixed.
135 or (target_os == 'linux' 131 or (target_os == 'linux'
136 and host_cpu == 'x86' 132 and host_cpu == 'x86'
137 and not UseSanitizer(args)))) 133 and not UseSanitizer(args)))
138 134
139 135
140 def ToGnArgs(args, mode, arch, target_os): 136 def ToGnArgs(args, mode, arch, target_os):
141 gn_args = {} 137 gn_args = {}
142 138
143 host_os = HostOsForGn(HOST_OS) 139 host_os = HostOsForGn(HOST_OS)
144 if target_os == 'host': 140 if target_os == 'host':
145 gn_args['target_os'] = host_os 141 gn_args['target_os'] = host_os
146 else: 142 else:
147 gn_args['target_os'] = target_os 143 gn_args['target_os'] = target_os
148 144
149 if arch.startswith('mips'):
150 bold = '\033[1m'
151 reset = '\033[0m'
152 print(bold + "Warning: MIPS architectures are unlikely to be supported in "
153 "upcoming releases. Please consider using another architecture "
154 "and/or file an issue explaining your specific use of and need for "
155 "MIPS support." + reset)
156
157 gn_args['dart_target_arch'] = arch 145 gn_args['dart_target_arch'] = arch
158 gn_args['target_cpu'] = TargetCpuForArch(arch, target_os) 146 gn_args['target_cpu'] = TargetCpuForArch(arch, target_os)
159 gn_args['host_cpu'] = HostCpuForArch(arch) 147 gn_args['host_cpu'] = HostCpuForArch(arch)
160 crossbuild = gn_args['target_cpu'] != gn_args['host_cpu'] 148 crossbuild = gn_args['target_cpu'] != gn_args['host_cpu']
161 149
162 # See: runtime/observatory/BUILD.gn. 150 # See: runtime/observatory/BUILD.gn.
163 # This allows the standalone build of the observatory to fall back on 151 # This allows the standalone build of the observatory to fall back on
164 # dart_bootstrap if the prebuilt SDK doesn't work. 152 # dart_bootstrap if the prebuilt SDK doesn't work.
165 gn_args['dart_host_pub_exe'] = "" 153 gn_args['dart_host_pub_exe'] = ""
166 154
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 args.os = 'host,android' 253 args.os = 'host,android'
266 args.mode = args.mode.split(',') 254 args.mode = args.mode.split(',')
267 args.arch = args.arch.split(',') 255 args.arch = args.arch.split(',')
268 args.os = args.os.split(',') 256 args.os = args.os.split(',')
269 for mode in args.mode: 257 for mode in args.mode:
270 if not mode in ['debug', 'release', 'product']: 258 if not mode in ['debug', 'release', 'product']:
271 print "Unknown mode %s" % mode 259 print "Unknown mode %s" % mode
272 return False 260 return False
273 for arch in args.arch: 261 for arch in args.arch:
274 archs = ['ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6', 262 archs = ['ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6',
275 'simarmv5te', 'armv5te', 'simmips', 'mips', 'simarm64', 'arm64', 263 'simarmv5te', 'armv5te', 'simarm64', 'arm64',
276 'simdbc', 'simdbc64', 'armsimdbc', 'armsimdbc64'] 264 'simdbc', 'simdbc64', 'armsimdbc', 'armsimdbc64']
277 if not arch in archs: 265 if not arch in archs:
278 print "Unknown arch %s" % arch 266 print "Unknown arch %s" % arch
279 return False 267 return False
280 oses = [ProcessOsOption(os_name) for os_name in args.os] 268 oses = [ProcessOsOption(os_name) for os_name in args.os]
281 for os_name in oses: 269 for os_name in oses:
282 if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']: 270 if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']:
283 print "Unknown os %s" % os_name 271 print "Unknown os %s" % os_name
284 return False 272 return False
285 if os_name != HOST_OS: 273 if os_name != HOST_OS:
286 if os_name != 'android': 274 if os_name != 'android':
287 print "Unsupported target os %s" % os_name 275 print "Unsupported target os %s" % os_name
288 return False 276 return False
289 if not HOST_OS in ['linux', 'macos']: 277 if not HOST_OS in ['linux', 'macos']:
290 print ("Cross-compilation to %s is not supported on host os %s." 278 print ("Cross-compilation to %s is not supported on host os %s."
291 % (os_name, HOST_OS)) 279 % (os_name, HOST_OS))
292 return False 280 return False
293 if not arch in ['ia32', 'x64', 'arm', 'armv6', 'armv5te', 'arm64', 'mips', 281 if not arch in ['ia32', 'x64', 'arm', 'armv6', 'armv5te', 'arm64',
294 'simdbc', 'simdbc64']: 282 'simdbc', 'simdbc64']:
295 print ("Cross-compilation to %s is not supported for architecture %s." 283 print ("Cross-compilation to %s is not supported for architecture %s."
296 % (os_name, arch)) 284 % (os_name, arch))
297 return False 285 return False
298 return True 286 return True
299 287
300 288
301 def os_has_ide(host_os): 289 def os_has_ide(host_os):
302 return host_os.startswith('win') or host_os.startswith('mac') 290 return host_os.startswith('win') or host_os.startswith('mac')
303 291
(...skipping 12 matching lines...) Expand all
316 parser = argparse.ArgumentParser( 304 parser = argparse.ArgumentParser(
317 description='A script to run `gn gen`.', 305 description='A script to run `gn gen`.',
318 formatter_class=argparse.ArgumentDefaultsHelpFormatter) 306 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
319 common_group = parser.add_argument_group('Common Arguments') 307 common_group = parser.add_argument_group('Common Arguments')
320 other_group = parser.add_argument_group('Other Arguments') 308 other_group = parser.add_argument_group('Other Arguments')
321 309
322 common_group.add_argument('--arch', '-a', 310 common_group.add_argument('--arch', '-a',
323 type=str, 311 type=str,
324 help='Target architectures (comma-separated).', 312 help='Target architectures (comma-separated).',
325 metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,' 313 metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,'
326 'simmips,mips,simarm64,arm64,simdbc,armsimdbc]', 314 'simarm64,arm64,simdbc,armsimdbc]',
327 default='x64') 315 default='x64')
328 common_group.add_argument('--mode', '-m', 316 common_group.add_argument('--mode', '-m',
329 type=str, 317 type=str,
330 help='Build variants (comma-separated).', 318 help='Build variants (comma-separated).',
331 metavar='[all,debug,release,product]', 319 metavar='[all,debug,release,product]',
332 default='debug') 320 default='debug')
333 common_group.add_argument('--os', 321 common_group.add_argument('--os',
334 type=str, 322 type=str,
335 help='Target OSs (comma-separated).', 323 help='Target OSs (comma-separated).',
336 metavar='[all,host,android]', 324 metavar='[all,host,android]',
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 return 1 467 return 1
480 468
481 endtime = time.time() 469 endtime = time.time()
482 if args.verbose: 470 if args.verbose:
483 print ("GN Time: %.3f seconds" % (endtime - starttime)) 471 print ("GN Time: %.3f seconds" % (endtime - starttime))
484 return 0 472 return 0
485 473
486 474
487 if __name__ == '__main__': 475 if __name__ == '__main__':
488 sys.exit(Main(sys.argv)) 476 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « tools/gardening/lib/src/shard_data.dart ('k') | tools/gyp/configurations.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698