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 if not conf
.env
.disable_python
:
64 # also disable if we don't have the python libs installed
65 conf
.find_program('python', var
='PYTHON')
67 conf
.check_python_version((2,4,2))
68 conf
.SAMBA_CHECK_PYTHON_HEADERS(mandatory
=False)
69 if not conf
.env
.HAVE_PYTHON_H
:
70 Logs
.warn('Disabling pytevent as python devel libs not found')
71 conf
.env
.disable_python
= True
75 conf
.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
78 bld
.RECURSE('lib/replace')
79 bld
.RECURSE('lib/talloc')
81 SRC
= '''tevent.c tevent_debug.c tevent_fd.c tevent_immediate.c
82 tevent_queue.c tevent_req.c tevent_wrapper.c
83 tevent_poll.c tevent_threads.c
84 tevent_signal.c tevent_standard.c tevent_timed.c tevent_util.c tevent_wakeup.c'''
86 if bld
.CONFIG_SET('HAVE_EPOLL'):
87 SRC
+= ' tevent_epoll.c'
89 if bld
.CONFIG_SET('HAVE_SOLARIS_PORTS'):
90 SRC
+= ' tevent_port.c'
92 if bld
.env
.standalone_tevent
:
93 bld
.env
.PKGCONFIGDIR
= '${LIBDIR}/pkgconfig'
94 private_library
= False
96 private_library
= True
98 if not bld
.CONFIG_SET('USING_SYSTEM_TEVENT'):
99 tevent_deps
= 'replace talloc'
100 if bld
.CONFIG_SET('HAVE_PTHREAD'):
101 tevent_deps
+= ' pthread'
103 bld
.SAMBA_LIBRARY('tevent',
106 enabled
= not bld
.CONFIG_SET('USING_SYSTEM_TEVENT'),
109 abi_match
='tevent_* _tevent_*',
111 public_headers
=('' if private_library
else 'tevent.h'),
112 public_headers_install
=not private_library
,
113 pc_files
='tevent.pc',
114 private_library
=private_library
)
116 if not bld
.CONFIG_SET('USING_SYSTEM_PYTEVENT') and not bld
.env
.disable_python
:
117 for env
in bld
.gen_python_environments(['PKGCONFIGDIR']):
118 bld
.SAMBA_PYTHON('_tevent',
121 realname
='_tevent.so',
122 cflags
='-DPACKAGE_VERSION=\"%s\"' % VERSION
)
125 bld
.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'tevent.py', flat
=False)
127 # install out various python scripts for use by make test
128 bld
.SAMBA_SCRIPT('tevent_python',
135 print("The tevent testsuite is part of smbtorture in samba4")
137 samba_utils
.ADD_LD_LIBRARY_PATH('bin/shared')
138 samba_utils
.ADD_LD_LIBRARY_PATH('bin/shared/private')
140 pyret
= samba_utils
.RUN_PYTHON_TESTS(['bindings.py'])
145 '''makes a tarball for distribution'''
148 def reconfigure(ctx
):
149 '''reconfigure if config scripts have changed'''
150 samba_utils
.reconfigure(ctx
)