Files
proxy-suite-flake/windows/tools/fxc-wine.sh
T
faumarayandClaude Opus 5.5 77becc235c windows: the app's tray, and its Windows build from Linux
- Tray (gpui-tray): a shield coloured by how things are (working, one
  failed, all off, no service), its tooltip saying which; the menu opens
  the window and switches the local proxy, the DPI bypass and the Telegram
  proxy, with their states checked; Quit. Closing the window leaves the
  app in the tray (no tray: it quits); --hidden starts it there.
- The app builds for Windows from Linux: GPUI compiles its HLSL shaders
  with fxc.exe only when the building machine is Windows, so its Windows
  backend is vendored with that one check made on the target instead
  (vendor/gpui-pre-windows/PATCHED.md, tools/vendor-gpui-windows.py), and
  tools/fxc-wine.sh runs Microsoft's fxc.exe under Wine: the compiler from
  the Windows SDK 10.0.26100 installer, pinned by hash, kept on the build
  machine; only the compiled shaders go into the app.
- gui-shot.sh keeps the app off the desktop's session bus.

Under Wine the app starts but cannot draw text (Wine's DirectWrite does
not implement font-set matching), so its Windows rendering is untested.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 02:03:18 +03:00

48 lines
2.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# fxc.exe, Microsoft's HLSL compiler, under Wine: GPUI's shaders, when the app is cross-compiled
# for Windows (GPUI_FXC_PATH names this; see tools/vendor-gpui-windows.py). The compiler comes
# from the Windows SDK 10.0.26100 that Visual Studio's installer offers, pinned by hash, and
# stays on this machine: only the shaders it compiles go into the app.
#
# GPUI_FXC_PATH=$PWD/tools/fxc-wine.sh cargo xwin build --release -p ps-gui --target x86_64-pc-windows-msvc
set -euo pipefail
CACHE=${XDG_CACHE_HOME:-$HOME/.cache}/proxy-suite-windows/fxc-10.0.26100
CAB_URL=https://download.visualstudio.microsoft.com/download/pr/6452c1f1-dc1e-413c-8b19-991b61870a8b/944d105a33e16da614cbf2a17da22954/69661e20556b3ca9456b946c2c881ddd.cab
CAB_SHA256=bef5b038fce288fa1db234bd61c3e450abecc02f5a386248625073a83010f61e
FXC_SHA256=31fa10504b1551337de4d06ec2194143885a76a8b5a81177999e2faa34729183
DLL_SHA256=2b23efdc8b45adc4b79c1c0b940a906336628cd35ed80defd489d70d22ff6d74
# Their names in the cab: the File table of "Windows SDK for Windows Store Apps Tools", bin/10.0.26100.0/x64.
FXC_IN_CAB=fil6dfaf6bbf56939fbab75b569ffa0fd41
DLL_IN_CAB=fil0d3f984977487cd87127d614f654195b
here=$(dirname "$(realpath "$0")")
pkg() { nix build --no-link --print-out-paths --inputs-from "$here/.." "nixpkgs#$1" | head -1; }
verified() {
[ -f "$CACHE/fxc.exe" ] && [ -f "$CACHE/d3dcompiler_47.dll" ] &&
echo "$FXC_SHA256 $CACHE/fxc.exe" | sha256sum -c --quiet 2>/dev/null &&
echo "$DLL_SHA256 $CACHE/d3dcompiler_47.dll" | sha256sum -c --quiet 2>/dev/null
}
if ! verified; then
mkdir -p "$CACHE"
tmp=$(mktemp -d)
curl -sSfL -o "$tmp/tools.cab" "$CAB_URL"
echo "$CAB_SHA256 $tmp/tools.cab" | sha256sum -c --quiet
(cd "$tmp" && "$(pkg gcab.bin)/bin/gcab" -x tools.cab "$FXC_IN_CAB" "$DLL_IN_CAB")
mv "$tmp/$FXC_IN_CAB" "$CACHE/fxc.exe"
mv "$tmp/$DLL_IN_CAB" "$CACHE/d3dcompiler_47.dll"
rm -rf "$tmp"
verified || { echo "fxc-wine.sh: the extracted compiler does not match its hashes" >&2; exit 1; }
fi
WINE=$(pkg wineWow64Packages.stable)/bin
export WINEPREFIX=$CACHE/wine WINEDEBUG=-all WINEDLLOVERRIDES="mscoree,mshtml="
[ -d "$WINEPREFIX" ] || "$WINE/wineboot" -i >/dev/null 2>&1 || true
# Unix paths (the shader sources, the headers it writes) as Wine's Z: paths; a lone /X is a switch.
args=()
for a in "$@"; do
if [[ $a == /*/* ]]; then args+=("$("$WINE/winepath" -w "$a")"); else args+=("$a"); fi
done
exec "$WINE/wine" "$CACHE/fxc.exe" "${args[@]}"