diff --git a/Justfile b/Justfile index c907a22..4610cf8 100644 --- a/Justfile +++ b/Justfile @@ -54,6 +54,17 @@ build-cli: build-ffi build-cli-release: build-ffi-release cd cli && zig build -Doptimize=ReleaseSafe +# Build the gossamer-launcher (wasmtime host) + cli.wasm. Replaces the +# legacy Zig CLI once Phase 14b body-port (#42) lands. The launcher build +# invokes ephapax to compile cli/src/Main.eph → cli.wasm in the same +# `zig build` step, so EPHAPAX must point at a working compiler. +build-launcher: build-ffi + cd cli/launcher && EPHAPAX="{{ephapax}}" zig build + +# Release-mode launcher + cli.wasm (used by packaging recipes). +build-launcher-release: build-ffi-release + cd cli/launcher && EPHAPAX="{{ephapax}}" zig build -Doptimize=ReleaseSafe + # Build everything (FFI + CLI + check) build: build-ffi build-cli check @@ -250,11 +261,17 @@ clean: # Development # ═══════════════════════════════════════════════════════════════ -# Install the gossamer CLI to ~/.local/bin -install: build-cli - mkdir -p ~/.local/bin - cp cli/zig-out/bin/gossamer ~/.local/bin/gossamer - @echo " ✓ Installed gossamer to ~/.local/bin/gossamer" +# Install the gossamer CLI to ~/.local/bin (launcher + cli.wasm) +# +# Lays the artefacts out so the launcher's install-prefix-relative +# discovery (/../share/gossamer/cli.wasm) finds the wasm at +# runtime — see cli/launcher/src/main.zig:266. +install: build-launcher + mkdir -p ~/.local/bin ~/.local/share/gossamer + cp cli/launcher/zig-out/bin/gossamer-launcher ~/.local/bin/gossamer + cp cli/launcher/zig-out/share/gossamer/cli.wasm ~/.local/share/gossamer/cli.wasm + @echo " ✓ Installed gossamer (launcher) to ~/.local/bin/gossamer" + @echo " ✓ Installed cli.wasm to ~/.local/share/gossamer/cli.wasm" # Show exported FFI symbols symbols: @@ -411,11 +428,11 @@ tour: # ═══════════════════════════════════════════════════════════════ # Build .deb package for Debian/Ubuntu -package-deb: build-ffi-release build-cli-release +package-deb: build-ffi-release build-launcher-release dpkg-buildpackage -b --no-sign --build-dir=packaging/debian # Build .rpm package for Fedora/RHEL -package-rpm: build-ffi-release build-cli-release +package-rpm: build-ffi-release build-launcher-release rpmbuild -bb packaging/rpm/gossamer.spec # Build Flatpak bundle diff --git a/packaging/debian/gossamer.install b/packaging/debian/gossamer.install index 9e85f85..85fe682 100644 --- a/packaging/debian/gossamer.install +++ b/packaging/debian/gossamer.install @@ -5,5 +5,6 @@ # Format: src/interface/ffi/zig-out/lib/libgossamer.so usr/lib/ -cli/zig-out/bin/gossamer usr/bin/ +cli/launcher/zig-out/bin/gossamer-launcher usr/bin/ +cli/launcher/zig-out/share/gossamer/cli.wasm usr/share/gossamer/ generated/abi/gossamer.h usr/include/gossamer/ diff --git a/packaging/debian/rules b/packaging/debian/rules index 6eee256..6ca978a 100644 --- a/packaging/debian/rules +++ b/packaging/debian/rules @@ -13,7 +13,7 @@ # the default dh_auto_build heuristic (which does not know about Zig). override_dh_auto_build: just build-ffi-release - just build-cli-release + just build-launcher-release # Override the install step to place files into the package staging tree. # dh_auto_install would look for a Makefile install target; we do it manually. @@ -22,10 +22,16 @@ override_dh_auto_install: install -Dm755 src/interface/ffi/zig-out/lib/libgossamer.so \ debian/gossamer/usr/lib/libgossamer.so - # CLI binary — goes to /usr/bin/ - install -Dm755 cli/zig-out/bin/gossamer \ + # CLI launcher (wasmtime host) — installed as `gossamer` so existing + # UX is preserved. Renames gossamer-launcher → gossamer. + install -Dm755 cli/launcher/zig-out/bin/gossamer-launcher \ debian/gossamer/usr/bin/gossamer + # Precompiled cli.wasm — discovered by the launcher at + # /../share/gossamer/cli.wasm at runtime. + install -Dm644 cli/launcher/zig-out/share/gossamer/cli.wasm \ + debian/gossamer/usr/share/gossamer/cli.wasm + # Public C header — goes to /usr/include/gossamer/ install -Dm644 generated/abi/gossamer.h \ debian/gossamer/usr/include/gossamer/gossamer.h diff --git a/packaging/rpm/gossamer.spec b/packaging/rpm/gossamer.spec index 47530ca..3777654 100644 --- a/packaging/rpm/gossamer.spec +++ b/packaging/rpm/gossamer.spec @@ -22,9 +22,16 @@ BuildRequires: webkit2gtk4-devel >= 2.40 BuildRequires: gtk3-devel >= 3.22 BuildRequires: just BuildRequires: pkg-config +# wasmtime C API >= v44.0.1 — packaged out-of-tree for now; install +# from https://github.com/bytecodealliance/wasmtime/releases under +# /usr/local before building (see cli/launcher/build.zig). +# ephapax — compiles cli/src/Main.eph → cli.wasm during the launcher +# build. Set EPHAPAX=/path/to/ephapax if not on PATH. Requires: webkit2gtk4 >= 2.40 Requires: gtk3 >= 3.22 +# wasmtime is dlopened by the launcher binary; same out-of-tree note +# applies — /usr/local/lib/libwasmtime.so must be present at runtime. %description Gossamer is a webview shell framework that uses linear types to guarantee @@ -55,8 +62,8 @@ building applications that embed the Gossamer webview shell framework. # Build the Zig FFI shared library in release mode. just build-ffi-release -# Build the Gossamer CLI in release mode. -just build-cli-release +# Build the wasmtime-host launcher + cli.wasm in release mode. +just build-launcher-release %install # Clear any stale install root. @@ -70,10 +77,16 @@ install -Dm755 src/interface/ffi/zig-out/lib/libgossamer.so \ install -Dm644 src/interface/ffi/zig-out/lib/libgossamer.a \ %{buildroot}%{_libdir}/libgossamer.a -# Install the CLI binary. -install -Dm755 cli/zig-out/bin/gossamer \ +# Install the launcher binary as `gossamer` (preserving the existing +# UX). The launcher discovers cli.wasm via the install-prefix-relative +# path /../share/gossamer/cli.wasm at runtime. +install -Dm755 cli/launcher/zig-out/bin/gossamer-launcher \ %{buildroot}%{_bindir}/gossamer +# Install the precompiled cli.wasm into the share/gossamer prefix. +install -Dm644 cli/launcher/zig-out/share/gossamer/cli.wasm \ + %{buildroot}%{_datadir}/gossamer/cli.wasm + # Install the public C header. install -Dm644 generated/abi/gossamer.h \ %{buildroot}%{_includedir}/gossamer/gossamer.h @@ -83,6 +96,7 @@ install -Dm644 generated/abi/gossamer.h \ %doc README.adoc %{_libdir}/libgossamer.so %{_bindir}/gossamer +%{_datadir}/gossamer/cli.wasm %files devel %{_libdir}/libgossamer.a