1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/webrtc/trunk/build/download_nacl_toolchains.py Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,64 @@ 1.4 +#!/usr/bin/env python 1.5 +# Copyright (c) 2012 The Chromium Authors. All rights reserved. 1.6 +# Use of this source code is governed by a BSD-style license that can be 1.7 +# found in the LICENSE file. 1.8 + 1.9 +"""Shim to run nacl toolchain download script only if there is a nacl dir.""" 1.10 + 1.11 +import os 1.12 +import sys 1.13 + 1.14 + 1.15 +def Main(args): 1.16 + # Exit early if disable_nacl=1. 1.17 + if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''): 1.18 + return 0 1.19 + script_dir = os.path.dirname(os.path.abspath(__file__)) 1.20 + src_dir = os.path.dirname(script_dir) 1.21 + nacl_dir = os.path.join(src_dir, 'native_client') 1.22 + nacl_build_dir = os.path.join(nacl_dir, 'build') 1.23 + download_script = os.path.join(nacl_build_dir, 'download_toolchains.py') 1.24 + if not os.path.exists(download_script): 1.25 + print "Can't find '%s'" % download_script 1.26 + print 'Presumably you are intentionally building without NativeClient.' 1.27 + print 'Skipping NativeClient toolchain download.' 1.28 + sys.exit(0) 1.29 + sys.path.insert(0, nacl_build_dir) 1.30 + import download_toolchains 1.31 + 1.32 + # TODO (robertm): Finish getting PNaCl ready for prime time. 1.33 + # BUG: 1.34 + # We remove this --optional-pnacl argument, and instead replace it with 1.35 + # --no-pnacl for most cases. However, if the bot name is the pnacl_sdk 1.36 + # bot then we will go ahead and download it. This prevents increasing the 1.37 + # gclient sync time for developers, or standard Chrome bots. 1.38 + if '--optional-pnacl' in args: 1.39 + args.remove('--optional-pnacl') 1.40 + # By default we don't use PNaCl toolchain yet, unless on ARM, where 1.41 + # there is no other toolchain to build untrusted code at the moment. 1.42 + # So analyze if we're building for ARM, or on SDK buildbot. 1.43 + # TODO(olonho): we need to invent more reliable way to get build 1.44 + # configuration info, to know if we're building for ARM. 1.45 + use_pnacl = False 1.46 + if 'target_arch=arm' in os.environ.get('GYP_DEFINES', ''): 1.47 + use_pnacl = True 1.48 + buildbot_name = os.environ.get('BUILDBOT_BUILDERNAME', '') 1.49 + if buildbot_name.find('pnacl') >= 0 and buildbot_name.find('sdk') >= 0: 1.50 + use_pnacl = True 1.51 + if use_pnacl: 1.52 + print '\n*** DOWNLOADING PNACL TOOLCHAIN ***\n' 1.53 + else: 1.54 + args.append('--no-pnacl') 1.55 + 1.56 + # Append the name of the file to use as a version and hash source. 1.57 + # NOTE: While not recommended, it is possible to redirect this file to 1.58 + # a chrome location to avoid branching NaCl if just a toolchain needs 1.59 + # to be bumped. 1.60 + args.append(os.path.join(nacl_dir,'TOOL_REVISIONS')) 1.61 + 1.62 + download_toolchains.main(args) 1.63 + return 0 1.64 + 1.65 + 1.66 +if __name__ == '__main__': 1.67 + sys.exit(Main(sys.argv[1:]))