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

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
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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 if target_os == 'android': 416 if target_os == 'android':
405 toolchainprefix = ('%s/i686-linux-android' 417 toolchainprefix = ('%s/i686-linux-android'
406 % os.environ['ANDROID_TOOLCHAIN']) 418 % os.environ['ANDROID_TOOLCHAIN'])
407 toolsOverride = SetTools(arch, toolchainprefix) 419 toolsOverride = SetTools(arch, toolchainprefix)
408 if toolsOverride: 420 if toolsOverride:
409 printToolOverrides = target_os != 'android' 421 printToolOverrides = target_os != 'android'
410 for k, v in toolsOverride.iteritems(): 422 for k, v in toolsOverride.iteritems():
411 args.append( k + "=" + v) 423 args.append( k + "=" + v)
412 if printToolOverrides: 424 if printToolOverrides:
413 print k + " = " + v 425 print k + " = " + v
426 if not os.path.isfile(toolsOverride['CC.target']):
427 if arch == 'arm':
428 print arm_cc_error
429 else:
430 print "Couldn't find compiler: %s" % toolsOverride['CC.target']
431 return 1
432
414 433
415 print ' '.join(args) 434 print ' '.join(args)
416 process = None 435 process = None
417 if filter_xcodebuild_output: 436 if filter_xcodebuild_output:
418 process = subprocess.Popen(args, 437 process = subprocess.Popen(args,
419 stdin=None, 438 stdin=None,
420 bufsize=1, # Line buffered. 439 bufsize=1, # Line buffered.
421 stdout=subprocess.PIPE, 440 stdout=subprocess.PIPE,
422 stderr=subprocess.STDOUT) 441 stderr=subprocess.STDOUT)
423 FilterEmptyXcodebuildSections(process) 442 FilterEmptyXcodebuildSections(process)
424 else: 443 else:
425 process = subprocess.Popen(args, stdin=None) 444 process = subprocess.Popen(args, stdin=None)
426 process.wait() 445 process.wait()
427 if process.returncode != 0: 446 if process.returncode != 0:
428 print "BUILD FAILED" 447 print "BUILD FAILED"
429 return 1 448 return 1
430 449
431 return 0 450 return 0
432 451
433 452
434 if __name__ == '__main__': 453 if __name__ == '__main__':
435 sys.exit(Main()) 454 sys.exit(Main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698