-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMakefile
More file actions
150 lines (121 loc) · 5.18 KB
/
Makefile
File metadata and controls
150 lines (121 loc) · 5.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# ArcBox Development Makefile
PROFILE ?= debug
ENTITLEMENTS := bundle/arcbox.entitlements
AGENT_TARGET := aarch64-unknown-linux-musl
# Signing identity: auto-detect "Developer ID Application: ArcBox, Inc."
# from keychain. Override with: make sign SIGN_IDENTITY="..."
# Use SIGN_IDENTITY=- for ad-hoc signing (won't work with Virtualization.framework
# on recent macOS).
SIGN_IDENTITY ?= $(shell security find-identity -v -p codesigning 2>/dev/null \
| grep -o '"Developer ID Application: ArcBox, Inc\.[^"]*"' \
| head -1 | tr -d '"')
BINARIES := arcbox-daemon arcbox-helper abctl
ifeq ($(PROFILE),release)
CARGO_FLAGS := --release
TARGET_DIR := target/release
else
CARGO_FLAGS :=
TARGET_DIR := target/debug
endif
.PHONY: build build-release build-cli build-daemon build-helper build-agent \
test check fmt clean \
setup-boot-assets sign sign-daemon sign-all verify run-daemon \
run-helper install-helper reload-helper
## ── Build ──────────────────────────────────────────────
build:
cargo build $(CARGO_FLAGS)
build-release:
$(MAKE) build PROFILE=release
build-cli:
cargo build -p arcbox-cli $(CARGO_FLAGS)
build-daemon:
cargo build -p arcbox-daemon $(CARGO_FLAGS)
build-helper:
cargo build -p arcbox-helper $(CARGO_FLAGS)
build-agent:
cargo build -p arcbox-agent --target $(AGENT_TARGET) --release
## ── Quality ────────────────────────────────────────────
check:
cargo clippy --workspace --all-targets -- -D warnings
cargo fmt --check
fmt:
cargo fmt
test:
cargo test --workspace
## ── Code Signing ─────────────────────────────────────
sign-daemon: build-daemon
@if [ -z "$(SIGN_IDENTITY)" ]; then \
echo "ERROR: No Developer ID signing identity found." >&2; \
echo " Install the ArcBox Developer ID certificate or set SIGN_IDENTITY:" >&2; \
echo " make sign-daemon SIGN_IDENTITY=\"Developer ID Application: ...\"" >&2; \
exit 1; \
fi
codesign --force --options runtime \
--identifier com.arcboxlabs.desktop.daemon \
--entitlements $(ENTITLEMENTS) \
--sign "$(SIGN_IDENTITY)" \
$(TARGET_DIR)/arcbox-daemon
@codesign -v --deep --strict $(TARGET_DIR)/arcbox-daemon && echo "✓ arcbox-daemon signed"
sign-all: build
@if [ -z "$(SIGN_IDENTITY)" ]; then \
echo "ERROR: No Developer ID signing identity found." >&2; \
exit 1; \
fi
codesign --force --options runtime \
--identifier com.arcboxlabs.desktop.daemon \
--entitlements $(ENTITLEMENTS) \
--sign "$(SIGN_IDENTITY)" \
$(TARGET_DIR)/arcbox-daemon
codesign --force --options runtime \
--identifier com.arcboxlabs.desktop.helper \
--sign "$(SIGN_IDENTITY)" \
$(TARGET_DIR)/arcbox-helper
codesign --force --options runtime \
--identifier com.arcboxlabs.desktop.cli \
--sign "$(SIGN_IDENTITY)" \
$(TARGET_DIR)/abctl
@for bin in $(BINARIES); do \
codesign -v --deep --strict $(TARGET_DIR)/$$bin && echo "✓ $$bin signed"; \
done
# Legacy ad-hoc sign (kept for CI smoke tests where no Developer ID exists).
sign:
codesign --force --options runtime \
--entitlements $(ENTITLEMENTS) \
-s - $(TARGET_DIR)/arcbox-daemon
verify:
@for bin in $(BINARIES); do \
if [ -f $(TARGET_DIR)/$$bin ]; then \
echo "--- $$bin ---"; \
codesign -d -v --entitlements :- $(TARGET_DIR)/$$bin 2>&1 | head -5; \
echo; \
fi; \
done
## ── Dev Workflow ───────────────────────────────────────
setup-boot-assets:
./scripts/setup-dev-boot-assets.sh
run-daemon: sign-daemon
SIGN=0 ./scripts/rebuild-run-daemon.sh
# Run the helper in manual mode (no launchd). Uses /tmp socket by default
# so the daemon can connect without launchd registration.
# Usage:
# make run-helper # default socket /tmp/arcbox-helper.sock
# make run-helper HELPER_SOCKET=/var/run/arcbox-helper.sock
HELPER_SOCKET ?= /tmp/arcbox-helper.sock
run-helper: build-helper
sudo ARCBOX_HELPER_SOCKET=$(HELPER_SOCKET) $(TARGET_DIR)/arcbox-helper
# Install the helper into launchd (production-like). Requires sudo.
install-helper: build-helper
sudo install -o root -g wheel -m 755 $(TARGET_DIR)/arcbox-helper /usr/local/libexec/arcbox-helper
sudo cp bundle/com.arcboxlabs.desktop.helper.plist /Library/LaunchDaemons/
-sudo launchctl bootout system/com.arcboxlabs.desktop.helper 2>/dev/null
sudo launchctl bootstrap system /Library/LaunchDaemons/com.arcboxlabs.desktop.helper.plist
@echo "✓ arcbox-helper installed and registered with launchd"
# Rebuild and hot-reload the helper in launchd (bootout → copy → bootstrap).
reload-helper: build-helper
-sudo launchctl bootout system/com.arcboxlabs.desktop.helper 2>/dev/null
sudo cp $(TARGET_DIR)/arcbox-helper /usr/local/libexec/arcbox-helper
sudo launchctl bootstrap system /Library/LaunchDaemons/com.arcboxlabs.desktop.helper.plist
@echo "✓ arcbox-helper reloaded"
## ── Cleanup ───────────────────────────────────────────
clean:
cargo clean