| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 | 2 |
| 3 # Copyright (c) 2012 The Dart Authors. All rights reserved. | 3 # Copyright (c) 2014 The Dart Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 """ | 7 """ |
| 8 This script performs the final link step for Android NDK executables. | 8 This script performs the final link step for Android NDK executables. |
| 9 Usage: | 9 Usage: |
| 10 ./android_link {arm,ia32} {executable,library,shared_library} {host,target} | 10 ./android_link {arm,ia32} {executable,library,shared_library} {host,target} |
| 11 [linker args] | 11 [linker args] |
| 12 """ | 12 """ |
| 13 | 13 |
| 14 import optparse | |
| 15 import os | 14 import os |
| 16 import subprocess | 15 import subprocess |
| 17 import sys | 16 import sys |
| 18 | 17 |
| 19 # Figure out where we are. | 18 # Figure out where we are. |
| 20 SCRIPT_DIR = os.path.dirname(sys.argv[0]) | 19 SCRIPT_DIR = os.path.dirname(sys.argv[0]) |
| 21 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) | 20 DART_ROOT = os.path.realpath(os.path.join(SCRIPT_DIR, '..')) |
| 22 THIRD_PARTY_ROOT = os.path.join(DART_ROOT, 'third_party') | 21 THIRD_PARTY_ROOT = os.path.join(DART_ROOT, 'third_party') |
| 23 | 22 |
| 24 | 23 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 # for the results. We disable it here to avoid inspecting the OS type in | 61 # for the results. We disable it here to avoid inspecting the OS type in |
| 63 # the gyp files. | 62 # the gyp files. |
| 64 if link_type == 'shared_library': | 63 if link_type == 'shared_library': |
| 65 print "NOT linking shared library for Android." | 64 print "NOT linking shared library for Android." |
| 66 o_index = link_args.index('-o') | 65 o_index = link_args.index('-o') |
| 67 output = os.path.join(DART_ROOT, link_args[o_index + 1]) | 66 output = os.path.join(DART_ROOT, link_args[o_index + 1]) |
| 68 open(output, 'a').close() | 67 open(output, 'a').close() |
| 69 sys.exit(0) | 68 sys.exit(0) |
| 70 | 69 |
| 71 # Set up path to the Android NDK. | 70 # Set up path to the Android NDK. |
| 72 CheckDirExists(THIRD_PARTY_ROOT, 'third party tools'); | 71 CheckDirExists(THIRD_PARTY_ROOT, 'third party tools') |
| 73 android_tools = os.path.join(THIRD_PARTY_ROOT, 'android_tools') | 72 android_tools = os.path.join(THIRD_PARTY_ROOT, 'android_tools') |
| 74 CheckDirExists(android_tools, 'Android tools') | 73 CheckDirExists(android_tools, 'Android tools') |
| 75 android_ndk_root = os.path.join(android_tools, 'ndk') | 74 android_ndk_root = os.path.join(android_tools, 'ndk') |
| 76 CheckDirExists(android_ndk_root, 'Android NDK') | 75 CheckDirExists(android_ndk_root, 'Android NDK') |
| 77 | 76 |
| 78 # Set up the directory of the Android NDK cross-compiler toolchain. | 77 # Set up the directory of the Android NDK cross-compiler toolchain. |
| 79 toolchain_arch = 'arm-linux-androideabi-4.6' | 78 toolchain_arch = 'arm-linux-androideabi-4.6' |
| 80 if target_arch == 'ia32': | 79 if target_arch == 'ia32': |
| 81 toolchain_arch = 'x86-4.6' | 80 toolchain_arch = 'x86-4.6' |
| 82 toolchain_dir = 'linux-x86_64' | 81 toolchain_dir = 'linux-x86_64' |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 125 |
| 127 link_args.insert(0, android_linker) | 126 link_args.insert(0, android_linker) |
| 128 else: | 127 else: |
| 129 link_args.extend(['-ldl', '-lrt']) | 128 link_args.extend(['-ldl', '-lrt']) |
| 130 link_args.insert(0, 'g++') | 129 link_args.insert(0, 'g++') |
| 131 | 130 |
| 132 sys.exit(execute(link_args)) | 131 sys.exit(execute(link_args)) |
| 133 | 132 |
| 134 if __name__ == '__main__': | 133 if __name__ == '__main__': |
| 135 main() | 134 main() |
| OLD | NEW |