FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
toolchains_path.py
1#!/usr/bin/env python3
2"""
3 Get the toolchains path
4 https://proandroiddev.com/tutorial-compile-openssl-to-1-1-1-for-android-application-87137968fee
5"""
6import argparse
7import atexit
8import inspect
9import os
10import shutil
11import stat
12import sys
13import textwrap
14
16 """Return the host tag for this platform. Die if not supported."""
17 if sys.platform.startswith('linux'):
18 return 'linux-x86_64'
19 elif sys.platform == 'darwin':
20 return 'darwin-x86_64'
21 elif sys.platform == 'win32' or sys.platform == 'cygwin':
22 host_tag = 'windows-x86_64'
23 if not os.path.exists(os.path.join(NDK_DIR, 'prebuilt', host_tag)):
24 host_tag = 'windows'
25 return host_tag
26 sys.exit('Unsupported platform: ' + sys.platform)
27
28
29def get_toolchain_path_or_die(ndk, host_tag):
30 """Return the toolchain path or die."""
31 toolchain_path = os.path.join(ndk, 'toolchains/llvm/prebuilt',
32 host_tag, 'bin')
33 if not os.path.exists(toolchain_path):
34 sys.exit('Could not find toolchain: {}'.format(toolchain_path))
35 return toolchain_path
36
37def main():
38 """Program entry point."""
39 parser = argparse.ArgumentParser(description='Optional app description')
40 parser.add_argument('--ndk', required=True,
41 help='The NDK Home directory')
42 args = parser.parse_args()
43
44 host_tag = get_host_tag_or_die()
45 toolchain_path = get_toolchain_path_or_die(args.ndk, host_tag)
46 print(toolchain_path)
47
48if __name__ == '__main__':
49 main()
get_toolchain_path_or_die(ndk, host_tag)