1 @rem Script to build LuaJIT with the PS Vita SDK.
\r
2 @rem Donated to the public domain.
\r
4 @rem Open a "Visual Studio .NET Command Prompt" (32 bit host compiler)
\r
5 @rem Then cd to this directory and run this script.
\r
7 @if not defined INCLUDE goto :FAIL
\r
8 @if not defined SCE_PSP2_SDK_DIR goto :FAIL
\r
11 @rem ---- Host compiler ----
\r
12 @set LJCOMPILE=cl /nologo /c /MD /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE
\r
13 @set LJLINK=link /nologo
\r
14 @set LJMT=mt /nologo
\r
15 @set DASMDIR=..\dynasm
\r
16 @set DASM=%DASMDIR%\dynasm.lua
\r
17 @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
\r
19 %LJCOMPILE% host\minilua.c
\r
20 @if errorlevel 1 goto :BAD
\r
21 %LJLINK% /out:minilua.exe minilua.obj
\r
22 @if errorlevel 1 goto :BAD
\r
23 if exist minilua.exe.manifest^
\r
24 %LJMT% -manifest minilua.exe.manifest -outputresource:minilua.exe
\r
26 @rem Check for 32 bit host compiler.
\r
28 @if errorlevel 8 goto :FAIL
\r
30 @set DASMFLAGS=-D FPU -D HFABI
\r
31 minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h vm_arm.dasc
\r
32 @if errorlevel 1 goto :BAD
\r
34 if exist ..\.git ( git show -s --format=%%ct >luajit_relver.txt ) else ( type ..\.relver >luajit_relver.txt )
\r
35 minilua host\genversion.lua
\r
37 %LJCOMPILE% /I "." /I %DASMDIR% -DLUAJIT_TARGET=LUAJIT_ARCH_ARM -DLUAJIT_OS=LUAJIT_OS_OTHER -DLUAJIT_DISABLE_JIT -DLUAJIT_DISABLE_FFI -DLJ_TARGET_PSVITA=1 host\buildvm*.c
\r
38 @if errorlevel 1 goto :BAD
\r
39 %LJLINK% /out:buildvm.exe buildvm*.obj
\r
40 @if errorlevel 1 goto :BAD
\r
41 if exist buildvm.exe.manifest^
\r
42 %LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe
\r
44 buildvm -m elfasm -o lj_vm.s
\r
45 @if errorlevel 1 goto :BAD
\r
46 buildvm -m bcdef -o lj_bcdef.h %ALL_LIB%
\r
47 @if errorlevel 1 goto :BAD
\r
48 buildvm -m ffdef -o lj_ffdef.h %ALL_LIB%
\r
49 @if errorlevel 1 goto :BAD
\r
50 buildvm -m libdef -o lj_libdef.h %ALL_LIB%
\r
51 @if errorlevel 1 goto :BAD
\r
52 buildvm -m recdef -o lj_recdef.h %ALL_LIB%
\r
53 @if errorlevel 1 goto :BAD
\r
54 buildvm -m vmdef -o jit\vmdef.lua %ALL_LIB%
\r
55 @if errorlevel 1 goto :BAD
\r
56 buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
\r
57 @if errorlevel 1 goto :BAD
\r
59 @rem ---- Cross compiler ----
\r
60 @set LJCOMPILE="%SCE_PSP2_SDK_DIR%\host_tools\build\bin\psp2snc" -c -w -DLUAJIT_DISABLE_FFI -DLUAJIT_USE_SYSMALLOC
\r
61 @set LJLIB="%SCE_PSP2_SDK_DIR%\host_tools\build\bin\psp2ld32" -r --output=
\r
64 "%SCE_PSP2_SDK_DIR%\host_tools\build\bin\psp2as" -o lj_vm.o lj_vm.s
\r
66 @if "%1" neq "debug" goto :NODEBUG
\r
68 @set LJCOMPILE=%LJCOMPILE% -g -O0
\r
69 @set TARGETLIB=libluajitD.a
\r
72 @set LJCOMPILE=%LJCOMPILE% -O2
\r
73 @set TARGETLIB=libluajit.a
\r
77 %LJCOMPILE% ljamalg.c
\r
78 @if errorlevel 1 goto :BAD
\r
79 %LJLIB%%TARGETLIB% ljamalg.o lj_vm.o
\r
80 @if errorlevel 1 goto :BAD
\r
82 @del *.o *.obj *.manifest minilua.exe buildvm.exe
\r
84 @echo === Successfully built LuaJIT for PS Vita ===
\r
89 @echo *******************************************************
\r
90 @echo *** Build FAILED -- Please check the error messages ***
\r
91 @echo *******************************************************
\a\r
94 @echo To run this script you must open a "Visual Studio .NET Command Prompt"
\r
95 @echo (32 bit host compiler). The PS Vita SDK must be installed, too.
\r