OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Classes and functions for building Chrome. | 5 """Classes and functions for building Chrome. |
6 | 6 |
7 This includes functions for running commands to build, as well as | 7 This includes functions for running commands to build, as well as |
8 specific rules about which targets to build. | 8 specific rules about which targets to build. |
9 """ | 9 """ |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... | |
36 | 36 |
37 if opts.build_preference == 'msvs': | 37 if opts.build_preference == 'msvs': |
38 if not os.getenv('VS100COMNTOOLS'): | 38 if not os.getenv('VS100COMNTOOLS'): |
39 raise RuntimeError( | 39 raise RuntimeError( |
40 'Path to visual studio could not be determined.') | 40 'Path to visual studio could not be determined.') |
41 else: | 41 else: |
42 # Need to re-escape goma dir, see crbug.com/394990. | 42 # Need to re-escape goma dir, see crbug.com/394990. |
43 if opts.goma_dir: | 43 if opts.goma_dir: |
44 opts.goma_dir = opts.goma_dir.encode('string_escape') | 44 opts.goma_dir = opts.goma_dir.encode('string_escape') |
45 SetBuildSystemDefault(opts.build_preference, opts.use_goma, | 45 SetBuildSystemDefault(opts.build_preference, opts.use_goma, |
46 opts.goma_dir) | 46 opts.goma_dir, opts.target_arch) |
47 else: | 47 else: |
48 if not opts.build_preference: | 48 if not opts.build_preference: |
49 if 'ninja' in os.getenv('GYP_GENERATORS', default=''): | 49 if 'ninja' in os.getenv('GYP_GENERATORS', default=''): |
50 opts.build_preference = 'ninja' | 50 opts.build_preference = 'ninja' |
51 else: | 51 else: |
52 opts.build_preference = 'make' | 52 opts.build_preference = 'make' |
53 | 53 |
54 SetBuildSystemDefault(opts.build_preference, opts.use_goma, opts.goma_dir) | 54 SetBuildSystemDefault(opts.build_preference, opts.use_goma, opts.goma_dir) |
55 | 55 |
56 if not SetupPlatformBuildEnvironment(opts): | 56 if not SetupPlatformBuildEnvironment(opts): |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 super(AndroidChromeBuilder, self).__init__(opts) | 184 super(AndroidChromeBuilder, self).__init__(opts) |
185 | 185 |
186 # TODO(qyearsley): Make this a class method and verify that it works with | 186 # TODO(qyearsley): Make this a class method and verify that it works with |
187 # a unit test. | 187 # a unit test. |
188 # pylint: disable=R0201 | 188 # pylint: disable=R0201 |
189 def _GetTargets(self): | 189 def _GetTargets(self): |
190 """Returns a list of build targets.""" | 190 """Returns a list of build targets.""" |
191 return AndroidBuilder._GetTargets(self) + ['chrome_apk'] | 191 return AndroidBuilder._GetTargets(self) + ['chrome_apk'] |
192 | 192 |
193 | 193 |
194 def SetBuildSystemDefault(build_system, use_goma, goma_dir): | 194 def SetBuildSystemDefault(build_system, use_goma, goma_dir, target_arch='ia32'): |
195 """Sets up any environment variables needed to build with the specified build | 195 """Sets up any environment variables needed to build with the specified build |
196 system. | 196 system. |
197 | 197 |
198 Args: | 198 Args: |
199 build_system: A string specifying build system. Currently only 'ninja' or | 199 build_system: A string specifying build system. Currently only 'ninja' or |
200 'make' are supported. | 200 'make' are supported. |
201 use_goma: Determines whether to GOMA for compile. | |
202 goma_dir: GOMA directory path. | |
203 target_arch: The target build architecture ia32 or x64. Default is ia32 | |
qyearsley
2015/02/27 03:37:57
Style nit: Missing period at the end; I think you
prasadv
2015/02/27 18:08:16
Done.
| |
201 """ | 204 """ |
202 if build_system == 'ninja': | 205 if build_system == 'ninja': |
203 gyp_var = os.getenv('GYP_GENERATORS', default='') | 206 gyp_var = os.getenv('GYP_GENERATORS', default='') |
204 | 207 |
205 if not gyp_var or not 'ninja' in gyp_var: | 208 if not gyp_var or not 'ninja' in gyp_var: |
206 if gyp_var: | 209 if gyp_var: |
207 os.environ['GYP_GENERATORS'] = gyp_var + ',ninja' | 210 os.environ['GYP_GENERATORS'] = gyp_var + ',ninja' |
208 else: | 211 else: |
209 os.environ['GYP_GENERATORS'] = 'ninja' | 212 os.environ['GYP_GENERATORS'] = 'ninja' |
210 | 213 |
211 if bisect_utils.IsWindowsHost(): | 214 if bisect_utils.IsWindowsHost(): |
212 os.environ['GYP_DEFINES'] = 'component=shared_library '\ | 215 os.environ['GYP_DEFINES'] = 'component=shared_library '\ |
213 'incremental_chrome_dll=1 disable_nacl=1 fastbuild=1 '\ | 216 'incremental_chrome_dll=1 disable_nacl=1 fastbuild=1 '\ |
214 'chromium_win_pch=0' | 217 'chromium_win_pch=0' |
215 | 218 |
216 elif build_system == 'make': | 219 elif build_system == 'make': |
217 os.environ['GYP_GENERATORS'] = 'make' | 220 os.environ['GYP_GENERATORS'] = 'make' |
218 else: | 221 else: |
219 raise RuntimeError('%s build not supported.' % build_system) | 222 raise RuntimeError('%s build not supported.' % build_system) |
220 | 223 |
221 if use_goma: | 224 if use_goma: |
222 os.environ['GYP_DEFINES'] = '%s %s' % (os.getenv('GYP_DEFINES', default=''), | 225 os.environ['GYP_DEFINES'] = '%s %s' % (os.getenv('GYP_DEFINES', default=''), |
223 'use_goma=1') | 226 'use_goma=1') |
224 if goma_dir: | 227 if goma_dir: |
225 os.environ['GYP_DEFINES'] += ' gomadir=%s' % goma_dir | 228 os.environ['GYP_DEFINES'] += ' gomadir=%s' % goma_dir |
226 | 229 |
230 # Produce 64 bit chromium binaries when target architecure is set to x64. | |
231 if target_arch == 'x64': | |
232 os.environ['GYP_DEFINES'] += ' target_arch=%s' % target_arch | |
227 | 233 |
228 def SetupPlatformBuildEnvironment(opts): | 234 def SetupPlatformBuildEnvironment(opts): |
229 """Performs any platform-specific setup. | 235 """Performs any platform-specific setup. |
230 | 236 |
231 Args: | 237 Args: |
232 opts: The options parsed from the command line through parse_args(). | 238 opts: The options parsed from the command line through parse_args(). |
233 | 239 |
234 Returns: | 240 Returns: |
235 True if successful. | 241 True if successful. |
236 """ | 242 """ |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
340 # (See http://crrev.com/170273005). So, we set this variable explicitly here | 346 # (See http://crrev.com/170273005). So, we set this variable explicitly here |
341 # in order to build Chrome on Android. | 347 # in order to build Chrome on Android. |
342 if 'GYP_DEFINES' not in os.environ: | 348 if 'GYP_DEFINES' not in os.environ: |
343 os.environ['GYP_DEFINES'] = 'OS=android' | 349 os.environ['GYP_DEFINES'] = 'OS=android' |
344 else: | 350 else: |
345 os.environ['GYP_DEFINES'] += ' OS=android' | 351 os.environ['GYP_DEFINES'] += ' OS=android' |
346 | 352 |
347 if opts.use_goma: | 353 if opts.use_goma: |
348 os.environ['GYP_DEFINES'] += ' use_goma=1' | 354 os.environ['GYP_DEFINES'] += ' use_goma=1' |
349 return not proc.returncode | 355 return not proc.returncode |
OLD | NEW |