Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.
Swift apple-silicond3dmetaldxmtdxvkfexgame-porting-toolkitgamingmac-gamingmacosmetalmoltenvksteamswiftuivkd3d-protonwhisky-alternativewindows-gameswinewine-wrapper
sparkle: auto-updates (EdDSA appcast, embedded framework, Check for Updates menu); release pipeline; notarize-when-credentialed
Gauthier Piarrette41962b7c30ac
diff --git a/Package.resolved b/Package.resolvedindex 246d21f..6cef7f3 100644--- a/Package.resolved+++ b/Package.resolved@@ -1,6 +1,15 @@{- "originHash" : "50d600e85f260cc7c33f023304c744332d9c41d917015f19c6aa1e0b4c538d93",+ "originHash" : "0ecd359dc38335602c79d6d19bf7d8d42f8b0b5f8f1a8304862f933e273f0190","pins" : [+ {+ "identity" : "sparkle",+ "kind" : "remoteSourceControl",+ "location" : "https://github.com/sparkle-project/Sparkle",+ "state" : {+ "revision" : "ac2def288cbff5cfc7df3ffef6abdf45b72bcb0a",+ "version" : "2.9.6"+ }+ },{"identity" : "swift-argument-parser","kind" : "remoteSourceControl",diff --git a/Package.swift b/Package.swiftindex 884e261..42fade4 100644--- a/Package.swift+++ b/Package.swift@@ -11,6 +11,7 @@ let package = Package(],dependencies: [.package(url: "https://github.com/apple/swift-argument-parser.git", from: "1.5.0"),+ .package(url: "https://github.com/sparkle-project/Sparkle", from: "2.6.0"),],targets: [.target(name: "HighballKit", path: "Sources/HighballKit", swiftSettings: [.enableUpcomingFeature("StrictConcurrency")]),@@ -20,8 +21,9 @@ let package = Package(path: "Sources/highball"),.executableTarget(name: "HighballApp",- dependencies: ["HighballKit"],- path: "Sources/HighballApp"),+ dependencies: ["HighballKit", .product(name: "Sparkle", package: "Sparkle")],+ path: "Sources/HighballApp",+ linkerSettings: [.unsafeFlags(["-Xlinker", "-rpath", "-Xlinker", "@executable_path/../Frameworks"])]),.testTarget(name: "HighballKitTests", dependencies: ["HighballKit"], path: "Tests/GinKitTests"),])diff --git a/Scripts/make-app.sh b/Scripts/make-app.shindex fc83fe9..bc3089e 100755--- a/Scripts/make-app.sh+++ b/Scripts/make-app.sh@@ -1,26 +1,37 @@#!/bin/zsh-# Assemble dist/Highball.app from the SwiftPM build (ad-hoc signed; notarization needs an Apple Developer account).+# Assemble dist/Highball.app from the SwiftPM build.+# Usage: Scripts/make-app.sh [debug|release] [version]+# Signs with Developer ID when available (hardened runtime); notarizes + staples when a+# notarytool keychain profile named "highball" exists.set -euo pipefailcd "$(dirname "$0")/.."CONFIG="${1:-release}"+VERSION="${2:-0.0.0-dev}"+FEED_URL="https://raw.githubusercontent.com/gauthierpiarrette/highball/main/appcast.xml"+ED_PUBLIC_KEY="lntI8A+HC5Wo6xb4dZNQ6IYteI771cNybU8XNXmvMd8="+swift build -c "$CONFIG" --product HighballAppAPP=dist/Highball.app-rm -rf "$APP"; mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"+rm -rf "$APP"; mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources" "$APP/Contents/Frameworks"cp ".build/$CONFIG/HighballApp" "$APP/Contents/MacOS/Highball"-# Ship the manifest, recipes and the GPTK license text inside the bundle.++# Sparkle framework (SwiftPM artifact) — embedded, rpath is baked into the binary.+SPARKLE_FW=$(ls -d .build/artifacts/sparkle/Sparkle/Sparkle.xcframework/macos-*/Sparkle.framework | head -1)+cp -R "$SPARKLE_FW" "$APP/Contents/Frameworks/"++# Resources: engine manifest, GPTK license, recipes and DB entries (from highball-db).cp spike/engine-manifest.json "$APP/Contents/Resources/engine-manifest.json"cp spike/d3dmetal-license.txt "$APP/Contents/Resources/d3dmetal-license.txt"-# Recipes come from the highball-db repo (sibling checkout, or a shallow clone into .build).RECIPES="../highball-db/recipes"if [ ! -d "$RECIPES" ]; thenRECIPES=".build/highball-db/recipes"[ -d "$RECIPES" ] || git clone --depth 1 https://github.com/gauthierpiarrette/highball-db.git .build/highball-dbfifor f in "$RECIPES"/launchers/*.json "$RECIPES"/games/*.json; do cp "$f" "$APP/Contents/Resources/"; done-# Compatibility DB entries (for in-app status pills on the games grid).DBDIR="$(dirname "$RECIPES")/db/games"if [ -d "$DBDIR" ]; then mkdir -p "$APP/Contents/Resources/db-games"; cp "$DBDIR"/*.json "$APP/Contents/Resources/db-games/"; fi-# App icon: rendered from source, packed to icns.++# App icon.ICONWORK=.build/iconmkdir -p "$ICONWORK/AppIcon.iconset"swift Scripts/make-icon.swift "$ICONWORK/AppIcon-1024.png" >/dev/null@@ -30,6 +41,7 @@ for sz in 16 32 128 256 512; dodoneiconutil -c icns "$ICONWORK/AppIcon.iconset" -o "$APP/Contents/Resources/AppIcon.icns"sips -z 512 512 "$ICONWORK/AppIcon-1024.png" --out "$APP/Contents/Resources/AppIcon.png" >/dev/null+cat > "$APP/Contents/Info.plist" <<PLIST<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">@@ -39,22 +51,40 @@ cat > "$APP/Contents/Info.plist" <<PLIST<key>CFBundleName</key><string>Highball</string><key>CFBundleDisplayName</key><string>Highball</string><key>CFBundlePackageType</key><string>APPL</string>- <key>CFBundleShortVersionString</key><string>0.1.0</string>- <key>CFBundleVersion</key><string>1</string>- <key>LSMinimumSystemVersion</key><string>14.0</string>+ <key>CFBundleShortVersionString</key><string>${VERSION}</string>+ <key>CFBundleVersion</key><string>${VERSION}</string><key>CFBundleIconFile</key><string>AppIcon</string>+ <key>LSMinimumSystemVersion</key><string>14.0</string><key>NSHighResolutionCapable</key><true/>+ <key>SUFeedURL</key><string>${FEED_URL}</string>+ <key>SUPublicEDKey</key><string>${ED_PUBLIC_KEY}</string>+ <key>SUEnableInstallerLauncherService</key><false/><key>NSHumanReadableCopyright</key><string>GPL-3.0 — no paid tier, ever.</string></dict></plist>PLIST-# Prefer a Developer ID certificate when one is in the keychain (hardened runtime, timestamp);-# fall back to ad-hoc. Notarization additionally needs: xcrun notarytool submit dist/Highball.zip-# --keychain-profile <profile> --wait && xcrun stapler staple dist/Highball.app+IDENTITY=$(security find-identity -v -p codesigning 2>/dev/null | awk -F'"' '/Developer ID Application/{print $2; exit}')if [ -n "$IDENTITY" ]; then- codesign --force --deep --options runtime --timestamp -s "$IDENTITY" "$APP"+ codesign --force --options runtime --timestamp -s "$IDENTITY" "$APP/Contents/Frameworks/Sparkle.framework/Versions/B/XPCServices/Downloader.xpc" 2>/dev/null || true+ codesign --force --options runtime --timestamp -s "$IDENTITY" "$APP/Contents/Frameworks/Sparkle.framework/Versions/B/XPCServices/Installer.xpc" 2>/dev/null || true+ codesign --force --options runtime --timestamp -s "$IDENTITY" "$APP/Contents/Frameworks/Sparkle.framework/Versions/B/Autoupdate"+ codesign --force --options runtime --timestamp -s "$IDENTITY" "$APP/Contents/Frameworks/Sparkle.framework/Versions/B/Updater.app"+ codesign --force --options runtime --timestamp -s "$IDENTITY" "$APP/Contents/Frameworks/Sparkle.framework"+ codesign --force --options runtime --timestamp -s "$IDENTITY" "$APP"elsecodesign --force --deep -s - "$APP"fi-codesign -dv "$APP" 2>&1 | grep -E "Authority|Signature|flags" | head -3 || true-echo "built $APP"+codesign -dv "$APP" 2>&1 | grep -E "Authority=Developer|flags" | head -2 || true++# Notarize + staple when credentials are stored (xcrun notarytool store-credentials highball ...).+if xcrun notarytool history --keychain-profile highball >/dev/null 2>&1; then+ echo "notarizing…"+ ditto -c -k --keepParent "$APP" dist/Highball-notarize.zip+ xcrun notarytool submit dist/Highball-notarize.zip --keychain-profile highball --wait+ xcrun stapler staple "$APP"+ rm dist/Highball-notarize.zip+ echo "notarized and stapled"+else+ echo "note: no notarytool profile 'highball' — skipping notarization"+fi+echo "built $APP ($VERSION)"diff --git a/Scripts/release.sh b/Scripts/release.shnew file mode 100755index 0000000..2a0e261--- /dev/null+++ b/Scripts/release.sh@@ -0,0 +1,54 @@+#!/bin/zsh+# Cut a Highball release: build+sign+notarize the app, sign the update for Sparkle,+# update appcast.xml, publish the GitHub release.+# Usage: Scripts/release.sh 0.3.1 "One-line summary" [notes-file.md]+set -euo pipefail+cd "$(dirname "$0")/.."+VERSION="${1:?usage: release.sh <version> <summary> [notes.md]}"+SUMMARY="${2:?summary required}"+NOTES_FILE="${3:-}"++Scripts/make-app.sh release "$VERSION"+ZIP="dist/Highball-$VERSION.zip"+ditto -c -k --keepParent dist/Highball.app "$ZIP"++# Sparkle EdDSA signature for the appcast.+SIGN=.build/artifacts/sparkle/Sparkle/bin/sign_update+ED_ATTRS=$("$SIGN" "$ZIP" | tr -d '\n') # sparkle:edSignature="…" length="…"++DOWNLOAD_URL="https://github.com/gauthierpiarrette/highball/releases/download/v$VERSION/Highball-$VERSION.zip"+DATE=$(date -R 2>/dev/null || date "+%a, %d %b %Y %H:%M:%S %z")++# Create appcast.xml if missing, then insert the new item after <channel>.+if [ ! -f appcast.xml ]; then+ cat > appcast.xml <<'XML'+<?xml version="1.0" encoding="utf-8"?>+<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">+ <channel>+ <title>Highball</title>+ <link>https://github.com/gauthierpiarrette/highball</link>+ <description>Run Windows games on Apple Silicon.</description>+ </channel>+</rss>+XML+fi+ITEM=" <item>\\+ <title>Highball $VERSION</title>\\+ <description><![CDATA[$SUMMARY]]></description>\\+ <pubDate>$DATE</pubDate>\\+ <sparkle:minimumSystemVersion>14.0</sparkle:minimumSystemVersion>\\+ <enclosure url=\"$DOWNLOAD_URL\" sparkle:version=\"$VERSION\" sparkle:shortVersionString=\"$VERSION\" $ED_ATTRS type=\"application/octet-stream\"/>\\+ </item>"+sed -i '' "s|<description>Run Windows games on Apple Silicon.</description>|<description>Run Windows games on Apple Silicon.</description>\\+$ITEM|" appcast.xml+plutil -lint /dev/null >/dev/null 2>&1 || true+python3 -c "import xml.dom.minidom,sys; xml.dom.minidom.parse('appcast.xml')" && echo "appcast.xml valid"++if [ -n "$NOTES_FILE" ]; then+ gh release create "v$VERSION" "$ZIP" --prerelease --title "Highball $VERSION" --notes-file "$NOTES_FILE"+else+ gh release create "v$VERSION" "$ZIP" --prerelease --title "Highball $VERSION" --notes "$SUMMARY"+fi++git add appcast.xml && git commit -m "release: v$VERSION appcast" && git push+echo "released v$VERSION — appcast live once the push lands"diff --git a/Sources/HighballApp/HighballApp.swift b/Sources/HighballApp/HighballApp.swiftindex e48a7c4..59e0f8f 100644--- a/Sources/HighballApp/HighballApp.swift+++ b/Sources/HighballApp/HighballApp.swift@@ -1,5 +1,6 @@import AppKitimport HighballKit+import Sparkleimport SwiftUI@main@@ -16,10 +17,41 @@ struct HighballApp: App {.onAppear { state.refresh() }}.windowResizability(.contentSize)+ .commands {+ CommandGroup(after: .appInfo) {+ CheckForUpdatesView(updater: delegate.updaterController.updater)+ }+ }+ }+}++/// "Check for Updates…" menu item, enabled/disabled by Sparkle's own state.+struct CheckForUpdatesView: View {+ @ObservedObject private var model: CheckForUpdatesViewModel+ private let updater: SPUUpdater++ init(updater: SPUUpdater) {+ self.updater = updater+ self.model = CheckForUpdatesViewModel(updater: updater)+ }++ var body: some View {+ Button(L("Check for Updates…")) { updater.checkForUpdates() }+ .disabled(!model.canCheckForUpdates)+ }+}++final class CheckForUpdatesViewModel: ObservableObject {+ @Published var canCheckForUpdates = false+ init(updater: SPUUpdater) {+ updater.publisher(for: \.canCheckForUpdates).assign(to: &$canCheckForUpdates)}}final class AppDelegate: NSObject, NSApplicationDelegate {+ /// Sparkle: reads SUFeedURL and SUPublicEDKey from Info.plist; no-ops in bare dev builds without them.+ let updaterController = SPUStandardUpdaterController(startingUpdater: true, updaterDelegate: nil, userDriverDelegate: nil)+func applicationDidFinishLaunching(_ notification: Notification) {// Works as a bare SwiftPM executable during development: give it a real UI presence.NSApp.setActivationPolicy(.regular)diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swiftindex 563202c..b73df23 100644--- a/Sources/HighballApp/L10n.swift+++ b/Sources/HighballApp/L10n.swift@@ -84,6 +84,8 @@ enum L10n {"Games run with the bottle’s sync (msync is fastest). Opening the Steam window restarts Windows processes with sync off — its interface needs it.":"Les jeux utilisent la synchronisation de la bouteille (msync est la plus rapide). Ouvrir la fenêtre Steam redémarre les processus Windows sans synchronisation — son interface l’exige.",+ "Check for Updates…": "Rechercher les mises à jour…",+// Status pills"Verified": "Vérifié","Reported": "Signalé",