blob: 2fdfa00f37c7fa9f72db6ed79c3c88ca25ae74f2 [file] [log] [blame]
[email protected]3f09d182011-11-23 19:13:441#!/usr/bin/env python
[email protected]6d6f83b12012-01-11 20:17:042# Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]89e43f652011-08-18 00:03:173# 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]89e43f652011-08-18 00:03:1716 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]a95c5872012-02-08 02:28:5128
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')
[email protected]fd84af22012-02-15 21:14:0037 buildbot_name = os.environ.get('BUILDBOT_BUILDERNAME', '')
38 if buildbot_name.find('pnacl') >= 0 and buildbot_name.find('sdk') >= 0:
[email protected]a95c5872012-02-08 02:28:5139 print '\n*** DOWNLOADING PNACL TOOLCHAIN ***\n'
40 else:
41 args.append('--no-pnacl')
42
[email protected]cb431922011-08-26 21:49:5843 download_toolchains.Main(args)
[email protected]3f09d182011-11-23 19:13:4444 return 0
[email protected]89e43f652011-08-18 00:03:1745
46
47if __name__ == '__main__':
[email protected]3f09d182011-11-23 19:13:4448 sys.exit(Main(sys.argv[1:]))
[email protected]a95c5872012-02-08 02:28:5149