Skip to content

Commit 03387ca

Browse files
committed
Switch to vanilla LuaJIT 2.1 (Mike Pall's)
1 parent c86fb00 commit 03387ca

File tree

5 files changed

+36
-13
lines changed

5 files changed

+36
-13
lines changed

.gitmodules

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[submodule "luajit2"]
22
path = luajit2
3-
url = https://github.com/openresty/luajit2
3+
url = https://github.com/LuaJIT/LuaJIT.git
4+
branch = v2.1

Cargo.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ keywords = ["lua", "luajit"]
88
readme = "README.md"
99
license = "MIT"
1010
description = """
11-
Sources of LuaJIT 2.1 (OpenResty's branch) and logic to build it.
11+
Sources of LuaJIT 2.1 and logic to build it.
1212
"""
13-
exclude = ["/luajit2/doc", "/luajit2/etc", "/luajit2/t"]
13+
exclude = ["/luajit2/doc", "/luajit2/etc"]
1414

1515
[dependencies]
1616
cc = "1.0"

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
[Build Status]: https://github.com/khvzak/luajit-src-rs/workflows/CI/badge.svg
66
[github-actions]: https://github.com/khvzak/luajit-src-rs/actions
77

8-
This crate contains the sources of LuaJIT 2.1 (OpenResty's [branch]) and logic to build it.
8+
This crate contains the sources of [LuaJIT] 2.1 (from Mike Pall) and logic to build it.
99
Intended to be consumed by the [mlua-sys] crate.
1010

11-
[branch]: https://github.com/openresty/luajit2
11+
[LuaJIT]: https://github.com/LuaJIT/LuaJIT
1212
[mlua-sys]: https://crates.io/crates/mlua-sys
1313

1414
# License

extras/msvcbuild.bat

+29-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
@rem Script to build LuaJIT with MSVC.
2-
@rem Copyright (C) 2005-2022 Mike Pall. See Copyright Notice in luajit.h
2+
@rem Copyright (C) 2005-2023 Mike Pall. See Copyright Notice in luajit.h
33
@rem
44
@rem Open a "Visual Studio Command Prompt" (either x86 or x64).
55
@rem Then cd to this directory and run this script. Use the following
@@ -28,27 +28,37 @@
2828
@set BUILDTYPE=release
2929
@set ALL_LIB=lib_base.c lib_math.c lib_bit.c lib_string.c lib_table.c lib_io.c lib_os.c lib_package.c lib_debug.c lib_jit.c lib_ffi.c lib_buffer.c
3030

31+
@setlocal
32+
@call :SETHOSTVARS
3133
%LJCOMPILE% host\minilua.c
3234
@if errorlevel 1 goto :BAD
3335
%LJLINK% /out:minilua.exe minilua.obj
3436
@if errorlevel 1 goto :BAD
3537
if exist minilua.exe.manifest^
3638
%LJMT% -manifest minilua.exe.manifest -outputresource:minilua.exe
39+
@endlocal
3740

38-
@set DASMFLAGS=-D WIN -D JIT -D FFI -D P64
41+
@set DASMFLAGS=-D WIN -D JIT -D FFI -D ENDIAN_LE -D FPU -D P64
3942
@set LJARCH=x64
4043
@minilua
41-
@if errorlevel 8 goto :X64
44+
@if errorlevel 8 goto :NO32
4245
@set DASC=vm_x86.dasc
43-
@set DASMFLAGS=-D WIN -D JIT -D FFI
46+
@set DASMFLAGS=-D WIN -D JIT -D FFI -D ENDIAN_LE -D FPU
4447
@set LJARCH=x86
4548
@set LJCOMPILE=%LJCOMPILE% /arch:SSE2
49+
@goto :DA
50+
:NO32
51+
@if "%VSCMD_ARG_TGT_ARCH%" neq "arm64" goto :X64
52+
@set DASC=vm_arm64.dasc
53+
@set DASMTARGET=-D LUAJIT_TARGET=LUAJIT_ARCH_ARM64
54+
@set LJARCH=arm64
55+
@goto :DA
4656
:X64
47-
@if "%1" neq "nogc64" goto :GC64
57+
@if "%1" neq "nogc64" goto :DA
4858
@shift
4959
@set DASC=vm_x86.dasc
5060
@set LJCOMPILE=%LJCOMPILE% /DLUAJIT_DISABLE_GC64
51-
:GC64
61+
:DA
5262
minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h %DASC%
5363
@if errorlevel 1 goto :BAD
5464

@@ -57,12 +67,18 @@ minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h %DASC%
5767
@set LJCOMPILE=%LJCOMPILE% /DLUAJIT_ENABLE_LUA52COMPAT
5868
:NOLUA52C
5969

60-
%LJCOMPILE% /I "." /I %DASMDIR% host\buildvm*.c
70+
if exist ..\.git ( git show -s --format=%%ct >luajit_relver.txt ) else ( type ..\.relver >luajit_relver.txt )
71+
minilua host\genversion.lua
72+
73+
@setlocal
74+
@call :SETHOSTVARS
75+
%LJCOMPILE% /I "." /I %DASMDIR% %DASMTARGET% host\buildvm*.c
6176
@if errorlevel 1 goto :BAD
6277
%LJLINK% /out:buildvm.exe buildvm*.obj
6378
@if errorlevel 1 goto :BAD
6479
if exist buildvm.exe.manifest^
6580
%LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe
81+
@endlocal
6682

6783
buildvm -m peobj -o lj_vm.obj
6884
@if errorlevel 1 goto :BAD
@@ -121,6 +137,12 @@ if exist luajit.exe.manifest^
121137
@echo.
122138
@echo === Successfully built LuaJIT for Windows/%LJARCH% ===
123139

140+
@goto :END
141+
:SETHOSTVARS
142+
@if "%VSCMD_ARG_HOST_ARCH%_%VSCMD_ARG_TGT_ARCH%" equ "x64_arm64" (
143+
call "%VSINSTALLDIR%Common7\Tools\VsDevCmd.bat" -arch=%VSCMD_ARG_HOST_ARCH% -no_logo
144+
echo on
145+
)
124146
@goto :END
125147
:BAD
126148
@echo.

luajit2

Submodule luajit2 updated 249 files

0 commit comments

Comments
 (0)