wscript (2013B)
1 # -*- python -*- 2 3 SRC_DIR = 'lua-5.3.6/src' 4 5 def configure(ctx): 6 ctx.check_cc(lib='m', mandatory=False) 7 if ctx.check_cc(lib='dl', mandatory=False): 8 ctx.env.append_value('DEFINES_LUA', 'LUA_USE_DLOPEN') 9 if ctx.env.DEST_OS != 'win32': 10 ctx.env.append_value('DEFINES_LUA', 'LUA_USE_POSIX') 11 12 if not ctx.env.LUAC_MODE: 13 ctx.env.LUAC_MODE = ctx.env.CROSS and 'copy' or 'luac' 14 ctx.env.append_value('DEFINES_LUA', ['LUA_COMPAT_5_2', 'LUA_COMPAT_5_1']) 15 16 def build(ctx): 17 ctx(idx = 51200, 18 source = 'lua_one.cpp', 19 features = ctx.env.LUA_DLL and 'cxx cxxshlib' or 'cxx cxxstlib', 20 includes = SRC_DIR, 21 export_includes = SRC_DIR, 22 uselib = 'EXT', 23 use = 'LUA DL M', 24 # '#lua53' puts the dll into the root build dir, but names the implib 25 # '#lua53.lib', which works actually, because it links with '-l#lua53', 26 # but on linux it creates a 'liblua53.a' while still trying to link with 27 # '-l#lua53'. '#./lua53' is an ugly workaround, but it works. 28 target = '#./lua53', 29 name = 'lua') 30 31 # maybe optional 32 ctx(idx = 51201, 33 features = 'cxx cxxprogram', 34 source = '%s/lua.c' % SRC_DIR, 35 use = 'lua', 36 uselib = 'EXT', 37 target = 'libshit-lua') 38 ctx(idx = 51202, 39 features = 'cxx cxxprogram', 40 source = 'lua_one.cpp', 41 defines = 'MAKE_LUAC', 42 use = 'lua', 43 uselib = 'EXT', 44 target = 'luac') 45 46 from waflib import Task 47 # task .lua->.h 48 class luac(Task.Task): 49 run_str = '${tsk.executable} ${LUACFLAGS} -o ${TGT} ${SRC}' 50 color = 'BLUE' 51 52 from waflib.TaskGen import taskgen_method 53 @taskgen_method 54 def luac_task(self, inp, out, executable): 55 tmp = inp.change_ext('.luac') 56 tsk = self.create_task('luac', inp, tmp) 57 tsk.executable = executable 58 self.create_task('bin2c', tmp, out) 59 return tsk