From a7272fc92e716e1b62a0d63f817760d72c114666 Mon Sep 17 00:00:00 2001 From: Vassiliy Yegorov Date: Mon, 15 Jun 2026 11:39:03 +0700 Subject: [PATCH] fix(bundle): ship spaceshd inside the .app (packaged GUI was offline) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit tauri build bundled only the GUI binary, so the packaged app had no daemon: find_daemon() looks for a sibling `spaceshd` next to the GUI (Contents/MacOS/spaceshd) and ensure_daemon failed to spawn it → "offline". (Dev worked only because find_daemon falls back to the repo-root target path.) - tauri.bundle.conf.json: a build-only overlay adding bundle.externalBin ["bin/spaceshd"], kept out of tauri.conf.json so `tauri dev` doesn't require a sidecar file. - Makefile: `make dmg` now builds spaceshd for both arches, lipo's a universal sidecar into src-tauri/bin/spaceshd-universal-apple-darwin, and passes --config so it lands in Contents/MacOS/spaceshd. `make dmg-native` does the host-arch equivalent. - .gitignore: ignore the generated app/src-tauri/bin/. After install, the unsigned helper runs once quarantine is cleared recursively: xattr -dr com.apple.quarantine /Applications/spacesh.app Co-Authored-By: Claude Opus 4.8 (1M context) --- .gitignore | 3 +++ Makefile | 18 ++++++++++++++++-- app/src-tauri/tauri.bundle.conf.json | 6 ++++++ 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 app/src-tauri/tauri.bundle.conf.json diff --git a/.gitignore b/.gitignore index d50af48..2fa1b0b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,6 @@ node_modules/ app/dist/ .DS_Store + +# Generated daemon sidecar for DMG bundling (make dmg) +app/src-tauri/bin/ diff --git a/Makefile b/Makefile index efac077..63d5017 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,9 @@ APP_DIR := app TAURI_TARGET := universal-apple-darwin DMG_DIR := $(APP_DIR)/src-tauri/target/$(TAURI_TARGET)/release/bundle/dmg NATIVE_DMG_DIR := $(APP_DIR)/src-tauri/target/release/bundle/dmg +NATIVE_TRIPLE := $(shell rustc -vV 2>/dev/null | awk '/^host:/{print $$2}') +SIDECAR_DIR := $(APP_DIR)/src-tauri/bin +BUNDLE_CONFIG := src-tauri/tauri.bundle.conf.json APP_VERSION := $(shell node -p "require('./$(APP_DIR)/src-tauri/tauri.conf.json').version" 2>/dev/null || echo 0.0.0) LANDING_IMAGE := spacesh-landing @@ -32,12 +35,23 @@ targets: ## add rust targets for the universal build .PHONY: dmg dmg: targets ## build the universal (Intel + Apple Silicon) .dmg — UNSIGNED - cd $(APP_DIR) && npm run tauri build -- --target $(TAURI_TARGET) + # Build the daemon for both arches and lipo into a universal sidecar so it + # ships inside spacesh.app/Contents/MacOS/spaceshd (else the GUI is offline). + cargo build --release -p spaceshd --target aarch64-apple-darwin + cargo build --release -p spaceshd --target x86_64-apple-darwin + mkdir -p $(SIDECAR_DIR) + lipo -create -output $(SIDECAR_DIR)/spaceshd-universal-apple-darwin \ + target/aarch64-apple-darwin/release/spaceshd \ + target/x86_64-apple-darwin/release/spaceshd + cd $(APP_DIR) && npm run tauri build -- --target $(TAURI_TARGET) --config $(BUNDLE_CONFIG) @echo "→ $(DMG_DIR)" && ls -lh $(DMG_DIR)/*.dmg .PHONY: dmg-native dmg-native: ## build a .dmg for the current arch only (faster) - cd $(APP_DIR) && npm run tauri build + cargo build --release -p spaceshd + mkdir -p $(SIDECAR_DIR) + cp target/release/spaceshd $(SIDECAR_DIR)/spaceshd-$(NATIVE_TRIPLE) + cd $(APP_DIR) && npm run tauri build -- --config $(BUNDLE_CONFIG) @ls -lh $(NATIVE_DMG_DIR)/*.dmg .PHONY: dev diff --git a/app/src-tauri/tauri.bundle.conf.json b/app/src-tauri/tauri.bundle.conf.json new file mode 100644 index 0000000..6b9b9b0 --- /dev/null +++ b/app/src-tauri/tauri.bundle.conf.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://schema.tauri.app/config/2", + "bundle": { + "externalBin": ["bin/spaceshd"] + } +}