OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, 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 | 7 |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 result.add_option("-m", "--mode", | 56 result.add_option("-m", "--mode", |
57 help='Build variants (comma-separated).', | 57 help='Build variants (comma-separated).', |
58 metavar='[all,debug,release,product]', | 58 metavar='[all,debug,release,product]', |
59 default='debug') | 59 default='debug') |
60 result.add_option("-v", "--verbose", | 60 result.add_option("-v", "--verbose", |
61 help='Verbose output.', | 61 help='Verbose output.', |
62 default=False, action="store_true") | 62 default=False, action="store_true") |
63 result.add_option("-a", "--arch", | 63 result.add_option("-a", "--arch", |
64 help='Target architectures (comma-separated).', | 64 help='Target architectures (comma-separated).', |
65 metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,' | 65 metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,' |
66 'simmips,mips,simarm64,arm64,simdbc,armsimdbc]', | 66 'simarm64,arm64,simdbc,armsimdbc]', |
67 default=utils.GuessArchitecture()) | 67 default=utils.GuessArchitecture()) |
68 result.add_option("--os", | 68 result.add_option("--os", |
69 help='Target OSs (comma-separated).', | 69 help='Target OSs (comma-separated).', |
70 metavar='[all,host,android]', | 70 metavar='[all,host,android]', |
71 default='host') | 71 default='host') |
72 result.add_option("-t", "--toolchain", | 72 result.add_option("-t", "--toolchain", |
73 help='Cross-compiler toolchain path', | 73 help='Cross-compiler toolchain path', |
74 default=None) | 74 default=None) |
75 result.add_option("-j", | 75 result.add_option("-j", |
76 help='The number of parallel jobs to run.', | 76 help='The number of parallel jobs to run.', |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 if not options.gyp and options.toolchain != None: | 110 if not options.gyp and options.toolchain != None: |
111 print "The --toolchain flag is only supported by the gyp build." | 111 print "The --toolchain flag is only supported by the gyp build." |
112 print "When using the GN build, set the toolchain and sysroot using gn.py." | 112 print "When using the GN build, set the toolchain and sysroot using gn.py." |
113 return False | 113 return False |
114 for mode in options.mode: | 114 for mode in options.mode: |
115 if not mode in ['debug', 'release', 'product']: | 115 if not mode in ['debug', 'release', 'product']: |
116 print "Unknown mode %s" % mode | 116 print "Unknown mode %s" % mode |
117 return False | 117 return False |
118 for arch in options.arch: | 118 for arch in options.arch: |
119 archs = ['ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6', | 119 archs = ['ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6', |
120 'simarmv5te', 'armv5te', 'simmips', 'mips', 'simarm64', 'arm64', | 120 'simarmv5te', 'armv5te', 'simarm64', 'arm64', |
121 'simdbc', 'simdbc64', 'armsimdbc', 'armsimdbc64'] | 121 'simdbc', 'simdbc64', 'armsimdbc', 'armsimdbc64'] |
122 if not arch in archs: | 122 if not arch in archs: |
123 print "Unknown arch %s" % arch | 123 print "Unknown arch %s" % arch |
124 return False | 124 return False |
125 options.os = [ProcessOsOption(os_name) for os_name in options.os] | 125 options.os = [ProcessOsOption(os_name) for os_name in options.os] |
126 for os_name in options.os: | 126 for os_name in options.os: |
127 if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']: | 127 if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']: |
128 print "Unknown os %s" % os_name | 128 print "Unknown os %s" % os_name |
129 return False | 129 return False |
130 if os_name != HOST_OS: | 130 if os_name != HOST_OS: |
131 if os_name != 'android': | 131 if os_name != 'android': |
132 print "Unsupported target os %s" % os_name | 132 print "Unsupported target os %s" % os_name |
133 return False | 133 return False |
134 if not HOST_OS in ['linux', 'macos']: | 134 if not HOST_OS in ['linux', 'macos']: |
135 print ("Cross-compilation to %s is not supported on host os %s." | 135 print ("Cross-compilation to %s is not supported on host os %s." |
136 % (os_name, HOST_OS)) | 136 % (os_name, HOST_OS)) |
137 return False | 137 return False |
138 if not arch in ['ia32', 'x64', 'arm', 'armv6', 'armv5te', 'arm64', 'mips', | 138 if not arch in ['ia32', 'x64', 'arm', 'armv6', 'armv5te', 'arm64', |
139 'simdbc', 'simdbc64']: | 139 'simdbc', 'simdbc64']: |
140 print ("Cross-compilation to %s is not supported for architecture %s." | 140 print ("Cross-compilation to %s is not supported for architecture %s." |
141 % (os_name, arch)) | 141 % (os_name, arch)) |
142 return False | 142 return False |
143 # We have not yet tweaked the v8 dart build to work with the Android | 143 # We have not yet tweaked the v8 dart build to work with the Android |
144 # NDK/SDK, so don't try to build it. | 144 # NDK/SDK, so don't try to build it. |
145 if not args: | 145 if not args: |
146 print "For android builds you must specify a target, such as 'runtime'." | 146 print "For android builds you must specify a target, such as 'runtime'." |
147 return False | 147 return False |
148 return True | 148 return True |
(...skipping 19 matching lines...) Expand all Loading... |
168 raise Exception('Unless --toolchain is used cross-building is only ' | 168 raise Exception('Unless --toolchain is used cross-building is only ' |
169 'supported on Linux.') | 169 'supported on Linux.') |
170 | 170 |
171 # For ARM Linux, by default use the Linux distribution's cross-compiler. | 171 # For ARM Linux, by default use the Linux distribution's cross-compiler. |
172 if arch == 'arm' or arch == 'armsimdbc': | 172 if arch == 'arm' or arch == 'armsimdbc': |
173 # To use a non-hf compiler, specify on the command line with --toolchain. | 173 # To use a non-hf compiler, specify on the command line with --toolchain. |
174 return (DEFAULT_ARM_CROSS_COMPILER_PATH + "/arm-linux-gnueabihf") | 174 return (DEFAULT_ARM_CROSS_COMPILER_PATH + "/arm-linux-gnueabihf") |
175 if arch == 'arm64': | 175 if arch == 'arm64': |
176 return (DEFAULT_ARM_CROSS_COMPILER_PATH + "/aarch64-linux-gnu") | 176 return (DEFAULT_ARM_CROSS_COMPILER_PATH + "/aarch64-linux-gnu") |
177 | 177 |
178 # TODO(zra): Find default MIPS Linux cross-compiler. | |
179 | |
180 return None | 178 return None |
181 | 179 |
182 | 180 |
183 def SetTools(arch, target_os, options): | 181 def SetTools(arch, target_os, options): |
184 toolsOverride = None | 182 toolsOverride = None |
185 | 183 |
186 toolchainprefix = GetToolchainPrefix(target_os, arch, options) | 184 toolchainprefix = GetToolchainPrefix(target_os, arch, options) |
187 | 185 |
188 # Override the Android toolchain's linker to handle some complexity in the | 186 # Override the Android toolchain's linker to handle some complexity in the |
189 # linker arguments that gyp has trouble with. | 187 # linker arguments that gyp has trouble with. |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 # If we couldn't ensure that goma is started, let the build start, but | 475 # If we couldn't ensure that goma is started, let the build start, but |
478 # slowly so we can see any helpful error messages that pop out. | 476 # slowly so we can see any helpful error messages that pop out. |
479 command += ['-j1'] | 477 command += ['-j1'] |
480 command += [target] | 478 command += [target] |
481 return command | 479 return command |
482 | 480 |
483 | 481 |
484 filter_xcodebuild_output = False | 482 filter_xcodebuild_output = False |
485 def BuildOneConfig(options, target, target_os, mode, arch): | 483 def BuildOneConfig(options, target, target_os, mode, arch): |
486 global filter_xcodebuild_output | 484 global filter_xcodebuild_output |
487 if arch.startswith('mips'): | |
488 bold = '\033[1m' | |
489 reset = '\033[0m' | |
490 print(bold + "Warning: MIPS architectures are unlikely to be supported in " | |
491 "upcoming releases. Please consider using another architecture " | |
492 "and/or file an issue explaining your specific use of and need for " | |
493 "MIPS support." + reset) | |
494 start_time = time.time() | 485 start_time = time.time() |
495 args = [] | 486 args = [] |
496 build_config = utils.GetBuildConf(mode, arch, target_os) | 487 build_config = utils.GetBuildConf(mode, arch, target_os) |
497 if not options.gyp: | 488 if not options.gyp: |
498 args = BuildNinjaCommand(options, target, target_os, mode, arch) | 489 args = BuildNinjaCommand(options, target, target_os, mode, arch) |
499 else: | 490 else: |
500 os.environ['DART_BUILD_MODE'] = mode | 491 os.environ['DART_BUILD_MODE'] = mode |
501 if HOST_OS == 'macos': | 492 if HOST_OS == 'macos': |
502 filter_xcodebuild_output = True | 493 filter_xcodebuild_output = True |
503 project_file = 'dart.xcodeproj' | 494 project_file = 'dart.xcodeproj' |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 for arch in options.arch: | 607 for arch in options.arch: |
617 if BuildOneConfig(options, target, target_os, | 608 if BuildOneConfig(options, target, target_os, |
618 mode, arch) != 0: | 609 mode, arch) != 0: |
619 return 1 | 610 return 1 |
620 | 611 |
621 return 0 | 612 return 0 |
622 | 613 |
623 | 614 |
624 if __name__ == '__main__': | 615 if __name__ == '__main__': |
625 sys.exit(Main()) | 616 sys.exit(Main()) |
OLD | NEW |