Debian Codegraph @

libs/luajit/LuaJIT-src/src/psvitabuild.bat

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