nandi/frqpublic Fork 0
9c1dfe96e622c7a42cc8d4fec7ade9e5ddf074b0
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 · 177 lines · 6.6 KBMakefile Blame HistoryRaw
Six verbs, and the last of the nix 2e24e64 nandi 20h ago1# Six verbs over one tree.
Inline the babashka scripts into the justfile 76dcc6c nandi 11d ago2#
Six verbs, and the last of the nix 2e24e64 nandi 20h ago3# There is no nix here any more. `tools/toolchain.sh` fetches Flutter (which
4# carries Dart), a JDK, the Clojure CLI and Nim as sha256-pinned tarballs into
5# `.toolchain/`, and every recipe below runs inside the environment that
6# script prints. One mechanism, and the same one the containers in `.modal/`
7# use — which is what lets a plain Debian image build this.
8#
9# What the host still brings: a C compiler (Nim shells out to one), OpenSSL
10# (nim.cfg is `-d:ssl`), git, curl, unzip, python3. For `run desktop` and the
11# other Linux builds, GTK and the usual CMake/Ninja/pkg-config.
12#
13# just build TARGET apk desktop web lib ui app
14# just run TARGET apk desktop web ui app
15# just test SUITE all nim dart common live
The last of the Clojure 284b59c nandi 12h ago16# just modal CONTAINER dev
Six verbs, and the last of the nix 2e24e64 nandi 20h ago17# just serve [PORT] the Modal-built web bundle, on localhost
18# just tools ... the toolchain itself
Take glimmer-vidya from gitlab, so a stranger can build this 5c40e75 nandi 19d ago19
Write the build in babashka, and pin the babashka 34832a8 nandi 19d ago20set shell := ["bash", "-euo", "pipefail", "-c"]
A freeq client in jolt, as glimmer components on Vidya 4719d6f nandi 20d ago21
Six verbs, and the last of the nix 2e24e64 nandi 20h ago22# Every recipe is a `#!` script. Without this, "$@" is empty in one of them —
23# just interpolates into a shebang recipe rather than handing it argv.
Give the terminal's classpath an nREPL, and hand recipes their arguments 664397d nandi 11d ago24set positional-arguments
25
Six verbs, and the last of the nix 2e24e64 nandi 20h ago26root := justfile_directory()
27tc := justfile_directory() / "tools/toolchain.sh"
Inline the babashka scripts into the justfile 76dcc6c nandi 11d ago28
A freeq client in jolt, as glimmer components on Vidya 4719d6f nandi 20d ago29default:
30 @just --list
31
The last of the Clojure 284b59c nandi 12h ago32# The toolchain, directly: `just tools versions`,
Six verbs, and the last of the nix 2e24e64 nandi 20h ago33# `just tools exec -- flutter doctor`.
The last of the Clojure 284b59c nandi 12h ago34[doc('the toolchain itself: versions, exec -- CMD')]
Six verbs, and the last of the nix 2e24e64 nandi 20h ago35tools *args:
36 #!/usr/bin/env bash
37 cd "{{root}}"
38 exec "{{tc}}" "$@"
39
40# Build a target.
41#
The last of the Clojure 284b59c nandi 12h ago42# desktop the app: Nim owns the state and the screens, Flutter paints
43# lib the Nim core alone, as build/nim/libfrqcore.so
44#
45# There were four more. `apk` and `web` compiled ClojureDart and went with it:
46# the web target cannot come back without a wasm build of the core, since a
47# browser has no dart:ffi, and the APK wants libfrqcore.so cross-compiled for
48# Android's ABIs. `ui` and `app` were the two halves of the migration, and
49# there is one app now.
50[doc('build a target: desktop lib')]
Six verbs, and the last of the nix 2e24e64 nandi 20h ago51build target="desktop":
Build the APK, out of ClojureDart and Flutter e2b0e6b nandi 8d ago52 #!/usr/bin/env bash
53 set -euo pipefail
Six verbs, and the last of the nix 2e24e64 nandi 20h ago54 cd "{{root}}"
55 case "{{target}}" in
56 desktop) just _flutter desktop build ;;
57 lib) just _nim-lib ;;
The last of the Clojure 284b59c nandi 12h ago58 *) echo "usage: just build [desktop|lib]" >&2; exit 1 ;;
Build the APK, out of ClojureDart and Flutter e2b0e6b nandi 8d ago59 esac
60
Six verbs, and the last of the nix 2e24e64 nandi 20h ago61# Build a target and start it.
Paint the desktop with Flutter too, beside libcosmic fc5f63c nandi 7d ago62#
The last of the Clojure 284b59c nandi 12h ago63# FRQ_TRACE=1 every line in and out, both languages in one log
64# FRQ_AUTOCONNECT=1 press Connect at startup, for a window a script cannot
65# click; FRQ_NICK overrides the nickname
66[doc('build the app and start it')]
67run target="desktop":
Paint the desktop with Flutter too, beside libcosmic fc5f63c nandi 7d ago68 #!/usr/bin/env bash
69 set -euo pipefail
Six verbs, and the last of the nix 2e24e64 nandi 20h ago70 cd "{{root}}"
71 case "{{target}}" in
72 desktop) just _flutter desktop run ;;
The last of the Clojure 284b59c nandi 12h ago73 *) echo "usage: just run [desktop]" >&2; exit 1 ;;
Paint the desktop with Flutter too, beside libcosmic fc5f63c nandi 7d ago74 esac
A shell that is already the devShell, and two recipes to reach it e853593 nandi 5d ago75
Six verbs, and the last of the nix 2e24e64 nandi 20h ago76# Test a suite.
77#
78# nim the Nim core. No Flutter, no Dart, no SDK — a rule about the IRC
79# wire format is checkable in a second.
80# dart the Dart side of the FFI boundary, on the plain Dart VM. Passing
81# `nim` and failing this one is a marshalling bug, which is why the
82# two are separate suites.
83# live the whole stack against a real freeq. Not in `all`: it wants a
84# network and a running server.
85#
86# just test all of them
87# just test nim tircparse one Nim file
The last of the Clojure 284b59c nandi 12h ago88[doc('run a suite: all nim dart layout live')]
Six verbs, and the last of the nix 2e24e64 nandi 20h ago89test suite="all" *args:
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago90 #!/usr/bin/env bash
91 set -euo pipefail
Six verbs, and the last of the nix 2e24e64 nandi 20h ago92 cd "{{root}}"
93 shift
94 case "{{suite}}" in
The last of the Clojure 284b59c nandi 12h ago95 all) just test nim && just test dart && just test layout ;;
Lay every screen out in a test, and fix what that found 36bdfc5 nandi 19h ago96 layout) just _nim-lib
97 just _flutter layout test ;;
Six verbs, and the last of the nix 2e24e64 nandi 20h ago98 nim) just _nim-test "$@" ;;
99 dart) just _nim-lib
100 exec "{{tc}}" exec -- bash -c \
101 'cd dart/frq_core && dart pub get && dart test -r expanded' ;;
102 live) just _nim-lib
103 exec "{{tc}}" exec -- bash -c \
104 'cd dart/frq_core && dart pub get >/dev/null && dart run tool/live_ui.dart "$@"' _ "$@" ;;
The last of the Clojure 284b59c nandi 12h ago105 *) echo "usage: just test [all|nim|dart|layout|live]" >&2; exit 1 ;;
Six verbs, and the last of the nix 2e24e64 nandi 20h ago106 esac
A third target, and the seam that was already waiting for it f54ca45 nandi 2d ago107
Six verbs, and the last of the nix 2e24e64 nandi 20h ago108# The containers in `.modal/`, run on Modal rather than here: this machine
109# evaluates and Modal builds. See CLAUDE.md, which says so rather more firmly.
A shell that is already the devShell, and two recipes to reach it e853593 nandi 5d ago110#
Six verbs, and the last of the nix 2e24e64 nandi 20h ago111# `--shell` leaves a sandbox running with the container's own image, volumes
112# and environment, and prints the command to attach to it. It blocks — an
113# ephemeral app takes its sandbox down when the entrypoint returns — so attach
114# from a second terminal and Ctrl-C here when done. The sandbox bills until
115# you do.
A shell that is already the devShell, and two recipes to reach it e853593 nandi 5d ago116#
Six verbs, and the last of the nix 2e24e64 nandi 20h ago117# just modal dev
The last of the Clojure 284b59c nandi 12h ago118# just modal dev --shell
Six verbs, and the last of the nix 2e24e64 nandi 20h ago119[doc('run a .modal/ container on Modal')]
120modal container="dev" *args:
A shell that is already the devShell, and two recipes to reach it e853593 nandi 5d ago121 #!/usr/bin/env bash
122 set -euo pipefail
Six verbs, and the last of the nix 2e24e64 nandi 20h ago123 cd "{{root}}"
124 shift || true
A shell that is already the devShell, and two recipes to reach it e853593 nandi 5d ago125 exec modal run ".modal/{{container}}/container.py" "$@"
126
Six verbs, and the last of the nix 2e24e64 nandi 20h ago127[private]
128_nim-lib:
One frontend where there were three, and a core that is not Clojure 438b247 nandi yesterday129 #!/usr/bin/env bash
130 set -euo pipefail
Six verbs, and the last of the nix 2e24e64 nandi 20h ago131 cd "{{root}}"
132 out="{{root}}/build/nim"
One frontend where there were three, and a core that is not Clojure 438b247 nandi yesterday133 mkdir -p "$out"
Six verbs, and the last of the nix 2e24e64 nandi 20h ago134 exec "{{tc}}" exec -- bash -euo pipefail -c '
135 cd nim
136 nim c --app:lib --mm:orc -d:release --hints:off \
137 --path:src --out:"'"$out"'/libfrqcore.so" src/frq_core.nim
138 echo "built '"$out"'/libfrqcore.so"
139 nm -D --defined-only "'"$out"'/libfrqcore.so" | grep " T frq_" || true'
140
141[private]
142_nim-test *args:
The binding is Dart, and it works f7aea3b nandi 23h ago143 #!/usr/bin/env bash
144 set -euo pipefail
Six verbs, and the last of the nix 2e24e64 nandi 20h ago145 cd "{{root}}"
146 exec "{{tc}}" exec -- bash -euo pipefail -c '
147 cd nim
148 if [ -n "${1:-}" ]; then
149 exec nim c -r --hints:off --path:src "tests/$1.nim"
150 fi
151 for t in tests/t*.nim; do
152 echo "== $t"
153 nim c -r --hints:off --path:src "$t"
154 done' _ "$@"
155
156[private]
157_flutter target action:
Nim under the existing UI, not instead of it 56551a8 nandi 23h ago158 #!/usr/bin/env bash
159 set -euo pipefail
Six verbs, and the last of the nix 2e24e64 nandi 20h ago160 cd "{{root}}"
The last of the Clojure 284b59c nandi 12h ago161 just _nim-lib
Six verbs, and the last of the nix 2e24e64 nandi 20h ago162 exec "{{tc}}" exec -- bash -euo pipefail -c '
163 cd flutter
164 # Nim resolves OpenSSL through dynlib at run time; without the host
165 # library on the loader path `newContext` dies in a SIGSEGV that says
166 # nothing about SSL.
167 export LD_LIBRARY_PATH="${FRQ_OPENSSL_LIB:-}${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
The last of the Clojure 284b59c nandi 12h ago168 flutter pub get
Six verbs, and the last of the nix 2e24e64 nandi 20h ago169 case "$1:$2" in
The last of the Clojure 284b59c nandi 12h ago170 desktop:build) exec flutter build linux --debug ;;
171 desktop:run) exec flutter run -d linux ;;
Lay every screen out in a test, and fix what that found 36bdfc5 nandi 19h ago172 # Widget tests, which lay every screen out for real. Headless: no
The last of the Clojure 284b59c nandi 12h ago173 # GL and no window, which is what makes them the check a Wayland
Lay every screen out in a test, and fix what that found 36bdfc5 nandi 19h ago174 # window cannot be.
The last of the Clojure 284b59c nandi 12h ago175 layout:test) exec flutter test test/nim_layout_test.dart ;;
176 *) echo "unknown target/action: $1 $2" >&2; exit 1 ;;
Six verbs, and the last of the nix 2e24e64 nandi 20h ago177 esac' _ "{{target}}" "{{action}}"