-
Notifications
You must be signed in to change notification settings - Fork 5
/
cross-lua.py
26 lines (22 loc) · 1009 Bytes
/
cross-lua.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import os, sys
output = 'luac.cross'
cdefs = '-DLUA_CROSS_COMPILER'
# Lua source files and include path
lua_files = """lapi.c lcode.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c lmem.c lobject.c lopcodes.c
lparser.c lstate.c lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c lauxlib.c lbaselib.c
ldblib.c liolib.c lmathlib.c loslib.c ltablib.c lstrlib.c loadlib.c linit.c luac.c print.c lrotable.c"""
lua_full_files = " " + " ".join( [ "src/lua/%s" % name for name in lua_files.split() ] )
local_include = "-Isrc/lua -Iinc/desktop -Iinc"
# Compiler/linker options
cccom = "gcc -O2 %s -Wall %s -c $SOURCE -o $TARGET" % ( local_include, cdefs )
linkcom = "gcc -o $TARGET $SOURCES -lm"
# Env for building the program
comp = Environment( CCCOM = cccom,
LINKCOM = linkcom,
ENV = os.environ )
if comp['PLATFORM'] == 'win32':
suffix = ".exe"
else:
suffix = ""
Decider( 'MD5' )
Default( comp.Program( output + suffix, Split( lua_full_files ) ) )