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.
This commit is contained in:
MiTHRAL 2026-08-27 14:19:46 -04:00
parent 81189576c0
commit d809bbc25a

View file

@ -42,8 +42,18 @@ if errorlevel 1 (
exit /b 1
)
rem Prevent Git Bash from converting/corrupting %LIB% and semicolon paths.
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).