Skip to content

Commit a679e8b

Browse files
committed
feat: build 5.3-5.5 with LUA_32BITS defined
1 parent a5c72b0 commit a679e8b

File tree

2 files changed

+55
-8
lines changed

2 files changed

+55
-8
lines changed

.github/workflows/build.yml

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,36 @@ jobs:
9696
build-lua:
9797
strategy:
9898
matrix: # using ubuntu-22.04 to build a Linux binary targeting older glibc to improve compatibility
99-
os: [{name: ubuntu, version: ubuntu-22.04}, {name: macos, version: macos-latest}, {name: windows, version: windows-latest}]
100-
lua: [{name: '5.1', directory: lua51}, {name: '5.2', directory: lua52}, {name: '5.3', directory: lua53}, {name: '5.4', directory: lua54}, {name: '5.5', directory: lua55}]
99+
os:
100+
- name: ubuntu
101+
version: ubuntu-22.04
102+
- name: macos
103+
version: macos-latest
104+
- name: windows
105+
version: windows-latest
106+
lua:
107+
- name: '5.1'
108+
directory: lua51
109+
- name: '5.2'
110+
directory: lua52
111+
- name: '5.3'
112+
directory: lua53
113+
- name: '5.3 (LUA_32BITS)'
114+
directory: lua53
115+
output: lua53-int32
116+
options: "-DLUA_32BITS"
117+
- name: '5.4'
118+
directory: lua54
119+
- name: '5.4 (LUA_32BITS)'
120+
directory: lua54
121+
output: lua54-int32
122+
options: "-DLUA_32BITS"
123+
- name: '5.5'
124+
directory: lua55
125+
- name: '5.5 (LUA_32BITS)'
126+
directory: lua55
127+
output: lua55-int32
128+
options: "-DLUA_32BITS"
101129
fail-fast: false
102130
name: Build Lua ${{ matrix.lua.name }} (${{ matrix.os.name }})
103131
runs-on: ${{ matrix.os.version }}
@@ -116,20 +144,20 @@ jobs:
116144
- name: Build for Windows
117145
if: matrix.os.name == 'windows'
118146
run: |
119-
..\..\CompileLua.bat
147+
..\..\CompileLua.bat ${{ matrix.lua.options || '' }}
120148
- name: Build for macOS
121149
if: matrix.os.name == 'macos'
122150
run: |
123151
# `make macosx` doesn't allow us to change MYCFLAGS/MYLDFLAGS
124-
make all MYCFLAGS="-DLUA_USE_LINUX -arch arm64 -arch x86_64" MYLIBS="-lreadline" MYLDFLAGS="-arch arm64 -arch x86_64"
152+
make all MYCFLAGS="-DLUA_USE_LINUX ${{ matrix.lua.options || '' }} -arch arm64 -arch x86_64" MYLIBS="-lreadline" MYLDFLAGS="-arch arm64 -arch x86_64"
125153
- name: Build for Linux
126154
if: matrix.os.name == 'ubuntu'
127155
run: |
128-
make linux
156+
make linux MYCFLAGS="${{ matrix.lua.options || '' }}"
129157
- name: Upload artifact
130158
uses: actions/upload-artifact@v6
131159
with:
132-
name: ${{ matrix.lua.directory }}-${{matrix.os.name}}
160+
name: ${{ matrix.lua.output || matrix.lua.directory }}-${{matrix.os.name}}
133161
path: ${{ format(matrix.os.name == 'windows' && '{0}/src/lua.exe' || '{0}/src/lua', matrix.lua.directory) }}
134162
if-no-files-found: error
135163
merge-and-release:

CompileLua.bat

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,28 @@
1010
::
1111

1212
:: Start local variable scope
13-
@SETLOCAL
13+
@SETLOCAL EnableExtensions EnableDelayedExpansion
1414
@ECHO ON
1515

16+
:: Build sanitized args in CL_EXTRA
17+
set "CL_EXTRA="
18+
19+
:ARG_LOOP
20+
if "%~1"=="" goto ARG_DONE
21+
22+
set "arg=%~1"
23+
24+
:: If arg begins with -D..., convert it to /D...
25+
if /I "!arg:~0,2!"=="-D" set "arg=/D!arg:~2!"
26+
27+
:: Preserve quoting per-arg
28+
set "CL_EXTRA=!CL_EXTRA! "!arg!""
29+
30+
shift
31+
goto ARG_LOOP
32+
33+
:ARG_DONE
34+
1635
:ENDSETUP
1736

1837
::
@@ -26,7 +45,7 @@
2645
@IF EXIST *.exe @DEL *.exe
2746

2847
:: Compile all .c files into .obj
29-
@CL /nologo /MT /O2 /W3 /GL /c /D_CRT_SECURE_NO_DEPRECATE *.c
48+
@CL /nologo /MT /O2 /W3 /GL /c /D_CRT_SECURE_NO_DEPRECATE !CL_EXTRA! *.c
3049

3150
:: Rename two special files
3251
@REN lua.obj lua.o

0 commit comments

Comments
 (0)