nandi/frqpublic Fork 0
9a5c2a8e68ed3adac9515f317282402cb55e9cd3
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 9a5c2a8e68ed3adac9515f317282402cb55e9cd3 · nandi · 18d ago
android-ndk-bin · 32 lines · 1.3 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" "$@"
)

;; Print the directory holding the NDK's clang and LLVM binutils.
;;
;; android-cc needs one of those binaries and an APK build needs others —
;; llvm-objcopy, for the boot image blob — so the lookup is here rather than
;; duplicated at each caller. ANDROID_NDK_HOME wins if it is set; otherwise the
;; pin in android-ndk.dotslash beside this script answers, downloading once.
(require '[babashka.fs :as fs]
         '[babashka.process :as p]
         '[clojure.string :as str])

(def here (fs/parent (fs/canonicalize *file*)))
(def ndk (or (not-empty (str (System/getenv "ANDROID_NDK_HOME")))
             (not-empty (str (System/getenv "ANDROID_NDK_ROOT")))))

(if ndk
  (if-let [bin (->> ["linux-x86_64" "darwin-x86_64"]
                    (map #(fs/path ndk "toolchains" "llvm" "prebuilt" % "bin"))
                    (filter fs/directory?)
                    first)]
    (println (str bin))
    (binding [*out* *err*]
      (println (str "scripts/android-ndk-bin: no llvm prebuilt under " ndk))
      (System/exit 1)))
  (println (str (fs/parent
                 (str/trim (:out (p/shell {:out :string}
                                          "dotslash" "--" "fetch"
                                          (str (fs/path here "android-ndk.dotslash")))))))))