[email protected] | 3f09d18 | 2011-11-23 19:13:44 | [diff] [blame] | 1 | #!/usr/bin/env python |
[email protected] | 89e43f65 | 2011-08-18 00:03:17 | [diff] [blame] | 2 | # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 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] | cb43192 | 2011-08-26 21:49:58 | [diff] [blame] | 16 | # Handle chromeos=1 specially (until its building its own toolchain). |
| 17 | if 'chromeos=1' in os.environ.get('GYP_DEFINES', ''): |
| 18 | args = [ |
| 19 | '--nacl-newlib-only', |
| 20 | '--file-hash', 'linux_x86_newlib', |
[email protected] | 1db6746 | 2011-11-29 03:21:41 | [diff] [blame] | 21 | '1deb316302fde89a2200dff6550cf510ae90b89b', |
[email protected] | cb43192 | 2011-08-26 21:49:58 | [diff] [blame] | 22 | '--base-url', ('https://commondatastorage.googleapis.com/' |
| 23 | 'nativeclient-archive2/special_chromeos'), |
[email protected] | 1db6746 | 2011-11-29 03:21:41 | [diff] [blame] | 24 | '--x86-version', '7258', |
[email protected] | cb43192 | 2011-08-26 21:49:58 | [diff] [blame] | 25 | ] |
[email protected] | 9eef93c | 2011-08-26 22:24:38 | [diff] [blame] | 26 | print 'NOTE: Special handling for chromeos' |
| 27 | print 'Running with these argument instead:' |
| 28 | print args |
[email protected] | 89e43f65 | 2011-08-18 00:03:17 | [diff] [blame] | 29 | script_dir = os.path.dirname(os.path.abspath(__file__)) |
| 30 | src_dir = os.path.dirname(script_dir) |
| 31 | nacl_dir = os.path.join(src_dir, 'native_client') |
| 32 | nacl_build_dir = os.path.join(nacl_dir, 'build') |
| 33 | download_script = os.path.join(nacl_build_dir, 'download_toolchains.py') |
| 34 | if not os.path.exists(download_script): |
| 35 | print "Can't find '%s'" % download_script |
| 36 | print 'Presumably you are intentionally building without NativeClient.' |
| 37 | print 'Skipping NativeClient toolchain download.' |
| 38 | sys.exit(0) |
| 39 | sys.path.insert(0, nacl_build_dir) |
| 40 | import download_toolchains |
[email protected] | cb43192 | 2011-08-26 21:49:58 | [diff] [blame] | 41 | download_toolchains.Main(args) |
[email protected] | 3f09d18 | 2011-11-23 19:13:44 | [diff] [blame] | 42 | return 0 |
[email protected] | 89e43f65 | 2011-08-18 00:03:17 | [diff] [blame] | 43 | |
| 44 | |
| 45 | if __name__ == '__main__': |
[email protected] | 3f09d18 | 2011-11-23 19:13:44 | [diff] [blame] | 46 | sys.exit(Main(sys.argv[1:])) |