Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add Lua 5.4.7 detection #24

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 45 additions & 3 deletions etc/winmake.bat
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,46 @@ IF NOT EXIST "%LUA_H%" (
goto :EXITERROR
)

rem Check on a Lua 5.1 version
findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MAJOR" %LUA_H% > NUL
if NOT %ERRORLEVEL%==0 (
rem ECHO We've got a Lua version 5.1
rem ECHO We've got a Lua version 5.1.x
rem findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION[ %TABCHAR%]" %LUA_H%
SET LUA_VER=5.1
) else (
rem ECHO We've got a Lua version 5.2+
goto :VERSION_DETECTED
)

rem Check on a Lua 5.4.7+ version
findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MAJOR_N[ %TABCHAR%]" %LUA_H% > NUL
if %ERRORLEVEL%==0 (
rem ECHO We've got a Lua version 5.4.7+
rem findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MAJOR_N[ %TABCHAR%]" %LUA_H%
rem findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MINOR_N[ %TABCHAR%]" %LUA_H%

for /F "delims=" %%a in ('findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MAJOR_N[ %TABCHAR%]" %LUA_H%') do set LUA_MAJOR=%%a
SET LUA_MAJOR=!LUA_MAJOR:#define=!
SET LUA_MAJOR=!LUA_MAJOR:LUA_VERSION_MAJOR_N=!
SET LUA_MAJOR=!LUA_MAJOR: =!
SET LUA_MAJOR=!LUA_MAJOR:%TABCHAR%=!
SET LUA_MAJOR=!LUA_MAJOR:"=!
SET LUA_MAJOR=!LUA_MAJOR:~0,1!

for /F "delims=" %%a in ('findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MINOR_N[ %TABCHAR%]" %LUA_H%') do set LUA_MINOR=%%a
SET LUA_MINOR=!LUA_MINOR:#define=!
SET LUA_MINOR=!LUA_MINOR:LUA_VERSION_MINOR_N=!
SET LUA_MINOR=!LUA_MINOR: =!
SET LUA_MINOR=!LUA_MINOR:%TABCHAR%=!
SET LUA_MINOR=!LUA_MINOR:"=!
SET LUA_MINOR=!LUA_MINOR:~0,1!

SET LUA_VER=!LUA_MAJOR!.!LUA_MINOR!
goto :VERSION_DETECTED
)

rem Check on a Lua version 5.2.0+ to 5.4.6
findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MAJOR[ %TABCHAR%]" %LUA_H% > NUL
if %ERRORLEVEL%==0 (
rem ECHO We've got a Lua version 5.2.0 to 5.4.6
rem findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MAJOR[ %TABCHAR%]" %LUA_H%
rem findstr /R /C:"#define[ %TABCHAR%][ %TABCHAR%]*LUA_VERSION_MINOR[ %TABCHAR%]" %LUA_H%

Expand All @@ -205,7 +238,16 @@ if NOT %ERRORLEVEL%==0 (
SET LUA_MINOR=!LUA_MINOR:~0,1!

SET LUA_VER=!LUA_MAJOR!.!LUA_MINOR!
goto :VERSION_DETECTED
)


echo.
echo Failed to detect the Lua version from %LUA_H%.
goto :EXITERROR


:VERSION_DETECTED
SET LUA_SVER=!LUA_VER:.=!

Echo Lua version found: %LUA_VER%
Expand Down