Free fork of NotProton: Windows Steam games in Mac Steam, on CodeWeavers' Wine and Apple's Game Porting Toolkit
Swift apple-silicond3dmetaldxmtdxvkgame-porting-toolkitgptkmac-gamingmacosmetalfxrosetta-2steamsteam-playwinewinecx
build: local font phase, upstream sync and local release scripts
raymondchins85ae658a27f5
diff --git a/scripts/build-local.sh b/scripts/build-local.shindex da010c0..7a20a78 100755--- a/scripts/build-local.sh+++ b/scripts/build-local.sh@@ -172,6 +172,24 @@ fiphase bridge make -j"$JOBS" bridge[ -f "$wine_stamp" ] || echo "$wine_key" >"$wine_stamp"+# --- fonts -------------------------------------------------------------------------++# CI's font toolchain: Homebrew fontforge + gpatch, and afdko/fonttools in a venv.+font_tools=$(sed -n 's/^ *FONT_TOOLS: "\(.*\)"$/\1/p' .github/workflows/app.yml)+for tool in fontforge gpatch; do+ command -v "$tool" >/dev/null 2>&1 || [ -x "$(brew --prefix 2>/dev/null)/opt/$tool/bin/$tool" ] \+ || { echo "==> $tool is missing, run: brew install fontforge gpatch" >&2; exit 1; }+done+if [ ! -x scratch/fontvenv/bin/makeotfexe ] || [ "$(cat scratch/fontvenv/.tools 2>/dev/null)" != "$font_tools" ]; then+ python3 -m venv scratch/fontvenv+ # shellcheck disable=SC2086 # FONT_TOOLS is a space-separated requirement list+ scratch/fontvenv/bin/pip install -q $font_tools+ echo "$font_tools" >scratch/fontvenv/.tools+fi+PATH="$repo/scratch/fontvenv/bin:$(brew --prefix)/opt/gpatch/libexec/gnubin:$PATH"+export PATH+phase fonts make fonts+# --- app ---------------------------------------------------------------------------phase app-payload make app-payloaddiff --git a/scripts/release-local.sh b/scripts/release-local.shnew file mode 100755index 0000000..1e850cb--- /dev/null+++ b/scripts/release-local.sh@@ -0,0 +1,57 @@+#!/bin/sh+# Build NotProton from this checkout and publish it as this fork's latest GitHub release,+# which is what the app's "Check for Updates…" (Sparkle, SUFeedURL in app/Info.plist)+# reads.+#+# scripts/release-local.sh "release notes"+#+# The update is signed with the EdDSA key in this Mac's login keychain, created once with+# app/.build/artifacts/sparkle/Sparkle/bin/generate_keys; app/Info.plist's SUPublicEDKey+# must be its public half. The version comes from dylib/version.h and must not have been+# released yet. HEAD must already be pushed to origin/main.++set -eu++repo=$(cd "$(dirname "$0")/.." && pwd)+cd "$repo"++notes=${1:-}+[ -n "$notes" ] || { sed -n '6p' "$0" | sed 's/^# \{0,1\}//'; exit 1; }++die() { echo "==> $*" >&2; exit 1; }++[ -z "$(git status --porcelain --untracked-files=no)" ] || die "the tree has uncommitted changes"+git fetch -q origin+[ "$(git rev-parse HEAD)" = "$(git rev-parse origin/main)" ] || die "HEAD is not origin/main; push first"++slug=$(git remote get-url origin | sed -E 's#^(https://github.com/|[email protected]:)##; s#\.git$##')+version=$(sed -n 's/^#define NOTPROTON_VERSION "\(.*\)"/\1/p' dylib/version.h)+if gh release view "v$version" -R "$slug" >/dev/null 2>&1; then+ die "v$version is already released; bump dylib/version.h (scripts/sync-upstream.sh does)"+fi++sparkle=app/.build/artifacts/sparkle/Sparkle/bin+key=$("$sparkle/generate_keys" -p 2>/dev/null) || die "no Sparkle key in the keychain; run $sparkle/generate_keys"+[ "$key" = "$(/usr/libexec/PlistBuddy -c 'Print :SUPublicEDKey' app/Info.plist)" ] \+ || die "app/Info.plist SUPublicEDKey is not this keychain's Sparkle key"++if [ -z "${CX_ROOT:-}" ]; then+ CX_ROOT="$HOME/Library/Application Support/notproton/runners/crossover-winehq-11.15/CrossOver"+ export CX_ROOT+fi+scripts/build-local.sh --checks++built=$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' build/NotProton.app/Contents/Info.plist)+[ "$built" = "$version" ] || die "built $built, expected $version"++out=$(mktemp -d)+trap 'rm -rf "$out"' EXIT+cp build/NotProton.zip "$out/NotProton.zip"+printf '%s\n' "$notes" >"$out/NotProton.txt"+"$sparkle/generate_appcast" \+ --download-url-prefix "https://github.com/$slug/releases/download/v$version/" \+ --embed-release-notes "$out"++gh release create "v$version" "$out/NotProton.zip" "$out/appcast.xml" -R "$slug" \+ --target "$(git rev-parse HEAD)" --title "$version" --notes "$notes" --latest+echo "==> released v$version: https://github.com/$slug/releases/tag/v$version"diff --git a/scripts/sync-upstream.sh b/scripts/sync-upstream.shnew file mode 100755index 0000000..46b02d0--- /dev/null+++ b/scripts/sync-upstream.sh@@ -0,0 +1,97 @@+#!/bin/sh+# Merge new work from the projects this fork follows, keeping every local patch.+#+# scripts/sync-upstream.sh merge, then print what came in+# scripts/sync-upstream.sh --check only report whether anything new is upstream+#+# Sources, in order: leonseemann/NotProton-WineHQ (remote fork-src) and+# NotProtonNot/NotProton (remote upstream). Each is merged with a merge commit, never+# rebased or taken with -X theirs, so local commits stay as they are. The only conflict+# resolved automatically is dylib/version.h: the result is upstream's base version with+# this fork's "-winehq.N-ray.M" suffix, M bumped so Sparkle sees a newer build. Any+# other conflict aborts that merge and leaves the tree untouched.++set -eu++repo=$(cd "$(dirname "$0")/.." && pwd)+cd "$repo"++check_only=0+case "${1:-}" in+ --check) check_only=1 ;;+ "") ;;+ *) sed -n '2,5p' "$0" | sed 's/^# \{0,1\}//'; exit 1 ;;+esac++ensure_remote() {+ url=$(git remote get-url "$1" 2>/dev/null || true)+ [ -n "$url" ] || git remote add "$1" "$2"+}+ensure_remote fork-src https://github.com/leonseemann/NotProton-WineHQ+ensure_remote upstream https://github.com/NotProtonNot/NotProton++if [ -n "$(git status --porcelain --untracked-files=no)" ]; then+ echo "==> the tree has uncommitted changes, commit them first" >&2+ exit 1+fi++git fetch -q fork-src+git fetch -q upstream++version_of() {+ sed -n 's/^#define NOTPROTON_VERSION "\(.*\)"/\1/p'+}++pending=""+for ref in fork-src/main upstream/main; do+ count=$(git rev-list --count "HEAD..$ref")+ [ "$count" -eq 0 ] || pending="$pending $ref:$count"+done++if [ -z "$pending" ]; then+ echo "==> up to date with fork-src/main and upstream/main"+ exit 0+fi+echo "==> new upstream commits:$pending"+[ "$check_only" -eq 0 ] || exit 2++ours_before=$(version_of <dylib/version.h)+for entry in $pending; do+ ref=${entry%%:*}+ echo "==> merging $ref"+ if git merge --no-ff --no-edit "$ref" >/dev/null 2>&1; then+ continue+ fi+ conflicts=$(git diff --name-only --diff-filter=U)+ if [ "$conflicts" != "dylib/version.h" ]; then+ git merge --abort+ echo "==> $ref conflicts with local patches in:" >&2+ # shellcheck disable=SC2086 # one path per line+ printf ' %s\n' $conflicts >&2+ echo " nothing was merged from $ref; resolve it by hand" >&2+ exit 1+ fi+ theirs=$(git show "$ref:dylib/version.h" | version_of)+ base=${theirs%%-*}+ suffix=${ours_before#*-}+ ray=${suffix##*-ray.}+ next="$base-${suffix%-ray.*}-ray.$((ray + 1))"+ printf '%s\n' "// Build version string" "#ifndef NOTPROTON_VERSION_H" "#define NOTPROTON_VERSION_H" "" \+ "#define NOTPROTON_VERSION \"$next\"" "" "#endif // NOTPROTON_VERSION_H" >dylib/version.h+ git add dylib/version.h+ git commit -q --no-edit+ echo "==> version $ours_before -> $next"+done++ours_after=$(version_of <dylib/version.h)+if [ "$ours_after" = "$ours_before" ]; then+ # The merges were clean but a release still needs a newer version than the last one.+ suffix=${ours_before#*-}+ ray=${suffix##*-ray.}+ next="${ours_before%-ray.*}-ray.$((ray + 1))"+ sed -i '' "s/^#define NOTPROTON_VERSION \".*\"/#define NOTPROTON_VERSION \"$next\"/" dylib/version.h+ git commit -q -m "chore: bump version to $next after upstream merge" dylib/version.h+ echo "==> version $ours_before -> $next"+fi++echo "==> merged. Build and test, then publish with scripts/release-local.sh"