Fix native Linux static build setup
ober
307e7a624431dd98928aa2cf952577d4161d43b7
--- a/Makefile +++ b/Makefile @@ -149,6 +149,7 @@ export CHEZ_DIR test-vtscreen test-debug-repl test-qt test-qt-e2e build-qt binary-qt \ test-pty test-emacs test-functional test-term-hang \ podman-deps ensure-podman-deps static-qt static-tui clean-podman check-podman check-root \ + check-static-qt-local-deps \ linux-static-qt-podman linux-static-tui-podman \ build-jemacs-qt-static build-jemacs-tui-static binary macos \ linux linux-amd64 linux-arm64 jemacs-linux-amd64 jemacs-linux-arm64 freebsd freebsd-amd64 jemacs-freebsd-amd64 \ @@ -175,8 +176,8 @@ all: @echo " run-qt Build and run Qt editor" @echo " binary Build TUI binary (./jemacs) — embeds Scheme, links system libs" @echo " jemacs-jerbuild Build host TUI launcher via 'jerbuild build' (.jerbuild)" - @echo " static-tui Build fully static TUI binary via Podman (./jemacs)" - @echo " static-qt Build static jemacs-qt binary via Podman" + @echo " static-tui Build static TUI binary on this Linux host (./jemacs)" + @echo " static-qt Build static jemacs-qt binary on this Linux host" @echo " linux-amd64 Build Linux amd64 TUI artifact via jerbuild (local Linux or SSH)" @echo " linux-arm64 Build Linux arm64 TUI artifact via jerbuild on a Linux arm64 host" @echo " freebsd-amd64 Build FreeBSD amd64 TUI artifact via jerbuild on FreeBSD" @@ -222,8 +223,13 @@ vendor-deps: rmdir "$$dest"; \ echo " cloning $$repo from $$url"; \ git clone --depth 1 "$$url" "$$dest"; \ + elif [ -d "$$dest" ]; then \ + echo " replacing non-git vendor directory $$dest"; \ + rm -rf "$$dest"; \ + echo " cloning $$repo from $$url"; \ + git clone --depth 1 "$$url" "$$dest"; \ elif [ -e "$$dest" ]; then \ - echo "ERROR: $$dest exists but is not a git clone; remove it and rerun make vendor-deps" >&2; \ + echo "ERROR: $$dest exists but is not a directory; remove it and rerun make vendor-deps" >&2; \ exit 1; \ else \ echo " cloning $$repo from $$url"; \ @@ -241,8 +247,13 @@ vendor-deps: rmdir "$$dest"; \ echo " cloning $$repo"; \ git clone --depth 1 "https://git.sr.ht/~lisp/$$repo" "$$dest"; \ + elif [ -d "$$dest" ]; then \ + echo " replacing non-git vendor directory $$dest"; \ + rm -rf "$$dest"; \ + echo " cloning $$repo"; \ + git clone --depth 1 "https://git.sr.ht/~lisp/$$repo" "$$dest"; \ elif [ -e "$$dest" ]; then \ - echo "ERROR: $$dest exists but is not a git clone; remove it and rerun make vendor-deps" >&2; \ + echo "ERROR: $$dest exists but is not a directory; remove it and rerun make vendor-deps" >&2; \ exit 1; \ else \ echo " cloning $$repo"; \ @@ -447,7 +458,7 @@ support/treesitter_shim.$(SHLIB_EXT): support/treesitter_shim.c support/treesitt -L$(TS_LIB_DIR) -ltree-sitter $(TS_GRAMMAR_LIBS) -Wall QT_INC := $(shell qmake6 -query QT_INSTALL_HEADERS 2>/dev/null || echo $(QT_INC_FALLBACK)) -QT_SHIM_H := vendor +QT_SHIM_H := support/vendor-overrides ifeq ($(UNAME_S),Darwin) QT_CFLAGS := $(shell pkg-config --cflags Qt6Widgets Qt6Gui Qt6Core 2>/dev/null) @@ -770,7 +781,7 @@ binary: check-vterm-system-deps build pty_shim.$(SHLIB_EXT) vterm_shim.$(SHLIB_E $(SCHEME) $(LIBDIRS) --script build-binary.ss # ============================================================================= -# Static binary builds (Podman-based, Alpine musl) +# Static binary build support (native Linux musl) # ============================================================================= ARCH := $(shell uname -m) @@ -818,10 +829,10 @@ JSH_COREUTILS_LIB ?= $(shell test -f $(_RUST_COREUTILS) && echo $(_RUST_COREUTIL DEPS_IMAGE := jemacs-deps:$(ARCH) 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; } + @echo "ERROR: container builds are disabled for this project; use static-qt/static-tui on a prepared Linux host." >&2 + @exit 1 -# Build intermediate deps Podman image (run once, or when deps change). +# Disabled legacy container dependency image target. # Takes ~45-60 min: Qt6 static + QScintilla + Chez Scheme + all shims. CHEZ_COMMIT ?= 902a10098603481afce0ec8588114234c09d6318 @@ -842,9 +853,8 @@ ensure-podman-deps: check-podman @$(PODMAN) image exists $(DEPS_IMAGE) || \ { echo "Deps image '$(DEPS_IMAGE)' not found; building with 'make podman-deps'."; $(MAKE) podman-deps; } -# Fast static Qt binary via Podman. -# Builds only jemacs-qt itself (~5-10 min). Output: ./jemacs-qt (static ELF). -static-qt: linux-static-qt-podman +# Static Qt binary on the target Linux host. +static-qt: check-static-qt-local-deps linux-qt-local linux: linux-amd64 @@ -1122,7 +1132,7 @@ linux-static-qt-podman: vendor-deps ensure-podman-deps make -C /src build-jemacs-qt-static" # ============================================================================= -# Static TUI binary (Podman-based, Alpine musl) +# Static TUI binary support (native Linux musl) # ============================================================================= # Scintilla/termbox/Lexilla C/C++ source + headers used to build static @@ -1130,9 +1140,8 @@ linux-static-qt-podman: vendor-deps ensure-podman-deps # vendored checkout. SCI_VENDOR_SRC ?= $(JERBOA_SCINTILLA_ROOT)/vendor -# Fast static TUI binary via Podman. -# Builds Scintilla+termbox+Lexilla from source, then ./jemacs (~5-10 min). -static-tui: linux-static-tui-podman +# Static TUI binary on the target Linux host. +static-tui: linux-tui-local # In-container build target for TUI static binary (called by linux-static-tui-podman) build-jemacs-tui-static: check-root @@ -1255,10 +1264,9 @@ linux-static-tui-podman: vendor-deps ensure-podman-deps cd /src && make build-jemacs-tui-static'" # ============================================================================= -# Static TUI via jerboa21/jerboa Podman image (like jerboa-gitsafe) +# Static TUI via the native Linux musl toolchain. # ============================================================================= -JERBOA_IMAGE ?= jerboa21/jerboa MUSL_CHEZ_DIR = $(shell ls -d /build/chez-musl/lib/csv*/ta6le 2>/dev/null | head -1) MUSL_SCHEME = /usr/local/bin/scheme MUSL_DEPS ?= $(VENDOR) @@ -1269,22 +1277,12 @@ MUSL_JSH_ROOT ?= $(MUSL_DEPS)/jerboa-shell MUSL_JSH ?= $(MUSL_JSH_ROOT)/src MUSL_SCI_VENDOR ?= /build/sci-vendor -# Podman build: produces ./jemacs static binary -linux-tui: check-podman - @echo "=== Building jemacs static TUI binary in Podman ===" - $(PODMAN) build $(PODMAN_BUILD_FLAGS) --platform $(PODMAN_PLATFORM) -f Dockerfile.tui -t jemacs-tui-builder . - @id=$$($(PODMAN) create jemacs-tui-builder) && \ - $(PODMAN) cp $$id:/out/jemacs ./jemacs && \ - $(PODMAN) rm $$id >/dev/null - @chmod +x jemacs - @echo "" - @ls -lh jemacs - @file jemacs +linux-tui: linux-tui-local -# In-container build target (called inside jerboa21/jerboa). +# Native Linux musl build target. # Dependency sources use the same vendor/ clones as local builds. linux-tui-local: vendor-deps - @echo "=== Building jemacs static TUI (in-container) ===" + @echo "=== Building jemacs static TUI on this Linux host ===" rm -f src/.jerbuild-hashes find lib -name '*.so' -o -name '*.wpo' | xargs rm -f 2>/dev/null; true find src/jerboa-emacs -name '*.ss' | sed 's|src/|lib/|; s|\.ss$$|.sls|' | xargs rm -f 2>/dev/null; true @@ -1353,30 +1351,28 @@ linux-tui-local: vendor-deps @file jemacs # ============================================================================= -# Static Qt binary via jerboa21/jerboa Podman image +# Static Qt binary via the native Linux musl toolchain. # ============================================================================= -# Podman build: produces ./jemacs-qt static binary -linux-qt: check-podman - @echo "=== Building jemacs-qt static binary in Podman ===" - $(PODMAN) build $(PODMAN_BUILD_FLAGS) --platform $(PODMAN_PLATFORM) \ - --build-arg JEMACS_FEATURES="$(JEMACS_FEATURES)" \ - -f Dockerfile.qt -t jemacs-qt-builder . - @id=$$($(PODMAN) create jemacs-qt-builder) && \ - $(PODMAN) cp $$id:/out/jemacs-qt ./jemacs-qt && \ - $(PODMAN) rm $$id >/dev/null - @chmod +x jemacs-qt - @echo "" - @ls -lh jemacs-qt - @file jemacs-qt +linux-qt: check-static-qt-local-deps linux-qt-local + +# Native Linux musl Qt build prerequisites. +# Qt6 static libs are at /opt/qt6-static. +# Tree-sitter is at /opt/tree-sitter-*. +# Pre-compiled libqt_shim.a is at /opt/qt-shim/. +check-static-qt-local-deps: + @test "$$(uname -s)" = Linux || { echo "ERROR: static-qt must run on a Linux target host."; exit 1; } + @test -x "$(MUSL_SCHEME)" || { echo "ERROR: missing $(MUSL_SCHEME) for static-qt."; exit 1; } + @test -n "$(MUSL_CHEZ_DIR)" || { echo "ERROR: missing musl Chez directory under /build/chez-musl/lib/csv*/ta6le."; exit 1; } + @test -d /opt/qt6-static || { echo "ERROR: missing /opt/qt6-static for static-qt."; exit 1; } + @test -d /opt/qt-shim || { echo "ERROR: missing /opt/qt-shim for static-qt."; exit 1; } + @test -d /opt/tree-sitter-include || { echo "ERROR: missing /opt/tree-sitter-include for static-qt."; exit 1; } + @test -d /opt/tree-sitter-lib || { echo "ERROR: missing /opt/tree-sitter-lib for static-qt."; exit 1; } + @test -d /opt/tree-sitter-grammars || { echo "ERROR: missing /opt/tree-sitter-grammars for static-qt."; exit 1; } + @test -d "$(MUSL_SCI_VENDOR)" || { echo "ERROR: missing $(MUSL_SCI_VENDOR) for static-qt."; exit 1; } -# In-container build target (called inside the Podman Qt build container) -# Qt6 static libs are at /opt/qt6-static (copied from Alpine stage). -# Tree-sitter is at /opt/tree-sitter-* (copied from Alpine stage). -# Pre-compiled libqt_shim.a is at /opt/qt-shim/ (Alpine-musl g++, ABI-compatible). -# /opt/chez → /build/chez-musl symlink provides musl Chez Scheme. linux-qt-local: vendor-deps - @echo "=== Building jemacs-qt static (in-container) ===" + @echo "=== Building jemacs-qt static on this Linux host ===" rm -f src/.jerbuild-hashes find lib -name '*.so' -o -name '*.wpo' | xargs rm -f 2>/dev/null; true find src/jerboa-emacs -name '*.ss' | sed 's|src/|lib/|; s|\.ss$$|.sls|' | xargs rm -f 2>/dev/null; true