| Cross-compile for Android, with an NDK nobody has to install 14a30c0 nandi 19d ago | 1 | #!/bin/sh |
| 2 | # Print the directory holding the NDK's clang and LLVM binutils. |
| 3 | # |
| 4 | # android-cc needs one of those binaries and an APK build needs others — |
| 5 | # llvm-objcopy, for the boot image blob — so the lookup is here rather than |
| 6 | # duplicated at each caller. ANDROID_NDK_HOME wins if it is set; otherwise the |
| 7 | # pin in android-ndk.dotslash beside this script answers, downloading once. |
| 8 | set -e |
| 9 | dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) |
| 10 | |
| 11 | ndk=${ANDROID_NDK_HOME:-${ANDROID_NDK_ROOT:-}} |
| 12 | if [ -n "$ndk" ]; then |
| 13 | for host in linux-x86_64 darwin-x86_64; do |
| 14 | if [ -d "$ndk/toolchains/llvm/prebuilt/$host/bin" ]; then |
| 15 | echo "$ndk/toolchains/llvm/prebuilt/$host/bin" |
| 16 | exit 0 |
| 17 | fi |
| 18 | done |
| 19 | echo "scripts/android-ndk-bin: no llvm prebuilt under $ndk" >&2 |
| 20 | exit 1 |
| 21 | fi |
| 22 | |
| 23 | dirname -- "$(dotslash -- fetch "$dir/android-ndk.dotslash")" |