| Paint the same screens into a terminal ab83b42 nandi 17d ago | 1 | #!/bin/sh |
| 2 | #_( |
| 3 | exec "$(dirname "$0")/bb" "$0" "$@" |
| 4 | ) |
| 5 | |
| 6 | ;; frq's screens in a terminal, from this working tree. |
| 7 | ;; |
| Merge origin/main, and let one jolt-native answer for both backends 1e8b590 nandi 16d ago | 8 | ;; tui.bb [--headless] [--demo] [--cols=N] [--rows=N] [--wait=MS] [--dump] |
| Paint the same screens into a terminal ab83b42 nandi 17d ago | 9 | ;; |
| Merge origin/main, and let one jolt-native answer for both backends 1e8b590 nandi 16d ago | 10 | ;; run.bb with the other backend under it, and the same two halves: the frq |
| 11 | ;; source is the files on disk, and everything below it is the flake's. The |
| 12 | ;; dev shell builds jolt-native and names both Jolt sides of it — glimmer-vidya |
| 13 | ;; for the window, glimmer-tui for the terminal — so this needs no checkout |
| 14 | ;; beside the tree and no library fetched by digest. |
| Paint the same screens into a terminal ab83b42 nandi 17d ago | 15 | ;; |
| Merge origin/main, and let one jolt-native answer for both backends 1e8b590 nandi 16d ago | 16 | ;; It still loads libvidya as well as libjolttui. `frq.app` requires |
| 17 | ;; glimmer-vidya, and `frq.tui` requires glimmer-tui after it so the backend |
| 18 | ;; installed last is the terminal; the window's library is resolved and then |
| 19 | ;; asked for nothing. |
| Paint the same screens into a terminal ab83b42 nandi 17d ago | 20 | ;; |
| Merge origin/main, and let one jolt-native answer for both backends 1e8b590 nandi 16d ago | 21 | ;; No nixGL here, unlike run.bb: a terminal wants nothing from the host's GL |
| 22 | ;; driver, which is the reason this output exists on machines that have none. |
| 23 | (require '[babashka.classpath :as cp]) |
| 24 | (cp/add-classpath (str (babashka.fs/parent *file*))) |
| 25 | (require '[frq.paths :as paths] |
| 26 | '[babashka.fs :as fs] |
| 27 | '[babashka.process :as p] |
| 28 | '[clojure.string :as str]) |
| Paint the same screens into a terminal ab83b42 nandi 17d ago | 29 | |
| 30 | (def root (str (fs/canonicalize (fs/path (fs/parent *file*) "..")))) |
| Merge origin/main, and let one jolt-native answer for both backends 1e8b590 nandi 16d ago | 31 | (def self (str (fs/path root "scripts" "tui.bb"))) |
| 32 | |
| 33 | ;; Outside the shell, get inside it and come back to this same script — the |
| 34 | ;; test, the flag and the reasoning are run.bb's. |
| 35 | (when-not (System/getenv "JOLT_NATIVE_LIB") |
| 36 | (let [cmd (paths/nix root |
| 37 | ["nix" "develop" root |
| 38 | "--max-jobs" (paths/env "FRQ_MAX_JOBS" "0") |
| 39 | "--command" self] |
| 40 | *command-line-args*)] |
| 41 | (System/exit (:exit @(apply p/process {:inherit true :dir root} cmd))))) |
| 42 | |
| 43 | (def overrides |
| 44 | (str "{:deps {jolt-lang/glimmer {:local/root \"" (System/getenv "GLIMMER_SRC") "\"}" |
| 45 | " nandi/glimmer-vidya {:local/root \"" (System/getenv "GLIMMER_VIDYA_SRC") "\"}" |
| 46 | " nandi/glimmer-tui {:local/root \"" (System/getenv "GLIMMER_TUI_SRC") "\"}}}")) |
| Paint the same screens into a terminal ab83b42 nandi 17d ago | 47 | |
| 48 | (System/exit |
| 49 | (:exit @(apply p/process |
| 50 | {:inherit true |
| 51 | :dir root |
| 52 | :extra-env {"LD_LIBRARY_PATH" |
| Merge origin/main, and let one jolt-native answer for both backends 1e8b590 nandi 16d ago | 53 | (->> [(System/getenv "JOLT_NATIVE_LIB") |
| 54 | (System/getenv "LD_LIBRARY_PATH")] |
| 55 | (remove str/blank?) |
| 56 | (str/join ":"))}} |
| 57 | (concat ["jolt" "-Sdeps" overrides "-m" "frq.tui"] |
| 58 | *command-line-args*)))) |