aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authoruser <user@clank>2026-09-02 16:22:03 +0200
committeruser <user@clank>2026-09-02 16:22:03 +0200
commitf9986df0da09cc692e168e33ef9ccfab5b9d2faf (patch)
treec0cc554269af4260a41eca2c3ea1a56efb4a730f /Makefile
parentpty: fall back to xterm-256color where xterm-ghostty has no terminfo (diff)
downloadslosh-f9986df0da09cc692e168e33ef9ccfab5b9d2faf.tar.gz
slosh-f9986df0da09cc692e168e33ef9ccfab5b9d2faf.tar.xz
slosh-f9986df0da09cc692e168e33ef9ccfab5b9d2faf.zip
slosh --install-terminfo: the binary carries its own terminfo entry
The xterm-256color fallback works everywhere; the real entry is better, and a tarball user on a bare box had no easy way to get it. The entry is generated from the vendored tree (contrib/terminfo, so it describes the terminal core we actually ship), compiled with tic, embedded as bytes, and written to ~/.terminfo under every name it answers to, letter and Darwin-hashed layouts both. No root, no package, no conflict with a ghostty installed later. Proven end to end in a mount namespace: bare box falls back, installs, and the next pane says xterm-ghostty.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile12
1 files changed, 11 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 7ac9736..c4aa82a 100644
--- a/Makefile
+++ b/Makefile
@@ -83,7 +83,7 @@ $(BIN): $(OBJ) $(VT_LIB)
$(call say,[LD],$@)
$(Q)$(CC) $(OBJ) $(VT_LIB) -o $@ $(LDFLAGS)
-build/%.o: src/%.c build/version.h build/logo.h $(VT_LIB) | build
+build/%.o: src/%.c build/version.h build/logo.h build/terminfo.h $(VT_LIB) | build
$(call say,[CC],$<)
$(Q)$(CC) $(CFLAGS) -c $< -o $@
@@ -106,6 +106,16 @@ build/logo.h: logo.txt | build
sed -e 's/\\\\/\\\\\\\\/g' -e 's/"/\\\\"/g' -e 's/^/ "/' -e 's/$$/",/' logo.txt; \
printf '};\n'; } > $@
+# The compiled xterm-ghostty terminfo entry, as bytes the binary carries so
+# `slosh --install-terminfo` can hand it to a machine that lacks it. See
+# contrib/terminfo/README.md for where the entry comes from.
+build/terminfo.h: contrib/terminfo/xterm-ghostty.terminfo | build
+ $(call say,[GEN],$@)
+ $(Q){ printf '/* generated from contrib/terminfo/xterm-ghostty.terminfo */\n'; \
+ printf 'static const unsigned char TERMINFO_GHOSTTY[] = {\n'; \
+ od -An -v -tx1 $< | sed -e 's/ \([0-9a-f][0-9a-f]\)/0x\1,/g'; \
+ printf '};\n'; } > $@
+
build/version.h: FORCE | build
@printf '/* generated by the Makefile */\n#define SLOSH_VERSION "%s"\n' \
'$(VERSION)' > $@.tmp