| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 result.add_option("-m", "--mode", | 49 result.add_option("-m", "--mode", |
| 50 help='Build variants (comma-separated).', | 50 help='Build variants (comma-separated).', |
| 51 metavar='[all,debug,release,product]', | 51 metavar='[all,debug,release,product]', |
| 52 default='debug') | 52 default='debug') |
| 53 result.add_option("-v", "--verbose", | 53 result.add_option("-v", "--verbose", |
| 54 help='Verbose output.', | 54 help='Verbose output.', |
| 55 default=False, action="store_true") | 55 default=False, action="store_true") |
| 56 result.add_option("-a", "--arch", | 56 result.add_option("-a", "--arch", |
| 57 help='Target architectures (comma-separated).', | 57 help='Target architectures (comma-separated).', |
| 58 metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,' | 58 metavar='[all,ia32,x64,simarm,arm,simarmv6,armv6,simarmv5te,armv5te,' |
| 59 'simmips,mips,simarm64,arm64,simdbc,]', | 59 'simmips,mips,simarm64,arm64,simdbc,armsimdbc]', |
| 60 default=utils.GuessArchitecture()) | 60 default=utils.GuessArchitecture()) |
| 61 result.add_option("--os", | 61 result.add_option("--os", |
| 62 help='Target OSs (comma-separated).', | 62 help='Target OSs (comma-separated).', |
| 63 metavar='[all,host,android]', | 63 metavar='[all,host,android]', |
| 64 default='host') | 64 default='host') |
| 65 result.add_option("-t", "--toolchain", | 65 result.add_option("-t", "--toolchain", |
| 66 help='Cross-compiler toolchain path', | 66 help='Cross-compiler toolchain path', |
| 67 default=None) | 67 default=None) |
| 68 result.add_option("-j", | 68 result.add_option("-j", |
| 69 help='The number of parallel jobs to run.', | 69 help='The number of parallel jobs to run.', |
| (...skipping 26 matching lines...) Expand all Loading... |
| 96 options.mode = options.mode.split(',') | 96 options.mode = options.mode.split(',') |
| 97 options.arch = options.arch.split(',') | 97 options.arch = options.arch.split(',') |
| 98 options.os = options.os.split(',') | 98 options.os = options.os.split(',') |
| 99 for mode in options.mode: | 99 for mode in options.mode: |
| 100 if not mode in ['debug', 'release', 'product']: | 100 if not mode in ['debug', 'release', 'product']: |
| 101 print "Unknown mode %s" % mode | 101 print "Unknown mode %s" % mode |
| 102 return False | 102 return False |
| 103 for arch in options.arch: | 103 for arch in options.arch: |
| 104 archs = ['ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6', | 104 archs = ['ia32', 'x64', 'simarm', 'arm', 'simarmv6', 'armv6', |
| 105 'simarmv5te', 'armv5te', 'simmips', 'mips', 'simarm64', 'arm64', | 105 'simarmv5te', 'armv5te', 'simmips', 'mips', 'simarm64', 'arm64', |
| 106 'simdbc', 'simdbc64'] | 106 'simdbc', 'simdbc64', 'armsimdbc'] |
| 107 if not arch in archs: | 107 if not arch in archs: |
| 108 print "Unknown arch %s" % arch | 108 print "Unknown arch %s" % arch |
| 109 return False | 109 return False |
| 110 options.os = [ProcessOsOption(os_name) for os_name in options.os] | 110 options.os = [ProcessOsOption(os_name) for os_name in options.os] |
| 111 for os_name in options.os: | 111 for os_name in options.os: |
| 112 if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']: | 112 if not os_name in ['android', 'freebsd', 'linux', 'macos', 'win32']: |
| 113 print "Unknown os %s" % os_name | 113 print "Unknown os %s" % os_name |
| 114 return False | 114 return False |
| 115 if os_name != HOST_OS: | 115 if os_name != HOST_OS: |
| 116 if os_name != 'android': | 116 if os_name != 'android': |
| (...skipping 30 matching lines...) Expand all Loading... |
| 147 return os.path.join(android_toolchain, 'i686-linux-android') | 147 return os.path.join(android_toolchain, 'i686-linux-android') |
| 148 if arch == 'x64': | 148 if arch == 'x64': |
| 149 return os.path.join(android_toolchain, 'x86_64-linux-android') | 149 return os.path.join(android_toolchain, 'x86_64-linux-android') |
| 150 | 150 |
| 151 # If no cross compiler is specified, only try to figure one out on Linux. | 151 # If no cross compiler is specified, only try to figure one out on Linux. |
| 152 if not HOST_OS in ['linux']: | 152 if not HOST_OS in ['linux']: |
| 153 raise Exception('Unless --toolchain is used cross-building is only ' | 153 raise Exception('Unless --toolchain is used cross-building is only ' |
| 154 'supported on Linux.') | 154 'supported on Linux.') |
| 155 | 155 |
| 156 # For ARM Linux, by default use the Linux distribution's cross-compiler. | 156 # For ARM Linux, by default use the Linux distribution's cross-compiler. |
| 157 if arch == 'arm': | 157 if arch == 'arm' or arch == 'armsimdbc': |
| 158 # To use a non-hf compiler, specify on the command line with --toolchain. | 158 # To use a non-hf compiler, specify on the command line with --toolchain. |
| 159 return (DEFAULT_ARM_CROSS_COMPILER_PATH + "/arm-linux-gnueabihf") | 159 return (DEFAULT_ARM_CROSS_COMPILER_PATH + "/arm-linux-gnueabihf") |
| 160 if arch == 'arm64': | 160 if arch == 'arm64': |
| 161 return (DEFAULT_ARM_CROSS_COMPILER_PATH + "/aarch64-linux-gnu") | 161 return (DEFAULT_ARM_CROSS_COMPILER_PATH + "/aarch64-linux-gnu") |
| 162 | 162 |
| 163 # TODO(zra): Find default MIPS Linux cross-compiler. | 163 # TODO(zra): Find default MIPS Linux cross-compiler. |
| 164 | 164 |
| 165 return None | 165 return None |
| 166 | 166 |
| 167 | 167 |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 else: | 558 else: |
| 559 if BuildOneConfig(options, target, target_os, | 559 if BuildOneConfig(options, target, target_os, |
| 560 mode, arch, cross_build) != 0: | 560 mode, arch, cross_build) != 0: |
| 561 return 1 | 561 return 1 |
| 562 | 562 |
| 563 return 0 | 563 return 0 |
| 564 | 564 |
| 565 | 565 |
| 566 if __name__ == '__main__': | 566 if __name__ == '__main__': |
| 567 sys.exit(Main()) | 567 sys.exit(Main()) |
| OLD | NEW |