#!/bin/sh #_( exec "$(dirname "$0")/bb" "$0" "$@" ) ;; The NDK's clang, as the linker rustc runs for an Android target. ;; ;; The buck-side twin of this is toolchains/ndk.sh, which the C toolchain gets ;; as a dependency; both resolve the same archive, pinned in one place — ;; android-ndk.dotslash beside this script. rustc reaches it through a shim ;; instead because -Clinker takes a plain string: rustc_flags cannot carry an ;; artifact path, so the linker has to be something with a stable name. The cfg ;; in toolchains/BUCK is what keeps two NDKs from sharing a cache entry. ;; ;; ANDROID_NDK_HOME wins if it is set, so a machine that already has an NDK ;; skips the download. (require '[babashka.fs :as fs] '[babashka.process :as p] '[clojure.string :as str]) (def here (fs/parent (fs/canonicalize *file*))) (def api (or (not-empty (str (System/getenv "JOLT_ANDROID_API"))) "28")) (def target (or (not-empty (str (System/getenv "JOLT_ANDROID_TARGET"))) "aarch64-linux-android")) ;; android-ndk-bin is where the lookup lives, because an APK build wants the ;; other binaries out of the same archive. (def bin (str/trim (:out (p/shell {:out :string} (str (fs/path here "android-ndk-bin")))))) (System/exit (:exit @(apply p/process {:inherit true} (str (fs/path bin "clang")) (str "--target=" target api) *command-line-args*)))