|
| 1 | +# Makefile for Claudia - Homebrew distribution |
| 2 | + |
| 3 | +# Variables |
| 4 | +VERSION := $(shell grep '^version' src-tauri/Cargo.toml | head -1 | cut -d'"' -f2) |
| 5 | +DIST_NAME := Claudia-$(VERSION)-darwin |
| 6 | +BUILD_DIR := src-tauri/target/universal-apple-darwin/release/bundle |
| 7 | + |
| 8 | +# Phony targets |
| 9 | +.PHONY: all clean build release cask test sign notarize help deps |
| 10 | + |
| 11 | +# Default target |
| 12 | +all: build |
| 13 | + |
| 14 | +# Help target |
| 15 | +help: |
| 16 | + @echo "Claudia Homebrew Build System" |
| 17 | + @echo "==============================" |
| 18 | + @echo "Available targets:" |
| 19 | + @echo " make build - Build the application for macOS (creates DMG)" |
| 20 | + @echo " make release - Create a release DMG for Homebrew" |
| 21 | + @echo " make cask - Update the Homebrew cask with latest SHA" |
| 22 | + @echo " make test - Test the Homebrew cask locally" |
| 23 | + @echo " make sign - Sign the application (requires Developer ID)" |
| 24 | + @echo " make notarize - Notarize the application (requires Apple account)" |
| 25 | + @echo " make clean - Clean build artifacts" |
| 26 | + @echo " make help - Show this help message" |
| 27 | + |
| 28 | +# Clean build artifacts |
| 29 | +clean: |
| 30 | + @echo "Cleaning build artifacts..." |
| 31 | + rm -rf dist |
| 32 | + rm -rf src-tauri/target/release/bundle |
| 33 | + rm -rf src-tauri/target/universal-apple-darwin/release/bundle |
| 34 | + rm -f *.dmg |
| 35 | + |
| 36 | +# Install dependencies |
| 37 | +deps: |
| 38 | + @echo "Installing dependencies..." |
| 39 | + bun install |
| 40 | + cd src-tauri && cargo fetch |
| 41 | + |
| 42 | +# Build the application |
| 43 | +build: deps |
| 44 | + @echo "Building Claudia v$(VERSION)..." |
| 45 | + @echo "Note: Use './sign.sh' to build a universal binary with proper signing" |
| 46 | + @echo "Building for current architecture only..." |
| 47 | + bun run build |
| 48 | + cd src-tauri && cargo tauri build |
| 49 | + |
| 50 | +# Create release DMG |
| 51 | +release: build |
| 52 | + @echo "Creating release DMG..." |
| 53 | + @if [ -f "$(BUILD_DIR)/dmg/Claudia.dmg" ]; then \ |
| 54 | + cp "$(BUILD_DIR)/dmg/Claudia.dmg" "Claudia-$(VERSION).dmg"; \ |
| 55 | + echo "DMG created: Claudia-$(VERSION).dmg"; \ |
| 56 | + echo "SHA256: $$(shasum -a 256 Claudia-$(VERSION).dmg | awk '{print $$1}')"; \ |
| 57 | + else \ |
| 58 | + echo "Error: DMG not found. Make sure 'dmg' is in your tauri.conf.json targets."; \ |
| 59 | + exit 1; \ |
| 60 | + fi |
| 61 | + |
| 62 | +# Update cask with current SHA |
| 63 | +cask: release |
| 64 | + $(eval SHA256 := $(shell shasum -a 256 Claudia-$(VERSION).dmg | awk '{print $$1}')) |
| 65 | + @echo "Updating cask with SHA256: $(SHA256)" |
| 66 | + @sed -i '' "s/sha256 \".*\"/sha256 \"$(SHA256)\"/" Casks/claudia.rb |
| 67 | + @sed -i '' "s/version \".*\"/version \"$(VERSION)\"/" Casks/claudia.rb |
| 68 | + @echo "Cask updated!" |
| 69 | + |
| 70 | +# Test the cask locally |
| 71 | +test: |
| 72 | + @echo "Testing Homebrew cask..." |
| 73 | + export HOMEBREW_NO_AUTO_UPDATE=1 && \ |
| 74 | + export HOMEBREW_NO_INSTALL_FROM_API=1 && \ |
| 75 | + brew install --cask Casks/claudia.rb |
| 76 | + brew audit --new --cask claudia |
| 77 | + brew style --fix Casks/claudia.rb |
| 78 | + |
| 79 | +# Sign the application (requires Apple Developer certificate) |
| 80 | +sign: |
| 81 | + @echo "Signing application..." |
| 82 | + @echo "Note: This requires a valid Apple Developer ID certificate" |
| 83 | + codesign --deep --force --verify --verbose --sign "Developer ID Application: YOUR NAME (TEAM_ID)" \ |
| 84 | + --options runtime \ |
| 85 | + --entitlements src-tauri/entitlements.plist \ |
| 86 | + $(BUILD_DIR)/macos/Claudia.app |
| 87 | + |
| 88 | +# Notarize the application (requires Apple Developer account) |
| 89 | +notarize: sign |
| 90 | + @echo "Notarizing application..." |
| 91 | + @echo "Creating ZIP for notarization..." |
| 92 | + cd $(BUILD_DIR)/macos && zip -r Claudia.zip Claudia.app |
| 93 | + xcrun notarytool submit $(BUILD_DIR)/macos/Claudia.zip \ |
| 94 | + --apple-id "YOUR_APPLE_ID" \ |
| 95 | + --team-id "YOUR_TEAM_ID" \ |
| 96 | + --password "YOUR_APP_PASSWORD" \ |
| 97 | + --wait |
| 98 | + xcrun stapler staple $(BUILD_DIR)/macos/Claudia.app |
0 commit comments