OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 2015 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 """Updates the 64 bit d8 binary for the current OS to match the v8 version used | 6 """Updates the 64 bit d8 binary for the current OS to match the v8 version used |
7 in the current version of the specified Chromium channel. If no channel is | 7 in the current version of the specified Chromium channel. If no channel is |
8 specified, we default to the 'stable' channel. | 8 specified, we default to the 'stable' channel. |
9 | 9 |
10 This script assumes that git is installed and the computer meets all | 10 This script assumes that git is installed and the computer meets all |
(...skipping 17 matching lines...) Expand all Loading... |
28 OMAHAPROXY_VERSION_MAP_URL = 'https://omahaproxy.appspot.com/all.json' | 28 OMAHAPROXY_VERSION_MAP_URL = 'https://omahaproxy.appspot.com/all.json' |
29 | 29 |
30 V8_PATH = os.path.join( | 30 V8_PATH = os.path.join( |
31 os.path.dirname(os.path.abspath(__file__)), os.path.pardir, 'third_party', | 31 os.path.dirname(os.path.abspath(__file__)), os.path.pardir, 'third_party', |
32 'v8') | 32 'v8') |
33 V8_DST_PATH = os.path.join(V8_PATH, '{os}', '{arch}') | 33 V8_DST_PATH = os.path.join(V8_PATH, '{os}', '{arch}') |
34 V8_README_PATH = os.path.join(V8_PATH, 'README.chromium') | 34 V8_README_PATH = os.path.join(V8_PATH, 'README.chromium') |
35 | 35 |
36 V8_CHECKOUT_BINARY_PATH = os.path.join( | 36 V8_CHECKOUT_BINARY_PATH = os.path.join( |
37 '{v8_root}', 'v8', 'out', 'Release', 'd8') | 37 '{v8_root}', 'v8', 'out', 'Release', 'd8') |
38 V8_GENERATE_GYP_CMD = (sys.executable + ' ' + os.path.join('build', 'gyp_v8') + | 38 V8_GENERATE_GYP_CMD = (sys.executable + ' ' + |
| 39 os.path.join('gypfiles', 'gyp_v8') + |
39 ' -Dtarget_arch={arch}') | 40 ' -Dtarget_arch={arch}') |
40 V8_COMPILE_CMD = 'ninja -C {0} d8'.format(os.path.join('out', 'Release')) | 41 V8_COMPILE_CMD = 'ninja -j 100 -C {0} d8'.format(os.path.join('out', 'Release')) |
41 V8_STRIP_CMD = 'strip -x {0}'.format(os.path.join('out', 'Release', 'd8')) | 42 V8_STRIP_CMD = 'strip -x {0}'.format(os.path.join('out', 'Release', 'd8')) |
42 | 43 |
43 VALID_CHANNEL_LIST = ['stable', 'canary', 'beta', 'dev'] | 44 VALID_CHANNEL_LIST = ['stable', 'canary', 'beta', 'dev'] |
44 # Dict from the acceptable return values for Python's platform.system() to the | 45 # Dict from the acceptable return values for Python's platform.system() to the |
45 # corresponding Chromium OS name. | 46 # corresponding Chromium OS name. |
46 PYTHON_SYSTEM_TO_CHROME_OS = { | 47 PYTHON_SYSTEM_TO_CHROME_OS = { |
47 'Linux': 'linux', | 48 'Linux': 'linux', |
48 'Windows': 'win', | 49 'Windows': 'win', |
49 'Darwin': 'mac' | 50 'Darwin': 'mac' |
50 } | 51 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 subprocess.check_call(command, shell=True, stderr=sys.stderr, | 106 subprocess.check_call(command, shell=True, stderr=sys.stderr, |
106 stdout=sys.stdout) | 107 stdout=sys.stdout) |
107 | 108 |
108 def UpdateV8Binary(v8_version, target_os, target_arch): | 109 def UpdateV8Binary(v8_version, target_os, target_arch): |
109 """Updates the catapult V8 binary for the specified OS to be the specified V8 | 110 """Updates the catapult V8 binary for the specified OS to be the specified V8 |
110 version.""" | 111 version.""" |
111 # Clone v8, checkout the version that corresponds to our target OS and target | 112 # Clone v8, checkout the version that corresponds to our target OS and target |
112 # channel, and build the d8 binary. | 113 # channel, and build the d8 binary. |
113 with TempDir() as v8_checkout_path: | 114 with TempDir() as v8_checkout_path: |
114 with ChangeDirectory(v8_checkout_path): | 115 with ChangeDirectory(v8_checkout_path): |
115 os.environ['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0' | 116 if 'DEPOT_TOOLS_WIN_TOOLCHAIN' not in os.environ: |
| 117 # If the user doesn't specify that they're using the Googler Windows |
| 118 # build toolchain, assume that they're not. |
| 119 os.environ['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0' |
| 120 |
116 _RunCommand('fetch v8') | 121 _RunCommand('fetch v8') |
117 with ChangeDirectory('v8'): | 122 with ChangeDirectory('v8'): |
118 _RunCommand('git checkout {0}'.format(v8_version)) | 123 _RunCommand('git checkout {0}'.format(v8_version)) |
119 _RunCommand('gclient sync') | 124 _RunCommand('gclient sync') |
120 if not 'GYP_DEFINES' in os.environ: | 125 if not 'GYP_DEFINES' in os.environ: |
121 os.environ['GYP_DEFINES'] = '' | 126 os.environ['GYP_DEFINES'] = '' |
122 os.environ['GYP_DEFINES'] += ' v8_use_external_startup_data=0' | 127 os.environ['GYP_DEFINES'] += ' v8_use_external_startup_data=0' |
123 os.environ['GYP_GENERATORS'] = 'ninja' | 128 os.environ['GYP_GENERATORS'] = 'ninja' |
124 ninja_arch = PYTHON_MACHINE_TO_NINJA_ARCH[target_arch] | 129 ninja_arch = PYTHON_MACHINE_TO_NINJA_ARCH[target_arch] |
125 _RunCommand( | 130 _RunCommand( |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 print "creating {0}".format(self.path) | 181 print "creating {0}".format(self.path) |
177 return self.path | 182 return self.path |
178 | 183 |
179 def __exit__(self, etype, value, traceback): | 184 def __exit__(self, etype, value, traceback): |
180 shutil.rmtree(self.path, ignore_errors=True) | 185 shutil.rmtree(self.path, ignore_errors=True) |
181 if os.path.isdir(self.path): | 186 if os.path.isdir(self.path): |
182 print '%s still exists. You may want to delete it' % self.path | 187 print '%s still exists. You may want to delete it' % self.path |
183 | 188 |
184 if __name__ == '__main__': | 189 if __name__ == '__main__': |
185 sys.exit(Main(sys.argv[1:])) | 190 sys.exit(Main(sys.argv[1:])) |
OLD | NEW |