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