| 1 | |
| 2 | set -euo pipefail |
| 3 | ROOT="$(cd "$(dirname "$0")/.." && pwd)" |
| 4 | PROFILE="${1:-release}" |
| 5 | cd "$ROOT" |
| 6 | OUT=$(cargo build --profile "$PROFILE" -p client --message-format=json | python3 -c ' |
| 7 | import sys, json |
| 8 | for line in sys.stdin: |
| 9 | m = json.loads(line) |
| 10 | if m.get("reason") == "build-script-executed" and "/crates/client" in m["package_id"]: |
| 11 | print(m["out_dir"])') |
| 12 | DIR="${PROFILE/dev/debug}" |
| 13 | APP="target/$DIR/Yumush.app" |
| 14 | rm -rf "$APP" |
| 15 | mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" |
| 16 | cp "target/$DIR/client" "$APP/Contents/MacOS/yumush" |
| 17 | cp "$OUT/yumush.icns" "$APP/Contents/Resources/yumush.icns" |
| 18 | VERSION=$(cargo pkgid -p client | sed 's/.*[#@]//') |
| 19 | cat > "$APP/Contents/Info.plist" <<PLIST |
| 20 | <?xml version="1.0" encoding="UTF-8"?> |
| 21 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 22 | <plist version="1.0"> |
| 23 | <dict> |
| 24 | <key>CFBundleName</key><string>Yumush</string> |
| 25 | <key>CFBundleDisplayName</key><string>yumuş</string> |
| 26 | <key>CFBundleIdentifier</key><string>com.yumush.client</string> |
| 27 | <key>CFBundleExecutable</key><string>yumush</string> |
| 28 | <key>CFBundleIconFile</key><string>yumush</string> |
| 29 | <key>CFBundlePackageType</key><string>APPL</string> |
| 30 | <key>CFBundleShortVersionString</key><string>$VERSION</string> |
| 31 | <key>CFBundleVersion</key><string>$VERSION</string> |
| 32 | <key>NSHighResolutionCapable</key><true/> |
| 33 | <key>NSMicrophoneUsageDescription</key><string>Voice calls</string> |
| 34 | <key>NSCameraUsageDescription</key><string>Video calls</string> |
| 35 | </dict> |
| 36 | </plist> |
| 37 | PLIST |
| 38 | echo "$APP" |