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`).