@@ -6,6 +6,10 @@ set shell := ["bash", "-uc"]
66set dotenv-load := true
77set positional-arguments := true
88
9+ # Use Zig as C compiler/linker (avoids gcc dependency)
10+ export CC := env_var_or_default (" CC" , justfile_directory () / " zig-cc" )
11+ export AR := env_var_or_default (" AR" , justfile_directory () / " zig-ar" )
12+
913# Project metadata
1014project := " formatrix-docs"
1115version := " 0.1.0"
@@ -53,26 +57,48 @@ build-core:
5357 @ echo " Building formatrix-core..."
5458 cargo build -p formatrix-core
5559
56- # Build Rust GUI (Tauri)
60+ # Build Rust GUI (Tauri - requires GTK/WebKit dev libs )
5761build-gui : build-core
58- @ echo " Building formatrix-gui..."
62+ #!/usr/bin/env bash
63+ echo " Building formatrix-gui..."
64+ if ! pkg-config --exists glib-2.0 2 >/ dev/ null; then
65+ echo " SKIP: glib-2.0 not found (install gtk4-devel webkit2gtk4.1-devel)"
66+ exit 0
67+ fi
5968 cargo build -p formatrix-gui
6069
61- # Build Ada TUI
70+ # Build Ada TUI (requires GNAT + ncurses-ada)
6271build-tui :
63- @ echo " Building formatrix-tui..."
72+ #!/usr/bin/env bash
73+ echo " Building formatrix-tui..."
74+ if ! command -v gprbuild > / dev/ null 2 >&1 ; then
75+ echo " SKIP: gprbuild not found (install gcc-gnat gprbuild)"
76+ exit 0
77+ fi
78+ # Check for ncurses.gpr availability
79+ NCURSES_GPR=" "
80+ for path in / usr/ share/ gpr/ ncurses.gpr / usr/ lib64 / gnat/ ncurses.gpr / usr/ share/ ada/ adainclude/ ncurses.gpr; do
81+ if [ -f " $path" ]; then
82+ NCURSES_GPR=" $path"
83+ break
84+ fi
85+ done
86+ if [ -z " $NCURSES_GPR" ]; then
87+ echo " SKIP: ncurses.gpr not found (install terminal_interface-curses-devel or florist-devel)"
88+ exit 0
89+ fi
6490 cd tui && gprbuild -P formatrix_tui.gpr -XMODE=debug
6591
6692# Build ReScript UI
6793build-ui :
6894 @ echo " Building ReScript UI..."
69- cd ui && deno task build 2 >/ dev / null || echo " UI build not configured yet"
95+ @ cd ui && deno task build:res 2 >& 1 | tail -5
7096
7197# Build in release mode
7298build-release :
7399 @ echo " Building all (release)..."
74100 cargo build --release
75- cd tui && gprbuild -P formatrix_tui.gpr -XMODE=release
101+ @ command -v gprbuild > / dev / null 2 >& 1 && cd tui && gprbuild -P formatrix_tui.gpr -XMODE=release || echo " SKIP: TUI (gprbuild not found)"
76102 cd ui && deno task build 2 >/ dev/ null || true
77103
78104# Clean build artifacts
@@ -98,7 +124,7 @@ test-core:
98124# Test Ada TUI (compile check)
99125test-tui : build-tui
100126 @ echo " Testing formatrix-tui..."
101- [ -f tui/ bin/ formatrix-tui ] && echo " TUI binary exists" || exit 1
127+ @ [ -f tui/ bin/ formatrix-tui ] && echo " TUI binary exists" || echo " SKIP: TUI not built (missing dependencies)"
102128
103129# Test ReScript UI
104130test-ui :
@@ -163,13 +189,12 @@ run-debug:
163189deps :
164190 @ echo " Checking dependencies..."
165191 @ command -v cargo > / dev/ null 2 >&1 || { echo " ERROR: cargo not found" ; exit 1 ; }
166- @ command -v gnat > / dev/ null 2 >&1 || { echo " ERROR: gnat not found" ; exit 1 ; }
167- @ command -v gprbuild > / dev/ null 2 >&1 || { echo " ERROR: gprbuild not found" ; exit 1 ; }
168192 @ command -v deno > / dev/ null 2 >&1 || { echo " ERROR: deno not found" ; exit 1 ; }
169193 @ echo " Rust: $(rustc --version)"
170- @ echo " GNAT: $(gnat --version | head -1)"
171194 @ echo " Deno: $(deno --version | head -1)"
172- @ echo " All dependencies satisfied"
195+ @ command -v gnat > / dev/ null 2 >&1 && echo " GNAT: $(gnat --version | head -1)" || echo " WARN: gnat not found (TUI disabled)"
196+ @ command -v gprbuild > / dev/ null 2 >&1 || echo " WARN: gprbuild not found (TUI disabled)"
197+ @ echo " Core dependencies satisfied"
173198
174199# Audit dependencies for vulnerabilities
175200deps-audit :
@@ -204,43 +229,72 @@ cookbook:
204229 echo " Generated: $OUTPUT"
205230
206231# ═══════════════════════════════════════════════════════════════════════════════
207- # CONTAINERS (nerdctl + Wolfi )
232+ # CONTAINERS (nerdctl-first, podman-fallback )
208233# ═══════════════════════════════════════════════════════════════════════════════
209234
235+ # Detect container runtime: nerdctl > podman > docker
236+ [private ]
237+ container-cmd :
238+ #!/usr/bin/env bash
239+ if command -v nerdctl >/ dev/ null 2 >&1 ; then
240+ echo " nerdctl"
241+ elif command -v podman >/ dev/ null 2 >&1 ; then
242+ echo " podman"
243+ elif command -v docker >/ dev/ null 2 >&1 ; then
244+ echo " docker"
245+ else
246+ echo " ERROR: No container runtime found (install nerdctl, podman, or docker)" >&2
247+ exit 1
248+ fi
249+
210250# Build container image
211251container-build tag = " latest":
212- @ echo " Building container..."
213- nerdctl build -t {{ project}} :{{ tag}} -f container/ Dockerfile.wolfi .
252+ #!/usr/bin/env bash
253+ CTR=$(just container-cmd)
254+ echo " Building container with $CTR..."
255+ $CTR build -t {{ project}} :{{ tag}} -f container/ Dockerfile.wolfi .
214256
215257# Run container (GUI)
216- container-run tag = " latest" * args :
217- nerdctl run --rm -it \
258+ container-run tag = " latest" cmd = " ":
259+ #!/usr/bin/env bash
260+ CTR=$(just container-cmd)
261+ $CTR run --rm -it \
218262 - e DISPLAY=$DISPLAY \
219263 - v / tmp/ .X11 -unix:/ tmp/ .X11 -unix:ro \
220- {{ project}} :{{ tag}} {{ args }}
264+ {{ project}} :{{ tag}} {{ cmd }}
221265
222266# Run container (TUI)
223267container-run-tui tag = " latest":
224- nerdctl run --rm -it \
268+ #!/usr/bin/env bash
269+ CTR=$(just container-cmd)
270+ $CTR run --rm -it \
225271 - e TERM=$TERM \
226272 {{ project}} :{{ tag}} / usr/ local/ bin/ formatrix-tui
227273
228274# Start all services with compose
229275compose-up :
230- cd container && nerdctl compose up -d
276+ #!/usr/bin/env bash
277+ CTR=$(just container-cmd)
278+ cd container && $CTR compose up -d
231279
232280# Stop all services
233281compose-down :
234- cd container && nerdctl compose down
282+ #!/usr/bin/env bash
283+ CTR=$(just container-cmd)
284+ cd container && $CTR compose down
235285
236286# View logs
237287compose-logs :
238- cd container && nerdctl compose logs -f
288+ #!/usr/bin/env bash
289+ CTR=$(just container-cmd)
290+ cd container && $CTR compose logs -f
239291
240292# Push container image
241293container-push registry = " ghcr.io/hyperpolymath" tag = " latest":
242- nerdctl tag {{ project}} :{{ tag}} {{ registry}} / {{ project}} :{{ tag}}
243- nerdctl push {{ registry}} / {{ project}} :{{ tag}}
294+ #!/usr/bin/env bash
295+ CTR=$(just container-cmd)
296+ $CTR tag {{ project}} :{{ tag}} {{ registry}} / {{ project}} :{{ tag}}
297+ $CTR push {{ registry}} / {{ project}} :{{ tag}}
244298
245299# ═══════════════════════════════════════════════════════════════════════════════
246300# CI & AUTOMATION
@@ -252,14 +306,11 @@ ci: deps quality
252306
253307# Install git hooks
254308install-hooks :
255- @ mkdir -p .git/ hooks
256- @ cat > .git/ hooks/ pre-commit << ' EOF'
257- #!/ bin/ bash
258- just fmt-check || exit 1
259- just lint || exit 1
260- EOF
261- @ chmod + x .git/ hooks/ pre-commit
262- @ echo " Git hooks installed"
309+ #!/usr/bin/env bash
310+ mkdir -p .git/ hooks
311+ printf ' %s\n' ' #!/bin/bash' ' just fmt-check || exit 1' ' just lint || exit 1' > .git/ hooks/ pre-commit
312+ chmod + x .git/ hooks/ pre-commit
313+ echo " Git hooks installed"
263314
264315# ═══════════════════════════════════════════════════════════════════════════════
265316# SECURITY
0 commit comments