| Build the APK with buck2, from pins rather than from a second checkout a71ef8f nandi 18d ago | 1 | #!/bin/sh |
| Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago | 2 | #_( |
| 3 | exec "$(dirname "$0")/bb" "$0" "$@" |
| 4 | ) |
| Build the APK with buck2, from pins rather than from a second checkout a71ef8f nandi 18d ago | 5 | |
| Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago | 6 | ;; Print the directory holding the NDK's clang and LLVM binutils. |
| 7 | ;; |
| 8 | ;; android-cc needs one of those binaries and an APK build needs others — |
| 9 | ;; llvm-objcopy, for the boot image blob — so the lookup is here rather than |
| 10 | ;; duplicated at each caller. ANDROID_NDK_HOME wins if it is set; otherwise the |
| 11 | ;; pin in android-ndk.dotslash beside this script answers, downloading once. |
| 12 | (require '[babashka.fs :as fs] |
| 13 | '[babashka.process :as p] |
| 14 | '[clojure.string :as str]) |
| Build the APK with buck2, from pins rather than from a second checkout a71ef8f nandi 18d ago | 15 | |
| Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago | 16 | (def here (fs/parent (fs/canonicalize *file*))) |
| 17 | (def ndk (or (not-empty (str (System/getenv "ANDROID_NDK_HOME"))) |
| 18 | (not-empty (str (System/getenv "ANDROID_NDK_ROOT"))))) |
| 19 | |
| 20 | (if ndk |
| 21 | (if-let [bin (->> ["linux-x86_64" "darwin-x86_64"] |
| 22 | (map #(fs/path ndk "toolchains" "llvm" "prebuilt" % "bin")) |
| 23 | (filter fs/directory?) |
| 24 | first)] |
| 25 | (println (str bin)) |
| 26 | (binding [*out* *err*] |
| 27 | (println (str "scripts/android-ndk-bin: no llvm prebuilt under " ndk)) |
| 28 | (System/exit 1))) |
| 29 | (println (str (fs/parent |
| 30 | (str/trim (:out (p/shell {:out :string} |
| 31 | "dotslash" "--" "fetch" |
| 32 | (str (fs/path here "android-ndk.dotslash"))))))))) |