Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: tools/build.py

Issue 12726011: Enables cross-compilation of the VM for ARM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/vm.gypi ('k') | tools/gyp/configurations_make.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 import shutil 11 import shutil
12 import subprocess 12 import subprocess
13 import sys 13 import sys
14 import utils 14 import utils
15 15
16 HOST_OS = utils.GuessOS() 16 HOST_OS = utils.GuessOS()
17 HOST_CPUS = utils.GuessCpus() 17 HOST_CPUS = utils.GuessCpus()
18 armcompilerlocation = '/opt/codesourcery/arm-2009q1'
19 SCRIPT_DIR = os.path.dirname(sys.argv[0]) 18 SCRIPT_DIR = os.path.dirname(sys.argv[0])
20 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) 19 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..'))
21 THIRD_PARTY_ROOT = os.path.join(DART_ROOT, 'third_party') 20 THIRD_PARTY_ROOT = os.path.join(DART_ROOT, 'third_party')
22 21
22 arm_cc_error = """
23 Couldn't find the arm cross compiler.
24 To make sure that you have the arm cross compilation tools installed, run:
25
26 $ wget http://src.chromium.org/chrome/trunk/src/build/install-build-deps.sh
27 OR
28 $ svn co http://src.chromium.org/chrome/trunk/src/build; cd build
29 Then,
30 $ chmod u+x install-build-deps.sh
31 $ ./install-build-deps.sh --arm --no-chromeos-fonts
32 """
33 DEFAULT_ARM_CROSS_COMPILER_PATH = '/usr'
34
23 def BuildOptions(): 35 def BuildOptions():
24 result = optparse.OptionParser() 36 result = optparse.OptionParser()
25 result.add_option("-m", "--mode", 37 result.add_option("-m", "--mode",
26 help='Build variants (comma-separated).', 38 help='Build variants (comma-separated).',
27 metavar='[all,debug,release]', 39 metavar='[all,debug,release]',
28 default='debug') 40 default='debug')
29 result.add_option("-v", "--verbose", 41 result.add_option("-v", "--verbose",
30 help='Verbose output.', 42 help='Verbose output.',
31 default=False, action="store_true") 43 default=False, action="store_true")
32 result.add_option("-a", "--arch", 44 result.add_option("-a", "--arch",
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return False 112 return False
101 if 'v8' in args: 113 if 'v8' in args:
102 print "The v8 target is not supported for android builds." 114 print "The v8 target is not supported for android builds."
103 return False 115 return False
104 return True 116 return True
105 117
106 118
107 def SetTools(arch, toolchainprefix): 119 def SetTools(arch, toolchainprefix):
108 toolsOverride = None 120 toolsOverride = None
109 if arch == 'arm' and toolchainprefix == None: 121 if arch == 'arm' and toolchainprefix == None:
110 toolchainprefix = armcompilerlocation + "/bin/arm-none-linux-gnueabi" 122 toolchainprefix = DEFAULT_ARM_CROSS_COMPILER_PATH + "/bin/arm-linux-gnueabi"
111 if toolchainprefix: 123 if toolchainprefix:
112 toolsOverride = { 124 toolsOverride = {
113 "CC" : toolchainprefix + "-gcc", 125 "CC.target" : toolchainprefix + "-gcc",
114 "CXX" : toolchainprefix + "-g++", 126 "CXX.target" : toolchainprefix + "-g++",
115 "AR" : toolchainprefix + "-ar", 127 "AR.target" : toolchainprefix + "-ar",
116 "LINK": toolchainprefix + "-g++", 128 "LINK.target": toolchainprefix + "-g++",
117 "NM" : toolchainprefix + "-nm", 129 "NM.target" : toolchainprefix + "-nm",
118 } 130 }
119 return toolsOverride 131 return toolsOverride
120 132
121 133
122 def CheckDirExists(path, docstring): 134 def CheckDirExists(path, docstring):
123 if not os.path.isdir(path): 135 if not os.path.isdir(path):
124 raise Exception('Could not find %s directory %s' 136 raise Exception('Could not find %s directory %s'
125 % (docstring, path)) 137 % (docstring, path))
126 138
127 139
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 if target_os == 'android': 418 if target_os == 'android':
407 toolchainprefix = ('%s/i686-linux-android' 419 toolchainprefix = ('%s/i686-linux-android'
408 % os.environ['ANDROID_TOOLCHAIN']) 420 % os.environ['ANDROID_TOOLCHAIN'])
409 toolsOverride = SetTools(arch, toolchainprefix) 421 toolsOverride = SetTools(arch, toolchainprefix)
410 if toolsOverride: 422 if toolsOverride:
411 printToolOverrides = target_os != 'android' 423 printToolOverrides = target_os != 'android'
412 for k, v in toolsOverride.iteritems(): 424 for k, v in toolsOverride.iteritems():
413 args.append( k + "=" + v) 425 args.append( k + "=" + v)
414 if printToolOverrides: 426 if printToolOverrides:
415 print k + " = " + v 427 print k + " = " + v
428 if not os.path.isfile(toolsOverride['CC.target']):
429 if arch == 'arm':
430 print arm_cc_error
431 else:
432 print "Couldn't find compiler: %s" % toolsOverride['CC.target']
433 return 1
434
416 435
417 print ' '.join(args) 436 print ' '.join(args)
418 process = None 437 process = None
419 if filter_xcodebuild_output: 438 if filter_xcodebuild_output:
420 process = subprocess.Popen(args, 439 process = subprocess.Popen(args,
421 stdin=None, 440 stdin=None,
422 bufsize=1, # Line buffered. 441 bufsize=1, # Line buffered.
423 stdout=subprocess.PIPE, 442 stdout=subprocess.PIPE,
424 stderr=subprocess.STDOUT) 443 stderr=subprocess.STDOUT)
425 FilterEmptyXcodebuildSections(process) 444 FilterEmptyXcodebuildSections(process)
426 else: 445 else:
427 process = subprocess.Popen(args, stdin=None) 446 process = subprocess.Popen(args, stdin=None)
428 process.wait() 447 process.wait()
429 if process.returncode != 0: 448 if process.returncode != 0:
430 print "BUILD FAILED" 449 print "BUILD FAILED"
431 return 1 450 return 1
432 451
433 return 0 452 return 0
434 453
435 454
436 if __name__ == '__main__': 455 if __name__ == '__main__':
437 sys.exit(Main()) 456 sys.exit(Main())
OLDNEW
« no previous file with comments | « runtime/vm/vm.gypi ('k') | tools/gyp/configurations_make.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698