Files
sleepy bbcf0c74bb Initial iOS port - Complete source code and build system
- 19 Swift source files (~4900 lines)
- Complete UI with SwiftUI (MainView, SettingsView, MessageBubble, InputBar)
- Inference layer (LlmEngine, Agent, ToolCalling, ConversationContext)
- Services (Audio, TTS, WebSearch, ModelDownload, Storage)
- Build system: Makefile, Package.swift, Podfile
- Documentation: BUILD.md, plan.md, PROJECT_STATUS.md
- Ready for Xcode build - just need LiteRT dependency added
2026-04-06 14:26:08 +02:00

180 lines
4.9 KiB
Makefile

# Sleepy Agent iOS Build Makefile
# Requires: Xcode 15+, iOS 15.0+ SDK
# Configuration
APP_NAME = SleepyAgent
BUNDLE_ID = com.sleepy.agent
SCHEME = SleepyAgent
WORKSPACE = $(APP_NAME).xcworkspace
PROJECT = $(APP_NAME).xcodeproj
# Build directories
BUILD_DIR = build
DERIVED_DATA = $(BUILD_DIR)/DerivedData
ARCHIVE_PATH = $(BUILD_DIR)/SleepyAgent.xcarchive
IPA_PATH = $(BUILD_DIR)/SleepyAgent.ipa
# Default: Show help
.PHONY: help
help:
@echo "Sleepy Agent iOS Build System"
@echo ""
@echo "Available targets:"
@echo " setup - Install dependencies (CocoaPods)"
@echo " project - Generate Xcode project"
@echo " build - Build debug version"
@echo " build-release - Build release version"
@echo " archive - Create archive for distribution"
@echo " ipa - Create .ipa file (requires signing)"
@echo " install - Install to connected device"
@echo " clean - Clean build artifacts"
@echo " all - Setup + build"
@echo ""
@echo "Prerequisites:"
@echo " - Xcode 15+ installed"
@echo " - iOS 15.0+ SDK"
@echo " - CocoaPods installed: sudo gem install cocoapods"
@echo " - Valid signing certificate for device/Archive builds"
# Setup dependencies
.PHONY: setup
setup:
@echo "Installing CocoaPods dependencies..."
pod install
# Generate project (if using a project generator)
.PHONY: project
project:
@echo "Opening project in Xcode..."
@echo "Note: If $(WORKSPACE) doesn't exist, run 'make setup' first"
@if [ -f "$(WORKSPACE)" ]; then \
open "$(WORKSPACE)"; \
else \
open "$(PROJECT)"; \
fi
# Build debug for simulator
.PHONY: build
build:
@echo "Building Sleepy Agent (Debug)..."
xcodebuild \
-workspace "$(WORKSPACE)" \
-scheme "$(SCHEME)" \
-configuration Debug \
-sdk iphonesimulator \
-derivedDataPath "$(DERIVED_DATA)" \
build
# Build release
.PHONY: build-release
build-release:
@echo "Building Sleepy Agent (Release)..."
xcodebuild \
-workspace "$(WORKSPACE)" \
-scheme "$(SCHEME)" \
-configuration Release \
-sdk iphoneos \
-derivedDataPath "$(DERIVED_DATA)" \
build
# Create archive
.PHONY: archive
archive:
@echo "Creating archive..."
@mkdir -p $(BUILD_DIR)
xcodebuild \
-workspace "$(WORKSPACE)" \
-scheme "$(SCHEME)" \
-configuration Release \
-sdk iphoneos \
-archivePath "$(ARCHIVE_PATH)" \
archive
@echo "Archive created at: $(ARCHIVE_PATH)"
# Create IPA (requires proper signing)
.PHONY: ipa
ipa: archive
@echo "Creating IPA..."
@echo "NOTE: This requires a valid signing identity and provisioning profile"
@echo "For developer-only builds, use 'make archive' and install via Xcode"
# Method 1: Using xcodebuild -exportArchive
xcodebuild -exportArchive \
-archivePath "$(ARCHIVE_PATH)" \
-exportPath "$(BUILD_DIR)/Export" \
-exportOptionsPlist exportOptions.plist \
|| echo "Export failed. Check your signing configuration."
@echo ""
@echo "IPA export attempted. Check $(BUILD_DIR)/Export/"
# Install to connected device (requires device to be connected and trusted)
.PHONY: install
install:
@echo "Installing to connected device..."
@if [ -z "$$(xcrun devicectl list devices 2>/dev/null | grep -i 'iPhone\|iPad')" ]; then \
echo "ERROR: No device detected. Connect your iPhone/iPad and trust this computer."; \
exit 1; \
fi
xcodebuild \
-workspace "$(WORKSPACE)" \
-scheme "$(SCHEME)" \
-configuration Debug \
-destination 'generic/platform=iOS' \
-derivedDataPath "$(DERIVED_DATA)" \
build
@echo "App built. Use Xcode to install to device, or use:"
@echo " xcrun devicectl device install app --device <device-id> <path-to-app>"
# Clean build artifacts
.PHONY: clean
clean:
@echo "Cleaning build artifacts..."
rm -rf $(BUILD_DIR)
xcodebuild clean -workspace "$(WORKSPACE)" -scheme "$(SCHEME)" 2>/dev/null || true
# Full clean including Pods
.PHONY: clean-all
clean-all: clean
@echo "Removing Pods directory..."
rm -rf Pods
rm -rf "$(WORKSPACE)"
rm -rf "$(PROJECT)/xcuserdata"
rm -rf "$(PROJECT)/project.xcworkspace"
# Everything
.PHONY: all
all: setup build
@echo "Build complete!"
# Check environment
.PHONY: check
check:
@echo "Checking build environment..."
@echo ""
@echo "Xcode version:"
xcodebuild -version 2>/dev/null || echo "ERROR: Xcode not found"
@echo ""
@echo "Swift version:"
swift --version 2>/dev/null || echo "ERROR: Swift not found"
@echo ""
@echo "CocoaPods version:"
pod --version 2>/dev/null || echo "WARNING: CocoaPods not installed"
@echo ""
@echo "Available iOS SDKs:"
xcodebuild -showsdks 2>/dev/null | grep ios || echo "ERROR: No iOS SDK found"
@echo ""
@echo "Connected devices:"
xcrun devicectl list devices 2>/dev/null | head -20 || echo "No devices or devicectl not available"
# Debug: Show build settings
.PHONY: settings
settings:
xcodebuild \
-workspace "$(WORKSPACE)" \
-scheme "$(SCHEME)" \
-configuration Debug \
-showBuildSettings | grep -E 'PRODUCT_BUNDLE_IDENTIFIER|CODE_SIGN|ARCH|SUPPORTED_PLATFORMS|SWIFT_VERSION'