|
| 1 | +#!/bin/bash |
| 2 | +# Build Trinity.app for macOS |
| 3 | +# Requires: zig 0.15.x, macOS 11+ |
| 4 | +# Usage: ./scripts/build_macos_app.sh [output_dir] |
| 5 | +# |
| 6 | +# Creates: |
| 7 | +# Trinity.app — macOS application bundle (9.3 MB) |
| 8 | +# Trinity-v2.1.0.dmg — distributable disk image (3.1 MB) |
| 9 | + |
| 10 | +set -e |
| 11 | + |
| 12 | +VERSION="2.1.0" |
| 13 | +BUILD_NUMBER="56" |
| 14 | +OUTPUT_DIR="${1:-$HOME/Desktop}" |
| 15 | +APP_DIR="$OUTPUT_DIR/Trinity.app" |
| 16 | +CONTENTS="$APP_DIR/Contents" |
| 17 | +MACOS_DIR="$CONTENTS/MacOS" |
| 18 | +RESOURCES="$CONTENTS/Resources" |
| 19 | +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" |
| 20 | +PROJECT_DIR="$SCRIPT_DIR/.." |
| 21 | + |
| 22 | +echo "Building Trinity.app v$VERSION..." |
| 23 | + |
| 24 | +# Step 1: Build binaries |
| 25 | +echo " [1/4] Building Zig binaries..." |
| 26 | +cd "$PROJECT_DIR" |
| 27 | +zig build |
| 28 | + |
| 29 | +# Step 2: Create bundle structure |
| 30 | +echo " [2/4] Creating app bundle..." |
| 31 | +rm -rf "$APP_DIR" |
| 32 | +mkdir -p "$MACOS_DIR" "$RESOURCES" |
| 33 | + |
| 34 | +# Copy binaries |
| 35 | +cp zig-out/bin/fluent "$RESOURCES/fluent" |
| 36 | +cp zig-out/bin/tri "$RESOURCES/tri" |
| 37 | +cp zig-out/bin/vibee "$RESOURCES/vibee" |
| 38 | +cp zig-out/bin/firebird "$RESOURCES/firebird" |
| 39 | +chmod +x "$RESOURCES"/* |
| 40 | + |
| 41 | +# Create launcher |
| 42 | +cat > "$MACOS_DIR/Trinity" << 'LAUNCHER' |
| 43 | +#!/bin/bash |
| 44 | +DIR="$(cd "$(dirname "$0")" && pwd)" |
| 45 | +RESOURCES="$DIR/../Resources" |
| 46 | +BINARY="$RESOURCES/fluent" |
| 47 | +
|
| 48 | +osascript <<APPLESCRIPT |
| 49 | +tell application "Terminal" |
| 50 | + activate |
| 51 | + set bannerCmd to "clear; printf '\\n'; printf ' ═══════════════════════════════════════════════════════════\\n'; printf ' ║ TRINITY AI v2.1.0 — Local Autonomous Multi-Modal Agent ║\\n'; printf ' ║ 56 IMMORTAL Cycles | phi^2 + 1/phi^2 = 3 ║\\n'; printf ' ║ Chat + Code + Vision + Voice + Tools + Self-Reflection ║\\n'; printf ' ═══════════════════════════════════════════════════════════\\n'; printf '\\n'; printf ' Binaries: fluent | tri | vibee | firebird\\n'; printf ' Run: tri --help for full command list\\n'; printf '\\n'" |
| 52 | + do script bannerCmd & "; export PATH=\"$RESOURCES:\$PATH\"; \"$BINARY\"" in front window |
| 53 | +end tell |
| 54 | +APPLESCRIPT |
| 55 | +LAUNCHER |
| 56 | +chmod +x "$MACOS_DIR/Trinity" |
| 57 | + |
| 58 | +# Create Info.plist |
| 59 | +cat > "$CONTENTS/Info.plist" << PLIST |
| 60 | +<?xml version="1.0" encoding="UTF-8"?> |
| 61 | +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 62 | +<plist version="1.0"> |
| 63 | +<dict> |
| 64 | + <key>CFBundleDevelopmentRegion</key> |
| 65 | + <string>en</string> |
| 66 | + <key>CFBundleExecutable</key> |
| 67 | + <string>Trinity</string> |
| 68 | + <key>CFBundleIdentifier</key> |
| 69 | + <string>com.trinity.igla</string> |
| 70 | + <key>CFBundleInfoDictionaryVersion</key> |
| 71 | + <string>6.0</string> |
| 72 | + <key>CFBundleName</key> |
| 73 | + <string>Trinity</string> |
| 74 | + <key>CFBundleDisplayName</key> |
| 75 | + <string>Trinity AI</string> |
| 76 | + <key>CFBundlePackageType</key> |
| 77 | + <string>APPL</string> |
| 78 | + <key>CFBundleShortVersionString</key> |
| 79 | + <string>$VERSION</string> |
| 80 | + <key>CFBundleVersion</key> |
| 81 | + <string>$BUILD_NUMBER</string> |
| 82 | + <key>LSMinimumSystemVersion</key> |
| 83 | + <string>11.0</string> |
| 84 | + <key>LSApplicationCategoryType</key> |
| 85 | + <string>public.app-category.developer-tools</string> |
| 86 | + <key>NSHighResolutionCapable</key> |
| 87 | + <true/> |
| 88 | + <key>NSHumanReadableCopyright</key> |
| 89 | + <string>Trinity v$VERSION — Unified Autonomous System. $BUILD_NUMBER IMMORTAL Cycles.</string> |
| 90 | +</dict> |
| 91 | +</plist> |
| 92 | +PLIST |
| 93 | + |
| 94 | +# Step 3: Create DMG |
| 95 | +echo " [3/4] Creating DMG..." |
| 96 | +DMG_PATH="$OUTPUT_DIR/Trinity-v$VERSION.dmg" |
| 97 | +rm -f "$DMG_PATH" |
| 98 | +hdiutil create -volname "Trinity AI v$VERSION" -srcfolder "$APP_DIR" -ov -format UDZO "$DMG_PATH" 2>/dev/null |
| 99 | + |
| 100 | +# Step 4: Verify |
| 101 | +echo " [4/4] Verifying..." |
| 102 | +plutil -lint "$CONTENTS/Info.plist" > /dev/null |
| 103 | +APP_SIZE=$(du -sh "$APP_DIR" | cut -f1) |
| 104 | +DMG_SIZE=$(du -sh "$DMG_PATH" | cut -f1) |
| 105 | + |
| 106 | +echo "" |
| 107 | +echo " Trinity.app created: $APP_DIR ($APP_SIZE)" |
| 108 | +echo " DMG created: $DMG_PATH ($DMG_SIZE)" |
| 109 | +echo "" |
| 110 | +echo " Embedded binaries:" |
| 111 | +ls -lh "$RESOURCES/" | awk 'NR>1 {printf " %-12s %s\n", $NF, $5}' |
| 112 | +echo "" |
| 113 | +echo " Done. Double-click Trinity.app or mount the DMG." |
0 commit comments