blob: 1b86a4bb9e19c54325636e2b9ee6e8ec42b7e0e8 [file] [log] [blame]
Takuto Ikuta3dab32e02023-01-12 18:52:001#!/usr/bin/env python3
Avi Drissman73a09d12022-09-08 20:33:382# Copyright 2012 The Chromium Authors
[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
Raul Tambre4197d3a2019-03-19 15:04:208
[email protected]89e43f652011-08-18 00:03:179import os
[email protected]74c6fd32014-05-13 17:50:0610import shutil
[email protected]89e43f652011-08-18 00:03:1711import sys
12
13
[email protected]cb431922011-08-26 21:49:5814def Main(args):
[email protected]89e43f652011-08-18 00:03:1715 script_dir = os.path.dirname(os.path.abspath(__file__))
16 src_dir = os.path.dirname(script_dir)
17 nacl_dir = os.path.join(src_dir, 'native_client')
18 nacl_build_dir = os.path.join(nacl_dir, 'build')
[email protected]eaf211012014-05-02 01:04:0019 package_version_dir = os.path.join(nacl_build_dir, 'package_version')
20 package_version = os.path.join(package_version_dir, 'package_version.py')
21 if not os.path.exists(package_version):
Raul Tambre4197d3a2019-03-19 15:04:2022 print("Can't find '%s'" % package_version)
23 print('Presumably you are intentionally building without NativeClient.')
24 print('Skipping NativeClient toolchain download.')
[email protected]89e43f652011-08-18 00:03:1725 sys.exit(0)
[email protected]eaf211012014-05-02 01:04:0026 sys.path.insert(0, package_version_dir)
27 import package_version
[email protected]a95c5872012-02-08 02:28:5128
[email protected]a95c5872012-02-08 02:28:5129 # BUG:
30 # We remove this --optional-pnacl argument, and instead replace it with
[email protected]03b32122013-04-05 07:19:4731 # --no-pnacl for most cases. However, if the bot name is an sdk
[email protected]a95c5872012-02-08 02:28:5132 # bot then we will go ahead and download it. This prevents increasing the
33 # gclient sync time for developers, or standard Chrome bots.
34 if '--optional-pnacl' in args:
35 args.remove('--optional-pnacl')
[email protected]5386cb242012-04-03 16:14:5236 use_pnacl = False
[email protected]fd84af22012-02-15 21:14:0037 buildbot_name = os.environ.get('BUILDBOT_BUILDERNAME', '')
[email protected]03b32122013-04-05 07:19:4738 if 'pnacl' in buildbot_name and 'sdk' in buildbot_name:
[email protected]5386cb242012-04-03 16:14:5239 use_pnacl = True
40 if use_pnacl:
Raul Tambre4197d3a2019-03-19 15:04:2041 print('\n*** DOWNLOADING PNACL TOOLCHAIN ***\n')
[email protected]a95c5872012-02-08 02:28:5142 else:
ncbray474ab322015-01-05 22:04:2243 args = ['--exclude', 'pnacl_newlib'] + args
[email protected]a95c5872012-02-08 02:28:5144
[email protected]03b32122013-04-05 07:19:4745 # Only download the ARM gcc toolchain if we are building for ARM
46 # TODO(olonho): we need to invent more reliable way to get build
47 # configuration info, to know if we're building for ARM.
[email protected]eaf211012014-05-02 01:04:0048 if 'target_arch=arm' not in os.environ.get('GYP_DEFINES', ''):
Raul Tambre4197d3a2019-03-19 15:04:2049 args = ['--exclude', 'nacl_arm_newlib'] + args
[email protected]03b32122013-04-05 07:19:4750
John Budorickb664d9d72017-11-20 20:18:5551 return package_version.main(args)
[email protected]89e43f652011-08-18 00:03:1752
53
54if __name__ == '__main__':
[email protected]3f09d182011-11-23 19:13:4455 sys.exit(Main(sys.argv[1:]))