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

justfile · 102 lines · 4.7 KBMakefile Blame HistoryRaw
A freeq client in jolt, as glimmer components on Vidya 4719d6f nandi 20d ago1set shell := ["bash", "-euo", "pipefail", "-c"]
2
Find the sibling checkouts from a worktree too cd7e9d2 nandi 19d ago3# Sibling checkouts, found relative to the *main* checkout rather than to this
4# directory. In a git worktree they are not the same place: the justfile sits
Take both native libraries from one place a66d1c1 nandi 19d ago5# at .claude/worktrees/<name>, so "../jolt-native" from here would be
6# .claude/worktrees/jolt-native, which is nothing. `--git-common-dir` is the one
Find the sibling checkouts from a worktree too cd7e9d2 nandi 19d ago7# thing that answers the same in a worktree as it does in the checkout it came
8# from.
9checkout := parent_directory(`git rev-parse --path-format=absolute --git-common-dir`)
Take glimmer-vidya from gitlab, so a stranger can build this 5c40e75 nandi 19d ago10
11# jolt-native holds both shared objects. A sibling checkout wins, so anyone
12# working on the two repos together builds what they are editing; everyone else
13# gets a clone of the gitlab repo under .jolt-native, pinned to the same commit
14# deps.edn takes glimmer-vidya from.
15jolt_native_url := "https://gitlab.com/nandithebull/jolt-native.git"
16jolt_native_sha := "70072e8e48ad396caeab6f6bd18b999cf449ec8f"
17jolt_native := `
18 checkout="$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")"
19 if [ -d "$checkout/../jolt-native" ]; then
20 cd "$checkout/../jolt-native" && pwd
21 else
22 echo "$checkout/.jolt-native"
23 fi
24`
A freeq client in jolt, as glimmer components on Vidya 4719d6f nandi 20d ago25
26default:
27 @just --list
28
Take both native libraries from one place a66d1c1 nandi 19d ago29# Both native libraries: libvidya (the tree ABI glimmer-vidya binds) and
30# libjoltmoq (the AV media plane). One workspace, one target directory.
Take glimmer-vidya from gitlab, so a stranger can build this 5c40e75 nandi 19d ago31lib: fetch
Calls f31ad3d nandi 19d ago32 cd {{jolt_native}} && just build
33
Take glimmer-vidya from gitlab, so a stranger can build this 5c40e75 nandi 19d ago34# Clone jolt-native at the pinned commit, unless it is already here — which it
35# is whenever the sibling checkout exists, since that is what jolt_native then
36# points at.
37[private]
38fetch:
39 if [ ! -d {{quote(jolt_native)}} ]; then \
40 git clone {{jolt_native_url}} {{quote(jolt_native)}}; \
41 cd {{quote(jolt_native)}} && git checkout --detach {{jolt_native_sha}}; \
42 fi
43
Build the APK with buck2, from pins rather than from a second checkout a71ef8f nandi 19d ago44# buck2, with the machine's paths written where the BUCK files can read them.
45#
46# The same arrangement jolt-native uses, and for the same reason: a BUCK file
47# may not look around the machine, and these five answers differ on every one.
48# Generated rather than committed, so no checkout carries another's paths.
49buck *args:
50 #!/usr/bin/env bash
51 set -euo pipefail
52 android_home="${ANDROID_HOME:-$HOME/.local/share/android-sdk}"
53 chez="${CHEZ_ANDROID:-$HOME/.cache/vidya-chez-android}"
54 openssl="${OPENSSL_ANDROID:-$HOME/.cache/frq-openssl-android/lib}"
55 for path in "$android_home/build-tools/36.0.0/aapt2" \
56 "$android_home/platforms/android-36/android.jar" \
57 "$chez/boot/tarm64le/scheme.boot" \
58 "$openssl/libssl.so"; do
59 [[ -e "$path" ]] || { echo "missing: $path" >&2; exit 1; }
60 done
61 # A jolt-native checkout wins over the pinned release, so that anyone
62 # working on both repos at once builds what they are editing. It is staged
63 # into this tree because a buck2 cell cannot reach outside its own root,
64 # and an action that shelled out to the other project would have nothing to
65 # invalidate on. With no checkout the release answers instead, fetched by
66 # digest — see toolchains/dist and scripts/libvidya-android.dotslash.
67 libvidya=pinned
68 if [[ -d "{{jolt_native}}/crates" ]]; then
69 libvidya=checkout
70 ( cd "{{jolt_native}}" && just ffi-android >/dev/null )
71 mkdir -p android/prebuilt/arm64-v8a
72 cp "{{jolt_native}}/build/android/arm64-v8a/libvidya.so" \
73 android/prebuilt/arm64-v8a/libvidya.so
74 fi
75 # The boot image's other source roots are outside this cell too; hash them
76 # here so the digest reaches the action. See android/BUCK.
77 printf '[frq]\n jolt_native = %s\n android_home = %s\n chez_android = %s\n openssl_android = %s\n libvidya = %s\n boot_stamp = %s\n' \
78 "{{jolt_native}}" "$android_home" "$chez" "$openssl" "$libvidya" \
79 "$(android/build-jolt-boot.sh --stamp)" > .buckconfig.local
80 scripts/buck2 {{args}}
81
82# The APK, built as a graph. `just apk install` puts it on the device.
83apk action="build":
84 #!/usr/bin/env bash
85 set -euo pipefail
86 apk="$(just buck build --show-output //:apk | awk '/frq.apk/{print $2}')"
87 case "{{action}}" in
88 build) printf '%s\n' "$apk" ;;
89 install) "${ADB:-$HOME/.local/share/android-sdk/platform-tools/adb}" install -r "$apk" ;;
90 run)
91 adb="${ADB:-$HOME/.local/share/android-sdk/platform-tools/adb}"
92 "$adb" install -r "$apk"
93 "$adb" shell am force-stop uk.nandi.frq
94 "$adb" shell am start -n uk.nandi.frq/.FrqActivity
95 ;;
96 log) "${ADB:-$HOME/.local/share/android-sdk/platform-tools/adb}" logcat -s VidyaJolt Vidya ;;
97 *) echo "usage: just apk [build|install|run|log]" >&2; exit 2 ;;
98 esac
99
Take both native libraries from one place a66d1c1 nandi 19d ago100# The app.
A freeq client in jolt, as glimmer components on Vidya 4719d6f nandi 20d ago101run *args:
Take both native libraries from one place a66d1c1 nandi 19d ago102 LD_LIBRARY_PATH="{{jolt_native}}/target/release" jolt -M:frq {{args}}