8 # find the buildtools directory
10 while not os
.path
.exists(top
+'/buildtools') and len(top
.split('/')) < 5:
12 sys
.path
.insert(0, top
+ '/buildtools/wafsamba')
17 from wafsamba
import samba_dist
, samba_utils
18 from waflib
import Options
, Logs
, Context
20 samba_dist
.DIST_DIRS('lib/tevent:. lib/replace:lib/replace lib/talloc:lib/talloc buildtools:buildtools third_party/waf:third_party/waf')
23 opt
.BUILTIN_DEFAULT('replace')
24 opt
.PRIVATE_EXTENSION_DEFAULT('tevent', noextension
='tevent')
25 opt
.RECURSE('lib/replace')
26 opt
.RECURSE('lib/talloc')
30 conf
.RECURSE('lib/replace')
31 conf
.RECURSE('lib/talloc')
33 conf
.env
.standalone_tevent
= conf
.IN_LAUNCH_DIR()
35 if not conf
.env
.standalone_tevent
:
36 if conf
.CHECK_BUNDLED_SYSTEM_PKG('tevent', minversion
=VERSION
,
37 onlyif
='talloc', implied_deps
='replace talloc'):
38 conf
.define('USING_SYSTEM_TEVENT', 1)
39 if not conf
.env
.disable_python
and \
40 conf
.CHECK_BUNDLED_SYSTEM_PYTHON('pytevent', 'tevent', minversion
=VERSION
):
41 conf
.define('USING_SYSTEM_PYTEVENT', 1)
43 if conf
.CHECK_FUNCS('epoll_create', headers
='sys/epoll.h'):
44 conf
.DEFINE('HAVE_EPOLL', 1)
46 tevent_num_signals
= 64
47 v
= conf
.CHECK_VALUEOF('NSIG', headers
='signal.h')
49 tevent_num_signals
= max(tevent_num_signals
, v
)
50 v
= conf
.CHECK_VALUEOF('_NSIG', headers
='signal.h')
52 tevent_num_signals
= max(tevent_num_signals
, v
)
53 v
= conf
.CHECK_VALUEOF('SIGRTMAX', headers
='signal.h')
55 tevent_num_signals
= max(tevent_num_signals
, v
)
56 v
= conf
.CHECK_VALUEOF('SIGRTMIN', headers
='signal.h')
58 tevent_num_signals
= max(tevent_num_signals
, v
*2)
60 if not conf
.CONFIG_SET('USING_SYSTEM_TEVENT'):
61 conf
.DEFINE('TEVENT_NUM_SIGNALS', tevent_num_signals
)
63 conf
.SAMBA_CHECK_PYTHON()
64 conf
.SAMBA_CHECK_PYTHON_HEADERS()
68 conf
.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
71 bld
.RECURSE('lib/replace')
72 bld
.RECURSE('lib/talloc')
74 SRC
= '''tevent.c tevent_debug.c tevent_fd.c tevent_immediate.c
75 tevent_queue.c tevent_req.c tevent_wrapper.c
76 tevent_poll.c tevent_threads.c
77 tevent_signal.c tevent_standard.c tevent_timed.c tevent_util.c tevent_wakeup.c'''
79 if bld
.CONFIG_SET('HAVE_EPOLL'):
80 SRC
+= ' tevent_epoll.c'
82 if bld
.CONFIG_SET('HAVE_SOLARIS_PORTS'):
83 SRC
+= ' tevent_port.c'
85 if bld
.env
.standalone_tevent
:
86 bld
.env
.PKGCONFIGDIR
= '${LIBDIR}/pkgconfig'
87 private_library
= False
89 private_library
= True
91 if not bld
.CONFIG_SET('USING_SYSTEM_TEVENT'):
92 tevent_deps
= 'replace talloc'
93 if bld
.CONFIG_SET('HAVE_PTHREAD'):
94 tevent_deps
+= ' pthread'
96 bld
.SAMBA_LIBRARY('tevent',
99 enabled
= not bld
.CONFIG_SET('USING_SYSTEM_TEVENT'),
102 abi_match
='tevent_* _tevent_*',
104 public_headers
=('' if private_library
else 'tevent.h'),
105 public_headers_install
=not private_library
,
106 pc_files
='tevent.pc',
107 private_library
=private_library
)
109 if not bld
.CONFIG_SET('USING_SYSTEM_PYTEVENT') and not bld
.env
.disable_python
:
110 bld
.SAMBA_PYTHON('_tevent',
113 realname
='_tevent.so',
114 cflags
='-DPACKAGE_VERSION=\"%s\"' % VERSION
)
117 bld
.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'tevent.py', flat
=False)
119 # install out various python scripts for use by make test
120 bld
.SAMBA_SCRIPT('tevent_python',
127 print("The tevent testsuite is part of smbtorture in samba4")
129 samba_utils
.ADD_LD_LIBRARY_PATH('bin/shared')
130 samba_utils
.ADD_LD_LIBRARY_PATH('bin/shared/private')
132 pyret
= samba_utils
.RUN_PYTHON_TESTS(['bindings.py'])
137 '''makes a tarball for distribution'''
140 def reconfigure(ctx
):
141 '''reconfigure if config scripts have changed'''
142 samba_utils
.reconfigure(ctx
)