diff options
| author | sl0p <sl0p@sl0p.foo> | 2026-08-13 22:00:03 +0200 |
|---|---|---|
| committer | sl0p <sl0p@sl0p.foo> | 2026-08-13 22:00:03 +0200 |
| commit | 2c1b855c3cf8cf8841bf25cd939e478a7f0bfac8 (patch) | |
| tree | 7cd6274303ba1da1f8bd57371aec336dd687fb58 /Makefile | |
| download | slosh-2c1b855c3cf8cf8841bf25cd939e478a7f0bfac8.tar.gz slosh-2c1b855c3cf8cf8841bf25cd939e478a7f0bfac8.tar.xz slosh-2c1b855c3cf8cf8841bf25cd939e478a7f0bfac8.zip | |
sl0ptty: M0 — libghostty-vt vendored, one pane, compositor, diff renderer
Design contract in DESIGN.md. libghostty-vt vendored fresh from ghostty
main@bedb6f2 (zig 0.16), built to a 14MB static lib.
M0: pty spawn (no libutil), a lib-vt terminal per pane, a screen cell buffer,
a diff emitter that repaints only what changed, raw mode, SIGWINCH, and a
~120Hz frame cap that coalesces pty reads.
Also the seed of the headless harness: --headless dumps the composited screen
without a tty, so composition is testable in milliseconds.
tests/live_m0.py covers what headless cannot: raw mode, the diff emitter,
resize propagation, and the quit path. 6/6 green.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d391f7b --- /dev/null +++ b/Makefile @@ -0,0 +1,54 @@ +# sl0ptty — see DESIGN.md +# +# zig is the C compiler: it is already required to build libghostty-vt, and it +# gives us static musl linking and cross-compilation for free (D12). + +ZIG ?= $(HOME)/zig-0.16.0/zig +CC := $(ZIG) cc +VT := vendor/libghostty-vt +VT_OUT := $(VT)/zig-out +VT_LIB := $(VT_OUT)/lib/libghostty-vt.a +VT_INC := $(VT_OUT)/include + +CFLAGS := -std=c23 -O1 -g -Wall -Wextra -Wno-unused-parameter \ + -I$(VT_INC) -Isrc +LDFLAGS := + +SRC := $(wildcard src/*.c) +OBJ := $(SRC:src/%.c=build/%.o) +BIN := build/sl0ptty + +.PHONY: all clean vendor run test smoke help +.DEFAULT_GOAL := help + +help: ## show this + @grep -hE '^[a-z-]+:.*##' $(MAKEFILE_LIST) | sed 's/:.*##/\t/' | expand -t20 + +all: $(BIN) ## build sl0ptty + +$(BIN): $(OBJ) $(VT_LIB) + $(CC) $(OBJ) $(VT_LIB) -o $@ $(LDFLAGS) + +build/%.o: src/%.c $(VT_LIB) | build + $(CC) $(CFLAGS) -c $< -o $@ + +build: + @mkdir -p build + +$(VT_LIB): + @$(MAKE) vendor + +vendor: ## build the vendored libghostty-vt (needs zig 0.16) + cd $(VT) && PATH="$(dir $(ZIG)):$$PATH" zig build -Demit-lib-vt -Doptimize=ReleaseFast + +test: $(BIN) ## run the live pty checks + python3 tests/live_m0.py + +smoke: $(BIN) ## compose a screen headlessly and print it + ./$(BIN) --headless --cols 40 --rows 6 -- /bin/sh -c 'printf "hello \033[1;32msl0ptty\033[0m\n"; echo "wide: 日本語"' + +run: $(BIN) ## build and run + ./$(BIN) + +clean: ## remove our build output (not the vendor lib) + rm -rf build |
