[email protected] | 3f09d18 | 2011-11-23 19:13:44 | [diff] [blame] | 1 | #!/usr/bin/env python |
[email protected] | 6d6f83b1 | 2012-01-11 20:17:04 | [diff] [blame] | 2 | # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 89e43f65 | 2011-08-18 00:03:17 | [diff] [blame] | 3 | # Use of this source code is governed by a BSD-style license that can be |
4 | # found in the LICENSE file. | ||||
5 | |||||
6 | """Shim to run nacl toolchain download script only if there is a nacl dir.""" | ||||
7 | |||||
8 | import os | ||||
9 | import sys | ||||
10 | |||||
11 | |||||
[email protected] | cb43192 | 2011-08-26 21:49:58 | [diff] [blame] | 12 | def Main(args): |
[email protected] | 556200f | 2011-12-06 23:28:32 | [diff] [blame] | 13 | # Exit early if disable_nacl=1. |
14 | if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''): | ||||
15 | return 0 | ||||
[email protected] | 89e43f65 | 2011-08-18 00:03:17 | [diff] [blame] | 16 | script_dir = os.path.dirname(os.path.abspath(__file__)) |
17 | src_dir = os.path.dirname(script_dir) | ||||
18 | nacl_dir = os.path.join(src_dir, 'native_client') | ||||
19 | nacl_build_dir = os.path.join(nacl_dir, 'build') | ||||
20 | download_script = os.path.join(nacl_build_dir, 'download_toolchains.py') | ||||
21 | if not os.path.exists(download_script): | ||||
22 | print "Can't find '%s'" % download_script | ||||
23 | print 'Presumably you are intentionally building without NativeClient.' | ||||
24 | print 'Skipping NativeClient toolchain download.' | ||||
25 | sys.exit(0) | ||||
26 | sys.path.insert(0, nacl_build_dir) | ||||
27 | import download_toolchains | ||||
[email protected] | a95c587 | 2012-02-08 02:28:51 | [diff] [blame^] | 28 | |
29 | # TODO (robertm): Finish getting PNaCl ready for prime time. | ||||
30 | # BUG: | ||||
31 | # We remove this --optional-pnacl argument, and instead replace it with | ||||
32 | # --no-pnacl for most cases. However, if the bot name is the pnacl_sdk | ||||
33 | # bot then we will go ahead and download it. This prevents increasing the | ||||
34 | # gclient sync time for developers, or standard Chrome bots. | ||||
35 | if '--optional-pnacl' in args: | ||||
36 | args.remove('--optional-pnacl') | ||||
37 | if os.environ.get('BUILDBOT_BUILDERNAME', '') == 'linux_pnacl_sdk': | ||||
38 | print '\n*** DOWNLOADING PNACL TOOLCHAIN ***\n' | ||||
39 | else: | ||||
40 | args.append('--no-pnacl') | ||||
41 | |||||
[email protected] | cb43192 | 2011-08-26 21:49:58 | [diff] [blame] | 42 | download_toolchains.Main(args) |
[email protected] | 3f09d18 | 2011-11-23 19:13:44 | [diff] [blame] | 43 | return 0 |
[email protected] | 89e43f65 | 2011-08-18 00:03:17 | [diff] [blame] | 44 | |
45 | |||||
46 | if __name__ == '__main__': | ||||
[email protected] | 3f09d18 | 2011-11-23 19:13:44 | [diff] [blame] | 47 | sys.exit(Main(sys.argv[1:])) |
[email protected] | a95c587 | 2012-02-08 02:28:51 | [diff] [blame^] | 48 |