allow using the flex shipped with MSYS

(it expects path separated by / instead of \)

Signed-off-by: Thomas Nagy <tnagy2pow10@gmail.com>
This commit is contained in:
Anthony Baire 2012-10-10 11:00:44 +02:00 committed by Thomas Nagy
parent 6499810aec
commit 57b555b5fe
1 changed files with 8 additions and 2 deletions

View File

@ -8,7 +8,7 @@ The **flex** program is a code generator which creates C or C++ files.
The generated files are compiled into object files.
"""
import waflib.TaskGen
import waflib.TaskGen, os, re
def decide_ext(self, node):
if 'cxx' in self.features:
@ -25,7 +25,10 @@ def flexfun(tsk):
tsk.last_cmd = lst = []
lst.extend(to_list(env['FLEX']))
lst.extend(to_list(env['FLEXFLAGS']))
lst.extend([a.path_from(bld.bldnode) for a in tsk.inputs])
inputs = [a.path_from(bld.bldnode) for a in tsk.inputs]
if env.FLEX_MSYS:
inputs = [x.replace(os.sep, '/') for x in inputs]
lst.extend(inputs)
lst = [x for x in lst if x]
txt = bld.cmd_and_log(lst, cwd=wd, env=env.env or None, quiet=0)
tsk.outputs[0].write(txt.replace('\r\n', '\n').replace('\r', '\n')) # issue #1207
@ -44,3 +47,6 @@ def configure(conf):
conf.find_program('flex', var='FLEX')
conf.env.FLEXFLAGS = ['-t']
if re.search (r"\\msys\\[0-9.]+\\bin\\flex.exe$", conf.env.FLEX):
# this is the flex shipped with MSYS
conf.env.FLEX_MSYS = True