media/webrtc/trunk/build/download_nacl_toolchains.py

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rwxr-xr-x

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 #!/usr/bin/env python
michael@0 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
michael@0 3 # Use of this source code is governed by a BSD-style license that can be
michael@0 4 # found in the LICENSE file.
michael@0 5
michael@0 6 """Shim to run nacl toolchain download script only if there is a nacl dir."""
michael@0 7
michael@0 8 import os
michael@0 9 import sys
michael@0 10
michael@0 11
michael@0 12 def Main(args):
michael@0 13 # Exit early if disable_nacl=1.
michael@0 14 if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''):
michael@0 15 return 0
michael@0 16 script_dir = os.path.dirname(os.path.abspath(__file__))
michael@0 17 src_dir = os.path.dirname(script_dir)
michael@0 18 nacl_dir = os.path.join(src_dir, 'native_client')
michael@0 19 nacl_build_dir = os.path.join(nacl_dir, 'build')
michael@0 20 download_script = os.path.join(nacl_build_dir, 'download_toolchains.py')
michael@0 21 if not os.path.exists(download_script):
michael@0 22 print "Can't find '%s'" % download_script
michael@0 23 print 'Presumably you are intentionally building without NativeClient.'
michael@0 24 print 'Skipping NativeClient toolchain download.'
michael@0 25 sys.exit(0)
michael@0 26 sys.path.insert(0, nacl_build_dir)
michael@0 27 import download_toolchains
michael@0 28
michael@0 29 # TODO (robertm): Finish getting PNaCl ready for prime time.
michael@0 30 # BUG:
michael@0 31 # We remove this --optional-pnacl argument, and instead replace it with
michael@0 32 # --no-pnacl for most cases. However, if the bot name is the pnacl_sdk
michael@0 33 # bot then we will go ahead and download it. This prevents increasing the
michael@0 34 # gclient sync time for developers, or standard Chrome bots.
michael@0 35 if '--optional-pnacl' in args:
michael@0 36 args.remove('--optional-pnacl')
michael@0 37 # By default we don't use PNaCl toolchain yet, unless on ARM, where
michael@0 38 # there is no other toolchain to build untrusted code at the moment.
michael@0 39 # So analyze if we're building for ARM, or on SDK buildbot.
michael@0 40 # TODO(olonho): we need to invent more reliable way to get build
michael@0 41 # configuration info, to know if we're building for ARM.
michael@0 42 use_pnacl = False
michael@0 43 if 'target_arch=arm' in os.environ.get('GYP_DEFINES', ''):
michael@0 44 use_pnacl = True
michael@0 45 buildbot_name = os.environ.get('BUILDBOT_BUILDERNAME', '')
michael@0 46 if buildbot_name.find('pnacl') >= 0 and buildbot_name.find('sdk') >= 0:
michael@0 47 use_pnacl = True
michael@0 48 if use_pnacl:
michael@0 49 print '\n*** DOWNLOADING PNACL TOOLCHAIN ***\n'
michael@0 50 else:
michael@0 51 args.append('--no-pnacl')
michael@0 52
michael@0 53 # Append the name of the file to use as a version and hash source.
michael@0 54 # NOTE: While not recommended, it is possible to redirect this file to
michael@0 55 # a chrome location to avoid branching NaCl if just a toolchain needs
michael@0 56 # to be bumped.
michael@0 57 args.append(os.path.join(nacl_dir,'TOOL_REVISIONS'))
michael@0 58
michael@0 59 download_toolchains.main(args)
michael@0 60 return 0
michael@0 61
michael@0 62
michael@0 63 if __name__ == '__main__':
michael@0 64 sys.exit(Main(sys.argv[1:]))

mercurial