BlueGit

ict rusty-teams

Files

rusty-teams / packaging / kvt / build-windows.sh

build-windows.sh

build-windows.sh 1.7 KiB Download Raw
1#!/usr/bin/env bash
2# KVT fork: cross-build target/x86_64-pc-windows-msvc/release/teams.exe in a Linux
3# CI container. Wraps upstream's scripts/build-windows.sh (cargo-xwin, patched
4# gpui-pre-windows, embedded onnxruntime.dll) and swaps its WSL fxc for
5# packaging/kvt/fxc-wine.sh. Keeping upstream's script as is keeps merges small.
6set -euo pipefail
7ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
8# Microsoft.Windows.SDK.CPP from nuget.org carries fxc.exe and d3dcompiler_47.dll.
9SDK_VERSION="${KVT_WINDOWS_SDK_VERSION:-10.0.28000.2957}"
10SDK_SHA256="${KVT_WINDOWS_SDK_SHA256:-f0a200dae58858f418b30dc9e2f52b4188f97eb7837bd4f73074652a01937ddd}"
11export FXC_DIR="${FXC_DIR:-$ROOT/target/kvt-fxc/$SDK_VERSION}"
12if [[ ! -f "$FXC_DIR/fxc.exe" || ! -f "$FXC_DIR/d3dcompiler_47.dll" ]]; then
13 mkdir -p "$FXC_DIR"
14 nupkg="$FXC_DIR/sdk.nupkg"
15 curl -fsSL --retry 3 -o "$nupkg" \
16 "https://api.nuget.org/v3-flatcontainer/microsoft.windows.sdk.cpp/$SDK_VERSION/microsoft.windows.sdk.cpp.$SDK_VERSION.nupkg"
17 echo "$SDK_SHA256 $nupkg" | sha256sum -c -
18 unzip -o -q -j "$nupkg" "c/bin/${SDK_VERSION%.*}.0/x64/fxc.exe" "c/bin/${SDK_VERSION%.*}.0/x64/d3dcompiler_47.dll" -d "$FXC_DIR"
19 rm -f "$nupkg"
20fi
21script="$(mktemp)"
22trap 'rm -f "$script"' EXIT
23sed 's#^export GPUI_FXC_PATH=.*#export GPUI_FXC_PATH="$repoRoot/packaging/kvt/fxc-wine.sh"#' \
24 "$ROOT/scripts/build-windows.sh" > "$script"
25grep -q 'packaging/kvt/fxc-wine.sh' "$script" || {
26 echo "scripts/build-windows.sh no longer sets GPUI_FXC_PATH; update packaging/kvt/build-windows.sh" >&2
27 exit 1
28}
29# The copy lives in /tmp; point its repoRoot at this checkout.
30sed -i "s#^repoRoot=.*#repoRoot=\"$ROOT\"#" "$script"
31export CARGO_TARGET_DIR="$ROOT/target"
32bash "$script" "$ROOT/crates/app" teams