| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2011, 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 shutil | 10 import shutil |
| 11 import subprocess | 11 import subprocess |
| 12 import sys | 12 import sys |
| 13 import utils | 13 import utils |
| 14 | 14 |
| 15 HOST_OS = utils.GuessOS() | 15 HOST_OS = utils.GuessOS() |
| 16 HOST_CPUS = utils.GuessCpus() | 16 HOST_CPUS = utils.GuessCpus() |
| 17 armcompilerlocation = '/opt/codesourcery/arm-2009q1' | 17 armcompilerlocation = '/opt/codesourcery/arm-2009q1' |
| 18 | 18 |
| 19 def BuildOptions(): | 19 def BuildOptions(): |
| 20 result = optparse.OptionParser() | 20 result = optparse.OptionParser() |
| 21 result.add_option("-m", "--mode", | 21 result.add_option("-m", "--mode", |
| 22 help='Build variants (comma-separated).', | 22 help='Build variants (comma-separated).', |
| 23 metavar='[all,debug,release]', | 23 metavar='[all,debug,release]', |
| 24 default='debug') | 24 default='debug') |
| 25 result.add_option("-v", "--verbose", | 25 result.add_option("-v", "--verbose", |
| 26 help='Verbose output.', | 26 help='Verbose output.', |
| 27 default=False, action="store_true") | 27 default=False, action="store_true") |
| 28 result.add_option("--arch", | 28 result.add_option("--arch", |
| 29 help='Target architectures (comma-separated).', | 29 help='Target architectures (comma-separated).', |
| 30 metavar='[all,ia32,x64,simarm,arm,dartc]', | 30 metavar='[all,ia32,x64,simarm,arm]', |
| 31 default=utils.GuessArchitecture()) | 31 default=utils.GuessArchitecture()) |
| 32 result.add_option("-j", | 32 result.add_option("-j", |
| 33 help='The number of parallel jobs to run.', | 33 help='The number of parallel jobs to run.', |
| 34 metavar=HOST_CPUS, | 34 metavar=HOST_CPUS, |
| 35 default=str(HOST_CPUS)) | 35 default=str(HOST_CPUS)) |
| 36 result.add_option("--devenv", | 36 result.add_option("--devenv", |
| 37 help='Path containing devenv.com on Windows', | 37 help='Path containing devenv.com on Windows', |
| 38 default='C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\Common7\\ID
E') | 38 default='C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\Common7\\ID
E') |
| 39 return result | 39 return result |
| 40 | 40 |
| 41 | 41 |
| 42 def ProcessOptions(options): | 42 def ProcessOptions(options): |
| 43 if options.arch == 'all': | 43 if options.arch == 'all': |
| 44 options.arch = 'ia32,x64,simarm' | 44 options.arch = 'ia32,x64,simarm' |
| 45 if options.mode == 'all': | 45 if options.mode == 'all': |
| 46 options.mode = 'debug,release' | 46 options.mode = 'debug,release' |
| 47 options.mode = options.mode.split(',') | 47 options.mode = options.mode.split(',') |
| 48 options.arch = options.arch.split(',') | 48 options.arch = options.arch.split(',') |
| 49 for mode in options.mode: | 49 for mode in options.mode: |
| 50 if not mode in ['debug', 'release']: | 50 if not mode in ['debug', 'release']: |
| 51 print "Unknown mode %s" % mode | 51 print "Unknown mode %s" % mode |
| 52 return False | 52 return False |
| 53 for arch in options.arch: | 53 for arch in options.arch: |
| 54 if not arch in ['ia32', 'x64', 'simarm', 'arm', 'dartc']: | 54 if not arch in ['ia32', 'x64', 'simarm', 'arm']: |
| 55 print "Unknown arch %s" % arch | 55 print "Unknown arch %s" % arch |
| 56 return False | 56 return False |
| 57 return True | 57 return True |
| 58 | 58 |
| 59 | 59 |
| 60 def setTools(arch): | 60 def setTools(arch): |
| 61 if arch == 'arm': | 61 if arch == 'arm': |
| 62 toolsOverride = { | 62 toolsOverride = { |
| 63 "CC" : armcompilerlocation + "/bin/arm-none-linux-gnueabi-gcc", | 63 "CC" : armcompilerlocation + "/bin/arm-none-linux-gnueabi-gcc", |
| 64 "CXX" : armcompilerlocation + "/bin/arm-none-linux-gnueabi-g++", | 64 "CXX" : armcompilerlocation + "/bin/arm-none-linux-gnueabi-g++", |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 process.wait() | 151 process.wait() |
| 152 if process.returncode != 0: | 152 if process.returncode != 0: |
| 153 print "BUILD FAILED" | 153 print "BUILD FAILED" |
| 154 return 1 | 154 return 1 |
| 155 | 155 |
| 156 return 0 | 156 return 0 |
| 157 | 157 |
| 158 | 158 |
| 159 if __name__ == '__main__': | 159 if __name__ == '__main__': |
| 160 sys.exit(Main()) | 160 sys.exit(Main()) |
| OLD | NEW |