Upgrade to new waf, run ragel in './waf dist' and make ragel optional if the needed files are already generated.
parent
6a477c5f7f
commit
33dd2691c1
33
ragel.py
33
ragel.py
|
@ -1,19 +1,32 @@
|
|||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
# Thomas Nagy, 2006 (ita)
|
||||
|
||||
"Ragel: '.rl' files are converted into .c files using 'ragel': {.rl -> .c -> .o}"
|
||||
|
||||
import TaskGen
|
||||
import TaskGen, Task, Runner
|
||||
|
||||
TaskGen.declare_chain(
|
||||
name = 'ragel',
|
||||
action = '${RAGEL} -o ${TGT} ${SRC}',
|
||||
ext_in = '.rl',
|
||||
ext_out = '.c',
|
||||
before = 'c',
|
||||
)
|
||||
|
||||
def rageltaskfun(task):
|
||||
env = task.env
|
||||
ragelbin = env.get_flat('RAGEL')
|
||||
if ragelbin:
|
||||
cmd = '%s -o %s %s' % (ragelbin, task.outputs[0].bldpath(env), task.inputs[0].srcpath(env))
|
||||
else:
|
||||
src = task.inputs[0].srcpath(env)
|
||||
src = src[:src.rfind('.')] + '.c'
|
||||
cmd = 'cp %s %s' % (src, task.outputs[0].bldpath(env))
|
||||
return Runner.exec_command(cmd)
|
||||
|
||||
rageltask = Task.task_type_from_func('ragel', rageltaskfun, vars = ['RAGEL'], color = 'BLUE', ext_in = '.rl', ext_out = '.c', before = 'c')
|
||||
|
||||
@TaskGen.extension('.rl')
|
||||
@TaskGen.before('c')
|
||||
def ragel(self, node):
|
||||
out = node.change_ext('.c')
|
||||
self.allnodes.append(out)
|
||||
tsk = self.create_task('ragel')
|
||||
tsk.set_inputs(node)
|
||||
tsk.set_outputs(out)
|
||||
|
||||
def detect(conf):
|
||||
dang = conf.find_program('ragel', var='RAGEL')
|
||||
if not dang: conf.fatal('cannot find the program "ragel"')
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# encoding: utf-8
|
||||
|
||||
#import Object, Params, os, sys
|
||||
import Params
|
||||
import Options
|
||||
|
||||
common_uselib = 'glib '
|
||||
|
||||
|
@ -54,7 +54,7 @@ main_source = '''
|
|||
#task.set_outputs(node.change_ext('.o'))
|
||||
|
||||
def lighty_mod(bld, target, src, uselib = '', option = ''):
|
||||
if option and not getattr(Params.g_options, option): return
|
||||
if option and not getattr(Options.options, option): return
|
||||
mod = bld.new_task_gen('cc', 'plugin')
|
||||
mod.target = target
|
||||
mod.source = src
|
||||
|
@ -136,7 +136,7 @@ def build(bld):
|
|||
def configure(conf):
|
||||
env = conf.env
|
||||
#env['LEMON_EXT'] = [ '.y' ]
|
||||
env['LIBDIR'] = Params.g_options.libdir
|
||||
env['APPEND'] = Params.g_options.append
|
||||
env['LIBDIR'] = Options.options.libdir
|
||||
env['APPEND'] = Options.options.append
|
||||
env['plugin_INST_VAR'] = 'LIBDIR'
|
||||
env['plugin_INST_DIR'] = ''
|
||||
|
|
17
wscript
17
wscript
|
@ -1,7 +1,7 @@
|
|||
#! /usr/bin/env python
|
||||
# encoding: utf-8
|
||||
|
||||
import Params, types, sys, Runner
|
||||
import Options, types, sys, Runner
|
||||
|
||||
# the following two variables are used by the target "waf dist"
|
||||
VERSION='2.0-pre'
|
||||
|
@ -15,7 +15,7 @@ def set_options(opt):
|
|||
# the gcc module provides a --debug-level option
|
||||
|
||||
opt.tool_options('compiler_cc')
|
||||
opt.tool_options('ragel', tooldir = '.')
|
||||
opt.tool_options('ragel', tdir = '.')
|
||||
|
||||
#opt.add_option('--with-xattr', action='store_true', help='xattr-support for the stat-cache [default: off]', dest='xattr', default = False)
|
||||
#opt.add_option('--with-mysql', action='store_true', help='with mysql-support for the mod_sql_vhost [default: off]', dest = 'mysql', default = False)
|
||||
|
@ -191,7 +191,7 @@ def PKGCONFIG(conf, name, uselib = None, define = '', version = '', mandatory =
|
|||
return res
|
||||
|
||||
def configure(conf):
|
||||
opts = Params.g_options
|
||||
opts = Options.options
|
||||
|
||||
conf.check_tool('compiler_cc')
|
||||
conf.check_tool('ragel', tooldir = '.')
|
||||
|
@ -451,10 +451,15 @@ class TestObject:
|
|||
def run_tests():
|
||||
import UnitTest
|
||||
unittest = UnitTest.unit_test()
|
||||
unittest.want_to_see_test_output = Params.g_options.verbose
|
||||
unittest.want_to_see_test_error = Params.g_options.verbose
|
||||
unittest.want_to_see_test_output = Options.options.verbose
|
||||
unittest.want_to_see_test_error = Options.options.verbose
|
||||
unittest.run()
|
||||
unittest.print_results()
|
||||
|
||||
def shutdown():
|
||||
if Params.g_commands['check']: run_tests()
|
||||
if Options.commands['check']: run_tests()
|
||||
|
||||
def dist_hook():
|
||||
from os import system
|
||||
system('ragel src/config_parser.rl')
|
||||
system('ragel src/http_request_parser.rl')
|
||||
|
|
Loading…
Reference in New Issue