This repository has been archived by the owner on Jul 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
wscript
68 lines (51 loc) · 2.15 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
#! /usr/bin/env python
# encoding: utf-8
import Options
# the following two variables are used by the target "waf dist"
VERSION='0.0.1'
APPNAME='fastproxy'
# these variables are mandatory ('/' are converted automatically)
top = '.'
out = 'build'
def set_options(opt):
opt.tool_options('compiler_cxx')
opt.tool_options('python')
opt.add_option('--build_kind', action='store', default='debug,release', help='build the selected variants')
def configure(conf):
conf.check_tool('compiler_cxx')
conf.check_tool('boost')
conf.check_boost(version='1.43')
conf.check_cxx(fragment='#include <unbound.h>\nint main(){return 0;}\n', lib='unbound', mandatory=True)
conf.sub_config('src')
# create a debug and release builds (variants)
dbg = conf.env.copy()
rel = conf.env.copy()
dbg.set_variant('debug')
conf.set_env_name('debug', dbg)
conf.setenv('debug')
conf.env.CXXFLAGS = ['-D_REENTRANT', '-DDBG_ENABLED', '-Wall', '-O0', '-ggdb3', '-ftemplate-depth-128']
rel.set_variant('release')
conf.set_env_name('release', rel)
conf.setenv('release')
conf.env.CXXFLAGS = ['-O2', '-DNOTRACE', '-ggdb3']
def build(bld):
bld.add_subdirs('src')
bld.install_as('/etc/zabbix/bin/zbx_fastproxy.py', 'scripts/zbx_fastproxy.py', chmod=755)
bld.install_as('/etc/fastproxy.conf', 'conf/fastproxy.conf')
for i in '500 502 503 504'.split():
bld.install_as('/etc/fastproxy/errors/{0}.http'.format(i), 'conf/errors/{0}.http'.format(i))
# enable the debug or the release variant, depending on the one wanted
for obj in bld.all_task_gen[:]:
# task generator instances (bld.new_task_gen...) should be created in the same order
# to avoid unnecessary rebuilds (remember that cloning task generators is cheap, but copying task instances are expensive)
debug_obj = obj.clone('debug')
release_obj = obj.clone('release')
# stupid reminder: do not make clones for the same variant (default -> default)
# disable the original task generator for the default variant (do not use it)
obj.posted = 1
# disable the unwanted variant(s)
kind = Options.options.build_kind
if kind.find('debug') < 0:
debug_obj.posted = 1
if kind.find('release') < 0:
release_obj.posted = 1