Skip to content

Commit

Permalink
[luajit] Use nmake build setup [skip actions]
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt committed Apr 2, 2023
1 parent 69efe9c commit 900034b
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 245 deletions.
139 changes: 0 additions & 139 deletions ports/luajit/004-fix-build-path-and-crt-linkage.patch

This file was deleted.

17 changes: 17 additions & 0 deletions ports/luajit/Makefile.nmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
all:
@echo _CL_ = $(_CL_)
@echo _LINK_ = $(_LINK_)
cd src && .\msvcbuild.bat $(MSVCBUILD_OPTIONS)

install: src/luajit.exe
-mkdir "$(INSTALLDIR)"
-mkdir "$(INSTALLDIR)\bin"
copy src\luajit.exe "$(INSTALLDIR)\bin\"
if exist src\lua51.dll copy src\lua51.dll "$(INSTALLDIR)\bin\"
-mkdir "$(INSTALLDIR)\lib"
copy src\lua51.lib "$(INSTALLDIR)\lib\"
!IF "$(LJARCH)" == ""
-mkdir "$(INSTALLDIR)\manual-tools"
-mkdir "$(INSTALLDIR)\manual-tools\luajit"
copy buildvm.exe "$(INSTALLDIR)\manual-tools\luajit\"
!ENDIF
2 changes: 1 addition & 1 deletion ports/luajit/luajit.pc.win.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ version=${majver}.${minver}.${relver}-beta3
abiver=51

prefix=@PREFIX@
multilib=@LJIT_LIBDIR@
multilib=lib
exec_prefix=${prefix}
libdir=${exec_prefix}/${multilib}
libname=lua${abiver}
Expand Down
55 changes: 55 additions & 0 deletions ports/luajit/msvcbuild.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
diff --git a/src/msvcbuild.bat b/src/msvcbuild.bat
index aab4ef1..8418a8d 100644
--- a/src/msvcbuild.bat
+++ b/src/msvcbuild.bat
@@ -15,7 +15,7 @@
@setlocal
@rem Add more debug flags here, e.g. DEBUGCFLAGS=/DLUA_USE_APICHECK
@set DEBUGCFLAGS=
-@set LJCOMPILE=cl /nologo /c /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE /D_CRT_STDIO_INLINE=__declspec(dllexport)__inline
+@set LJCOMPILE=cl /nologo /c /D_CRT_SECURE_NO_DEPRECATE /D_CRT_STDIO_INLINE=__declspec(dllexport)__inline
@set LJLINK=link /nologo
@set LJMT=mt /nologo
@set LJLIB=lib /nologo /nodefaultlib
@@ -27,6 +27,11 @@
@set BUILDTYPE=release
@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

+if "%LJARCH%"=="" goto :NATIVE
+if "%LJARCH%"=="x86" @set LJCOMPILE=%LJCOMPILE% /arch:SSE2
+goto :HAVE_BUILDVM
+
+:NATIVE
%LJCOMPILE% host\minilua.c
@if errorlevel 1 goto :BAD
%LJLINK% /out:minilua.exe minilua.obj
@@ -58,6 +63,8 @@ minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h %DASC%
if exist buildvm.exe.manifest^
%LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe

+copy buildvm.exe ..
+:HAVE_BUILDVM
buildvm -m peobj -o lj_vm.obj
@if errorlevel 1 goto :BAD
buildvm -m bcdef -o lj_bcdef.h %ALL_LIB%
@@ -79,10 +86,9 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
@set LJCOMPILE=%LJCOMPILE% /Zi %DEBUGCFLAGS%
@set LJLINK=%LJLINK% /opt:ref /opt:icf /incremental:no
:NODEBUG
-@set LJLINK=%LJLINK% /%BUILDTYPE%
@if "%1"=="amalg" goto :AMALGDLL
@if "%1"=="static" goto :STATIC
-%LJCOMPILE% /MD /DLUA_BUILD_AS_DLL lj_*.c lib_*.c
+%LJCOMPILE% /DLUA_BUILD_AS_DLL lj_*.c lib_*.c /Fdlua51.pdb
@if errorlevel 1 goto :BAD
%LJLINK% /DLL /out:%LJDLLNAME% lj_*.obj lib_*.obj
@if errorlevel 1 goto :BAD
@@ -102,7 +108,7 @@ buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
if exist %LJDLLNAME%.manifest^
%LJMT% -manifest %LJDLLNAME%.manifest -outputresource:%LJDLLNAME%;2

-%LJCOMPILE% luajit.c
+%LJCOMPILE% luajit.c /Fdluajit.pdb
@if errorlevel 1 goto :BAD
%LJLINK% /out:luajit.exe luajit.obj %LJLIBNAME%
@if errorlevel 1 goto :BAD
Loading

0 comments on commit 900034b

Please sign in to comment.