nandi/frqpublic Fork 0
6c745dfdacf9ce4b652034872fbebd67d16a66e5
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.

android-ndk-bin · 32 lines · 1.3 KBBash Blame HistoryRaw
Build the APK with buck2, from pins rather than from a second checkout a71ef8f nandi 18d ago1#!/bin/sh
Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago2#_(
3exec "$(dirname "$0")/bb" "$0" "$@"
4)
Build the APK with buck2, from pins rather than from a second checkout a71ef8f nandi 18d ago5
Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago6;; 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 ago15
Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago16(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")))))))))