| Cross-compile for Android, with an NDK nobody has to install 14a30c0 nandi 19d ago | 1 | #!/bin/sh |
| 2 | # The NDK's clang, as the linker rustc runs for an Android target. |
| 3 | # |
| 4 | # The buck-side twin of this is toolchains/ndk.sh, which the C toolchain gets |
| 5 | # as a dependency; both resolve the same archive, pinned in one place — |
| 6 | # android-ndk.dotslash beside this script. rustc reaches it through a shim |
| 7 | # instead because -Clinker takes a plain string: rustc_flags cannot carry an |
| 8 | # artifact path, so the linker has to be something with a stable name. The cfg |
| 9 | # in toolchains/BUCK is what keeps two NDKs from sharing a cache entry. |
| 10 | # |
| 11 | # ANDROID_NDK_HOME wins if it is set, so a machine that already has an NDK |
| 12 | # skips the download. |
| 13 | set -e |
| 14 | dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) |
| 15 | api=${JOLT_ANDROID_API:-28} |
| 16 | target=${JOLT_ANDROID_TARGET:-aarch64-linux-android} |
| 17 | |
| 18 | # android-ndk-bin is where the lookup lives, because an APK build wants the |
| 19 | # other binaries out of the same archive. |
| 20 | exec "$("$dir/android-ndk-bin")/clang" --target="$target$api" "$@" |