#!/bin/bash # Build macOS .app bundle for PicoClaw Launcher set -e EXECUTABLE=$1 if [ -z "$EXECUTABLE" ]; then echo "Usage: $0 " exit 1 fi LAUNCHER_EXECUTABLE="picoclaw-launcher-${EXECUTABLE}" EXECUTABLE="picoclaw-${EXECUTABLE}" echo "executable: $EXECUTABLE" APP_NAME="PicoClaw Launcher" APP_PATH="./build/${APP_NAME}.app" APP_CONTENTS="${APP_PATH}/Contents" APP_MACOS="${APP_CONTENTS}/MacOS" APP_RESOURCES="${APP_CONTENTS}/Resources" APP_EXECUTABLE="picoclaw-launcher" ICON_SOURCE="./scripts/icon.icns" # Clean up existing .app if [ -d "$APP_PATH" ]; then echo "Removing existing ${APP_PATH}" rm -rf "$APP_PATH" fi # Create directory structure echo "Creating .app bundle structure..." mkdir -p "$APP_MACOS" mkdir -p "$APP_RESOURCES" # Copy executable echo "Copying executable..." if [ -f "./build/${LAUNCHER_EXECUTABLE}" ]; then cp "./build/${LAUNCHER_EXECUTABLE}" "${APP_MACOS}/${APP_EXECUTABLE}" else echo "Error: ./build/${LAUNCHER_EXECUTABLE} not found. Please build the web backend first." echo "Run: make build-launcher" exit 1 fi if [ -f "./build/${EXECUTABLE}" ]; then cp "./build/${EXECUTABLE}" "${APP_MACOS}/picoclaw" else echo "Error: ./build/${EXECUTABLE} not found. Please build the main file first." echo "Run: make build" exit 1 fi chmod +x "${APP_MACOS}/"* # Create Info.plist echo "Creating Info.plist..." cat > "${APP_CONTENTS}/Info.plist" << 'EOF' CFBundleExecutable picoclaw-launcher CFBundleIdentifier com.picoclaw.launcher CFBundleName PicoClaw Launcher CFBundleDisplayName PicoClaw Launcher CFBundleIconFile icon.icns CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleVersion 1 NSHighResolutionCapable NSSupportsAutomaticGraphicsSwitching LSUIElement LSMinimumSystemVersion 10.11 EOF #sips -z 128 128 "$ICON_SOURCE" --out "${ICONSET_PATH}/icon_128x128.png" > /dev/null 2>&1 # ## Create icns file #iconutil -c icns "$ICONSET_PATH" -o "$ICON_OUTPUT" 2>/dev/null || { # echo "Warning: iconutil failed" #} cp $ICON_SOURCE "${APP_RESOURCES}/icon.icns" echo "" echo "==========================================" echo "Successfully created: ${APP_PATH}" echo "==========================================" echo "" echo "To launch PicoClaw:" echo " 1. Double-click ${APP_NAME}.app in Finder" echo " 2. Or use: open ${APP_PATH}" echo "" echo "Note: The app will run in the menu bar (systray) without a terminal window." echo ""