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

Side by Side Diff: tools/gn.py

Issue 2858623002: Remove MIPS support (Closed)
Patch Set: Rebase 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
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 def ToCommandLine(gn_args): 67 def ToCommandLine(gn_args):
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 host_cpu_for_arch(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 target_cpu_for_arch(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
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 args.os = 'host,android' 261 args.os = 'host,android'
266 args.mode = args.mode.split(',') 262 args.mode = args.mode.split(',')
267 args.arch = args.arch.split(',') 263 args.arch = args.arch.split(',')
268 args.os = args.os.split(',') 264 args.os = args.os.split(',')
269 for mode in args.mode: 265 for mode in args.mode:
270 if not mode in ['debug', 'release', 'product']: 266 if not mode in ['debug', 'release', 'product']:
271 print "Unknown mode %s" % mode 267 print "Unknown mode %s" % mode
272 return False 268 return False
273 for arch in args.arch: 269 for arch in args.arch:
274 archs = ['ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6', 270 archs = ['ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6',
275 'simarmv5te', 'armv5te', 'simmips', 'mips', 'simarm64', 'arm64', 271 'simarmv5te', 'armv5te', 'simarm64', 'arm64',
276 'simdbc', 'simdbc64', 'armsimdbc', 'armsimdbc64'] 272 'simdbc', 'simdbc64', 'armsimdbc', 'armsimdbc64']
277 if not arch in archs: 273 if not arch in archs:
278 print "Unknown arch %s" % arch 274 print "Unknown arch %s" % arch
279 return False 275 return False
280 oses = [ProcessOsOption(os_name) for os_name in args.os] 276 oses = [ProcessOsOption(os_name) for os_name in args.os]
281 for os_name in oses: 277 for os_name in oses:
282 if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']: 278 if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']:
283 print "Unknown os %s" % os_name 279 print "Unknown os %s" % os_name
284 return False 280 return False
285 if os_name != HOST_OS: 281 if os_name != HOST_OS:
286 if os_name != 'android': 282 if os_name != 'android':
287 print "Unsupported target os %s" % os_name 283 print "Unsupported target os %s" % os_name
288 return False 284 return False
289 if not HOST_OS in ['linux', 'macos']: 285 if not HOST_OS in ['linux', 'macos']:
290 print ("Cross-compilation to %s is not supported on host os %s." 286 print ("Cross-compilation to %s is not supported on host os %s."
291 % (os_name, HOST_OS)) 287 % (os_name, HOST_OS))
292 return False 288 return False
293 if not arch in ['ia32', 'x64', 'arm', 'armv6', 'armv5te', 'arm64', 'mips', 289 if not arch in ['ia32', 'x64', 'arm', 'armv6', 'armv5te', 'arm64',
294 'simdbc', 'simdbc64']: 290 'simdbc', 'simdbc64']:
295 print ("Cross-compilation to %s is not supported for architecture %s." 291 print ("Cross-compilation to %s is not supported for architecture %s."
296 % (os_name, arch)) 292 % (os_name, arch))
297 return False 293 return False
298 return True 294 return True
299 295
300 296
301 def os_has_ide(host_os): 297 def os_has_ide(host_os):
302 return host_os.startswith('win') or host_os.startswith('mac') 298 return host_os.startswith('win') or host_os.startswith('mac')
303 299
(...skipping 12 matching lines...) Expand all
316 parser = argparse.ArgumentParser( 312 parser = argparse.ArgumentParser(
317 description='A script to run `gn gen`.', 313 description='A script to run `gn gen`.',
318 formatter_class=argparse.ArgumentDefaultsHelpFormatter) 314 formatter_class=argparse.ArgumentDefaultsHelpFormatter)
319 common_group = parser.add_argument_group('Common Arguments') 315 common_group = parser.add_argument_group('Common Arguments')
320 other_group = parser.add_argument_group('Other Arguments') 316 other_group = parser.add_argument_group('Other Arguments')
321 317
322 common_group.add_argument('--arch', '-a', 318 common_group.add_argument('--arch', '-a',
323 type=str, 319 type=str,
324 help='Target architectures (comma-separated).', 320 help='Target architectures (comma-separated).',
325 metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,' 321 metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,'
326 'simmips,mips,simarm64,arm64,simdbc,armsimdbc]', 322 'simarm64,arm64,simdbc,armsimdbc]',
327 default='x64') 323 default='x64')
328 common_group.add_argument('--mode', '-m', 324 common_group.add_argument('--mode', '-m',
329 type=str, 325 type=str,
330 help='Build variants (comma-separated).', 326 help='Build variants (comma-separated).',
331 metavar='[all,debug,release,product]', 327 metavar='[all,debug,release,product]',
332 default='debug') 328 default='debug')
333 common_group.add_argument('--os', 329 common_group.add_argument('--os',
334 type=str, 330 type=str,
335 help='Target OSs (comma-separated).', 331 help='Target OSs (comma-separated).',
336 metavar='[all,host,android]', 332 metavar='[all,host,android]',
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 return 1 469 return 1
474 470
475 endtime = time.time() 471 endtime = time.time()
476 if args.verbose: 472 if args.verbose:
477 print ("GN Time: %.3f seconds" % (endtime - starttime)) 473 print ("GN Time: %.3f seconds" % (endtime - starttime))
478 return 0 474 return 0
479 475
480 476
481 if __name__ == '__main__': 477 if __name__ == '__main__':
482 sys.exit(Main(sys.argv)) 478 sys.exit(Main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698