OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
4 # for details. All rights reserved. Use of this source code is governed by a | 4 # for details. All rights reserved. Use of this source code is governed by a |
5 # BSD-style license that can be found in the LICENSE file. | 5 # BSD-style license that can be found in the LICENSE file. |
6 | 6 |
7 import multiprocessing | 7 import multiprocessing |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import subprocess | 10 import subprocess |
(...skipping 22 matching lines...) Expand all Loading... |
33 result.add_option("-m", "--mode", | 33 result.add_option("-m", "--mode", |
34 help='Build variants (comma-separated).', | 34 help='Build variants (comma-separated).', |
35 metavar='[all,debug,release,product]', | 35 metavar='[all,debug,release,product]', |
36 default='debug') | 36 default='debug') |
37 result.add_option("-v", "--verbose", | 37 result.add_option("-v", "--verbose", |
38 help='Verbose output.', | 38 help='Verbose output.', |
39 default=False, action="store_true") | 39 default=False, action="store_true") |
40 result.add_option("-a", "--arch", | 40 result.add_option("-a", "--arch", |
41 help='Target architectures (comma-separated).', | 41 help='Target architectures (comma-separated).', |
42 metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,' | 42 metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,' |
43 'simmips,mips,simarm64,arm64,simdbc,armsimdbc]', | 43 'simarm64,arm64,simdbc,armsimdbc]', |
44 default=utils.GuessArchitecture()) | 44 default=utils.GuessArchitecture()) |
45 result.add_option("--os", | 45 result.add_option("--os", |
46 help='Target OSs (comma-separated).', | 46 help='Target OSs (comma-separated).', |
47 metavar='[all,host,android]', | 47 metavar='[all,host,android]', |
48 default='host') | 48 default='host') |
49 result.add_option("-j", | 49 result.add_option("-j", |
50 type=int, | 50 type=int, |
51 help='Ninja -j option for Goma builds.', | 51 help='Ninja -j option for Goma builds.', |
52 metavar=1000, | 52 metavar=1000, |
53 default=1000) | 53 default=1000) |
(...skipping 15 matching lines...) Expand all Loading... |
69 options.os = 'host,android' | 69 options.os = 'host,android' |
70 options.mode = options.mode.split(',') | 70 options.mode = options.mode.split(',') |
71 options.arch = options.arch.split(',') | 71 options.arch = options.arch.split(',') |
72 options.os = options.os.split(',') | 72 options.os = options.os.split(',') |
73 for mode in options.mode: | 73 for mode in options.mode: |
74 if not mode in ['debug', 'release', 'product']: | 74 if not mode in ['debug', 'release', 'product']: |
75 print "Unknown mode %s" % mode | 75 print "Unknown mode %s" % mode |
76 return False | 76 return False |
77 for arch in options.arch: | 77 for arch in options.arch: |
78 archs = ['ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6', | 78 archs = ['ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6', |
79 'simarmv5te', 'armv5te', 'simmips', 'mips', 'simarm64', 'arm64', | 79 'simarmv5te', 'armv5te', 'simarm64', 'arm64', |
80 'simdbc', 'simdbc64', 'armsimdbc', 'armsimdbc64'] | 80 'simdbc', 'simdbc64', 'armsimdbc', 'armsimdbc64'] |
81 if not arch in archs: | 81 if not arch in archs: |
82 print "Unknown arch %s" % arch | 82 print "Unknown arch %s" % arch |
83 return False | 83 return False |
84 options.os = [ProcessOsOption(os_name) for os_name in options.os] | 84 options.os = [ProcessOsOption(os_name) for os_name in options.os] |
85 for os_name in options.os: | 85 for os_name in options.os: |
86 if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']: | 86 if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']: |
87 print "Unknown os %s" % os_name | 87 print "Unknown os %s" % os_name |
88 return False | 88 return False |
89 if os_name != HOST_OS: | 89 if os_name != HOST_OS: |
90 if os_name != 'android': | 90 if os_name != 'android': |
91 print "Unsupported target os %s" % os_name | 91 print "Unsupported target os %s" % os_name |
92 return False | 92 return False |
93 if not HOST_OS in ['linux', 'macos']: | 93 if not HOST_OS in ['linux', 'macos']: |
94 print ("Cross-compilation to %s is not supported on host os %s." | 94 print ("Cross-compilation to %s is not supported on host os %s." |
95 % (os_name, HOST_OS)) | 95 % (os_name, HOST_OS)) |
96 return False | 96 return False |
97 if not arch in ['ia32', 'x64', 'arm', 'armv6', 'armv5te', 'arm64', 'mips', | 97 if not arch in ['ia32', 'x64', 'arm', 'armv6', 'armv5te', 'arm64', |
98 'simdbc', 'simdbc64']: | 98 'simdbc', 'simdbc64']: |
99 print ("Cross-compilation to %s is not supported for architecture %s." | 99 print ("Cross-compilation to %s is not supported for architecture %s." |
100 % (os_name, arch)) | 100 % (os_name, arch)) |
101 return False | 101 return False |
102 # We have not yet tweaked the v8 dart build to work with the Android | 102 # We have not yet tweaked the v8 dart build to work with the Android |
103 # NDK/SDK, so don't try to build it. | 103 # NDK/SDK, so don't try to build it. |
104 if not args: | 104 if not args: |
105 print "For android builds you must specify a target, such as 'runtime'." | 105 print "For android builds you must specify a target, such as 'runtime'." |
106 return False | 106 return False |
107 return True | 107 return True |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 if process.returncode != 0: | 218 if process.returncode != 0: |
219 print ("Tried to run goma_ctl.py, but it failed. Try running it manually: " | 219 print ("Tried to run goma_ctl.py, but it failed. Try running it manually: " |
220 + "\n\t" + ' '.join(goma_ctl_command)) | 220 + "\n\t" + ' '.join(goma_ctl_command)) |
221 return False | 221 return False |
222 goma_started = True | 222 goma_started = True |
223 return True | 223 return True |
224 | 224 |
225 | 225 |
226 # Returns a tuple (build_config, command to run, whether goma is used) | 226 # Returns a tuple (build_config, command to run, whether goma is used) |
227 def BuildOneConfig(options, targets, target_os, mode, arch): | 227 def BuildOneConfig(options, targets, target_os, mode, arch): |
228 if arch.startswith('mips'): | |
229 bold = '\033[1m' | |
230 reset = '\033[0m' | |
231 print(bold + "Warning: MIPS architectures are unlikely to be supported in " | |
232 "upcoming releases. Please consider using another architecture " | |
233 "and/or file an issue explaining your specific use of and need for " | |
234 "MIPS support." + reset) | |
235 build_config = utils.GetBuildConf(mode, arch, target_os) | 228 build_config = utils.GetBuildConf(mode, arch, target_os) |
236 out_dir = utils.GetBuildRoot(HOST_OS, mode, arch, target_os) | 229 out_dir = utils.GetBuildRoot(HOST_OS, mode, arch, target_os) |
237 using_goma = False | 230 using_goma = False |
238 if ShouldRunGN(out_dir): | 231 if ShouldRunGN(out_dir): |
239 RunGN(target_os, mode, arch) | 232 RunGN(target_os, mode, arch) |
240 command = ['ninja', '-C', out_dir] | 233 command = ['ninja', '-C', out_dir] |
241 if options.verbose: | 234 if options.verbose: |
242 command += ['-v'] | 235 command += ['-v'] |
243 if UseGoma(out_dir): | 236 if UseGoma(out_dir): |
244 if EnsureGomaStarted(out_dir): | 237 if EnsureGomaStarted(out_dir): |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 if r != 0: | 308 if r != 0: |
316 return 1 | 309 return 1 |
317 | 310 |
318 endtime = time.time() | 311 endtime = time.time() |
319 print ("The build took %.3f seconds" % (endtime - starttime)) | 312 print ("The build took %.3f seconds" % (endtime - starttime)) |
320 return 0 | 313 return 0 |
321 | 314 |
322 | 315 |
323 if __name__ == '__main__': | 316 if __name__ == '__main__': |
324 sys.exit(Main()) | 317 sys.exit(Main()) |
OLD | NEW |