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

lib.bb · 66 lines · 3.1 KBBlitzBasic Blame HistoryRaw
Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago1#!/bin/sh
2#_(
3exec "$(dirname "$0")/bb" "$0" "$@"
4)
5
Take every jolt-native half from the release, and only from there a008d3b nandi 18d ago6;; Both native libraries, out of jolt-native's release rather than a checkout.
Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago7;;
Take every jolt-native half from the release, and only from there a008d3b nandi 18d ago8;; libvidya is the tree ABI glimmer-vidya binds; libjoltmoq is the AV media
9;; plane. They come out of one archive because they are built together, and
Run this tree on a native half the builders made a32699e nandi 17d ago10;; they land in build/lib because a loader wants one directory. `just run` does
11;; not come through here — running a change to jolt-native means building it,
12;; which is what the dev shell is for — so this is the released half: what the
13;; APK and the buck2 build take, and what a run of the last release takes.
Take every jolt-native half from the release, and only from there a008d3b nandi 18d ago14;;
15;; Nothing is compiled here. The pinned bytes are the bytes: this repo used to
16;; clone jolt-native and cargo-build it, which meant a Rust toolchain, a build
17;; whose output depended on the machine, and two places — the clone's sha and
18;; the release digest — that could disagree about which jolt-native frq was
19;; running against. Bump scripts/*.dotslash instead: see bump-jolt-native.bb.
20;;
21;; Linked rather than copied, so a bump reaches a running tree by relinking and
22;; nothing goes stale in build/ — except for the one object that has to be
23;; repaired on the way through. See below.
Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago24(require '[babashka.classpath :as cp])
25(cp/add-classpath (str (babashka.fs/parent *file*)))
26(require '[frq.paths :as paths]
27 '[babashka.fs :as fs]
Take every jolt-native half from the release, and only from there a008d3b nandi 18d ago28 '[clojure.string :as str])
Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago29
30(def root (str (fs/canonicalize (fs/path (fs/parent *file*) ".."))))
Take every jolt-native half from the release, and only from there a008d3b nandi 18d ago31(def lib (fs/path root "build" "lib"))
32
33;; v0.1.3's desktop libjoltmoq.so has 68 undefined `snd_*` symbols and no
34;; DT_NEEDED on libasound: cpal's ALSA host is compiled in, and the library it
35;; calls is not named. It is the defect that release fixed for Android, in the
36;; place the fix did not reach — buck2 keeps a build script's cfgs and drops
37;; its link directives, so `cargo:rustc-link-lib=asound` never became a link
38;; argument. Undefined symbols are legal in a cdylib, so nothing said so until
39;; something tried to load it.
40;;
41;; So the library is named here instead, on a copy: the DotSlash cache holds
42;; what the release published, and rewriting that in place would make a
43;; verified digest a lie about the bytes on disk.
44;;
45;; This goes away with the release that links it. `patchelf --print-needed`
46;; below is the test for that — a fixed object is linked, not copied.
47(def repairs {"libjoltmoq.so" "libasound.so.2"})
Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago48
Take every jolt-native half from the release, and only from there a008d3b nandi 18d ago49(defn needed [file]
50 (set (str/split-lines (paths/out "patchelf" "--print-needed" file))))
Write the build in babashka, and pin the babashka 34832a8 nandi 18d ago51
Take every jolt-native half from the release, and only from there a008d3b nandi 18d ago52(fs/create-dirs lib)
53(doseq [name ["libvidya-linux" "libjoltmoq-linux"]]
54 (let [file (paths/dist root name)
55 base (fs/file-name file)
56 dest (fs/path lib base)
57 missing (get repairs base)]
58 (fs/delete-if-exists dest)
59 (if (and missing (not (contains? (needed file) missing)))
60 (do (fs/copy file dest)
61 ;; Out of the cache read-only, and patchelf writes.
62 (fs/set-posix-file-permissions dest "rw-r--r--")
63 (paths/out "patchelf" "--add-needed" missing (str dest))
64 (println (str (fs/relativize root dest) " <- " file " (+" missing ")")))
65 (do (fs/create-sym-link dest file)
66 (println (str (fs/relativize root dest) " -> " file))))))