nandi/frqpublic Fork 0
a1cd517afd12084e536a9367a6bdff077b629982
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 · 107 lines · 5.1 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"
Say who reacted, when the pointer rests on a pill a1cd517 nandi 18d ago16jolt_native_sha := "c71fc595f031aaa5cb461735af1865146f7b42ec"
Take glimmer-vidya from gitlab, so a stranger can build this 5c40e75 nandi 19d ago17jolt_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
Make the worktree its own buck root, and the glue an input ae207b8 nandi 18d ago74 # The glue travels with it, for the same reason: editing jolt_main.c
75 # should relink libjoltapp, and it cannot if buck only knows a path.
76 mkdir -p android/prebuilt/glue/android android/prebuilt/glue/include
77 cp "{{jolt_native}}/android/jolt_main.c" android/prebuilt/glue/android/
78 cp "{{jolt_native}}"/crates/jolt-vidya/include/*.h android/prebuilt/glue/include/
Build the APK with buck2, from pins rather than from a second checkout a71ef8f nandi 19d ago79 fi
80 # The boot image's other source roots are outside this cell too; hash them
81 # here so the digest reaches the action. See android/BUCK.
82 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' \
83 "{{jolt_native}}" "$android_home" "$chez" "$openssl" "$libvidya" \
84 "$(android/build-jolt-boot.sh --stamp)" > .buckconfig.local
85 scripts/buck2 {{args}}
86
87# The APK, built as a graph. `just apk install` puts it on the device.
88apk action="build":
89 #!/usr/bin/env bash
90 set -euo pipefail
91 apk="$(just buck build --show-output //:apk | awk '/frq.apk/{print $2}')"
92 case "{{action}}" in
93 build) printf '%s\n' "$apk" ;;
94 install) "${ADB:-$HOME/.local/share/android-sdk/platform-tools/adb}" install -r "$apk" ;;
95 run)
96 adb="${ADB:-$HOME/.local/share/android-sdk/platform-tools/adb}"
97 "$adb" install -r "$apk"
98 "$adb" shell am force-stop uk.nandi.frq
99 "$adb" shell am start -n uk.nandi.frq/.FrqActivity
100 ;;
101 log) "${ADB:-$HOME/.local/share/android-sdk/platform-tools/adb}" logcat -s VidyaJolt Vidya ;;
102 *) echo "usage: just apk [build|install|run|log]" >&2; exit 2 ;;
103 esac
104
Take both native libraries from one place a66d1c1 nandi 19d ago105# The app.
A freeq client in jolt, as glimmer components on Vidya 4719d6f nandi 20d ago106run *args:
Take both native libraries from one place a66d1c1 nandi 19d ago107 LD_LIBRARY_PATH="{{jolt_native}}/target/release" jolt -M:frq {{args}}