Skip to content

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

fix(licensing): publish matching source and licence texts for the Wine and DXMT builds we ship (#1787)

Raystormsb44c46a2e6fe
diff --git a/NOTICE b/NOTICE
index 3b3cbdf..dca2954 100644
--- a/NOTICE
+++ b/NOTICE
@@ -51,6 +51,13 @@ later (LGPL-2.1-or-later); these files keep that license. Wine's license notice
and the LGPL-2.1 text ship in the app as LICENSE.wine. Build recipes and
sha256 pins are in docs/WINECX.md and each patch directory's README.
+The Corresponding Source for these binaries is winecx
+(https://github.com/dappermint/winecx) at the commits named below, plus the
+patches above. LGPL-2.1-or-later asks whoever distributes the binaries to also
+provide that source, so Bridgeplay publishes a copy of it alongside the
+patches, built by scripts/package-wine-patch-sources.sh (see the written offer
+below for the current archive's name and sha256).
+
WineCX 11.17 (winecx e0aa380780b73e20fabcfe78fd42713b94929a53, runtime 4.7.3):
win32u-winecx-11.17.so win32u-patch/patch-driver-version.sh (binary
string edit of the runtime's win32u.so)
@@ -90,7 +97,12 @@ in app/Sources/BridgeplayApp/Model/FreeEngine.swift) when they are not there.
DXMT (dxmt-e94c312.tar.gz, built from https://github.com/3Shain/dxmt at
e94c312f5c054263acf261cfa109edf13e757587; docs/DXMT.md), Copyright (c)
- 2023-2026 Feifan He for CodeWeavers, LGPL-2.1-or-later.
+ 2023-2026 Feifan He for CodeWeavers, LGPL-2.1-or-later. scripts/build-dxmt.sh
+ packs the license texts (COPYING.LIB, LICENSE, LICENSE-0.80-and-earlier.txt)
+ and the Corresponding Source, the exact source tree the build ran from with
+ its submodules, into every DXMT build from here on, alongside the binaries on
+ the same dxmt-<commit> release (see docs/DXMT.md). dxmt-e94c312.tar.gz itself
+ predates that and carries neither; its source is the upstream commit above.
DXVK-macOS 1.10.3 (dxvk-macOS-async-v1.10.3-20230507-repack-builtin.tar.gz from
https://github.com/Gcenx/DXVK-macOS/releases/tag/v1.10.3-20230507-repack),
zlib license.
@@ -134,6 +146,23 @@ three years after the last release that ships them, Raymond Chin will also
provide that source on request, for no more than the cost of providing it; open
an issue at https://github.com/raymondchins/Bridgeplay/issues.
+The LGPL and this offer ask Bridgeplay to provide that source alongside the
+binaries it distributes, so Bridgeplay also publishes a copy of the winecx
+source behind the patched Wine files, packed with the patches and recipes by
+scripts/package-wine-patch-sources.sh:
+
+ wine-patch-sources-2d19f09dde5d.tar.gz, sha256
+ 193b33d111f9bac6e3f544a219f9fdc8921c2cf4862f5a70d8b12cc78b1c09d2, published on
+ this project's release of the same name. Covers winecx e0aa380780b73e20fabcfe78fd42713b94929a53
+ and 5b45f4564c4f87fa9c0f958733a5e9bb3918a058 (the commits named above) plus the patch
+ directories they are built from. Rebuild it (same id and sha256 for the same
+ inputs) whenever those pins or patches change, and republish with --publish.
+
+Likewise, every dxmt-<commit> release from here on carries a
+dxmt-<commit>-source.tar.gz beside the binaries (above; docs/DXMT.md). The DXMT
+commit currently pinned, e94c312, predates that and has no self-hosted source archive
+yet; its source is the upstream URL above until the next rebuild adds one.
+
Compatibility data
------------------
diff --git a/docs/DXMT.md b/docs/DXMT.md
index 50b0e8a..7470731 100644
--- a/docs/DXMT.md
+++ b/docs/DXMT.md
@@ -10,6 +10,7 @@ fixes, the WIP D3D12 backend).
| Why | head of `main` when pinned; every job of its CI run is green ([run 37474938195](https://github.com/3Shain/dxmt/actions/runs/37474938195)) |
| Tarball | `dxmt-e94c312.tar.gz`, top-level directory `e94c312/` |
| License | LGPL-2.1-or-later since `ec357fd` (v0.80 was the last MIT release) |
+| Source | the upstream commit above, public at https://github.com/3Shain/dxmt/tree/e94c312f5c054263acf261cfa109edf13e757587. The currently published `dxmt-e94c312.tar.gz` predates `dxmt-<shortsha>-source.tar.gz` (below) and carries no license files or source of its own; the next rebuild publishes both on the same release, see Rebuilding |
## In Bridgeplay
@@ -42,10 +43,14 @@ this.
DEVELOPER_DIR=/Applications/Xcode-beta.app/Contents/Developer \
scripts/build-dxmt.sh e94c312f5c054263acf261cfa109edf13e757587
-Needs Xcode with its Metal toolchain (`xcodebuild -downloadComponent MetalToolchain`),
-Homebrew `cmake bison flex mingw-w64`, and python3; the script installs meson 1.10.0 and
-ninja into a venv. Work goes to `scratch/dxmt-build/`, output to `scratch/dxmt-out/`
-(tarball plus a `.sha256` manifest). Finished stages are reused. A cold run on an M5 Max
+Add `--publish` to also create the `dxmt-<shortsha>` GitHub release once the build and its
+checks pass. Needs Xcode with its Metal toolchain (`xcodebuild -downloadComponent
+MetalToolchain`), Homebrew `cmake bison flex mingw-w64`, and python3; the script installs
+meson 1.10.0 and ninja into a venv. Work goes to `scratch/dxmt-build/`, output to
+`scratch/dxmt-out/`: the binary tarball with `COPYING.LIB`, `LICENSE` and
+`LICENSE-0.80-and-earlier.txt` inside it, `dxmt-<shortsha>-source.tar.gz` (the Corresponding
+Source: the exact worktree the build ran from, submodules included), and a `.sha256`
+manifest covering both. Finished stages are reused. A cold run on an M5 Max
takes about 6 minutes plus clones: LLVM about 3, Wine configure about 1, DXMT about 1.
It follows the gcc-release jobs of DXMT's `ci.yml` (LLVM 15.0.7 for x86_64-apple-darwin,
@@ -107,3 +112,8 @@ from the same tarball.
| `i386-windows/winemetal.dll` | `6ddeb053c5510cffafdabfd27c8a67950f2e37308e6b9f9d1a0c44b9119ac456` |
| `x86_64-windows-d3d12/d3d12.dll` | `30c11f6672fd59ebbe316b3b4e85efb2090c6e28df8a0bdc74befde0f02d4c27` |
| tarball | `8de0d5b7eb2b96315f6ec8e259c05423ab43212e776196147b30d9f44927f7f0` |
+
+This table pins what `dxmt-e94c312.tar.gz` already ships; its hash does not change. The next
+pinned commit's tarball also carries `COPYING.LIB`, `LICENSE` and
+`LICENSE-0.80-and-earlier.txt` (`scripts/build-dxmt.sh`), which `FreeEngine.swift` does not
+list in `expectedFiles` and so does not need pinning here.
diff --git a/docs/RELEASING.md b/docs/RELEASING.md
index aee0c80..651b692 100644
--- a/docs/RELEASING.md
+++ b/docs/RELEASING.md
@@ -243,6 +243,28 @@ have them from earlier apps, so they download nothing. When `fonts/` changes:
3. `scripts/package-fonts.sh --publish` creates the release. `release-local.sh` stops while the
pinned archive is missing on GitHub.
+## WineCX patch source
+
+The Corresponding Source for the patched Wine (WineCX) binaries in `app/Sources/BridgeplayApp/Resources/`
+(NOTICE, "Patched Wine (WineCX) binaries") is winecx (`dappermint/winecx`) at the pinned
+commits plus the patches in this repository. LGPL-2.1-or-later asks whoever distributes the
+binaries to also provide that source, so `scripts/package-wine-patch-sources.sh` publishes
+both onto a `wine-patch-sources-<id>` release of this project; `<id>` comes from the pinned
+commits and the patch files, so unchanged pins and patches give the same name and sha256.
+When `docs/WINECX.md`'s winecx pins or any of the patch directories change:
+
+1. `scripts/package-wine-patch-sources.sh`. Copy the pin it prints into NOTICE.
+2. `scripts/package-wine-patch-sources.sh --publish` creates the release. `release-local.sh`
+ stops while the pinned archive is missing on GitHub.
+
+## DXMT source
+
+Every `dxmt-<commit>` release from `scripts/build-dxmt.sh --publish` on carries the license
+texts inside the binary tarball and a `dxmt-<commit>-source.tar.gz` (the exact DXMT worktree
+the build ran from, submodules included) beside it; see [DXMT.md](DXMT.md), Rebuilding. The
+currently pinned `dxmt-e94c312.tar.gz` predates this and has neither; its source is the
+upstream commit named in NOTICE and `FreeEngine.swift` until the next rebuild.
+
## Compatibility reports
The app's one-tap reports go to `https://bridgeplay.dev/api/report` (bridgeplay-web,
diff --git a/docs/WINECX.md b/docs/WINECX.md
index f3f4105..0fd71d8 100644
--- a/docs/WINECX.md
+++ b/docs/WINECX.md
@@ -412,6 +412,16 @@ The unpack test (`FreeEngineWinecxTests.unpacksRealArchive`, once per release) c
this against the real archive when `NOTPROTON_WINECX_ARCHIVE` points at it, or when it sits in
Bridgeplay's download cache.
+## Corresponding Source
+
+Every patched binary below (LGPL-2.1-or-later) is built from winecx (`dappermint/winecx`) at
+the commit pinned at the top of this page plus one of the patches above. The license asks
+whoever distributes these binaries to also provide that source, so
+`scripts/package-wine-patch-sources.sh` publishes winecx's source at those commits with the
+patches and recipes onto a `wine-patch-sources-<id>` release of this project, pinned in
+NOTICE. See [RELEASING.md](RELEASING.md), WineCX patch source, for when to rebuild and
+republish it.
+
## Shipped binaries
Every binary in `app/Sources/BridgeplayApp/Resources/` built from a patch or source in this
diff --git a/dylib/tests/seedcheck.sh b/dylib/tests/seedcheck.sh
index 76fba0e..feca0fe 100644
--- a/dylib/tests/seedcheck.sh
+++ b/dylib/tests/seedcheck.sh
@@ -9,6 +9,15 @@ detach_images() {
done
}
trap 'detach_images; chmod -R u+rwX "$work"; rm -rf "$work"' EXIT
+# A volume just written to can stay busy for a moment, and CI then fails with EBUSY.
+detach_image() {
+ tries=0
+ until /usr/bin/hdiutil detach -quiet -force "$1"; do
+ tries=$((tries + 1))
+ [ "$tries" -lt 5 ] || return 1
+ sleep 1
+ done
+}
cut_block() {
from="$1" to="$2" keep="$3" awk '
BEGIN { from = ENVIRON["from"]; to = ENVIRON["to"]; keep = ENVIRON["keep"] }
@@ -410,7 +419,7 @@ else
check test "$(stat -f %l "$WINEPREFIX/drive_c/windows/ntdll.dll")" = 1
printf changed > "$WINEPREFIX/drive_c/windows/ntdll.dll"
check test "$(cat "$template_dir/pfx/drive_c/windows/ntdll.dll")" = dll
- /usr/bin/hdiutil detach -quiet -force "$work/mnt.hfs"
+ detach_image "$work/mnt.hfs"
fi
# An external drive can come back with another device number: a seed killed on it is still
@@ -426,7 +435,7 @@ else
{ kill_seed_after 1; } 2>/dev/null || true
check test ! -e "$WINEPREFIX/system.reg"
plugged=$(stat -f %d "$work/mnt.drive")
- /usr/bin/hdiutil detach -quiet -force "$work/mnt.drive"
+ detach_image "$work/mnt.drive"
# Another disk takes the drive's old device node while it is away.
attach_image HFS+ other || true
if ! attach_image HFS+ drive; then
@@ -436,7 +445,7 @@ else
finish_dead_seeds
check seeded_whole
check grep -q 'finished seeding this prefix' "$log"
- /usr/bin/hdiutil detach -quiet -force "$work/mnt.drive"
+ detach_image "$work/mnt.drive"
fi
[ ! -d "$work/mnt.other" ] || /usr/bin/hdiutil detach -quiet -force "$work/mnt.other" 2>/dev/null || true
fi
@@ -469,7 +478,7 @@ else
check test -z "$(ls -A "$WINEPREFIX")"
check test "$(grep -c 'finished seeding this prefix' "$log" || true)" = 0
check test "$(find "$STEAM_COMPAT_DATA_PATH" -maxdepth 1 -name 'pfx.seeding.*' | wc -l | tr -d ' ')" = 0
- /usr/bin/hdiutil detach -quiet -force "$work/mnt.exfat"
+ detach_image "$work/mnt.exfat"
fi
# A conflict anywhere moves nothing in.
diff --git a/scripts/build-dxmt.sh b/scripts/build-dxmt.sh
index c0bda57..6da8ef2 100755
--- a/scripts/build-dxmt.sh
+++ b/scripts/build-dxmt.sh
@@ -2,13 +2,18 @@
# Build DXMT from a pinned commit and package it the way the upstream v0.80 release
# tarball is laid out, so FreeEngine can consume it in place of that release.
#
-# scripts/build-dxmt.sh <commit>
+# scripts/build-dxmt.sh [--publish] <commit>
#
# Output: scratch/dxmt-out/dxmt-<shortsha>.tar.gz holding
# <shortsha>/x86_64-unix/winemetal.so
# <shortsha>/x86_64-windows/{d3d10core,d3d11,dxgi,winemetal,nvapi64,nvngx}.dll
# <shortsha>/i386-windows/{d3d10core,d3d11,dxgi,winemetal}.dll
# <shortsha>/x86_64-windows-d3d12/d3d12.dll (WIP backend, kept apart on purpose)
+# <shortsha>/{COPYING.LIB,LICENSE,LICENSE-0.80-and-earlier.txt}
+# and scratch/dxmt-out/dxmt-<shortsha>-source.tar.gz: the Corresponding Source
+# (LGPL-2.1-or-later), the exact DXMT worktree this build ran from, submodules
+# included, as <shortsha>/. --publish also creates the dxmt-<shortsha> GitHub release
+# carrying both tarballs and the sha256 manifest.
#
# The toolchain follows DXMT's CI (.github/workflows/ci.yml, the gcc-release jobs that
# feed its package step): LLVM 15.0.7 built for x86_64-apple-darwin, Homebrew mingw-w64,
@@ -21,11 +26,21 @@
# delete the matching directory under scratch/dxmt-build to redo one.
set -euo pipefail
-if [ $# -ne 1 ]; then
- echo "usage: $0 <dxmt commit>" >&2
+PUBLISH=0
+COMMIT_ARG=""
+for arg in "$@"; do
+ case "$arg" in
+ --publish) PUBLISH=1 ;;
+ *)
+ if [ -n "$COMMIT_ARG" ]; then echo "usage: $0 [--publish] <dxmt commit>" >&2; exit 2; fi
+ COMMIT_ARG="$arg"
+ ;;
+ esac
+done
+if [ -z "$COMMIT_ARG" ]; then
+ echo "usage: $0 [--publish] <dxmt commit>" >&2
exit 2
fi
-COMMIT_ARG="$1"
# A commit, never a branch or tag that can move: 7 to 40 hex digits, checked below to be
# a prefix of what it resolves to.
case "$COMMIT_ARG" in
@@ -275,6 +290,13 @@ for f in $files; do
|| die "$f embeds Metal code newer than macOS $MACOSX_DEPLOYMENT_TARGET"
done
+# License texts beside the binaries, so a direct download (FreeEngine, not only the
+# installer path) carries them too: LGPL-2.1-or-later since ec357fd (v0.80 was the last
+# MIT release).
+cp "$repo/installer/licenses/COPYING.LIB.dxmt" "$TREE/COPYING.LIB"
+cp "$repo/installer/licenses/LICENSE.dxmt" "$TREE/LICENSE"
+cp "$repo/installer/licenses/LICENSE.dxmt-old" "$TREE/LICENSE-0.80-and-earlier.txt"
+
# Same modes as the release, fixed owners and times, sorted entries and no macOS
# metadata, so the same binaries always give the same tarball.
epoch="$(git -C "$SRC" show -s --format=%ct "$COMMIT")"
@@ -297,6 +319,63 @@ MANIFEST="$OUT/dxmt-$SHORT.sha256"
printf '%s %s\n' "$(sha "$TARBALL")" "$(basename "$TARBALL")"
} > "$MANIFEST"
+# --- source tarball ----------------------------------------------------------------
+# Corresponding Source (LGPL-2.1-or-later): the exact worktree this build ran from,
+# submodules included (DXMT vendors external/nvapi and include/native/directx that
+# way), without git's own metadata. LGPL-2.1-or-later asks whoever distributes this
+# build to also provide that source, so it ships beside the binaries.
+SRC_STAGE="$OUT/stage-source"
+SRC_TREE="$SRC_STAGE/$SHORT"
+rm -rf "$SRC_STAGE"
+mkdir -p "$SRC_TREE"
+( cd "$SRC" && find . -name .git -prune -o -type f -print ) | sed 's#^\./##' > "$OUT/.srclist"
+( cd "$SRC" && tar -cf - -T "$OUT/.srclist" ) | tar -x -C "$SRC_TREE"
+rm -f "$OUT/.srclist"
+find "$SRC_TREE" -type d -exec chmod 755 {} +
+find "$SRC_TREE" -type f -exec chmod 644 {} +
+find "$SRC_STAGE" -exec env TZ=UTC touch -h -t "$stamp" {} +
+SOURCE_TARBALL="$OUT/dxmt-$SHORT-source.tar.gz"
+( cd "$SRC_STAGE" && find "$SHORT" | LC_ALL=C sort ) > "$OUT/.srcfilelist"
+( cd "$SRC_STAGE" && COPYFILE_DISABLE=1 tar --format ustar --uid 0 --gid 0 --uname "" --gname "" \
+ --no-xattrs --no-mac-metadata --no-acls --no-fflags -c -n -T "$OUT/.srcfilelist" -f - ) \
+ | gzip -n -9 > "$SOURCE_TARBALL"
+rm -f "$OUT/.srcfilelist"
+printf '%s %s\n' "$(sha "$SOURCE_TARBALL")" "$(basename "$SOURCE_TARBALL")" >> "$MANIFEST"
+
log "DXMT $COMMIT built in $(( $(date +%s) - start ))s"
log "tarball: $TARBALL (tree: $SHORT)"
+log "source tarball: $SOURCE_TARBALL"
cat "$MANIFEST"
+
+if [ "$PUBLISH" -eq 1 ]; then
+ slug=raymondchins/Bridgeplay
+ tag="dxmt-$SHORT"
+ if gh release view "$tag" -R "$slug" >/dev/null 2>&1; then
+ # Add what the release lacks, such as the source of a release that predates it.
+ # Never replace an asset: the app pins the published binary tarball by sha256.
+ assets="$(gh release view "$tag" -R "$slug" --json assets -q '.assets[].name')"
+ missing=()
+ for f in "$TARBALL" "$SOURCE_TARBALL"; do
+ grep -qxF "$(basename "$f")" <<<"$assets" || missing+=("$f")
+ done
+ # The manifest lists this build's tarball, so it only fits a release holding that one.
+ if ! grep -qxF "$(basename "$MANIFEST")" <<<"$assets"; then
+ published="$(gh release view "$tag" -R "$slug" --json assets \
+ -q ".assets[] | select(.name == \"$(basename "$TARBALL")\") | .digest")"
+ if [ -z "$published" ] || [ "$published" = "sha256:$(sha "$TARBALL")" ]; then
+ missing+=("$MANIFEST")
+ fi
+ fi
+ if [ "${#missing[@]}" -gt 0 ]; then
+ gh release upload "$tag" "${missing[@]}" -R "$slug"
+ log "added ${#missing[@]} asset(s) to https://github.com/$slug/releases/tag/$tag"
+ else
+ log "$tag is already published"
+ fi
+ else
+ gh release create "$tag" "$TARBALL" "$SOURCE_TARBALL" "$MANIFEST" -R "$slug" \
+ --prerelease --latest=false --title "DXMT $SHORT" \
+ --notes "DXMT built from https://github.com/3Shain/dxmt at $COMMIT ($(git -C "$SRC" describe --always)). LGPL-2.1-or-later since ec357fd (v0.80 was the last MIT release); license texts and the dxmt-$SHORT-source.tar.gz Corresponding Source (submodules included) ship alongside the binaries. See docs/DXMT.md."
+ log "published https://github.com/$slug/releases/tag/$tag"
+ fi
+fi
diff --git a/scripts/package-wine-patch-sources.sh b/scripts/package-wine-patch-sources.sh
new file mode 100755
index 0000000..3b1d85d
--- /dev/null
+++ b/scripts/package-wine-patch-sources.sh
@@ -0,0 +1,165 @@
+#!/bin/sh
+# Pack the Corresponding Source (LGPL-2.1-or-later) of the patched WineCX binaries listed
+# in NOTICE under "Patched Wine (WineCX) binaries": a full source tree of winecx at each
+# pinned commit, plus every patch directory in this repository and the recipe docs, into
+# out/wine-patch-sources-<id>.tar.gz. The id is derived from the pinned commits and the
+# patch files, so it only changes when one of those does.
+#
+# scripts/package-wine-patch-sources.sh pack, then print the pin for NOTICE
+# scripts/package-wine-patch-sources.sh --publish also create the GitHub release that hosts it
+#
+# The source for these binaries is winecx (https://github.com/dappermint/winecx) at the
+# exact commits patched, plus the patches here. LGPL-2.1-or-later asks whoever distributes
+# the binaries to also provide that source, so Bridgeplay publishes it alongside its own
+# releases, crediting winecx as the source. Run it again whenever docs/WINECX.md's winecx
+# pins change, then run with --publish and update NOTICE's pin.
+set -eu
+
+die() { echo "==> $*" >&2; exit 1; }
+
+repo=$(cd "$(dirname "$0")/.." && pwd)
+cd "$repo"
+publish=0
+case "${1:-}" in
+ --publish) publish=1 ;;
+ "") ;;
+ *) die "usage: $0 [--publish]" ;;
+esac
+
+# Keep this list in step with the "Patched Wine (WineCX) binaries" section of NOTICE.
+patch_dirs="win32u-patch winemac-patch winebus-patch winecoreaudio-patch wined3d-patch ws2_32-patch d3dx11-patch ngx-signer-patch hide-wine-exports-patch ntdll-patch"
+for d in $patch_dirs; do
+ [ -d "$d" ] || die "missing $d; update patch_dirs in $0 to match NOTICE"
+done
+
+winecx_url=https://github.com/dappermint/winecx.git
+sha_1117=$(sed -n 's/^ WineCX 11\.17 (winecx \([0-9a-f]\{40\}\), runtime.*/\1/p' NOTICE)
+sha_1115=$(sed -n 's/^ WineCX 11\.15 (winecx \([0-9a-f]\{40\}\), runtime.*/\1/p' NOTICE)
+[ -n "$sha_1117" ] && [ -n "$sha_1115" ] || die "could not read the winecx pins from NOTICE"
+# docs/WINECX.md holds the pins the binaries are built from, so NOTICE must agree with it.
+for sha in "$sha_1117" "$sha_1115"; do
+ grep -qF "winecx \`$sha\`" docs/WINECX.md || die "winecx $sha in NOTICE is not pinned in docs/WINECX.md"
+done
+
+# The id covers every input that determines the archive's bytes (except the generated
+# README.md, whose only variables -- $id and the two short shas -- are themselves already
+# hashed below): the two commits, every patch file's content and executable bit, the two
+# recipe/license files copied in below, and this script itself (its README template and
+# winecx_url are otherwise invisible to the hash). So any of them changing gives a new id,
+# and --publish never mistakes stale content for what's already published under an
+# unchanged name. Only tracked files count, so build output left in a patch directory can't
+# change the id or end up in the archive.
+id=$(
+ {
+ printf '%s\n%s\n' "$sha_1117" "$sha_1115"
+ for d in $patch_dirs; do
+ git ls-files "$d" | LC_ALL=C sort | while read -r f; do
+ stat -f '%Lp' "$f"
+ shasum -a 256 "$f"
+ done
+ done
+ shasum -a 256 docs/WINECX.md LICENSE.wine scripts/package-wine-patch-sources.sh
+ } | shasum -a 256 | cut -c1-12
+)
+name=wine-patch-sources-$id
+
+work=$(mktemp -d)
+trap 'rm -rf "$work"' EXIT
+mirror="$repo/scratch/wine-patch-sources-build/winecx.git"
+mkdir -p "$(dirname "$mirror")"
+if [ ! -d "$mirror" ]; then
+ echo "==> cloning winecx (bare, shared by both pins)"
+ git clone --quiet --bare "$winecx_url" "$mirror"
+fi
+for sha in "$sha_1117" "$sha_1115"; do
+ git -C "$mirror" cat-file -e "$sha^{commit}" 2>/dev/null \
+ || git -C "$mirror" fetch --quiet origin "$sha"
+ git -C "$mirror" cat-file -e "$sha^{commit}" 2>/dev/null || die "winecx $sha not found"
+done
+
+stage="$work/$name"
+mkdir -p "$stage/patches"
+for d in $patch_dirs; do
+ git ls-files "$d" | while read -r f; do
+ mkdir -p "$stage/patches/$(dirname "$f")"
+ cp "$f" "$stage/patches/$f"
+ done
+done
+# Not NOTICE: it names this archive's own sha256, so bundling it would make the archive's
+# bytes, and so its sha256, depend on what was last pasted into NOTICE.
+cp docs/WINECX.md LICENSE.wine "$stage/"
+# Only their content is hashed into id above, not their mode; force a fixed mode so a
+# stray +x in the working tree can't change the archive's bytes under an unchanged id.
+chmod 644 "$stage/WINECX.md" "$stage/LICENSE.wine"
+
+extract() {
+ short=$(git -C "$mirror" rev-parse --short=12 "$1")
+ dest="$stage/winecx-$2-$short"
+ mkdir -p "$dest"
+ # tar.umask defaults to the archiving user's git config (0002, or their umask if set to
+ # "user"), so without pinning it here the modes git archive writes, and so what the
+ # chmod pass below normalizes them to, would depend on whoever runs this script.
+ # core.attributesFile defaults to a path under the user's home directory; export-ignore
+ # or export-subst rules there would change which files or bytes come out of this archive
+ # without changing winecx's pinned commit, so point it at nothing instead.
+ git -c tar.umask=0022 -c core.attributesFile=/dev/null \
+ -C "$mirror" archive --format=tar "$1" | tar -x -C "$dest"
+}
+extract "$sha_1117" 11.17
+extract "$sha_1115" 11.15
+
+cat >"$stage/README.md" <<EOF
+# WineCX patch sources
+
+The LGPL-2.1-or-later Corresponding Source for the patched Wine (WineCX) binaries that
+NOTICE lists under "Patched Wine (WineCX) binaries" ($id):
+
+- \`winecx-11.17-$(git -C "$mirror" rev-parse --short=12 "$sha_1117")/\` and
+ \`winecx-11.15-$(git -C "$mirror" rev-parse --short=12 "$sha_1115")/\`: the unmodified
+ winecx source at the commit each binary is built from (dappermint/winecx,
+ $winecx_url).
+- \`patches/\`: this repository's patches and build recipes, one directory per binary,
+ copied as of this archive.
+- \`WINECX.md\`: how Bridgeplay lays the binaries over the engine and the per-binary build
+ recipes; \`LICENSE.wine\`: Wine's license notice and the LGPL-2.1 text. The full list
+ mapping each shipped file to its source commit and patch is NOTICE, in the Bridgeplay
+ repository (https://github.com/raymondchins/Bridgeplay/blob/main/NOTICE).
+
+Built by \`scripts/package-wine-patch-sources.sh\`.
+EOF
+
+# Keep each file's executable bit: winecx's configure and its own build scripts need it
+# to match the "Rebuilding" recipes in docs/WINECX.md and each patch's README.
+find "$stage" -type d -exec chmod 755 {} +
+find "$stage" -type f -perm -u+x -exec chmod 755 {} +
+find "$stage" -type f ! -perm -u+x -exec chmod 644 {} +
+find "$stage" -exec env TZ=UTC touch -h -t 202601010000 {} +
+(cd "$work" && find "$name" -type f | LC_ALL=C sort) >"$work/list"
+mkdir -p out
+archive=out/$name.tar.gz
+(cd "$work" && COPYFILE_DISABLE=1 tar --uid 0 --gid 0 --uname root --gname wheel --no-xattrs \
+ --no-mac-metadata -cf - -T "$work/list") | gzip -n -9 >"$archive"
+sha=$(shasum -a 256 "$archive" | cut -d' ' -f1)
+echo "==> $archive ($(du -h "$archive" | cut -f1 | tr -d ' ')), sha256 $sha"
+
+echo "==> pin for NOTICE (Patched Wine (WineCX) binaries):"
+echo " archive: $name.tar.gz"
+echo " sha256: $sha"
+echo " release tag: $name"
+
+[ "$publish" -eq 1 ] || exit 0
+slug=raymondchins/Bridgeplay
+if gh release view "$name" -R "$slug" >/dev/null 2>&1; then
+ if gh release view "$name" -R "$slug" --json assets -q '.assets[].name' | grep -qxF "$name.tar.gz"; then
+ echo "==> $name is already published"
+ else
+ # A release left without its asset by a failed upload.
+ gh release upload "$name" "$archive" -R "$slug"
+ echo "==> uploaded $name.tar.gz to https://github.com/$slug/releases/tag/$name"
+ fi
+ exit 0
+fi
+gh release create "$name" "$archive" -R "$slug" --prerelease --latest=false \
+ --title "WineCX patch sources ($id)" \
+ --notes "The LGPL-2.1-or-later Corresponding Source for the patched Wine (WineCX) binaries in NOTICE: winecx at the pinned commits plus this repository's patches and build recipes. Built by scripts/package-wine-patch-sources.sh."
+echo "==> published https://github.com/$slug/releases/tag/$name"
diff --git a/scripts/release-local.sh b/scripts/release-local.sh
index 71d1f66..7cb860a 100755
--- a/scripts/release-local.sh
+++ b/scripts/release-local.sh
@@ -124,6 +124,18 @@ fonts_tag=${fonts_archive%.tar.xz}
gh release view "$fonts_tag" -R "$slug" --json assets -q '.assets[].name' 2>/dev/null | grep -qx "$fonts_archive" \
|| check "$fonts_tag has no $fonts_archive on GitHub; run scripts/package-fonts.sh --publish"
+# This release ships the patched WineCX binaries in Resources/; the license asks Bridgeplay
+# to also provide their source, which NOTICE's written offer points at wine-patch-sources-*
+# (scripts/package-wine-patch-sources.sh).
+wine_src_archive=$(sed -n 's/^ \(wine-patch-sources-[0-9a-f]*\.tar\.gz\), sha256$/\1/p' NOTICE)
+[ -n "$wine_src_archive" ] || die "no wine-patch-sources archive pinned in NOTICE"
+wine_src_sha=$(sed -n '/^ wine-patch-sources-[0-9a-f]*\.tar\.gz, sha256$/{n;s/^ \([0-9a-f]\{64\}\),.*/\1/p;}' NOTICE)
+[ -n "$wine_src_sha" ] || die "no wine-patch-sources sha256 pinned in NOTICE"
+wine_src_tag=${wine_src_archive%.tar.gz}
+gh release view "$wine_src_tag" -R "$slug" --json assets -q ".assets[] | select(.name == \"$wine_src_archive\") | .digest" 2>/dev/null \
+ | grep -qx "sha256:$wine_src_sha" \
+ || check "$wine_src_tag has no $wine_src_archive matching NOTICE's sha256 on GitHub; run scripts/package-wine-patch-sources.sh --publish"
+
sparkle=app/.build/artifacts/sparkle/Sparkle/bin
[ -x "$sparkle/generate_appcast" ] || swift build --package-path app >/dev/null
[ -x "$sparkle/generate_appcast" ] || die "no Sparkle tools at $sparkle"