Skip to content

Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit

build: local full-app build script, ray.1 version, fork update feed

raymondchins9d13b0462a2a
diff --git a/app/Info.plist b/app/Info.plist
index 8e6f310..c1644f1 100644
--- a/app/Info.plist
+++ b/app/Info.plist
@@ -31,7 +31,7 @@
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>SUFeedURL</key>
- <string>https://github.com/leonseemann/NotProton-WineHQ/releases/latest/download/appcast.xml</string>
+ <string>https://github.com/raymondchins/NotProton-WineHQ/releases/latest/download/appcast.xml</string>
<key>SUPublicEDKey</key>
<string>Nuv7Ma5pfYsZ7umT8wTZdqE1QbVzeymu9jjUd2D7bb0=</string>
</dict>
diff --git a/docs/BUILD-LOCAL.md b/docs/BUILD-LOCAL.md
new file mode 100644
index 0000000..5288155
--- /dev/null
+++ b/docs/BUILD-LOCAL.md
@@ -0,0 +1,94 @@
+# Local build
+
+`scripts/build-local.sh` builds the full app on an Apple Silicon Mac with the same make
+targets, in the same order, as `.github/workflows/app.yml`.
+
+## Prerequisites
+
+- Xcode 27 at `/Applications/Xcode-beta.app` or `/Applications/Xcode.app`. The script
+ exports `DEVELOPER_DIR` for its own process, so the Command Line Tools can stay the
+ active developer dir and you don't need `xcode-select`. To use a different Xcode, set
+ `DEVELOPER_DIR` yourself.
+- Homebrew: `brew install cmake mingw-w64 bison flex` (bison must be Homebrew's, at
+ `/opt/homebrew/opt/bison/bin`). `shellcheck` and `node` are optional; without them the
+ lint and panel checks skip.
+- Network on the first run: Dobby, Wine 11.15 (gitlab.winehq.org), the Proton tarball
+ and Sparkle.
+
+## Commands
+
+```sh
+scripts/build-local.sh # build only
+scripts/build-local.sh --checks # build, then every CI check target and the Swift tests
+```
+
+`JOBS=n` overrides the parallelism (default: `hw.ncpu`). Every phase also writes its
+output to `build/logs/<phase>.log`.
+
+## Outputs
+
+| Path | What |
+|---|---|
+| `build/NotProton.app` | ad-hoc signed app, passes `codesign --verify --strict` |
+| `build/NotProton.zip` | `ditto -c -k --keepParent` of the app, as CI packages it |
+| `out/NotProton.app` | the bundle `make app` writes; the script copies it to `build/` |
+
+At the end the script prints the version (from `dylib/version.h`, which `make app`
+writes into both `CFBundleShortVersionString` and `CFBundleVersion`) and the zip's
+sha256.
+
+## Timings (M5 Max, 18 cores, Xcode 27.0 beta 27A5218g)
+
+| Phase | Cold | Warm |
+|---|---|---|
+| dobby | 4s | skipped |
+| all (dylib) | 1s | 0s |
+| overlay-shim | 1s | 0s |
+| helpers (iconmaker, appinfo) | 3s | 0s |
+| bridge | 14m00s | 13s |
+| app-payload | 0s | 0s |
+| app | 42s | 13s |
+| checks (`--checks`) | about 3m20s | 3m20s |
+| total | about 15m, about 18m with checks | 27s, 3m47s with checks |
+
+The cold bridge phase breaks down roughly as follows:
+
+| Step | Time |
+|---|---|
+| Wine shallow clone | about 8m30s (network) |
+| two configures | about 1m10s |
+| `ntdll.so` for both trees | about 10s |
+| lsteamclient and steam.exe | about 4m15s |
+
+The lsteamclient unix halves compile their 219 files one at a time in
+`lsteamclient/build.sh`, so `-j` cannot speed that step up.
+
+## Caches
+
+Re-runs are incremental because everything CI restores from `actions/cache` stays on
+disk. All of these paths are gitignored:
+
+| Path | Contents | Size |
+|---|---|---|
+| `vendor/dobby`, `build/dobby` | Dobby at the pinned commit; rebuilt only when `DOBBY_COMMIT` in app.yml changes | 5 MB |
+| `scratch/wine` | Wine 11.15 source, plus `register-components.diff` | 551 MB |
+| `scratch/wine-build-dual` | x86_64 cross tree: PE halves, rosetta unix half, steam.exe | 341 MB |
+| `scratch/wine-build-arm64` | arm64 tree: FEX unix half | 134 MB |
+| `scratch/proton-lsc` | Proton tarball for lsteamclient | 182 MB |
+| `app/.build` | SwiftPM build and the Sparkle checkout | 772 MB |
+
+`setup-wine-tree.sh` skips anything that already exists. When `setup-wine-tree.sh` or
+`register-components.diff` changes, the script prints a warning. To rebuild fresh the way
+CI would, run `rm -rf scratch/wine scratch/wine-build-dual scratch/wine-build-arm64 scratch/.wine-key`.
+
+The Wine build trees record their source tree by absolute path (`srcdir = <repo>/scratch/wine`).
+To reuse them from another checkout, symlink that checkout's `scratch` to this one. Don't
+copy them. Two builds sharing one tree must not run at the same time.
+
+## Local deviation from CI
+
+On Xcode 27 beta 27A5218g, SwiftPM leaves `app/.build/out/Products/Debug/PackageFrameworks`
+empty. The Swift test bundle only looks for `Sparkle.framework` there, so it fails to
+load before any test runs. With `--checks`, the script builds the tests and then links
+`PackageFrameworks/Sparkle.framework` to `../Sparkle.framework`. That link is a
+build-product fix-up; no source changes. After it, all 475 tests in 56 suites pass.
diff --git a/dylib/version.h b/dylib/version.h
index 5c10bbf..4a32c97 100644
--- a/dylib/version.h
+++ b/dylib/version.h
@@ -2,6 +2,6 @@
#ifndef NOTPROTON_VERSION_H
#define NOTPROTON_VERSION_H
-#define NOTPROTON_VERSION "1.1.3-winehq.1"
+#define NOTPROTON_VERSION "1.1.3-winehq.1-ray.1"
#endif // NOTPROTON_VERSION_H
diff --git a/scripts/build-local.sh b/scripts/build-local.sh
new file mode 100755
index 0000000..da010c0
--- /dev/null
+++ b/scripts/build-local.sh
@@ -0,0 +1,238 @@
+#!/bin/sh
+# Build the whole app on this Mac the way .github/workflows/app.yml does on CI.
+#
+# scripts/build-local.sh build build/NotProton.app and build/NotProton.zip
+# scripts/build-local.sh --checks the same, then the CI check targets and Swift tests
+#
+# Phases run in CI order: dobby, all, overlay-shim, iconmaker+appinfo, bridge,
+# app-payload, app. Everything CI restores from actions/cache stays on disk here
+# instead, so a re-run only rebuilds what changed:
+# vendor/dobby, build/dobby Dobby source and build (rebuilt when the pinned commit moves)
+# scratch/wine Wine 11.15 source
+# scratch/wine-build-dual x86_64 cross tree (PE halves + rosetta unix half)
+# scratch/wine-build-arm64 arm64 tree (FEX unix half)
+# scratch/proton-lsc Proton tarball for lsteamclient
+# app/.build SwiftPM build and the Sparkle checkout
+#
+# Overridable: DEVELOPER_DIR (default Xcode-beta), JOBS (default hw.ncpu)
+
+set -eu
+
+repo=$(cd "$(dirname "$0")/.." && pwd)
+cd "$repo"
+
+usage() {
+ sed -n '2,5p' "$0" | sed 's/^# \{0,1\}//'
+}
+
+run_checks=0
+for arg in "$@"; do
+ case "$arg" in
+ --checks) run_checks=1 ;;
+ -h|--help) usage; exit 0 ;;
+ *) echo "==> unknown argument $arg" >&2; usage >&2; exit 1 ;;
+ esac
+done
+
+# The active developer dir on this machine is the Command Line Tools, which have
+# no actool and no macOS 27 SDK. Point at Xcode for this process only rather than
+# running xcode-select, which would change it for everything else too.
+if [ -z "${DEVELOPER_DIR:-}" ]; then
+ for xc in /Applications/Xcode-beta.app /Applications/Xcode.app; do
+ if [ -d "$xc/Contents/Developer" ]; then
+ DEVELOPER_DIR=$xc/Contents/Developer
+ break
+ fi
+ done
+fi
+if [ -z "${DEVELOPER_DIR:-}" ] || [ ! -d "$DEVELOPER_DIR" ]; then
+ echo "==> no Xcode found, set DEVELOPER_DIR to <Xcode>.app/Contents/Developer" >&2
+ exit 1
+fi
+export DEVELOPER_DIR
+
+JOBS=${JOBS:-$(sysctl -n hw.ncpu)}
+LOG_DIR=$repo/build/logs
+mkdir -p "$LOG_DIR"
+
+# --- prerequisites -----------------------------------------------------------------
+
+missing=""
+need() {
+ command -v "$1" >/dev/null 2>&1 || missing="$missing $1"
+}
+for tool in git make cmake curl python3 rsync lipo codesign ditto shasum \
+ i686-w64-mingw32-gcc x86_64-w64-mingw32-gcc; do
+ need "$tool"
+done
+# setup-wine-tree.sh puts Homebrew's keg-only bison first on PATH, macOS's is too old.
+[ -x /opt/homebrew/opt/bison/bin/bison ] || missing="$missing bison(homebrew)"
+xcrun --find swift >/dev/null 2>&1 || missing="$missing swift"
+xcrun --find actool >/dev/null 2>&1 || missing="$missing actool"
+if [ -n "$missing" ]; then
+ echo "==> missing:$missing" >&2
+ echo " brew install cmake mingw-w64 bison flex, and install Xcode" >&2
+ exit 1
+fi
+if [ "$run_checks" -eq 1 ]; then
+ command -v node >/dev/null 2>&1 || echo "==> note: node not found, panel-behavior will skip"
+fi
+
+echo "==> toolchain"
+echo " $(xcodebuild -version | tr '\n' ' ')"
+echo " $(swift --version 2>&1 | head -1)"
+echo " macOS SDK $(xcrun --sdk macosx --show-sdk-version), jobs $JOBS"
+
+# --- phase runner ------------------------------------------------------------------
+
+timings=""
+total_start=$(date +%s)
+
+fmt() {
+ printf '%dm%02ds' $(($1 / 60)) $(($1 % 60))
+}
+
+print_timings() {
+ echo "==> phase timings"
+ printf '%s\n' "$timings" | while read -r name secs; do
+ [ -n "$name" ] || continue
+ printf ' %-14s %s\n' "$name" "$(fmt "$secs")"
+ done
+ printf ' %-14s %s\n' total "$(fmt $(($(date +%s) - total_start)))"
+}
+
+# phase NAME CMD... runs CMD with its output on the terminal and in build/logs/NAME.log
+phase() {
+ name=$1
+ shift
+ log=$LOG_DIR/$name.log
+ rcf=$LOG_DIR/.$name.rc
+ echo "==> [$name] $*"
+ start=$(date +%s)
+ {
+ rc=0
+ "$@" || rc=$?
+ echo "$rc" >"$rcf"
+ } 2>&1 | tee "$log"
+ rc=$(cat "$rcf")
+ rm -f "$rcf"
+ secs=$(($(date +%s) - start))
+ timings="$timings
+$name $secs"
+ if [ "$rc" -ne 0 ]; then
+ echo "==> [$name] failed with exit $rc after $(fmt "$secs"), log: $log" >&2
+ print_timings
+ exit "$rc"
+ fi
+ echo "==> [$name] done in $(fmt "$secs")"
+}
+
+# --- dobby -------------------------------------------------------------------------
+
+DOBBY_COMMIT=$(sed -n 's/^[[:space:]]*DOBBY_COMMIT:[[:space:]]*"\([0-9a-f]*\)".*/\1/p' .github/workflows/app.yml)
+[ -n "$DOBBY_COMMIT" ] || { echo "==> DOBBY_COMMIT not found in .github/workflows/app.yml" >&2; exit 1; }
+
+if [ ! -d vendor/dobby/.git ]; then
+ git clone --no-checkout https://github.com/jmpews/Dobby.git vendor/dobby
+ git -C vendor/dobby checkout -q "$DOBBY_COMMIT"
+fi
+if [ "$(git -C vendor/dobby rev-parse HEAD)" != "$DOBBY_COMMIT" ]; then
+ git -C vendor/dobby fetch -q origin
+ git -C vendor/dobby checkout -q "$DOBBY_COMMIT"
+fi
+
+dobby_stamp=build/dobby/.notproton-commit
+if [ -f build/dobby/libdobby.a ] && [ "$(cat "$dobby_stamp" 2>/dev/null)" = "$DOBBY_COMMIT" ]; then
+ echo "==> [dobby] build/dobby is current for $DOBBY_COMMIT, skipped"
+else
+ rm -rf build/dobby
+ phase dobby make dobby
+ echo "$DOBBY_COMMIT" >"$dobby_stamp"
+fi
+
+# --- dylib, shim, helpers ----------------------------------------------------------
+
+phase all make -j"$JOBS" all
+phase overlay-shim make -j"$JOBS" overlay-shim
+phase helpers make -j"$JOBS" iconmaker appinfo
+
+# --- bridge ------------------------------------------------------------------------
+
+# CI keys its Wine cache on these two files. A local tree configured by an older
+# version of them is kept, because setup-wine-tree.sh skips whatever exists, so say so.
+wine_key=$(cat bridge/setup-wine-tree.sh bridge/register-components.diff | shasum -a 256 | cut -c1-16)
+wine_stamp=scratch/.wine-key
+if [ -f "$wine_stamp" ] && [ "$(cat "$wine_stamp")" != "$wine_key" ]; then
+ echo "==> warning: scratch/wine* was set up by a different setup-wine-tree.sh or"
+ echo " register-components.diff. CI would start fresh; to do the same here:"
+ echo " rm -rf scratch/wine scratch/wine-build-dual scratch/wine-build-arm64 $wine_stamp"
+fi
+
+# The wine-tree scripts call plain make, which joins this make's jobserver.
+phase bridge make -j"$JOBS" bridge
+[ -f "$wine_stamp" ] || echo "$wine_key" >"$wine_stamp"
+
+# --- app ---------------------------------------------------------------------------
+
+phase app-payload make app-payload
+phase app make app
+
+app_out=build/NotProton.app
+zip_out=build/NotProton.zip
+rm -rf "$app_out" "$zip_out"
+ditto out/NotProton.app "$app_out"
+ditto -c -k --keepParent "$app_out" "$zip_out"
+codesign --verify --strict "$app_out"
+
+version=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$app_out/Contents/Info.plist")
+sha=$(shasum -a 256 "$zip_out" | cut -d' ' -f1)
+
+# --- checks ------------------------------------------------------------------------
+
+# SwiftPM on Xcode 27 beta (27A5218g) leaves Products/Debug/PackageFrameworks empty
+# and puts Sparkle.framework one level up, while the test bundle's rpath only looks
+# in PackageFrameworks, so the bundle fails to dlopen before a single test runs.
+# Build the tests, then link Sparkle where the rpath expects it. Build products only.
+link_test_sparkle() {
+ swift build --package-path app --build-tests
+ bin=$(swift build --package-path app --show-bin-path)
+ if [ -d "$bin/PackageFrameworks" ] && [ -d "$bin/Sparkle.framework" ] &&
+ [ ! -e "$bin/PackageFrameworks/Sparkle.framework" ]; then
+ ln -s ../Sparkle.framework "$bin/PackageFrameworks/Sparkle.framework"
+ echo "==> linked Sparkle.framework into $bin/PackageFrameworks"
+ fi
+}
+
+check_failures=""
+if [ "$run_checks" -eq 1 ]; then
+ check_log=$LOG_DIR/checks.log
+ : >"$check_log"
+ start=$(date +%s)
+ for target in sigcheck callscheck webpatch-fixtures peicon-fixtures panel-behavior \
+ spawn-env compatcheck compatsvc-check launch-shell envcheck buildcheck \
+ settingscheck routecheck bridgecheck gamedrivecheck seedcheck app-tests; do
+ echo "==> [check] make -s $target" | tee -a "$check_log"
+ [ "$target" != app-tests ] || link_test_sparkle >>"$check_log" 2>&1 || true
+ if make -s "$target" >>"$check_log" 2>&1; then
+ tail -n 1 "$check_log" | sed 's/^/ /'
+ else
+ echo " FAILED, see $check_log" >&2
+ check_failures="$check_failures $target"
+ fi
+ done
+ timings="$timings
+checks $(($(date +%s) - start))"
+fi
+
+# --- summary -----------------------------------------------------------------------
+
+print_timings
+echo "==> NotProton $version"
+echo " app $repo/$app_out (ad-hoc signed, codesign --verify --strict ok)"
+echo " zip $repo/$zip_out"
+echo " sha256 $sha"
+if [ -n "$check_failures" ]; then
+ echo "==> checks failed:$check_failures" >&2
+ exit 1
+fi
+[ "$run_checks" -eq 0 ] || echo "==> all CI checks passed"