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

Build the desktop libraries rather than fetching a release of them

`just lib` fetched libvidya and libjoltmoq out of jolt-native's release by the
digests in scripts/*.dotslash and linked them into build/lib. Nothing read
build/lib. `just run` and `just tui` take the flake's build of jolt-native
through the dev shell's JOLT_NATIVE_LIB, and the APK fetches its own archives
by digest in nix/android.nix — so the recipe's output was a directory the
README told you to make and no code ever opened.

What it was really for was the one case those two do not cover: a bare `jolt`
in the tree. deps.edn names both libraries under :jolt/native, so every
invocation — a REPL, `jolt nrepl-server` for an editor — loads them before it
reads a line and dies naming the library if the loader cannot find them.
`just repl` is that case answered directly: run.bb's re-exec into `nix develop`
and its deps overrides, with the caller's jolt command line instead of -M:frq.

So the DotSlash pins go with it, and with them paths/dist and the half of
bump-jolt-native.bb that rewrote the manifests — the JSON pretty-printer that
round-tripped their shape, and the check that the path inside each archive
still resolves. nix/android.nix is the only release pin left, which is also the
answer to the drift the two-places comment worried about: there is one place
now. The libasound repair goes too. That was v0.1.3's desktop libjoltmoq, whose
buck2 build dropped `cargo:rustc-link-lib=asound`; the flake builds the same
crate with cargo and alsa-lib as a buildInput, so the DT_NEEDED is there and
there is nothing to patchelf.

One thing fixed on the way past: bump-nix! was called after the `finally` that
deleted the temp directory it fetches into, so `just bump` could not have
weighed the Android archives. The tmp now outlives it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandi committed 2026-09-03T22:48:01-07:00 Browse files
0b81161 parent: 590779a
modified README.md +23 -15
@@ -34,10 +34,9 @@ Android is logcat.
3434
3535 ## Running
3636
37-Both native libraries, then the app:
37+The app:
3838
3939 ```bash
40-just lib
4140 just run
4241 ```
4342
@@ -46,19 +45,28 @@ on `PATH` if there is one — the dev shell puts one there — and otherwise the
4645 flake's `.#bb`, built once and kept under `build/`. Nothing has to be installed
4746 for that but Nix.
4847
49-`just lib` fetches both shared objects this client loads —
50-[jolt-native](https://gitlab.com/nandithebull/jolt-native)'s `libvidya`, the
51-retained-tree ABI glimmer paints through, and `libjoltmoq`, the AV media plane
52-— out of that project's release, by the digests in `scripts/*.dotslash`, and
53-links them into `build/lib`. Nothing is compiled: no Rust toolchain, and no
54-jolt-native checkout beside this one. It needs `patchelf`, and only to name
55-libasound in `libjoltmoq.so`, which v0.1.3 does not — see the comment in
56-`scripts/lib.bb`; that goes away with the release that links it. `just bump` moves every pin to the
57-latest release at once, and `just bump v0.1.2` to a named one.
58-
59-`just run` is `jolt -M:frq` with `LD_LIBRARY_PATH` pointed at `build/lib`. It
60-connects to `irc.freeq.at:6697` over TLS and joins `#test`. Untick TLS on the
61-connect screen (or point it at `127.0.0.1`) for a local server's
48+`just run` is `jolt -M:frq` inside `nix develop`, with `LD_LIBRARY_PATH`
49+pointed at the shell's `JOLT_NATIVE_LIB` — the flake's build of
50+[jolt-native](https://gitlab.com/nandithebull/jolt-native), which is both
51+shared objects this client loads: `libvidya`, the retained-tree ABI glimmer
52+paints through, and `libjoltmoq`, the AV media plane. The source frq runs is
53+the working tree; everything under it is built rather than fetched, at the revs
54+`flake.lock` names. Nothing has to be installed but Nix, and no jolt-native
55+checkout beside this one.
56+
57+The APK is the other half of that: it takes the two libraries out of
58+jolt-native's *release* instead, by the digests in `nix/android.nix`, because a
59+derivation's inputs have to be fetchurl. `just bump` moves those pins — and
60+deps.edn's glimmer-vidya sha — to the latest release at once, and
61+`just bump v0.1.2` to a named one.
62+
63+`jolt` on its own does not work in this tree: `deps.edn` names both libraries
64+under `:jolt/native`, so every invocation loads them before it reads a line and
65+dies if the loader cannot find them. `just repl` is that jolt with the shell
66+under it — a REPL, or `just repl nrepl-server` for an editor.
67+
68+frq connects to `irc.freeq.at:6697` over TLS and joins `#test`. Untick TLS on
69+the connect screen (or point it at `127.0.0.1`) for a local server's
6270 plain listener:
6371
6472 ```bash
@@ -34,10 +34,9 @@ Android is logcat.
34 34
35 ## Running35 ## Running
36 36
37-Both native libraries, then the app:37+The app:
38 38
39 ```bash39 ```bash
40-just lib
41 just run40 just run
42 ```41 ```
43 42
@@ -46,19 +45,28 @@ on `PATH` if there is one — the dev shell puts one there — and otherwise the
46 flake's `.#bb`, built once and kept under `build/`. Nothing has to be installed45 flake's `.#bb`, built once and kept under `build/`. Nothing has to be installed
47 for that but Nix.46 for that but Nix.
48 47
49-`just lib` fetches both shared objects this client loads —48+`just run` is `jolt -M:frq` inside `nix develop`, with `LD_LIBRARY_PATH`
50-[jolt-native](https://gitlab.com/nandithebull/jolt-native)'s `libvidya`, the49+pointed at the shell's `JOLT_NATIVE_LIB` — the flake's build of
51-retained-tree ABI glimmer paints through, and `libjoltmoq`, the AV media plane50+[jolt-native](https://gitlab.com/nandithebull/jolt-native), which is both
52-— out of that project's release, by the digests in `scripts/*.dotslash`, and51+shared objects this client loads: `libvidya`, the retained-tree ABI glimmer
53-links them into `build/lib`. Nothing is compiled: no Rust toolchain, and no52+paints through, and `libjoltmoq`, the AV media plane. The source frq runs is
54-jolt-native checkout beside this one. It needs `patchelf`, and only to name53+the working tree; everything under it is built rather than fetched, at the revs
55-libasound in `libjoltmoq.so`, which v0.1.3 does not — see the comment in54+`flake.lock` names. Nothing has to be installed but Nix, and no jolt-native
56-`scripts/lib.bb`; that goes away with the release that links it. `just bump` moves every pin to the55+checkout beside this one.
57-latest release at once, and `just bump v0.1.2` to a named one.56+
58-57+The APK is the other half of that: it takes the two libraries out of
59-`just run` is `jolt -M:frq` with `LD_LIBRARY_PATH` pointed at `build/lib`. It58+jolt-native's *release* instead, by the digests in `nix/android.nix`, because a
60-connects to `irc.freeq.at:6697` over TLS and joins `#test`. Untick TLS on the59+derivation's inputs have to be fetchurl. `just bump` moves those pins — and
61-connect screen (or point it at `127.0.0.1`) for a local server's60+deps.edn's glimmer-vidya sha — to the latest release at once, and
61+`just bump v0.1.2` to a named one.
62+
63+`jolt` on its own does not work in this tree: `deps.edn` names both libraries
64+under `:jolt/native`, so every invocation loads them before it reads a line and
65+dies if the loader cannot find them. `just repl` is that jolt with the shell
66+under it — a REPL, or `just repl nrepl-server` for an editor.
67+
68+frq connects to `irc.freeq.at:6697` over TLS and joins `#test`. Untick TLS on
69+the connect screen (or point it at `127.0.0.1`) for a local server's
62 plain listener:70 plain listener:
63 71
64 ```bash72 ```bash
modified deps.edn +1 -1
@@ -26,7 +26,7 @@
2626 ;; lives in src/frq/av.jolt; the media half is three thousand lines of codec
2727 ;; and transport that would only be written badly a second time here.
2828 ;;
29- ;; just lib
29+ ;; just run
3030 :jolt/native [{:name "vidya"
3131 :darwin ["libvidya.dylib"]
3232 :linux ["libvidya.so"]}
@@ -26,7 +26,7 @@
26 ;; lives in src/frq/av.jolt; the media half is three thousand lines of codec26 ;; lives in src/frq/av.jolt; the media half is three thousand lines of codec
27 ;; and transport that would only be written badly a second time here.27 ;; and transport that would only be written badly a second time here.
28 ;;28 ;;
29- ;; just lib29+ ;; just run
30 :jolt/native [{:name "vidya"30 :jolt/native [{:name "vidya"
31 :darwin ["libvidya.dylib"]31 :darwin ["libvidya.dylib"]
32 :linux ["libvidya.so"]}32 :linux ["libvidya.so"]}
modified flake.nix +4 -4
@@ -29,10 +29,10 @@
2929 flake = false;
3030 };
3131
32- # Ahead of v0.1.3, which is what deps.edn and the scripts/*.dotslash pins
33- # name — and deliberately: the pins are the last release, and this is what
34- # `just run` builds, so a change to jolt-native can be run before there is
35- # a release to fetch. The two meet again at `just bump`.
32+ # Ahead of v0.1.3, which is what nix/android.nix pins the APK to — and
33+ # deliberately: that pin is the last release, and this is what `just run`
34+ # builds, so a change to jolt-native can be run before there is a release
35+ # to fetch. The two meet again at `just bump`.
3636 #
3737 # Pinned all the same, and pinned to a rev: this input carries both halves of
3838 # glimmer-vidya — libvidya, and the Jolt side that binds it — so an
@@ -29,10 +29,10 @@
29 flake = false;29 flake = false;
30 };30 };
31 31
32- # Ahead of v0.1.3, which is what deps.edn and the scripts/*.dotslash pins32+ # Ahead of v0.1.3, which is what nix/android.nix pins the APK to — and
33- # name — and deliberately: the pins are the last release, and this is what33+ # deliberately: that pin is the last release, and this is what `just run`
34- # `just run` builds, so a change to jolt-native can be run before there is34+ # builds, so a change to jolt-native can be run before there is a release
35- # a release to fetch. The two meet again at `just bump`.35+ # to fetch. The two meet again at `just bump`.
36 #36 #
37 # Pinned all the same, and pinned to a rev: this input carries both halves of37 # Pinned all the same, and pinned to a rev: this input carries both halves of
38 # glimmer-vidya — libvidya, and the Jolt side that binds it — so an38 # glimmer-vidya — libvidya, and the Jolt side that binds it — so an
modified justfile +5 -5
@@ -8,15 +8,11 @@ set shell := ["bash", "-euo", "pipefail", "-c"]
88 default:
99 @just --list
1010
11-# Both native libraries, out of the release pins. `run` builds them instead.
12-lib:
13- scripts/lib.bb
14-
1511 # The APK, out of the flake. `just apk install` puts it on the device.
1612 apk action="build":
1713 scripts/apk.bb {{action}}
1814
19-# Every jolt-native pin — the manifests, deps.edn, nix/android.nix — at a release.
15+# Every jolt-native pin — nix/android.nix and deps.edn — at a release.
2016 bump tag="":
2117 scripts/bump-jolt-native.bb {{tag}}
2218
@@ -27,3 +23,7 @@ run *args:
2723 # The same screens in a terminal. `just tui --headless` prints one screenshot.
2824 tui *args:
2925 scripts/tui.bb {{args}}
26+
27+# A jolt with the native libraries under it: a REPL, or `just repl nrepl-server`.
28+repl *args:
29+ scripts/repl.bb {{args}}
@@ -8,15 +8,11 @@ set shell := ["bash", "-euo", "pipefail", "-c"]
8 default:8 default:
9 @just --list9 @just --list
10 10
11-# Both native libraries, out of the release pins. `run` builds them instead.
12-lib:
13- scripts/lib.bb
14-
15 # The APK, out of the flake. `just apk install` puts it on the device.11 # The APK, out of the flake. `just apk install` puts it on the device.
16 apk action="build":12 apk action="build":
17 scripts/apk.bb {{action}}13 scripts/apk.bb {{action}}
18 14
19-# Every jolt-native pin — the manifests, deps.edn, nix/android.nix — at a release.15+# Every jolt-native pin — nix/android.nix and deps.edn — at a release.
20 bump tag="":16 bump tag="":
21 scripts/bump-jolt-native.bb {{tag}}17 scripts/bump-jolt-native.bb {{tag}}
22 18
@@ -27,3 +23,7 @@ run *args:
27 # The same screens in a terminal. `just tui --headless` prints one screenshot.23 # The same screens in a terminal. `just tui --headless` prints one screenshot.
28 tui *args:24 tui *args:
29 scripts/tui.bb {{args}}25 scripts/tui.bb {{args}}
26+
27+# A jolt with the native libraries under it: a REPL, or `just repl nrepl-server`.
28+repl *args:
29+ scripts/repl.bb {{args}}
modified nix/android.nix +5 -6
@@ -47,12 +47,11 @@ let
4747 ndkBin = "${ndkRoot}/toolchains/llvm/prebuilt/linux-x86_64/bin";
4848 cc = "${ndkBin}/aarch64-linux-android${apiLevel}-clang";
4949
50- # What comes out of jolt-native's releases. These two pins are the Android
51- # half of what `just bump` moves — the desktop half stays in
52- # scripts/*.dotslash, and the tag written here is the one written there, so
53- # a phone and a laptop run the same release. Do not edit them by hand:
54- # bump-jolt-native.bb fetches each archive, weighs it, and writes both the
55- # url and the digest below.
50+ # What comes out of jolt-native's releases. These two pins are the whole of
51+ # what `just bump` moves on the native side — a desktop run builds the flake
52+ # input instead, so this is the only place a release is fetched. Do not edit
53+ # them by hand: bump-jolt-native.bb fetches each archive, weighs it, and
54+ # writes both the url and the digest below.
5655 #
5756 # One archive, two libraries: libvidya (the retained-tree UI) and libjoltmoq
5857 # (the AV media plane). They are built together and only make sense together
@@ -47,12 +47,11 @@ let
47 ndkBin = "${ndkRoot}/toolchains/llvm/prebuilt/linux-x86_64/bin";47 ndkBin = "${ndkRoot}/toolchains/llvm/prebuilt/linux-x86_64/bin";
48 cc = "${ndkBin}/aarch64-linux-android${apiLevel}-clang";48 cc = "${ndkBin}/aarch64-linux-android${apiLevel}-clang";
49 49
50- # What comes out of jolt-native's releases. These two pins are the Android50+ # What comes out of jolt-native's releases. These two pins are the whole of
51- # half of what `just bump` moves — the desktop half stays in51+ # what `just bump` moves on the native side — a desktop run builds the flake
52- # scripts/*.dotslash, and the tag written here is the one written there, so52+ # input instead, so this is the only place a release is fetched. Do not edit
53- # a phone and a laptop run the same release. Do not edit them by hand:53+ # them by hand: bump-jolt-native.bb fetches each archive, weighs it, and
54- # bump-jolt-native.bb fetches each archive, weighs it, and writes both the54+ # writes both the url and the digest below.
55- # url and the digest below.
56 #55 #
57 # One archive, two libraries: libvidya (the retained-tree UI) and libjoltmoq56 # One archive, two libraries: libvidya (the retained-tree UI) and libjoltmoq
58 # (the AV media plane). They are built together and only make sense together57 # (the AV media plane). They are built together and only make sense together
modified scripts/bb +4 -5
@@ -6,12 +6,11 @@
66 # Clojure is already the language this repo is written in.
77 #
88 # This used to be a DotSlash manifest, pinning a release of babashka the way
9-# the native libraries are pinned. It is the flake's now, for the reason the
9+# the desktop libraries were pinned. It is the flake's now, for the reason the
1010 # flake exists: a bb from `nixpkgs` is one this tree already names a version
11-# of, so a checkout needs nix and nothing else. DotSlash still answers for the
12-# desktop libraries — those are jolt-native's releases, which no nixpkgs has —
13-# but nothing has to be installed to reach *them* any more either, because the
14-# script that fetches them starts here.
11+# of, so a checkout needs nix and nothing else. Nothing is fetched by digest
12+# here any more — the libraries a run loads are the flake's too, and the only
13+# release pins left are the APK's, in nix/android.nix.
1514 #
1615 # Three answers, in order:
1716 #
@@ -6,12 +6,11 @@
6 # Clojure is already the language this repo is written in.6 # Clojure is already the language this repo is written in.
7 #7 #
8 # This used to be a DotSlash manifest, pinning a release of babashka the way8 # This used to be a DotSlash manifest, pinning a release of babashka the way
9-# the native libraries are pinned. It is the flake's now, for the reason the9+# the desktop libraries were pinned. It is the flake's now, for the reason the
10 # flake exists: a bb from `nixpkgs` is one this tree already names a version10 # flake exists: a bb from `nixpkgs` is one this tree already names a version
11-# of, so a checkout needs nix and nothing else. DotSlash still answers for the11+# of, so a checkout needs nix and nothing else. Nothing is fetched by digest
12-# desktop libraries — those are jolt-native's releases, which no nixpkgs has —12+# here any more — the libraries a run loads are the flake's too, and the only
13-# but nothing has to be installed to reach *them* any more either, because the13+# release pins left are the APK's, in nix/android.nix.
14-# script that fetches them starts here.
15 #14 #
16 # Three answers, in order:15 # Three answers, in order:
17 #16 #
modified scripts/bump-jolt-native.bb +23 -89
@@ -8,24 +8,22 @@ exec "$(dirname "$0")/bb" "$0" "$@"
88 ;; scripts/bump-jolt-native.bb # the latest release
99 ;; scripts/bump-jolt-native.bb v0.1.3 # a named one
1010 ;;
11-;; A jolt-native bump is four facts in three places: the tag, the URL, the size
12-;; and the digest of each archive in scripts/*.dotslash, the same URL and digest
13-;; for the Android archives in nix/android.nix, and the release's commit in
11+;; A jolt-native bump is three facts in two places: the URL and the digest of
12+;; each Android archive in nix/android.nix, and the release's commit in
1413 ;; deps.edn. Done by hand it is a lot of copying between a browser and a
1514 ;; sha256sum, and the failure mode is a pin that still says v0.1.2 while its
16-;; digest is v0.1.3's — which DotSlash catches, but only on the machine that
17-;; next fetches it, and which fetchurl catches at build time and no sooner.
15+;; digest is v0.1.3's — which fetchurl catches at build time and no sooner.
1816 ;;
19-;; The two places exist because the two builds fetch differently and neither can
20-;; read the other's pin: `just lib` and a released-halves run resolve DotSlash
21-;; manifests, and the APK is a nix derivation, whose inputs have to be fetchurl.
22-;; The digests are the same bytes either way — DotSlash's `digest` is over the
23-;; archive, which is what fetchurl hashes too.
17+;; Only the APK fetches a release now; a desktop run builds jolt-native out of
18+;; the flake input, whose rev is flake.lock's. So the two halves this moves are
19+;; the phone's bytes and the Jolt source that binds them, and the thing to
20+;; remember is that flake.lock is a third pin nothing here touches — see the
21+;; jolt-native input's comment in flake.nix for why it runs ahead.
2422 ;;
2523 ;; So: ask GitLab what the release holds, fetch each archive once, weigh it,
26-;; write the manifests and nix/android.nix back, and put the release's commit in
27-;; deps.edn — which is what jolt resolves glimmer-vidya from, and so what the
28-;; boot image compiles against.
24+;; write nix/android.nix back, and put the release's commit in deps.edn — which
25+;; is what jolt resolves glimmer-vidya from, and so what the boot image
26+;; compiles against.
2927 ;;
3028 ;; Nothing here decides whether the new release is a good idea. It only makes
3129 ;; the tree say one version instead of two.
@@ -37,8 +35,7 @@ exec "$(dirname "$0")/bb" "$0" "$@"
3735 '[cheshire.core :as json]
3836 '[clojure.string :as str])
3937
40-(def here (fs/parent (fs/canonicalize *file*)))
41-(def root (str (fs/parent here)))
38+(def root (str (fs/parent (fs/parent (fs/canonicalize *file*)))))
4239 (def project "nandithebull%2Fjolt-native")
4340 (def repo "https://gitlab.com/nandithebull/jolt-native")
4441
@@ -55,21 +52,7 @@ exec "$(dirname "$0")/bb" "$0" "$@"
5552 body
5653 (or (first body) (paths/die (str "no releases at all under " repo))))))
5754
58-;; The manifests this tree pins out of jolt-native. Every DotSlash file beside
59-;; this script whose providers point at the repo — rather than a list written
60-;; here, which would be a sixth place to forget.
61-(defn manifests []
62- (->> (fs/glob here "*.dotslash")
63- sort
64- (keep (fn [file]
65- (let [text (slurp (str file))
66- json (json/parse-string (subs text (str/index-of text "{")))]
67- (when (->> (get json "platforms")
68- vals
69- (some #(str/starts-with? (get-in % ["providers" 0 "url"]) repo)))
70- {:file file :text text :json json}))))))
71-
72-;; The archive an entry names, at the new tag. The URL a manifest carries is the
55+;; The archive an entry names, at the new tag. The URL a pin carries is the
7356 ;; release permalink — /-/releases/<tag>/downloads/<asset> — so the asset's name
7457 ;; is its last segment, and the name carries the version too. Both move.
7558 (defn retag [url old new]
@@ -80,65 +63,20 @@ exec "$(dirname "$0")/bb" "$0" "$@"
8063 (defn tag-of [url]
8164 (second (re-find #"/-/releases/([^/]+)/downloads/" url)))
8265
83-;; Fetch once per distinct URL, then weigh it: DotSlash wants the size and the
84-;; sha256 of the archive as downloaded, not of anything inside it.
66+;; Fetch once per distinct URL, then weigh it: the digest is over the archive as
67+;; downloaded, which is what fetchurl hashes too — not of anything inside it.
8568 (def weigh
8669 (memoize
8770 (fn [dir url]
8871 (let [file (fs/path dir (last (str/split url #"/")))]
8972 (println (str " fetching " (fs/file-name file)))
9073 (p/shell "curl" "-fsSL" "-o" (str file) url)
91- {:size (fs/size file)
92- :digest (first (str/split (paths/out "sha256sum" (str file)) #"\s+"))
93- :file file}))))
94-
95-;; What the shim will reach for inside the archive. A release that moved a file
96-;; leaves a manifest that fetches and verifies and then cannot resolve, which is
97-;; a worse thing to find out from than this.
98-(defn check-path! [{:keys [file]} path]
99- (let [names (set (str/split-lines (paths/out "tar" "-tzf" (str file))))]
100- (when-not (some #(= path (str/replace % #"^\./" "")) names)
101- (paths/die (str "no " path " in " (fs/file-name file))
102- "The release moved it; the manifest's `path` needs a hand."))))
103-
104-;; The JSON back out, in the shape it went in: two-space indentation, a value
105-;; after each key, and the `//` comment block above it kept — that block is why
106-;; anyone reading the manifest knows what the object is for.
107-(def pretty
108- (json/create-pretty-printer
109- (assoc json/default-pretty-print-options
110- :indentation " "
111- :indent-arrays? true
112- :object-field-value-separator ": ")))
113-
114-(defn rewrite [{:keys [file text json]} tmp tag]
115- (let [platforms (get json "platforms")
116- updated
117- (into (array-map)
118- (for [[platform entry] platforms
119- :let [url (retag (get-in entry ["providers" 0 "url"]) (tag-of (get-in entry ["providers" 0 "url"])) tag)
120- {:keys [size digest] :as got} (weigh tmp url)]]
121- (do
122- (check-path! got (get entry "path"))
123- [platform (-> entry
124- (assoc "size" size "digest" digest)
125- (assoc-in ["providers" 0 "url"] url))])))
126- head (subs text 0 (str/index-of text "{"))
127- ;; The prose above the JSON names the release too — "from jolt-native's
128- ;; v0.1.3 release". Left saying the old one it would be a lie the moment
129- ;; this script succeeds.
130- head (reduce (fn [h old] (str/replace h old tag))
131- head
132- (distinct (keep #(tag-of (get-in % ["providers" 0 "url"])) (vals platforms))))]
133- (spit (str file) (str head (json/generate-string (assoc json "platforms" updated) {:pretty pretty}) "\n"))
134- (println (str " " (fs/file-name file)))))
74+ (first (str/split (paths/out "sha256sum" (str file)) #"\s+"))))))
13575
136-;; nix/android.nix fetches two of the same archives as `pkgs.fetchurl`, because
137-;; a derivation cannot resolve a DotSlash manifest: the fetch is the input, and
138-;; an input has to be a fixed-output derivation with the digest written down.
139-;; Rewritten as text for the same reason deps.edn is — the file is mostly the
140-;; comments explaining each step, and there is no round-tripping Nix as data
141-;; here anyway.
76+;; nix/android.nix fetches the release archives as `pkgs.fetchurl`, which is the
77+;; only fetch of a release left in this tree. Rewritten as text for the same
78+;; reason deps.edn is — the file is mostly the comments explaining each step,
79+;; and there is no round-tripping Nix as data here anyway.
14280 ;;
14381 ;; Every fetchurl whose url points at the repo, whatever it is called: a third
14482 ;; archive appearing in android.nix should move with the other two rather than
@@ -156,7 +94,7 @@ exec "$(dirname "$0")/bb" "$0" "$@"
15694 updated (str/replace text pattern
15795 (fn [[_ head url mid _ tail]]
15896 (let [new-url (retag url (tag-of url) tag)
159- {:keys [digest]} (weigh tmp new-url)]
97+ digest (weigh tmp new-url)]
16098 (swap! seen conj (last (str/split new-url #"/")))
16199 (str head new-url mid digest tail))))]
162100 (when (empty? @seen)
@@ -182,15 +120,11 @@ exec "$(dirname "$0")/bb" "$0" "$@"
182120 rel (release tag)
183121 tag (get rel "tag_name")
184122 commit (get-in rel ["commit" "id"])
185- files (manifests)
186123 tmp (fs/create-temp-dir {:prefix "jolt-native-"})]
187- (when (empty? files)
188- (paths/die (str "no DotSlash manifest in " here " points at " repo)))
189124 (println (str "jolt-native " tag " (" (subs commit 0 8) ")"))
190125 (try
191- (doseq [m files] (rewrite m tmp tag))
126+ (bump-nix! tmp tag)
192127 (finally (fs/delete-tree tmp)))
193- (bump-nix! tmp tag)
194128 (bump-deps! commit)
195- (println (str "\nNow: git diff, then `just lib` and `just apk` — the pins are "
129+ (println (str "\nNow: git diff, then `just apk` — the pins are "
196130 "written, nothing is built.")))
@@ -8,24 +8,22 @@ exec "$(dirname "$0")/bb" "$0" "$@"
8 ;; scripts/bump-jolt-native.bb # the latest release8 ;; scripts/bump-jolt-native.bb # the latest release
9 ;; scripts/bump-jolt-native.bb v0.1.3 # a named one9 ;; scripts/bump-jolt-native.bb v0.1.3 # a named one
10 ;;10 ;;
11-;; A jolt-native bump is four facts in three places: the tag, the URL, the size11+;; A jolt-native bump is three facts in two places: the URL and the digest of
12-;; and the digest of each archive in scripts/*.dotslash, the same URL and digest12+;; each Android archive in nix/android.nix, and the release's commit in
13-;; for the Android archives in nix/android.nix, and the release's commit in
14 ;; deps.edn. Done by hand it is a lot of copying between a browser and a13 ;; deps.edn. Done by hand it is a lot of copying between a browser and a
15 ;; sha256sum, and the failure mode is a pin that still says v0.1.2 while its14 ;; sha256sum, and the failure mode is a pin that still says v0.1.2 while its
16-;; digest is v0.1.3's — which DotSlash catches, but only on the machine that15+;; digest is v0.1.3's — which fetchurl catches at build time and no sooner.
17-;; next fetches it, and which fetchurl catches at build time and no sooner.
18 ;;16 ;;
19-;; The two places exist because the two builds fetch differently and neither can17+;; Only the APK fetches a release now; a desktop run builds jolt-native out of
20-;; read the other's pin: `just lib` and a released-halves run resolve DotSlash18+;; the flake input, whose rev is flake.lock's. So the two halves this moves are
21-;; manifests, and the APK is a nix derivation, whose inputs have to be fetchurl.19+;; the phone's bytes and the Jolt source that binds them, and the thing to
22-;; The digests are the same bytes either way — DotSlash's `digest` is over the20+;; remember is that flake.lock is a third pin nothing here touches — see the
23-;; archive, which is what fetchurl hashes too.21+;; jolt-native input's comment in flake.nix for why it runs ahead.
24 ;;22 ;;
25 ;; So: ask GitLab what the release holds, fetch each archive once, weigh it,23 ;; So: ask GitLab what the release holds, fetch each archive once, weigh it,
26-;; write the manifests and nix/android.nix back, and put the release's commit in24+;; write nix/android.nix back, and put the release's commit in deps.edn — which
27-;; deps.edn — which is what jolt resolves glimmer-vidya from, and so what the25+;; is what jolt resolves glimmer-vidya from, and so what the boot image
28-;; boot image compiles against.26+;; compiles against.
29 ;;27 ;;
30 ;; Nothing here decides whether the new release is a good idea. It only makes28 ;; Nothing here decides whether the new release is a good idea. It only makes
31 ;; the tree say one version instead of two.29 ;; the tree say one version instead of two.
@@ -37,8 +35,7 @@ exec "$(dirname "$0")/bb" "$0" "$@"
37 '[cheshire.core :as json]35 '[cheshire.core :as json]
38 '[clojure.string :as str])36 '[clojure.string :as str])
39 37
40-(def here (fs/parent (fs/canonicalize *file*)))38+(def root (str (fs/parent (fs/parent (fs/canonicalize *file*)))))
41-(def root (str (fs/parent here)))
42 (def project "nandithebull%2Fjolt-native")39 (def project "nandithebull%2Fjolt-native")
43 (def repo "https://gitlab.com/nandithebull/jolt-native")40 (def repo "https://gitlab.com/nandithebull/jolt-native")
44 41
@@ -55,21 +52,7 @@ exec "$(dirname "$0")/bb" "$0" "$@"
55 body52 body
56 (or (first body) (paths/die (str "no releases at all under " repo))))))53 (or (first body) (paths/die (str "no releases at all under " repo))))))
57 54
58-;; The manifests this tree pins out of jolt-native. Every DotSlash file beside55+;; The archive an entry names, at the new tag. The URL a pin carries is the
59-;; this script whose providers point at the repo — rather than a list written
60-;; here, which would be a sixth place to forget.
61-(defn manifests []
62- (->> (fs/glob here "*.dotslash")
63- sort
64- (keep (fn [file]
65- (let [text (slurp (str file))
66- json (json/parse-string (subs text (str/index-of text "{")))]
67- (when (->> (get json "platforms")
68- vals
69- (some #(str/starts-with? (get-in % ["providers" 0 "url"]) repo)))
70- {:file file :text text :json json}))))))
71-
72-;; The archive an entry names, at the new tag. The URL a manifest carries is the
73 ;; release permalink — /-/releases/<tag>/downloads/<asset> — so the asset's name56 ;; release permalink — /-/releases/<tag>/downloads/<asset> — so the asset's name
74 ;; is its last segment, and the name carries the version too. Both move.57 ;; is its last segment, and the name carries the version too. Both move.
75 (defn retag [url old new]58 (defn retag [url old new]
@@ -80,65 +63,20 @@ exec "$(dirname "$0")/bb" "$0" "$@"
80 (defn tag-of [url]63 (defn tag-of [url]
81 (second (re-find #"/-/releases/([^/]+)/downloads/" url)))64 (second (re-find #"/-/releases/([^/]+)/downloads/" url)))
82 65
83-;; Fetch once per distinct URL, then weigh it: DotSlash wants the size and the66+;; Fetch once per distinct URL, then weigh it: the digest is over the archive as
84-;; sha256 of the archive as downloaded, not of anything inside it.67+;; downloaded, which is what fetchurl hashes too — not of anything inside it.
85 (def weigh68 (def weigh
86 (memoize69 (memoize
87 (fn [dir url]70 (fn [dir url]
88 (let [file (fs/path dir (last (str/split url #"/")))]71 (let [file (fs/path dir (last (str/split url #"/")))]
89 (println (str " fetching " (fs/file-name file)))72 (println (str " fetching " (fs/file-name file)))
90 (p/shell "curl" "-fsSL" "-o" (str file) url)73 (p/shell "curl" "-fsSL" "-o" (str file) url)
91- {:size (fs/size file)74+ (first (str/split (paths/out "sha256sum" (str file)) #"\s+"))))))
92- :digest (first (str/split (paths/out "sha256sum" (str file)) #"\s+"))
93- :file file}))))
94-
95-;; What the shim will reach for inside the archive. A release that moved a file
96-;; leaves a manifest that fetches and verifies and then cannot resolve, which is
97-;; a worse thing to find out from than this.
98-(defn check-path! [{:keys [file]} path]
99- (let [names (set (str/split-lines (paths/out "tar" "-tzf" (str file))))]
100- (when-not (some #(= path (str/replace % #"^\./" "")) names)
101- (paths/die (str "no " path " in " (fs/file-name file))
102- "The release moved it; the manifest's `path` needs a hand."))))
103-
104-;; The JSON back out, in the shape it went in: two-space indentation, a value
105-;; after each key, and the `//` comment block above it kept — that block is why
106-;; anyone reading the manifest knows what the object is for.
107-(def pretty
108- (json/create-pretty-printer
109- (assoc json/default-pretty-print-options
110- :indentation " "
111- :indent-arrays? true
112- :object-field-value-separator ": ")))
113-
114-(defn rewrite [{:keys [file text json]} tmp tag]
115- (let [platforms (get json "platforms")
116- updated
117- (into (array-map)
118- (for [[platform entry] platforms
119- :let [url (retag (get-in entry ["providers" 0 "url"]) (tag-of (get-in entry ["providers" 0 "url"])) tag)
120- {:keys [size digest] :as got} (weigh tmp url)]]
121- (do
122- (check-path! got (get entry "path"))
123- [platform (-> entry
124- (assoc "size" size "digest" digest)
125- (assoc-in ["providers" 0 "url"] url))])))
126- head (subs text 0 (str/index-of text "{"))
127- ;; The prose above the JSON names the release too — "from jolt-native's
128- ;; v0.1.3 release". Left saying the old one it would be a lie the moment
129- ;; this script succeeds.
130- head (reduce (fn [h old] (str/replace h old tag))
131- head
132- (distinct (keep #(tag-of (get-in % ["providers" 0 "url"])) (vals platforms))))]
133- (spit (str file) (str head (json/generate-string (assoc json "platforms" updated) {:pretty pretty}) "\n"))
134- (println (str " " (fs/file-name file)))))
135 75
136-;; nix/android.nix fetches two of the same archives as `pkgs.fetchurl`, because76+;; nix/android.nix fetches the release archives as `pkgs.fetchurl`, which is the
137-;; a derivation cannot resolve a DotSlash manifest: the fetch is the input, and77+;; only fetch of a release left in this tree. Rewritten as text for the same
138-;; an input has to be a fixed-output derivation with the digest written down.78+;; reason deps.edn is — the file is mostly the comments explaining each step,
139-;; Rewritten as text for the same reason deps.edn is — the file is mostly the79+;; and there is no round-tripping Nix as data here anyway.
140-;; comments explaining each step, and there is no round-tripping Nix as data
141-;; here anyway.
142 ;;80 ;;
143 ;; Every fetchurl whose url points at the repo, whatever it is called: a third81 ;; Every fetchurl whose url points at the repo, whatever it is called: a third
144 ;; archive appearing in android.nix should move with the other two rather than82 ;; archive appearing in android.nix should move with the other two rather than
@@ -156,7 +94,7 @@ exec "$(dirname "$0")/bb" "$0" "$@"
156 updated (str/replace text pattern94 updated (str/replace text pattern
157 (fn [[_ head url mid _ tail]]95 (fn [[_ head url mid _ tail]]
158 (let [new-url (retag url (tag-of url) tag)96 (let [new-url (retag url (tag-of url) tag)
159- {:keys [digest]} (weigh tmp new-url)]97+ digest (weigh tmp new-url)]
160 (swap! seen conj (last (str/split new-url #"/")))98 (swap! seen conj (last (str/split new-url #"/")))
161 (str head new-url mid digest tail))))]99 (str head new-url mid digest tail))))]
162 (when (empty? @seen)100 (when (empty? @seen)
@@ -182,15 +120,11 @@ exec "$(dirname "$0")/bb" "$0" "$@"
182 rel (release tag)120 rel (release tag)
183 tag (get rel "tag_name")121 tag (get rel "tag_name")
184 commit (get-in rel ["commit" "id"])122 commit (get-in rel ["commit" "id"])
185- files (manifests)
186 tmp (fs/create-temp-dir {:prefix "jolt-native-"})]123 tmp (fs/create-temp-dir {:prefix "jolt-native-"})]
187- (when (empty? files)
188- (paths/die (str "no DotSlash manifest in " here " points at " repo)))
189 (println (str "jolt-native " tag " (" (subs commit 0 8) ")"))124 (println (str "jolt-native " tag " (" (subs commit 0 8) ")"))
190 (try125 (try
191- (doseq [m files] (rewrite m tmp tag))126+ (bump-nix! tmp tag)
192 (finally (fs/delete-tree tmp)))127 (finally (fs/delete-tree tmp)))
193- (bump-nix! tmp tag)
194 (bump-deps! commit)128 (bump-deps! commit)
195- (println (str "\nNow: git diff, then `just lib` and `just apk` — the pins are "129+ (println (str "\nNow: git diff, then `just apk` — the pins are "
196 "written, nothing is built.")))130 "written, nothing is built.")))
modified scripts/frq/paths.clj +0 -17
@@ -19,23 +19,6 @@
1919
2020 (defn env [k default] (or (not-empty (System/getenv k)) default))
2121
22-;; An archive pinned in scripts/*.dotslash, resolved to the file its manifest
23-;; names. DotSlash downloads it once, verifies the digest and caches it, so
24-;; every script here asks the same question of the same pin and a second
25-;; jolt-native checkout is never part of the answer.
26-;;
27-;; Only the desktop libraries are pinned this way now — `just lib`, and the
28-;; release half of a run. The Android side is nix/android.nix, which fetches
29-;; the same archives by the same digests as `fetchurl`.
30-;;
31-;; DOTSLASH names the fetcher for a caller that has one but has not got it on
32-;; PATH.
33-(defn dist [root name]
34- (let [manifest (fs/path root "scripts" (str name ".dotslash"))]
35- (when-not (fs/exists? manifest)
36- (die (str "no DotSlash manifest: " manifest)))
37- (out (env "DOTSLASH" "dotslash") "--" "fetch" manifest)))
38-
3922 ;; The sha deps.edn pins for a git url, so a bump there reaches the boot image.
4023 ;; Read as data rather than grepped: it is Clojure, and so is this.
4124 (defn dep-sha [root url]
@@ -19,23 +19,6 @@
19 19
20 (defn env [k default] (or (not-empty (System/getenv k)) default))20 (defn env [k default] (or (not-empty (System/getenv k)) default))
21 21
22-;; An archive pinned in scripts/*.dotslash, resolved to the file its manifest
23-;; names. DotSlash downloads it once, verifies the digest and caches it, so
24-;; every script here asks the same question of the same pin and a second
25-;; jolt-native checkout is never part of the answer.
26-;;
27-;; Only the desktop libraries are pinned this way now — `just lib`, and the
28-;; release half of a run. The Android side is nix/android.nix, which fetches
29-;; the same archives by the same digests as `fetchurl`.
30-;;
31-;; DOTSLASH names the fetcher for a caller that has one but has not got it on
32-;; PATH.
33-(defn dist [root name]
34- (let [manifest (fs/path root "scripts" (str name ".dotslash"))]
35- (when-not (fs/exists? manifest)
36- (die (str "no DotSlash manifest: " manifest)))
37- (out (env "DOTSLASH" "dotslash") "--" "fetch" manifest)))
38-
39 ;; The sha deps.edn pins for a git url, so a bump there reaches the boot image.22 ;; The sha deps.edn pins for a git url, so a bump there reaches the boot image.
40 ;; Read as data rather than grepped: it is Clojure, and so is this.23 ;; Read as data rather than grepped: it is Clojure, and so is this.
41 (defn dep-sha [root url]24 (defn dep-sha [root url]
deleted scripts/lib.bb +0 -67
deleted file mode 100755
@@ -1,67 +0,0 @@
1-#!/bin/sh
2-#_(
3-exec "$(dirname "$0")/bb" "$0" "$@"
4-)
5-
6-;; Both native libraries, out of jolt-native's release rather than a checkout.
7-;;
8-;; 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
10-;; 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: the same
13-;; bytes the APK takes through nix/android.nix, and what a run of the last
14-;; release takes.
15-;;
16-;; Nothing is compiled here. The pinned bytes are the bytes: this repo used to
17-;; clone jolt-native and cargo-build it, which meant a Rust toolchain, a build
18-;; whose output depended on the machine, and two places — the clone's sha and
19-;; the release digest — that could disagree about which jolt-native frq was
20-;; running against. Bump scripts/*.dotslash instead: see bump-jolt-native.bb.
21-;;
22-;; Linked rather than copied, so a bump reaches a running tree by relinking and
23-;; nothing goes stale in build/ — except for the one object that has to be
24-;; repaired on the way through. See below.
25-(require '[babashka.classpath :as cp])
26-(cp/add-classpath (str (babashka.fs/parent *file*)))
27-(require '[frq.paths :as paths]
28- '[babashka.fs :as fs]
29- '[clojure.string :as str])
30-
31-(def root (str (fs/canonicalize (fs/path (fs/parent *file*) ".."))))
32-(def lib (fs/path root "build" "lib"))
33-
34-;; v0.1.3's desktop libjoltmoq.so has 68 undefined `snd_*` symbols and no
35-;; DT_NEEDED on libasound: cpal's ALSA host is compiled in, and the library it
36-;; calls is not named. It is the defect that release fixed for Android, in the
37-;; place the fix did not reach — buck2 keeps a build script's cfgs and drops
38-;; its link directives, so `cargo:rustc-link-lib=asound` never became a link
39-;; argument. Undefined symbols are legal in a cdylib, so nothing said so until
40-;; something tried to load it.
41-;;
42-;; So the library is named here instead, on a copy: the DotSlash cache holds
43-;; what the release published, and rewriting that in place would make a
44-;; verified digest a lie about the bytes on disk.
45-;;
46-;; This goes away with the release that links it. `patchelf --print-needed`
47-;; below is the test for that — a fixed object is linked, not copied.
48-(def repairs {"libjoltmoq.so" "libasound.so.2"})
49-
50-(defn needed [file]
51- (set (str/split-lines (paths/out "patchelf" "--print-needed" file))))
52-
53-(fs/create-dirs lib)
54-(doseq [name ["libvidya-linux" "libjoltmoq-linux"]]
55- (let [file (paths/dist root name)
56- base (fs/file-name file)
57- dest (fs/path lib base)
58- missing (get repairs base)]
59- (fs/delete-if-exists dest)
60- (if (and missing (not (contains? (needed file) missing)))
61- (do (fs/copy file dest)
62- ;; Out of the cache read-only, and patchelf writes.
63- (fs/set-posix-file-permissions dest "rw-r--r--")
64- (paths/out "patchelf" "--add-needed" missing (str dest))
65- (println (str (fs/relativize root dest) " <- " file " (+" missing ")")))
66- (do (fs/create-sym-link dest file)
67- (println (str (fs/relativize root dest) " -> " file))))))
deleted file mode 100755
@@ -1,67 +0,0 @@
1-#!/bin/sh
2-#_(
3-exec "$(dirname "$0")/bb" "$0" "$@"
4-)
5-
6-;; Both native libraries, out of jolt-native's release rather than a checkout.
7-;;
8-;; 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
10-;; 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: the same
13-;; bytes the APK takes through nix/android.nix, and what a run of the last
14-;; release takes.
15-;;
16-;; Nothing is compiled here. The pinned bytes are the bytes: this repo used to
17-;; clone jolt-native and cargo-build it, which meant a Rust toolchain, a build
18-;; whose output depended on the machine, and two places — the clone's sha and
19-;; the release digest — that could disagree about which jolt-native frq was
20-;; running against. Bump scripts/*.dotslash instead: see bump-jolt-native.bb.
21-;;
22-;; Linked rather than copied, so a bump reaches a running tree by relinking and
23-;; nothing goes stale in build/ — except for the one object that has to be
24-;; repaired on the way through. See below.
25-(require '[babashka.classpath :as cp])
26-(cp/add-classpath (str (babashka.fs/parent *file*)))
27-(require '[frq.paths :as paths]
28- '[babashka.fs :as fs]
29- '[clojure.string :as str])
30-
31-(def root (str (fs/canonicalize (fs/path (fs/parent *file*) ".."))))
32-(def lib (fs/path root "build" "lib"))
33-
34-;; v0.1.3's desktop libjoltmoq.so has 68 undefined `snd_*` symbols and no
35-;; DT_NEEDED on libasound: cpal's ALSA host is compiled in, and the library it
36-;; calls is not named. It is the defect that release fixed for Android, in the
37-;; place the fix did not reach — buck2 keeps a build script's cfgs and drops
38-;; its link directives, so `cargo:rustc-link-lib=asound` never became a link
39-;; argument. Undefined symbols are legal in a cdylib, so nothing said so until
40-;; something tried to load it.
41-;;
42-;; So the library is named here instead, on a copy: the DotSlash cache holds
43-;; what the release published, and rewriting that in place would make a
44-;; verified digest a lie about the bytes on disk.
45-;;
46-;; This goes away with the release that links it. `patchelf --print-needed`
47-;; below is the test for that — a fixed object is linked, not copied.
48-(def repairs {"libjoltmoq.so" "libasound.so.2"})
49-
50-(defn needed [file]
51- (set (str/split-lines (paths/out "patchelf" "--print-needed" file))))
52-
53-(fs/create-dirs lib)
54-(doseq [name ["libvidya-linux" "libjoltmoq-linux"]]
55- (let [file (paths/dist root name)
56- base (fs/file-name file)
57- dest (fs/path lib base)
58- missing (get repairs base)]
59- (fs/delete-if-exists dest)
60- (if (and missing (not (contains? (needed file) missing)))
61- (do (fs/copy file dest)
62- ;; Out of the cache read-only, and patchelf writes.
63- (fs/set-posix-file-permissions dest "rw-r--r--")
64- (paths/out "patchelf" "--add-needed" missing (str dest))
65- (println (str (fs/relativize root dest) " <- " file " (+" missing ")")))
66- (do (fs/create-sym-link dest file)
67- (println (str (fs/relativize root dest) " -> " file))))))
deleted scripts/libjoltmoq-linux.dotslash +0 -27
deleted file mode 100755
@@ -1,27 +0,0 @@
1-#!/usr/bin/env dotslash
2-
3-// The AV media plane for the desktop, from jolt-native's v0.1.3 release.
4-//
5-// MoQ over QUIC, Opus and H.264, with V4L2 and PipeWire at the capture end.
6-// Out of the same archive as libvidya-linux and pinned with it, for the reason
7-// the Android pair gives: the two objects are built together, frq loads both,
8-// and one release's media plane beside another's UI is untested.
9-//
10-// x86_64 only; see libvidya-linux.
11-{
12- "name": "libjoltmoq-linux",
13- "platforms": {
14- "linux-x86_64": {
15- "size": 14870823,
16- "hash": "sha256",
17- "digest": "b49ca39793c0ee3809ba747d0040ac370ee4e6c92e433c53ca5459eaa90def18",
18- "format": "tar.gz",
19- "path": "libjoltmoq.so",
20- "providers": [
21- {
22- "url": "https://gitlab.com/nandithebull/jolt-native/-/releases/v0.1.3/downloads/jolt-native-linux-x86_64-v0.1.3.tar.gz"
23- }
24- ]
25- }
26- }
27-}
deleted file mode 100755
@@ -1,27 +0,0 @@
1-#!/usr/bin/env dotslash
2-
3-// The AV media plane for the desktop, from jolt-native's v0.1.3 release.
4-//
5-// MoQ over QUIC, Opus and H.264, with V4L2 and PipeWire at the capture end.
6-// Out of the same archive as libvidya-linux and pinned with it, for the reason
7-// the Android pair gives: the two objects are built together, frq loads both,
8-// and one release's media plane beside another's UI is untested.
9-//
10-// x86_64 only; see libvidya-linux.
11-{
12- "name": "libjoltmoq-linux",
13- "platforms": {
14- "linux-x86_64": {
15- "size": 14870823,
16- "hash": "sha256",
17- "digest": "b49ca39793c0ee3809ba747d0040ac370ee4e6c92e433c53ca5459eaa90def18",
18- "format": "tar.gz",
19- "path": "libjoltmoq.so",
20- "providers": [
21- {
22- "url": "https://gitlab.com/nandithebull/jolt-native/-/releases/v0.1.3/downloads/jolt-native-linux-x86_64-v0.1.3.tar.gz"
23- }
24- ]
25- }
26- }
27-}
deleted scripts/libvidya-linux.dotslash +0 -27
deleted file mode 100755
@@ -1,27 +0,0 @@
1-#!/usr/bin/env dotslash
2-
3-// libvidya for the desktop, from jolt-native's v0.1.3 release.
4-//
5-// The retained-tree ABI glimmer-vidya binds, on egui. `just lib` fetches this
6-// and libjoltmoq-linux one archive holds both and links them where `just
7-// run` points the loader.
8-//
9-// x86_64 only, because that is the only desktop asset the release cuts: a
10-// linux-aarch64 or a macOS frq needs jolt-native built by hand for now.
11-{
12- "name": "libvidya-linux",
13- "platforms": {
14- "linux-x86_64": {
15- "size": 14870823,
16- "hash": "sha256",
17- "digest": "b49ca39793c0ee3809ba747d0040ac370ee4e6c92e433c53ca5459eaa90def18",
18- "format": "tar.gz",
19- "path": "libvidya.so",
20- "providers": [
21- {
22- "url": "https://gitlab.com/nandithebull/jolt-native/-/releases/v0.1.3/downloads/jolt-native-linux-x86_64-v0.1.3.tar.gz"
23- }
24- ]
25- }
26- }
27-}
deleted file mode 100755
@@ -1,27 +0,0 @@
1-#!/usr/bin/env dotslash
2-
3-// libvidya for the desktop, from jolt-native's v0.1.3 release.
4-//
5-// The retained-tree ABI glimmer-vidya binds, on egui. `just lib` fetches this
6-// and libjoltmoq-linux one archive holds both and links them where `just
7-// run` points the loader.
8-//
9-// x86_64 only, because that is the only desktop asset the release cuts: a
10-// linux-aarch64 or a macOS frq needs jolt-native built by hand for now.
11-{
12- "name": "libvidya-linux",
13- "platforms": {
14- "linux-x86_64": {
15- "size": 14870823,
16- "hash": "sha256",
17- "digest": "b49ca39793c0ee3809ba747d0040ac370ee4e6c92e433c53ca5459eaa90def18",
18- "format": "tar.gz",
19- "path": "libvidya.so",
20- "providers": [
21- {
22- "url": "https://gitlab.com/nandithebull/jolt-native/-/releases/v0.1.3/downloads/jolt-native-linux-x86_64-v0.1.3.tar.gz"
23- }
24- ]
25- }
26- }
27-}
added scripts/repl.bb +60 -0
new file mode 100755
@@ -0,0 +1,60 @@
1+#!/bin/sh
2+#_(
3+exec "$(dirname "$0")/bb" "$0" "$@"
4+)
5+
6+;; A jolt against this tree, with the native libraries under it.
7+;;
8+;; repl.bb a REPL
9+;; repl.bb nrepl-server the same thing for an editor to connect to
10+;; repl.bb -e '(+ 1 1)' or any other jolt command line
11+;;
12+;; This exists because `jolt` in the repo root does not work on its own.
13+;; deps.edn carries :jolt/native, so every jolt invocation here — a REPL, an
14+;; nREPL server, `jolt -M:frq` — loads libvidya and libjoltmoq before it reads
15+;; a line, and dies naming the library if the loader cannot find them. The
16+;; libraries are the flake's, which means an LD_LIBRARY_PATH nobody should have
17+;; to remember.
18+;;
19+;; So it is run.bb without the app: the same re-exec into `nix develop`, the
20+;; same deps overrides for the Jolt halves that bind those objects, and then
21+;; whatever jolt command line the caller asked for. run.bb is `repl.bb -M:frq`
22+;; with a window's worth of extra care about the GL driver; this is the rest of
23+;; the time.
24+(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]
28+ '[babashka.process :as p]
29+ '[clojure.string :as str])
30+
31+(def root (str (fs/canonicalize (fs/path (fs/parent *file*) ".."))))
32+(def self (str (fs/path root "scripts" "repl.bb")))
33+
34+;; Outside the shell, get inside it and come back — the test, the flag and the
35+;; reasoning are run.bb's.
36+(when-not (System/getenv "JOLT_NATIVE_LIB")
37+ (let [cmd (paths/nix root
38+ ["nix" "develop" root
39+ "--max-jobs" (paths/env "FRQ_MAX_JOBS" "0")
40+ "--command" self]
41+ *command-line-args*)]
42+ (System/exit (:exit @(apply p/process {:inherit true :dir root} cmd)))))
43+
44+;; The Jolt halves that have to match those objects, for run.bb's reason: the
45+;; pin in deps.edn is a release, and what the shell built is the flake input.
46+(def overrides
47+ (str "{:deps {jolt-lang/glimmer {:local/root \"" (System/getenv "GLIMMER_SRC") "\"}"
48+ " nandi/glimmer-vidya {:local/root \"" (System/getenv "GLIMMER_VIDYA_SRC") "\"}}}"))
49+
50+(System/exit
51+ (:exit @(apply p/process
52+ {:inherit true
53+ :dir root
54+ :extra-env {"LD_LIBRARY_PATH"
55+ (->> [(System/getenv "JOLT_NATIVE_LIB")
56+ (System/getenv "FRQ_LIB_PATH")
57+ (System/getenv "LD_LIBRARY_PATH")]
58+ (remove str/blank?)
59+ (str/join ":"))}}
60+ (concat ["jolt" "-Sdeps" overrides] *command-line-args*))))
new file mode 100755
@@ -0,0 +1,60 @@
1+#!/bin/sh
2+#_(
3+exec "$(dirname "$0")/bb" "$0" "$@"
4+)
5+
6+;; A jolt against this tree, with the native libraries under it.
7+;;
8+;; repl.bb a REPL
9+;; repl.bb nrepl-server the same thing for an editor to connect to
10+;; repl.bb -e '(+ 1 1)' or any other jolt command line
11+;;
12+;; This exists because `jolt` in the repo root does not work on its own.
13+;; deps.edn carries :jolt/native, so every jolt invocation here — a REPL, an
14+;; nREPL server, `jolt -M:frq` — loads libvidya and libjoltmoq before it reads
15+;; a line, and dies naming the library if the loader cannot find them. The
16+;; libraries are the flake's, which means an LD_LIBRARY_PATH nobody should have
17+;; to remember.
18+;;
19+;; So it is run.bb without the app: the same re-exec into `nix develop`, the
20+;; same deps overrides for the Jolt halves that bind those objects, and then
21+;; whatever jolt command line the caller asked for. run.bb is `repl.bb -M:frq`
22+;; with a window's worth of extra care about the GL driver; this is the rest of
23+;; the time.
24+(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]
28+ '[babashka.process :as p]
29+ '[clojure.string :as str])
30+
31+(def root (str (fs/canonicalize (fs/path (fs/parent *file*) ".."))))
32+(def self (str (fs/path root "scripts" "repl.bb")))
33+
34+;; Outside the shell, get inside it and come back — the test, the flag and the
35+;; reasoning are run.bb's.
36+(when-not (System/getenv "JOLT_NATIVE_LIB")
37+ (let [cmd (paths/nix root
38+ ["nix" "develop" root
39+ "--max-jobs" (paths/env "FRQ_MAX_JOBS" "0")
40+ "--command" self]
41+ *command-line-args*)]
42+ (System/exit (:exit @(apply p/process {:inherit true :dir root} cmd)))))
43+
44+;; The Jolt halves that have to match those objects, for run.bb's reason: the
45+;; pin in deps.edn is a release, and what the shell built is the flake input.
46+(def overrides
47+ (str "{:deps {jolt-lang/glimmer {:local/root \"" (System/getenv "GLIMMER_SRC") "\"}"
48+ " nandi/glimmer-vidya {:local/root \"" (System/getenv "GLIMMER_VIDYA_SRC") "\"}}}"))
49+
50+(System/exit
51+ (:exit @(apply p/process
52+ {:inherit true
53+ :dir root
54+ :extra-env {"LD_LIBRARY_PATH"
55+ (->> [(System/getenv "JOLT_NATIVE_LIB")
56+ (System/getenv "FRQ_LIB_PATH")
57+ (System/getenv "LD_LIBRARY_PATH")]
58+ (remove str/blank?)
59+ (str/join ":"))}}
60+ (concat ["jolt" "-Sdeps" overrides] *command-line-args*))))
modified scripts/run.bb +4 -4
@@ -20,10 +20,10 @@ exec "$(dirname "$0")/bb" "$0" "$@"
2020 ;; runs as whatever was there before, silently. A run that is meant to answer
2121 ;; "does my change work" has to be the files on disk.
2222 ;;
23-;; And deliberately not the scripts/*.dotslash pins either, which is what this
24-;; used to do. Those name a release; a change to jolt-native is by definition
25-;; not in one yet. `just lib` still fetches them, and the APK takes the same
26-;; released bytes through nix/android.nix — but a run does not.
23+;; And deliberately not a release either, which is what this used to do: it
24+;; resolved the scripts/*.dotslash pins, and those name a release — a change to
25+;; jolt-native is by definition not in one yet. The APK still takes released
26+;; bytes, through nix/android.nix — but a run does not.
2727 (require '[babashka.classpath :as cp])
2828 (cp/add-classpath (str (babashka.fs/parent *file*)))
2929 (require '[frq.paths :as paths]
@@ -20,10 +20,10 @@ exec "$(dirname "$0")/bb" "$0" "$@"
20 ;; runs as whatever was there before, silently. A run that is meant to answer20 ;; runs as whatever was there before, silently. A run that is meant to answer
21 ;; "does my change work" has to be the files on disk.21 ;; "does my change work" has to be the files on disk.
22 ;;22 ;;
23-;; And deliberately not the scripts/*.dotslash pins either, which is what this23+;; And deliberately not a release either, which is what this used to do: it
24-;; used to do. Those name a release; a change to jolt-native is by definition24+;; resolved the scripts/*.dotslash pins, and those name a release — a change to
25-;; not in one yet. `just lib` still fetches them, and the APK takes the same25+;; jolt-native is by definition not in one yet. The APK still takes released
26-;; released bytes through nix/android.nix — but a run does not.26+;; bytes, through nix/android.nix — but a run does not.
27 (require '[babashka.classpath :as cp])27 (require '[babashka.classpath :as cp])
28 (cp/add-classpath (str (babashka.fs/parent *file*)))28 (cp/add-classpath (str (babashka.fs/parent *file*)))
29 (require '[frq.paths :as paths]29 (require '[frq.paths :as paths]