src/xedkbuild.bat - luajit-2.0-src

Global variables defined

Source code

  1. @rem Script to build LuaJIT with the Xbox 360 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. @if not defined INCLUDE goto :FAIL
  7. @if not defined XEDK goto :FAIL

  8. @setlocal
  9. @rem ---- Host compiler ----
  10. @set LJCOMPILE=cl /nologo /c /MD /O2 /W3 /D_CRT_SECURE_NO_DEPRECATE
  11. @set LJLINK=link /nologo
  12. @set LJMT=mt /nologo
  13. @set DASMDIR=..\dynasm
  14. @set DASM=%DASMDIR%\dynasm.lua
  15. @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

  16. %LJCOMPILE% host\minilua.c
  17. @if errorlevel 1 goto :BAD
  18. %LJLINK% /out:minilua.exe minilua.obj
  19. @if errorlevel 1 goto :BAD
  20. if exist minilua.exe.manifest^
  21.   %LJMT% -manifest minilua.exe.manifest -outputresource:minilua.exe

  22. @rem Error out for 64 bit host compiler
  23. @minilua
  24. @if errorlevel 8 goto :FAIL

  25. @set DASMFLAGS=-D GPR64 -D FRAME32 -D PPE -D SQRT -D DUALNUM
  26. minilua %DASM% -LN %DASMFLAGS% -o host\buildvm_arch.h vm_ppc.dasc
  27. @if errorlevel 1 goto :BAD

  28. %LJCOMPILE% /I "." /I %DASMDIR% /D_XBOX_VER=200 /DLUAJIT_TARGET=LUAJIT_ARCH_PPC  host\buildvm*.c
  29. @if errorlevel 1 goto :BAD
  30. %LJLINK% /out:buildvm.exe buildvm*.obj
  31. @if errorlevel 1 goto :BAD
  32. if exist buildvm.exe.manifest^
  33.   %LJMT% -manifest buildvm.exe.manifest -outputresource:buildvm.exe

  34. buildvm -m peobj -o lj_vm.obj
  35. @if errorlevel 1 goto :BAD
  36. buildvm -m bcdef -o lj_bcdef.h %ALL_LIB%
  37. @if errorlevel 1 goto :BAD
  38. buildvm -m ffdef -o lj_ffdef.h %ALL_LIB%
  39. @if errorlevel 1 goto :BAD
  40. buildvm -m libdef -o lj_libdef.h %ALL_LIB%
  41. @if errorlevel 1 goto :BAD
  42. buildvm -m recdef -o lj_recdef.h %ALL_LIB%
  43. @if errorlevel 1 goto :BAD
  44. buildvm -m vmdef -o jit\vmdef.lua %ALL_LIB%
  45. @if errorlevel 1 goto :BAD
  46. buildvm -m folddef -o lj_folddef.h lj_opt_fold.c
  47. @if errorlevel 1 goto :BAD

  48. @rem ---- Cross compiler ----
  49. @set LJCOMPILE="%XEDK%\bin\win32\cl" /nologo /c /MT /O2 /W3 /GF /Gm- /GR- /GS- /Gy /openmp- /D_CRT_SECURE_NO_DEPRECATE /DNDEBUG /D_XBOX /D_LIB /DLUAJIT_USE_SYSMALLOC
  50. @set LJLIB="%XEDK%\bin\win32\lib" /nologo
  51. @set "INCLUDE=%XEDK%\include\xbox"

  52. @if "%1" neq "debug" goto :NODEBUG
  53. @shift
  54. @set "LJCOMPILE=%LJCOMPILE% /Zi"
  55. :NODEBUG
  56. @if "%1"=="amalg" goto :AMALG
  57. %LJCOMPILE% /DLUA_BUILD_AS_DLL lj_*.c lib_*.c
  58. @if errorlevel 1 goto :BAD
  59. %LJLIB% /OUT:luajit20.lib lj_*.obj lib_*.obj
  60. @if errorlevel 1 goto :BAD
  61. @goto :NOAMALG
  62. :AMALG
  63. %LJCOMPILE% /DLUA_BUILD_AS_DLL ljamalg.c
  64. @if errorlevel 1 goto :BAD
  65. %LJLIB% /OUT:luajit20.lib ljamalg.obj lj_vm.obj
  66. @if errorlevel 1 goto :BAD
  67. :NOAMALG

  68. @del *.obj *.manifest minilua.exe buildvm.exe
  69. @echo.
  70. @echo === Successfully built LuaJIT for Xbox 360 ===

  71. @goto :END
  72. :BAD
  73. @echo.
  74. @echo *******************************************************
  75. @echo *** Build FAILED -- Please check the error messages ***
  76. @echo *******************************************************
  77. @goto :END
  78. :FAIL
  79. @echo To run this script you must open a "Visual Studio .NET Command Prompt"
  80. @echo (32 bit host compiler). The Xbox 360 SDK must be installed, too.
  81. :END