From b25719f31a520ec55248cfd74f391932b6ad4f40 Mon Sep 17 00:00:00 2001 From: Konrad Date: Sun, 8 Nov 2026 19:47:10 +0000 Subject: [PATCH] install: a program, not a wrapper ~/.local/bin/splinter was a shell script that sourced ~/.hermes/.env - another program's secrets file, which has no business being read here. It is now what 'make install PREFIX=$HOME/.local' puts there: an ELF binary with an rpath of $ORIGIN/../lib, so it finds libsplinter.so next to itself. No wrapper, no LD_LIBRARY_PATH, no environment file. Keys come from the environment the user exports; a delegate names the variable, never the value. Verified from /tmp with the wrapper and ~/.splinter/env gone: ~/.local/bin/splinter -p 'sage nur: install-ok' -> install-ok ldd | grep 'not found' -> 0 Also in this round: environment delegates are opt-in (env_delegates), the claude entry is named after itself instead of its array position, and the docs say how to install without root. --- Makefile | 8 +++++++- docs/CONFIG.md | 12 ++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 96aec73..1ec9a3e 100644 --- a/Makefile +++ b/Makefile @@ -183,10 +183,16 @@ check: $(LIB) $(BIN) $(PLUGIN) $(TESTS) for t in $(TESTS); do echo "== $$t"; ./$$t; done; \ echo "all tests passed" +# The installed binary finds its own library through an rpath relative to itself +# ($ORIGIN), so 'make install PREFIX=$HOME/.local' produces a program that runs +# without a wrapper, without LD_LIBRARY_PATH and without an environment file. install: all mkdir -p $(DESTDIR)$(PREFIX)/bin $(DESTDIR)$(PREFIX)/lib - cp $(BIN) $(DESTDIR)$(PREFIX)/bin/ + $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-rpath,'$$ORIGIN/../lib' \ + -o $(DESTDIR)$(PREFIX)/bin/splinter $(BINOBJ) -L. -lsplinter \ + $(CURSES_A) $(LIBS) cp $(LIB) $(DESTDIR)$(PREFIX)/lib/ + @echo "installed $(DESTDIR)$(PREFIX)/bin/splinter" clean: rm -f $(BIN) $(LIB) $(LIBOBJ) $(BINOBJ) $(PLUGIN) $(TESTS) diff --git a/docs/CONFIG.md b/docs/CONFIG.md index 00b25e6..3f1cd6c 100644 --- a/docs/CONFIG.md +++ b/docs/CONFIG.md @@ -82,3 +82,15 @@ it, every `*.conf` in name order: A later file overrides an earlier one, and an unknown key is still an error - now with the file it came from. Proven in `test_config`. + +## Installieren ohne root + + make install PREFIX=$HOME/.local + +Das installierte Binary traegt einen RPATH auf `$ORIGIN/../lib`, findet seine +`libsplinter.so` also neben sich. Kein Wrapper, kein `LD_LIBRARY_PATH`, keine +Umgebungsdatei: `~/.local/bin/splinter` ist das Programm. + +Keys kommen aus der Umgebung, die du selbst exportierst — splinter liest keine +fremde Konfigurationsdatei mit. Ein Delegate nennt nur den Namen der Variablen +(`key_env=OPENCODE_GO_API_KEY`).