lua.py (851B)
1 #!/usr/bin/env python 2 # encoding: utf-8 3 # Sebastian Schlingmann, 2008 4 # Thomas Nagy, 2008-2018 (ita) 5 6 """ 7 Lua support. 8 9 Compile *.lua* files into *.luac*:: 10 11 def configure(conf): 12 conf.load('lua') 13 conf.env.LUADIR = '/usr/local/share/myapp/scripts/' 14 def build(bld): 15 bld(source='foo.lua') 16 """ 17 18 from waflib.TaskGen import extension 19 from waflib import Task 20 21 @extension('.lua') 22 def add_lua(self, node): 23 tsk = self.create_task('luac', node, node.change_ext('.luac')) 24 inst_to = getattr(self, 'install_path', self.env.LUADIR and '${LUADIR}' or None) 25 if inst_to: 26 self.add_install_files(install_to=inst_to, install_from=tsk.outputs) 27 return tsk 28 29 class luac(Task.Task): 30 run_str = '${LUAC} -s -o ${TGT} ${SRC}' 31 color = 'PINK' 32 33 def configure(conf): 34 """ 35 Detect the luac compiler and set *conf.env.LUAC* 36 """ 37 conf.find_program('luac', var='LUAC') 38