ruby/win32/rtname.cmd
Nobuyoshi Nakada b839989fd2 win32: Add CR to all batch files.
This reverts commit 23f9a0d655c4d405bb2397a147a1523436205486, "win32:
Strip CR from batch files", and add CR to the other batch files too.

`cmd.exe` seems to work well with LF at a glance, but sometimes `goto`
jumps to an unexpected line.  This is probably because it is looking
for the beginning of a line, assuming that all lines end with CRLF,
and as a result mistaking the `goto` operand for a label.
2026-01-26 18:17:45 +09:00

37 lines
859 B
Batchfile
Executable File

@echo off
@setlocal EnableExtensions DisableDelayedExpansion || exit /b -1
set rt=
set rtver=
set osver=
for /f "usebackq" %%I in (`
dumpbin -dependents %1 ^|
findstr -r -i -c:"\<vcruntime.*\.dll$" -c:"\<msvcr.*\.dll$"
`) do (
set rt=%%~nI
)
for %%i in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do @(
::- downcase
call set rt=%%rt:%%i=%%i%%
)
if "%rt%" == "msvcrt" (
call set rtver=60
) else if "%rt:~0,5%" == "msvcr" (
call set rtver=%%rt:msvcr=%%
call set osver=_%%rtver%%
) else if "%rt:~0,9%" == "vcruntime" (
call set rtver=%%rt:vcruntime=%%
call set osver=_%%rtver%%
) else (
(echo %0: %1 is not linked to msvcrt nor vcruntime) 1>&2
exit 1
)
for %%I in (
"PLATFORM = $(TARGET_OS)%osver%"
"RT = %rt%"
"RT_VER = %rtver%"
) do @(
echo %%~I
)