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.
This commit is contained in:
Konrad committed 2026-11-08 19:47:10 +00:00
1 parent 4c4975c08a
commit b25719f31a
2 files changed
+19 -1

No files matched your search

+7 -1
View File
@@ -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)
+12
View File
@@ -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`).