skate3recomp-multiplayer/tools/release/windows-build.cmd
MiTHRAL d809bbc25a windows-build.cmd: also exclude MSYS environment conversion (%LIB%)
The kernel32.lib LNK1104 persists despite MSYS2_ARG_CONV_EXCL because that
only protects command-line ARGUMENTS - MSYS/Git Bash still rewrites the
%LIB% ENVIRONMENT variable (backslashes + semicolons), so link.exe receives
POSIX paths and cannot find kernel32.lib. Set MSYS2_ENV_CONV_EXCL=* too, and
print LIB + warn when it is empty after vcvarsall.
2026-08-27 14:19:46 -04:00

73 lines
No EOL
2.7 KiB
Batchfile

@echo off
rem One-click Windows release build for skate3recomp-multiplayer.
rem
rem Fixes the known Windows build issues documented in /mnt/archive/Issues.txt
rem (and mirrored in docs/releases.md):
rem 1. stable Windows SDK so kernel32.lib resolves (vcvarsall with an SDK
rem version instead of the broken default),
rem 2. Git Bash %LIB% mangling (MSYS2_ARG_CONV_EXCL=*),
rem 3. missing rexglue submodules (git submodule update --init + self-heal).
rem
rem Usage (from a normal cmd.exe / PowerShell prompt):
rem tools\release\windows-build.cmd [--tag vX.Y.Z] [--upload]
rem
rem Config via environment variables:
rem VCVARSALL path to vcvarsall.bat (default: VS 18 Community x64)
rem WINSDK Windows SDK version (default 10.0.26100.0; try 10.0.22621.0
rem if yours is different)
rem GITBASH path to Git for Windows bash.exe
setlocal
if "%VCVARSALL%"=="" set "VCVARSALL=%ProgramFiles%\Microsoft Visual Studio\18\Community\VC\Auxiliary\Build\vcvarsall.bat"
if "%WINSDK%"=="" set "WINSDK=10.0.26100.0"
if "%GITBASH%"=="" set "GITBASH=%ProgramFiles%\Git\bin\bash.exe"
if not exist "%VCVARSALL%" (
echo [ERROR] vcvarsall.bat not found: %VCVARSALL%
echo Set VCVARSALL to your Visual Studio install, e.g.
echo "%%ProgramFiles%%\Microsoft Visual Studio\17\Community\VC\Auxiliary\Build\vcvarsall.bat"
exit /b 1
)
if not exist "%GITBASH%" (
echo [ERROR] Git Bash not found: %GITBASH%
echo Install Git for Windows or set GITBASH.
exit /b 1
)
echo [1/3] Loading MSVC environment (x64, SDK %WINSDK%)
call "%VCVARSALL%" x64 %WINSDK%
if errorlevel 1 (
echo [ERROR] vcvarsall failed. Try a different WINSDK, e.g.
echo set WINSDK=10.0.22621.0
exit /b 1
)
rem Prevent Git Bash from converting/corrupting the MSVC environment.
rem MSYS2_ARG_CONV_EXCL protects command-line ARGUMENTS; the actual
rem kernel32.lib LNK1104 is caused by MSYS rewriting the %LIB% ENVIRONMENT
rem variable (backslashes + semicolons), which requires MSYS2_ENV_CONV_EXCL.
set "MSYS2_ARG_CONV_EXCL=*"
set "MSYS2_ENV_CONV_EXCL=*"
if "%LIB%"=="" (
echo [WARN] LIB is empty after vcvarsall - try a different WINSDK
echo e.g. set WINSDK=10.0.22621.0
)
echo LIB=%LIB%
rem Convert the repo path to forward slashes for Git Bash (%~dp0 is
rem tools\release\ with a trailing backslash; ..\.. reaches the repo root).
set "REPO=%~dp0..\.."
set "REPO=%REPO:\=/%"
echo [2/3] Initializing submodules (rexglue SDK + nested)
"%GITBASH%" --login -c "cd '%REPO%' && git submodule update --init --jobs 4 && bash tools/ci/init-submodules.sh"
if errorlevel 1 (
echo [ERROR] submodule init failed.
exit /b 1
)
echo [3/3] Building release
"%GITBASH%" --login -c "cd '%REPO%' && bash tools/release/release.sh %*"
exit /b %errorlevel%
endlocal