-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwscript
executable file
·88 lines (72 loc) · 2.02 KB
/
wscript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!./waf
import os
import subprocess
def options(ctx):
ctx.load('compiler_c')
import waflib.Logs
def configure(ctx):
ctx.load('compiler_c')
ctx.env.append_value( 'CFLAGS', '-g' )
ctx.env.append_value( 'CFLAGS', '-O2' )
ctx.env.append_value( 'CFLAGS', '-std=c99' )
ctx.start_msg( 'init submodules' )
gitStatus = ctx.exec_command( 'git submodule init && git submodule update' )
if gitStatus == 0:
ctx.end_msg( 'ok', 'GREEN' )
else:
ctx.fatal( 'fail' )
ctx.start_msg( 'build libtap dependency' )
libtapStatus = ctx.exec_command( 'cd vendor/libtap && make' )
if libtapStatus == 0:
ctx.end_msg( 'ok', 'GREEN' )
else:
ctx.fatal( 'fail' )
from waflib.TaskGen import extension
from waflib.Task import Task
class re2c(Task):
run_str = 're2c ${SRC} > ${TGT}'
color = 'PINK'
@extension('re2c')
def process_re2c( self, node ):
task = self.create_task( 're2c', node, node.change_ext( '.c' ) )
self.source.extend( task.outputs )
def build(bld):
bld.install_files( '${PREFIX}/include', 'toml.h' )
source = bld.path.ant_glob('toml.c toml-lemon.c toml-re2c.re2c')
d = {
'source': source,
'includes': '.',
'target': 'toml',
'install_path': '${PREFIX}/lib',
'lib': 'm'
}
bld.stlib( **d )
bld.shlib( **d )
bld.program(
source='main.c',
includes='.',
target='toml-lookup',
lib='m',
use='toml',
install_path='${PREFIX}/bin'
)
bld.program(
source=bld.path.ant_glob('test.c'),
includes='. ../vendor/libtap',
target='toml-test',
libpath='../vendor/libtap',
lib='tap m',
use='toml',
install_path=None
)
import waflib.Scripting, waflib.Context
def test(ctx):
waflib.Scripting.run_command( 'build' )
ctx.to_log( '\n' )
ctx.cmd_and_log(
'build/test\n',
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
quiet=waflib.Context.BOTH
)