nandi/frqpublic Fork 0
da8477224f51f442c6cbe81414085e3da75366c8
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Write the build in babashka, and pin the babashka 34832a8 · on da8477224f51f442c6cbe81414085e3da75366c8 · nandi · 18d ago
android-cc · 32 lines · 1.4 KBBash Blame HistoryRaw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/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*)))