build: build jerboa-browser with installed jerbuild (no ~/mine/jerboa)

ober

3ac1fb9f8848bb036c64c6ba84d12ae1f2e151d8

diff --git a/.jerbuild b/.jerbuild
index 5f4cdb8..5034c98 100644
--- a/.jerbuild
+++ b/.jerbuild
@@ -1,7 +1,9 @@
 ;; Build the Jerboa browser entry with a standalone jerbuild binary.
+;;
+;; jerbuild bundles Chez Scheme + the jerboa stdlib, so this needs only
+;; jerbuild + a C compiler — no jerboa source checkout. The full GUI bundle
+;; additionally needs the Qt/WebKit native wrapper from the Makefile.
 
 (entry "scheme/browser-main.ss")
 (output "jerboa-browser")
-(requires "cc" "the Qt/WebKit native dependencies used by the existing Makefile")
-(notes "The Scheme entry is listed here for jerbuild. The existing browser native wrapper may still be needed for the full GUI bundle. jerboa-native-rs and DuckDB are not required.")
 (libdirs "scheme")
diff --git a/Makefile b/Makefile
index ee37649..c1cfa5d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,82 +1,95 @@
-JERBOA_HOME ?= $(realpath $(CURDIR)/../jerboa)
-SCHEME      ?= $(JERBOA_HOME)/.chez/bin/scheme
-LIBDIRS     := $(CURDIR)/scheme:$(JERBOA_HOME)/lib
-
-.PHONY: binary test test-keymap test-minibuffer test-commands test-keys test-nav test-hint test-pass test-polish test-adblock test-gui test-buffers repl clean help
+# jerbuild bundles Chez Scheme + the jerboa stdlib, so building the browser
+# entry needs only `jerbuild` + a C compiler — no jerboa source checkout. (The
+# full Qt/WebKit GUI bundle additionally needs the native wrapper.)
+JERBUILD ?= jerbuild
+JH := $(shell $(JERBUILD) --jerboa-home 2>/dev/null)
+ifeq ($(JH),)
+$(error jerbuild not found on PATH (or '$(JERBUILD) --jerboa-home' failed). Install jerbuild, or set JERBUILD=/path/to/jerbuild)
+endif
+JEXEC       := $(JERBUILD) exec --libdirs $(CURDIR)/scheme:$(JH)/lib
+
+.PHONY: all build binary run test test-keymap test-minibuffer test-commands test-keys test-nav test-hint test-pass test-polish test-adblock test-gui test-buffers repl clean help
 .DEFAULT_GOAL := help
 
-# Build the self-contained native ./jerboa-browser (Chez + boot + (browser)).
+all: binary
+
+# Build the self-contained native ./jerboa-browser via .jerbuild.
 binary:
-	JERBOA_HOME=$(JERBOA_HOME) $(SCHEME) -q --libdirs $(LIBDIRS) --script build-binary.ss
+	$(JERBUILD) build
 	@echo "" && ls -lh jerboa-browser && file jerboa-browser
 
+build: binary
+
+run: binary
+	./jerboa-browser $(ARGS)
+
 # Run the (browser) test suite in the interpreter (no binary needed).
 test:
-	JERBOA_HOME=$(JERBOA_HOME) $(SCHEME) -q --libdirs $(LIBDIRS) --script scheme/browser-test.ss
+	$(JEXEC) scheme/browser-test.ss
 
 # Pure-Scheme unit tests for the keymap engine (no Qt, no display needed).
 test-keymap:
-	JERBOA_HOME=$(JERBOA_HOME) $(SCHEME) -q --libdirs $(LIBDIRS) --script scheme/browser-keymap-test.ss
+	$(JEXEC) scheme/browser-keymap-test.ss
 
 # Pure-Scheme unit tests for fuzzy completion + the minibuffer state machine.
 test-minibuffer:
-	JERBOA_HOME=$(JERBOA_HOME) $(SCHEME) -q --libdirs $(LIBDIRS) --script scheme/browser-minibuffer-test.ss
+	$(JEXEC) scheme/browser-minibuffer-test.ss
 
 # Stage 2 keymap+minibuffer+command controller functional tests (offscreen).
 test-commands:
-	QT_QPA_PLATFORM=offscreen JERBOA_HOME=$(JERBOA_HOME) \
-	  $(SCHEME) -q --libdirs $(LIBDIRS) --script scheme/browser-commands-test.ss
+	QT_QPA_PLATFORM=offscreen \
+	  $(JEXEC) scheme/browser-commands-test.ss
 
 # Stage 2 end-to-end Qt key-capture test: real synthetic Qt key events flow
 # through the app-wide filter → poll queue → controller (offscreen, headless).
 test-keys:
