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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 if r != 0: | 315 if r != 0: |
316 return 1 | 316 return 1 |
317 | 317 |
318 endtime = time.time() | 318 endtime = time.time() |
319 print ("The build took %.3f seconds" % (endtime - starttime)) | 319 print ("The build took %.3f seconds" % (endtime - starttime)) |
320 return 0 | 320 return 0 |
321 | 321 |
322 | 322 |
323 if __name__ == '__main__': | 323 if __name__ == '__main__': |
324 sys.exit(Main()) | 324 sys.exit(Main()) |
OLD | NEW |