smbd: Remove "st" from struct open_symlink_err
[Samba.git] / lib / tevent / wscript
blob8df1b40febf5008dd145f71b4f607309a1385577
1 #!/usr/bin/env python
3 APPNAME = 'tevent'
4 VERSION = '0.16.1'
6 import sys, os
8 # find the buildtools directory
9 top = '.'
10 while not os.path.exists(top+'/buildtools') and len(top.split('/')) < 5:
11 top = top + '/..'
12 sys.path.insert(0, top + '/buildtools/wafsamba')
14 out = 'bin'
16 import wafsamba
17 from wafsamba import samba_dist, samba_utils
18 from waflib import Options, Logs, Context, Errors
20 samba_dist.DIST_DIRS('''lib/tevent:. lib/replace:lib/replace
21 lib/talloc:lib/talloc buildtools:buildtools
22 third_party/cmocka:third_party/cmocka
23 third_party/waf:third_party/waf''')
25 def options(opt):
26 opt.BUILTIN_DEFAULT('replace')
27 opt.PRIVATE_EXTENSION_DEFAULT('tevent', noextension='tevent')
28 opt.RECURSE('lib/replace')
29 opt.RECURSE('lib/talloc')
32 def configure(conf):
33 conf.RECURSE('lib/replace')
34 conf.RECURSE('lib/talloc')
36 if conf.CHECK_FOR_THIRD_PARTY():
37 conf.RECURSE('third_party/cmocka')
38 else:
39 if not conf.CHECK_CMOCKA():
40 raise Errors.WafError('cmocka development package have not been found.\nIf third_party is installed, check that it is in the proper place.')
41 else:
42 conf.define('USING_SYSTEM_CMOCKA', 1)
44 conf.env.standalone_tevent = conf.IN_LAUNCH_DIR()
46 if not conf.env.standalone_tevent:
47 if conf.CHECK_BUNDLED_SYSTEM_PKG('tevent', minversion=VERSION,
48 onlyif='talloc', implied_deps='replace talloc'):
49 conf.define('USING_SYSTEM_TEVENT', 1)
50 if not conf.env.disable_python and \
51 conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytevent', 'tevent', minversion=VERSION):
52 conf.define('USING_SYSTEM_PYTEVENT', 1)
54 if conf.CHECK_FUNCS('epoll_create1', headers='sys/epoll.h'):
55 conf.DEFINE('HAVE_EPOLL', 1)
57 tevent_num_signals = 64
58 v = conf.CHECK_VALUEOF('NSIG', headers='signal.h')
59 if v is not None:
60 tevent_num_signals = max(tevent_num_signals, v)
61 v = conf.CHECK_VALUEOF('_NSIG', headers='signal.h')
62 if v is not None:
63 tevent_num_signals = max(tevent_num_signals, v)
64 v = conf.CHECK_VALUEOF('SIGRTMAX', headers='signal.h')
65 if v is not None:
66 tevent_num_signals = max(tevent_num_signals, v)
67 v = conf.CHECK_VALUEOF('SIGRTMIN', headers='signal.h')
68 if v is not None:
69 tevent_num_signals = max(tevent_num_signals, v*2)
71 if not conf.CONFIG_SET('USING_SYSTEM_TEVENT'):
72 conf.DEFINE('TEVENT_NUM_SIGNALS', tevent_num_signals)
74 conf.SAMBA_CHECK_PYTHON()
75 conf.SAMBA_CHECK_PYTHON_HEADERS()
77 conf.SAMBA_CONFIG_H()
79 conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
81 def build(bld):
82 bld.RECURSE('lib/replace')
83 bld.RECURSE('lib/talloc')
85 if bld.CHECK_FOR_THIRD_PARTY():
86 bld.RECURSE('third_party/cmocka')
88 SRC = '''tevent.c tevent_debug.c tevent_fd.c tevent_immediate.c
89 tevent_queue.c tevent_req.c tevent_wrapper.c
90 tevent_poll.c tevent_threads.c
91 tevent_signal.c tevent_standard.c tevent_timed.c tevent_util.c tevent_wakeup.c'''
93 if bld.CONFIG_SET('HAVE_EPOLL'):
94 SRC += ' tevent_epoll.c'
96 if bld.env.standalone_tevent:
97 bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
98 private_library = False
99 else:
100 private_library = True
102 if not bld.CONFIG_SET('USING_SYSTEM_TEVENT'):
103 tevent_deps = 'replace talloc'
104 if bld.CONFIG_SET('HAVE_PTHREAD'):
105 tevent_deps += ' pthread'
107 bld.SAMBA_LIBRARY('tevent',
108 SRC,
109 deps=tevent_deps,
110 enabled= not bld.CONFIG_SET('USING_SYSTEM_TEVENT'),
111 includes='.',
112 abi_directory='ABI',
113 abi_match='tevent_* _tevent_* __tevent_*',
114 vnum=VERSION,
115 public_headers=('' if private_library else 'tevent.h'),
116 public_headers_install=not private_library,
117 pc_files='tevent.pc',
118 private_library=private_library)
120 if not bld.CONFIG_SET('USING_SYSTEM_PYTEVENT') and not bld.env.disable_python:
121 bld.SAMBA_PYTHON('_tevent',
122 'pytevent.c',
123 deps='tevent',
124 realname='_tevent.so',
125 cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
128 bld.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'tevent.py', flat=False)
130 # install out various python scripts for use by make test
131 bld.SAMBA_SCRIPT('tevent_python',
132 pattern='tevent.py',
133 installdir='python')
135 bld.SAMBA_BINARY('test_tevent_tag',
136 source='tests/test_tevent_tag.c',
137 deps='cmocka tevent',
138 install=False)
140 bld.SAMBA_BINARY('test_tevent_trace',
141 source='tests/test_tevent_trace.c',
142 deps='cmocka tevent',
143 install=False)
145 def test(ctx):
146 '''test tevent'''
147 print("The tevent testsuite is part of smbtorture in samba4")
149 samba_utils.ADD_LD_LIBRARY_PATH('bin/shared')
150 samba_utils.ADD_LD_LIBRARY_PATH('bin/shared/private')
152 pyret = samba_utils.RUN_PYTHON_TESTS(['bindings.py'])
154 unit_test_ret = 0
155 unit_tests = [
156 'test_tevent_tag',
157 'test_tevent_trace',
160 for unit_test in unit_tests:
161 unit_test_cmd = os.path.join(Context.g_module.out, unit_test)
162 unit_test_ret = unit_test_ret or samba_utils.RUN_COMMAND(unit_test_cmd)
164 sys.exit(pyret or unit_test_ret)
166 def dist():
167 '''makes a tarball for distribution'''
168 samba_dist.dist()
170 def reconfigure(ctx):
171 '''reconfigure if config scripts have changed'''
172 samba_utils.reconfigure(ctx)