-	QT_QPA_PLATFORM=offscreen JERBOA_HOME=$(JERBOA_HOME) \
-	  $(SCHEME) -q --libdirs $(LIBDIRS) --script scheme/browser-keys-test.ss
+	QT_QPA_PLATFORM=offscreen \
+	  $(JEXEC) scheme/browser-keys-test.ss
 
 # Stage 3 navigation-parity functional tests: scroll/zoom/find/copy driven
 # through the command controller against rendered data: pages (offscreen).
 test-nav:
-	QT_QPA_PLATFORM=offscreen JERBOA_HOME=$(JERBOA_HOME) \
-	  $(SCHEME) -q --libdirs $(LIBDIRS) --script scheme/browser-nav-test.ss
+	QT_QPA_PLATFORM=offscreen \
+	  $(JEXEC) scheme/browser-nav-test.ss
 
 # Stage 4 hint-mode functional tests: JS link-hint overlay + follow (this/new
 # buffer) driven through the command controller against rendered data: pages.
 test-hint:
-	QT_QPA_PLATFORM=offscreen JERBOA_HOME=$(JERBOA_HOME) \
-	  $(SCHEME) -q --libdirs $(LIBDIRS) --script scheme/browser-hint-test.ss
+	QT_QPA_PLATFORM=offscreen \
+	  $(JEXEC) scheme/browser-hint-test.ss
 
 # Stage 5 password-manager functional tests: in-RAM vault round-trip + zeroing,
 # masked prompt, save/fill/forget autofill against a rendered data: form.
 test-pass:
-	QT_QPA_PLATFORM=offscreen JERBOA_HOME=$(JERBOA_HOME) \
-	  $(SCHEME) -q --libdirs $(LIBDIRS) --script scheme/browser-pass-test.ss
+	QT_QPA_PLATFORM=offscreen \
+	  $(JEXEC) scheme/browser-pass-test.ss
 
 # Stage 6 polish functional tests: in-RAM bookmarks + commands, M-x docs, the
 # status modes + echo-area wiring, and the describe-bindings help page.
 test-polish:
-	QT_QPA_PLATFORM=offscreen JERBOA_HOME=$(JERBOA_HOME) \
-	  $(SCHEME) -q --libdirs $(LIBDIRS) --script scheme/browser-polish-test.ss
+	QT_QPA_PLATFORM=offscreen \
+	  $(JEXEC) scheme/browser-polish-test.ss
 
 # Stage 7 ad/tracker blocking (adblock-rust): the process-global toggle ABI and
 # the toggle-adblock command + echo. The engine_match semantics are unit-tested
 # in C++ (cd qt-webengine/build && ctest -R adblock).
 test-adblock:
-	QT_QPA_PLATFORM=offscreen JERBOA_HOME=$(JERBOA_HOME) \
-	  $(SCHEME) -q --libdirs $(LIBDIRS) --script scheme/browser-adblock-test.ss
+	QT_QPA_PLATFORM=offscreen \
+	  $(JEXEC) scheme/browser-adblock-test.ss
 
 # Offline Qt GUI / snapshot harness (headless). Writes PNGs to ./test-artifacts.
 test-gui:
-	QT_QPA_PLATFORM=offscreen JERBOA_HOME=$(JERBOA_HOME) \
-	  $(SCHEME) -q --libdirs $(LIBDIRS) --script scheme/browser-gui-test.ss
+	QT_QPA_PLATFORM=offscreen \
+	  $(JEXEC) scheme/browser-gui-test.ss
 
 # Stage 1 buffer-model functional tests (headless). Writes PNGs to ./test-artifacts.
 test-buffers:
-	QT_QPA_PLATFORM=offscreen JERBOA_HOME=$(JERBOA_HOME) \
-	  $(SCHEME) -q --libdirs $(LIBDIRS) --script scheme/browser-buffers-test.ss
+	QT_QPA_PLATFORM=offscreen \
+	  $(JEXEC) scheme/browser-buffers-test.ss
 
 # REPL with (browser) preloaded, in the interpreter.
 repl:
-	JERBOA_HOME=$(JERBOA_HOME) $(SCHEME) -q --libdirs $(LIBDIRS) --program scheme/browser-repl.ss
+	$(JEXEC) scheme/browser-repl.ss
 
 clean:
 	rm -f jerboa-browser jb-main.c jb-main.o jb_*.h jerboa-browser.boot