blob: 46c7879e3ac27705de10ae111c1bbf841e300f08 [file] [log] [blame]
[email protected]3f09d182011-11-23 19:13:441#!/usr/bin/env python
[email protected]89e43f652011-08-18 00:03:172# 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
8import os
9import sys
10
11
[email protected]cb431922011-08-26 21:49:5812def Main(args):
[email protected]556200f2011-12-06 23:28:3213 # Exit early if disable_nacl=1.
14 if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''):
15 return 0
[email protected]cb431922011-08-26 21:49:5816 # 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]1db67462011-11-29 03:21:4121 '1deb316302fde89a2200dff6550cf510ae90b89b',
[email protected]cb431922011-08-26 21:49:5822 '--base-url', ('https://commondatastorage.googleapis.com/'
23 'nativeclient-archive2/special_chromeos'),
[email protected]1db67462011-11-29 03:21:4124 '--x86-version', '7258',
[email protected]cb431922011-08-26 21:49:5825 ]
[email protected]9eef93c2011-08-26 22:24:3826 print 'NOTE: Special handling for chromeos'
27 print 'Running with these argument instead:'
28 print args
[email protected]89e43f652011-08-18 00:03:1729 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]cb431922011-08-26 21:49:5841 download_toolchains.Main(args)
[email protected]3f09d182011-11-23 19:13:4442 return 0
[email protected]89e43f652011-08-18 00:03:1743
44
45if __name__ == '__main__':
[email protected]3f09d182011-11-23 19:13:4446 sys.exit(Main(sys.argv[1:]))