This repository was archived by the owner on Mar 7, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
123 lines (102 loc) · 3.12 KB
/
Makefile
File metadata and controls
123 lines (102 loc) · 3.12 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
# ArcBox Desktop Build Configuration
#
# Builds the macOS .app bundle with embedded daemon
CARGO := cargo
APP_NAME := ArcBox
BUNDLE_ID := com.arcbox.desktop
VERSION := 0.1.0
# Paths
BUILD_DIR := target/release
BUNDLE_DIR := target/bundle
APP_BUNDLE := $(BUNDLE_DIR)/$(APP_NAME).app
CONTENTS_DIR := $(APP_BUNDLE)/Contents
MACOS_DIR := $(CONTENTS_DIR)/MacOS
RESOURCES_DIR := $(CONTENTS_DIR)/Resources
# Binaries
DESKTOP_BIN := arcbox-desktop
DAEMON_BIN := arcbox
# Source paths (relative to this Makefile)
ARCBOX_DIR := ../arcbox
.PHONY: all clean build bundle run dev
# Default target
all: bundle
# Development build (debug)
dev:
$(CARGO) build
# Release build
build:
$(CARGO) build --release
cd $(ARCBOX_DIR) && $(CARGO) build --release -p arcbox-cli
# Create the .app bundle
bundle: build
@echo "Creating $(APP_NAME).app bundle..."
@mkdir -p $(MACOS_DIR)
@mkdir -p $(RESOURCES_DIR)
# Copy binaries
@cp $(BUILD_DIR)/$(DESKTOP_BIN) $(MACOS_DIR)/
@cp $(ARCBOX_DIR)/target/release/$(DAEMON_BIN) $(MACOS_DIR)/
# Copy Info.plist
@sed -e 's/$${BUNDLE_ID}/$(BUNDLE_ID)/g' \
-e 's/$${APP_NAME}/$(APP_NAME)/g' \
-e 's/$${VERSION}/$(VERSION)/g' \
-e 's/$${DESKTOP_BIN}/$(DESKTOP_BIN)/g' \
bundle/Info.plist.template > $(CONTENTS_DIR)/Info.plist
# Copy icon if exists
@if [ -f bundle/AppIcon.icns ]; then \
cp bundle/AppIcon.icns $(RESOURCES_DIR)/; \
fi
# Copy assets
@if [ -d assets ]; then \
cp -r assets $(RESOURCES_DIR)/; \
fi
@echo "Bundle created at $(APP_BUNDLE)"
# Run the app (development)
run: dev
$(CARGO) run
# Run the bundled app
run-bundle: bundle
open $(APP_BUNDLE)
# Clean build artifacts
clean:
$(CARGO) clean
rm -rf $(BUNDLE_DIR)
# Install to /Applications (requires sudo for system-wide)
install: bundle
@echo "Installing $(APP_NAME).app to ~/Applications..."
@mkdir -p ~/Applications
@rm -rf ~/Applications/$(APP_NAME).app
@cp -r $(APP_BUNDLE) ~/Applications/
@echo "Installed to ~/Applications/$(APP_NAME).app"
# Create DMG for distribution
dmg: bundle
@echo "Creating DMG..."
@mkdir -p $(BUNDLE_DIR)/dmg
@cp -r $(APP_BUNDLE) $(BUNDLE_DIR)/dmg/
@ln -sf /Applications $(BUNDLE_DIR)/dmg/Applications
@hdiutil create -volname "$(APP_NAME)" \
-srcfolder $(BUNDLE_DIR)/dmg \
-ov -format UDZO \
$(BUNDLE_DIR)/$(APP_NAME)-$(VERSION).dmg
@rm -rf $(BUNDLE_DIR)/dmg
@echo "DMG created at $(BUNDLE_DIR)/$(APP_NAME)-$(VERSION).dmg"
# Code sign (requires valid identity)
codesign: bundle
@echo "Code signing $(APP_NAME).app..."
@codesign --force --deep --sign - $(APP_BUNDLE)
@echo "Code signed (ad-hoc)"
# Show help
help:
@echo "ArcBox Desktop Build System"
@echo ""
@echo "Targets:"
@echo " all - Build the .app bundle (default)"
@echo " dev - Development build (debug)"
@echo " build - Release build"
@echo " bundle - Create .app bundle"
@echo " run - Run development build"
@echo " run-bundle - Run bundled app"
@echo " clean - Clean build artifacts"
@echo " install - Install to ~/Applications"
@echo " dmg - Create DMG for distribution"
@echo " codesign - Code sign the bundle (ad-hoc)"
@echo " help - Show this help"