| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Shim to run nacl toolchain download script only if there is a nacl dir.""" | 6 """Shim to run nacl toolchain download script only if there is a nacl dir.""" |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 | 10 |
| 11 | 11 |
| 12 def Main(args): | 12 def Main(args): |
| 13 # Exit early if disable_nacl=1. | 13 # Exit early if disable_nacl=1. |
| 14 if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''): | 14 if 'disable_nacl=1' in os.environ.get('GYP_DEFINES', ''): |
| 15 return 0 | 15 return 0 |
| 16 # 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', | |
| 21 '1deb316302fde89a2200dff6550cf510ae90b89b', | |
| 22 '--base-url', ('https://commondatastorage.googleapis.com/' | |
| 23 'nativeclient-archive2/special_chromeos'), | |
| 24 '--x86-version', '7258', | |
| 25 ] | |
| 26 print 'NOTE: Special handling for chromeos' | |
| 27 print 'Running with these argument instead:' | |
| 28 print args | |
| 29 script_dir = os.path.dirname(os.path.abspath(__file__)) | 16 script_dir = os.path.dirname(os.path.abspath(__file__)) |
| 30 src_dir = os.path.dirname(script_dir) | 17 src_dir = os.path.dirname(script_dir) |
| 31 nacl_dir = os.path.join(src_dir, 'native_client') | 18 nacl_dir = os.path.join(src_dir, 'native_client') |
| 32 nacl_build_dir = os.path.join(nacl_dir, 'build') | 19 nacl_build_dir = os.path.join(nacl_dir, 'build') |
| 33 download_script = os.path.join(nacl_build_dir, 'download_toolchains.py') | 20 download_script = os.path.join(nacl_build_dir, 'download_toolchains.py') |
| 34 if not os.path.exists(download_script): | 21 if not os.path.exists(download_script): |
| 35 print "Can't find '%s'" % download_script | 22 print "Can't find '%s'" % download_script |
| 36 print 'Presumably you are intentionally building without NativeClient.' | 23 print 'Presumably you are intentionally building without NativeClient.' |
| 37 print 'Skipping NativeClient toolchain download.' | 24 print 'Skipping NativeClient toolchain download.' |
| 38 sys.exit(0) | 25 sys.exit(0) |
| 39 sys.path.insert(0, nacl_build_dir) | 26 sys.path.insert(0, nacl_build_dir) |
| 40 import download_toolchains | 27 import download_toolchains |
| 41 download_toolchains.Main(args) | 28 download_toolchains.Main(args) |
| 42 return 0 | 29 return 0 |
| 43 | 30 |
| 44 | 31 |
| 45 if __name__ == '__main__': | 32 if __name__ == '__main__': |
| 46 sys.exit(Main(sys.argv[1:])) | 33 sys.exit(Main(sys.argv[1:])) |
| OLD | NEW |