fix(build): clean sidecar dir each build; native-focused install/reinstall

The stale bin/spaceshd-universal-apple-darwin sidecar (left over from an
earlier approach) poisoned the universal bundle — tauri shipped that old
daemon instead of the freshly built one, so the packaged daemon lacked the
TERM fix. dmg/dmg-native now wipe the sidecar dir first. install copies the
native bundle (was preferring the universal one, which could be stale) and
kills the running daemon; reinstall = native rebuild + install for fast
self-updates. Universal stays for distribution via dmg / install-universal.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-15 12:34:57 +07:00
parent 79b47d42e7
commit 8f431eaa40
+12 -6
View File
@@ -42,7 +42,7 @@ dmg: targets ## build the universal (Intel + Apple Silicon) .dmg — UNSIGNED
# ships spaceshd inside spacesh.app/Contents/MacOS (else the GUI is offline). # ships spaceshd inside spacesh.app/Contents/MacOS (else the GUI is offline).
cargo build --release -p spaceshd --target aarch64-apple-darwin cargo build --release -p spaceshd --target aarch64-apple-darwin
cargo build --release -p spaceshd --target x86_64-apple-darwin cargo build --release -p spaceshd --target x86_64-apple-darwin
mkdir -p $(SIDECAR_DIR) rm -rf $(SIDECAR_DIR) && mkdir -p $(SIDECAR_DIR) # avoid stale sidecars poisoning the bundle
cp target/aarch64-apple-darwin/release/spaceshd $(SIDECAR_DIR)/spaceshd-aarch64-apple-darwin cp target/aarch64-apple-darwin/release/spaceshd $(SIDECAR_DIR)/spaceshd-aarch64-apple-darwin
cp target/x86_64-apple-darwin/release/spaceshd $(SIDECAR_DIR)/spaceshd-x86_64-apple-darwin cp target/x86_64-apple-darwin/release/spaceshd $(SIDECAR_DIR)/spaceshd-x86_64-apple-darwin
cd $(APP_DIR) && npm run tauri build -- --target $(TAURI_TARGET) --config $(BUNDLE_CONFIG) cd $(APP_DIR) && npm run tauri build -- --target $(TAURI_TARGET) --config $(BUNDLE_CONFIG)
@@ -51,7 +51,7 @@ dmg: targets ## build the universal (Intel + Apple Silicon) .dmg — UNSIGNED
.PHONY: dmg-native .PHONY: dmg-native
dmg-native: ## build a .dmg for the current arch only (faster) dmg-native: ## build a .dmg for the current arch only (faster)
cargo build --release -p spaceshd cargo build --release -p spaceshd
mkdir -p $(SIDECAR_DIR) rm -rf $(SIDECAR_DIR) && mkdir -p $(SIDECAR_DIR) # avoid stale sidecars poisoning the bundle
cp target/release/spaceshd $(SIDECAR_DIR)/spaceshd-$(NATIVE_TRIPLE) cp target/release/spaceshd $(SIDECAR_DIR)/spaceshd-$(NATIVE_TRIPLE)
cd $(APP_DIR) && npm run tauri build -- --config $(BUNDLE_CONFIG) cd $(APP_DIR) && npm run tauri build -- --config $(BUNDLE_CONFIG)
@ls -lh $(NATIVE_DMG_DIR)/*.dmg @ls -lh $(NATIVE_DMG_DIR)/*.dmg
@@ -70,14 +70,20 @@ kill-daemon: ## stop a running spaceshd so a freshly-built one takes over
-rm -f $$HOME/.spacesh/sock -rm -f $$HOME/.spacesh/sock
.PHONY: install .PHONY: install
install: kill-daemon ## copy the built .app to /Applications, restart daemon, clear quarantine install: kill-daemon ## install the native .app to /Applications, restart daemon, clear quarantine
rm -rf /Applications/spacesh.app rm -rf /Applications/spacesh.app
cp -R "$(APP_BUNDLE)" /Applications/ 2>/dev/null || cp -R "$(NATIVE_APP_BUNDLE)" /Applications/ cp -R "$(NATIVE_APP_BUNDLE)" /Applications/
xattr -dr com.apple.quarantine /Applications/spacesh.app
@echo "Installed (native). Quit & relaunch spacesh; the bundled daemon restarts."
.PHONY: install-universal
install-universal: kill-daemon ## install the universal .app to /Applications
rm -rf /Applications/spacesh.app
cp -R "$(APP_BUNDLE)" /Applications/
xattr -dr com.apple.quarantine /Applications/spacesh.app xattr -dr com.apple.quarantine /Applications/spacesh.app
@echo "Installed. The bundled daemon (with the latest code) starts on next launch."
.PHONY: reinstall .PHONY: reinstall
reinstall: dmg install ## universal rebuild + reinstall + restart daemon (one shot) reinstall: dmg-native install ## native rebuild + reinstall + restart daemon (fast self-update)
# ---- Tests ---- # ---- Tests ----