Harden Makefile tool portability
ober
ff70a445dc89482af29b4843a1ece68807da0489
--- a/Makefile +++ b/Makefile @@ -14,13 +14,12 @@ JERBOA_TOOL_DIR ?= $(CURDIR)/.jerboa/bin DETERMINISTIC_JERBUILD ?= $(CURDIR)/support/deterministic-jerbuild.sh JERBUILD_TOOL ?= $(shell if [ -x ./jerbuild ]; then echo ./jerbuild; \ elif [ -x "$(JERBOA_TOOL_DIR)/jerbuild" ]; then echo "$(JERBOA_TOOL_DIR)/jerbuild"; \ - elif [ -x ../jerboa/dist/jerbuild ]; then echo ../jerboa/dist/jerbuild; \ - elif [ -x ../jerboa/jerbuild ]; then echo ../jerboa/jerbuild; \ elif command -v jerbuild >/dev/null 2>&1; then command -v jerbuild; \ else echo "$(JERBOA_TOOL_DIR)/jerbuild"; fi) JH = $(shell "$(JERBUILD_TOOL)" --jerboa-home 2>/dev/null) SSH ?= ssh SCP ?= scp +GDB ?= gdb LINUX_BUILD_HOST ?= linux.cons.io REMOTE_REPO_URL ?= $(shell git remote get-url origin 2>/dev/null || echo git@git.sr.ht:~lisp/jerboa-emacs) REMOTE_COMMIT ?= $(shell git rev-parse HEAD 2>/dev/null) @@ -167,7 +166,7 @@ export CHEZ_DIR test-org-duration test-org-element test-org-fold test-org-footnote \ test-org-lint test-org-num test-org-property test-org-src test-org-tempo \ test-vtscreen test-debug-repl test-ipc-security test-repl-shim test-qt test-qt-part2 test-qt-e2e build-qt binary-qt \ - test-pty test-emacs test-functional test-term-hang \ + test-pty test-emacs test-functional test-term-hang check-gdb \ podman-deps ensure-podman-deps static-qt static-tui clean-podman check-podman check-root \ podman-static-qt \ check-static-qt-local-deps \ @@ -353,10 +352,6 @@ ensure-jerboa-tools: echo "=== Using project-local ./jerbuild ==="; \ elif [ -x "$(JERBOA_TOOL_DIR)/jerbuild" ] && "$(JERBOA_TOOL_DIR)/jerbuild" --jerboa-home >/dev/null 2>&1; then \ echo "=== Using downloaded Jerboa toolchain: $(JERBOA_TOOL_DIR) ==="; \ - elif [ -x ../jerboa/dist/jerbuild ] && ../jerboa/dist/jerbuild --jerboa-home >/dev/null 2>&1; then \ - echo "=== Using sibling Jerboa build: ../jerboa/dist/jerbuild ==="; \ - elif [ -x ../jerboa/jerbuild ] && ../jerboa/jerbuild --jerboa-home >/dev/null 2>&1; then \ - echo "=== Using sibling Jerboa build: ../jerboa/jerbuild ==="; \ elif command -v jerbuild >/dev/null 2>&1 && jerbuild --jerboa-home >/dev/null 2>&1; then \ echo "=== Using Jerboa toolchain from PATH: $$(command -v jerbuild) ==="; \ else \ @@ -950,6 +945,10 @@ check-podman: @command -v $(PODMAN) >/dev/null 2>&1 || \ { echo "ERROR: Podman executable '$(PODMAN)' not found. Install Podman or set PODMAN=/path/to/podman."; exit 1; } +check-gdb: + @command -v $(GDB) >/dev/null 2>&1 || \ + { echo "ERROR: debugger '$(GDB)' not found. Install gdb or set GDB=/path/to/gdb."; exit 1; } + # Container dependency image target. # Takes ~45-60 min: Qt6 static + QScintilla + Chez Scheme + all shims. CHEZ_COMMIT ?= $(CHEZ_REV) @@ -1761,8 +1760,8 @@ stress-run: build repl_shim.$(SHLIB_EXT) libqt_shim.$(SHLIB_EXT) vterm_shim.$(SH $(SCHEME) $(LIBDIRS) --script qt-main.ss --repl $(STRESS_PORT) # Launch jemacs-qt (static binary) under gdb with REPL for crash diagnosis -stress-run-static: - $(XVFB_RUN) gdb -batch \ +stress-run-static: check-gdb + $(XVFB_RUN) $(GDB) -batch \ -ex 'handle SIGALRM nostop noprint' \ -ex 'handle SIG34 nostop noprint' \ -ex run \ @@ -1775,14 +1774,14 @@ stress-run-static: # UI works normally; on segfault/abort, gdb writes a full backtrace to # /tmp/jemacs-gdb.log and the in-process crash reporter writes the FFI ring # buffer to ~/.jemacs-crash.log. Use this to demo/reproduce crashes manually. -debug-qt: +debug-qt: check-gdb @rm -f ~/.jemacs-crash.log /tmp/jemacs-gdb.log @echo "=== jemacs-qt under gdb ===" @echo "Logs on crash:" @echo " ~/.jemacs-crash.log (FFI ring buffer)" @echo " /tmp/jemacs-gdb.log (native backtrace)" @echo - gdb -batch \ + $(GDB) -batch \ -ex 'handle SIGALRM nostop noprint' \ -ex 'handle SIG34 nostop noprint' \ -ex 'handle SIGPIPE nostop noprint' \ @@ -1887,11 +1886,11 @@ scenario-burn: build repl_shim.$(SHLIB_EXT) libqt_shim.$(SHLIB_EXT) vterm_shim.$ tail -80 scenario-run.log 2>/dev/null # All-in-one: launch static jemacs-qt under gdb + run scenario driver -scenario-burn-static: +scenario-burn-static: check-gdb @echo "=== Starting jemacs-qt (static) scenario burn-in under gdb ===" @rm -f $(HOME)/.jerboa-repl-port scenario-run.log scenario-failures.log @rm -rf scenario-screenshots - @$(XVFB_RUN) gdb -batch \ + @$(XVFB_RUN) $(GDB) -batch \ -ex 'handle SIGALRM nostop noprint' \ -ex 'handle SIG34 nostop noprint' \ -ex run \