2010-03-28 09:48:49 +11:00
#!/usr/bin/env python
2010-04-04 10:06:34 +10:00
APPNAME = 'tevent'
2012-08-16 21:06:45 +02:00
VERSION = '0.9.17'
2010-03-17 20:31:46 +11:00
2010-03-17 20:32:15 +11:00
blddir = 'bin'
2010-03-17 20:31:46 +11:00
2010-04-04 10:18:39 +10:00
import sys, os
# find the buildtools directory
2010-04-04 13:16:49 +10:00
srcdir = '.'
while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
srcdir = '../' + srcdir
sys.path.insert(0, srcdir + '/buildtools/wafsamba')
2010-04-04 10:18:39 +10:00
2010-09-23 14:28:02 -07:00
import wafsamba, samba_dist, Options, Logs
2010-04-04 11:00:42 +10:00
samba_dist.DIST_DIRS('lib/tevent:. lib/replace:lib/replace lib/talloc:lib/talloc buildtools:buildtools')
2010-02-26 22:21:50 +11:00
2010-03-17 20:31:46 +11:00
def set_options(opt):
2010-03-28 15:42:28 +11:00
opt.BUILTIN_DEFAULT('replace')
2010-10-23 23:26:43 +02:00
opt.PRIVATE_EXTENSION_DEFAULT('tevent', noextension='tevent')
2010-04-04 13:16:49 +10:00
opt.RECURSE('lib/replace')
opt.RECURSE('lib/talloc')
2010-09-23 14:28:02 -07:00
if opt.IN_LAUNCH_DIR():
opt.add_option('--disable-python',
help=("disable the pytevent module"),
action="store_true", dest='disable_python', default=False)
2010-03-17 20:31:46 +11:00
def configure(conf):
2010-04-04 13:16:49 +10:00
conf.RECURSE('lib/replace')
conf.RECURSE('lib/talloc')
2010-03-17 20:31:46 +11:00
2010-04-13 21:20:52 +10:00
conf.env.standalone_tevent = conf.IN_LAUNCH_DIR()
if not conf.env.standalone_tevent:
2011-11-12 16:36:28 +01:00
if conf.CHECK_BUNDLED_SYSTEM_PKG('tevent', minversion=VERSION,
2010-04-13 21:20:52 +10:00
onlyif='talloc', implied_deps='replace talloc'):
conf.define('USING_SYSTEM_TEVENT', 1)
2011-11-12 16:14:33 +01:00
if conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytevent', 'tevent', minversion=VERSION):
conf.define('USING_SYSTEM_PYTEVENT', 1)
2010-03-28 16:38:27 +11:00
2010-03-23 09:29:51 +11:00
if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'):
conf.DEFINE('HAVE_EPOLL', 1)
2010-03-17 20:31:46 +11:00
2010-09-23 14:28:02 -07:00
conf.env.disable_python = getattr(Options.options, 'disable_python', False)
if not conf.env.disable_python:
# also disable if we don't have the python libs installed
2011-04-23 02:04:13 +02:00
conf.find_program('python', var='PYTHON')
2010-09-23 14:28:02 -07:00
conf.check_tool('python')
conf.check_python_version((2,4,2))
2010-12-10 01:42:32 +03:00
conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
2010-09-23 14:28:02 -07:00
if not conf.env.HAVE_PYTHON_H:
Logs.warn('Disabling pytevent as python devel libs not found')
conf.env.disable_python = True
2010-03-17 20:31:46 +11:00
conf.SAMBA_CONFIG_H()
2011-11-13 18:01:09 +01:00
conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
2010-03-17 20:31:46 +11:00
def build(bld):
2010-04-04 13:16:49 +10:00
bld.RECURSE('lib/replace')
bld.RECURSE('lib/talloc')
2010-03-17 20:31:46 +11:00
2010-03-20 22:14:24 -04:00
SRC = '''tevent.c tevent_debug.c tevent_fd.c tevent_immediate.c
2010-03-17 20:31:46 +11:00
tevent_queue.c tevent_req.c tevent_select.c
2012-05-11 18:27:01 +02:00
tevent_poll.c
2010-03-17 20:31:46 +11:00
tevent_signal.c tevent_standard.c tevent_timed.c tevent_util.c tevent_wakeup.c'''
2010-03-20 22:14:24 -04:00
if bld.CONFIG_SET('HAVE_EPOLL'):
SRC += ' tevent_epoll.c'
2010-03-17 20:31:46 +11:00
2010-10-24 11:50:47 -07:00
if bld.env.standalone_tevent:
bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
private_library = False
else:
private_library = True
2010-03-28 16:38:27 +11:00
if not bld.CONFIG_SET('USING_SYSTEM_TEVENT'):
bld.SAMBA_LIBRARY('tevent',
SRC,
deps='replace talloc',
enabled= not bld.CONFIG_SET('USING_SYSTEM_TEVENT'),
2011-02-28 19:20:46 +01:00
includes='.',
2010-12-09 11:10:45 +11:00
abi_directory='ABI',
2010-04-18 12:47:13 +10:00
abi_match='tevent_* _tevent_*',
2010-12-09 21:58:20 +11:00
vnum=VERSION,
2011-02-28 18:56:05 +11:00
public_headers='tevent.h',
2011-03-03 17:19:33 +11:00
public_headers_install=not private_library,
2011-08-21 03:02:58 +02:00
pc_files='tevent.pc',
2010-10-24 11:50:47 -07:00
private_library=private_library)
2010-04-13 21:20:52 +10:00
2011-12-02 23:43:10 +01:00
if not bld.CONFIG_SET('USING_SYSTEM_PYTEVENT'):
2011-11-12 16:14:33 +01:00
bld.SAMBA_PYTHON('pytevent',
'pytevent.c',
deps='tevent',
2011-12-07 11:57:57 +01:00
realname='_tevent.so',
cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
2011-12-06 21:18:43 +01:00
# install out various python scripts for use by make test
bld.SAMBA_SCRIPT('tevent_python',
pattern='tevent.py',
installdir='python')
2012-03-06 18:07:20 +01:00
bld.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'tevent.py', flat=False)
2010-09-23 14:28:02 -07:00
2010-04-04 22:11:30 +10:00
def test(ctx):
'''test tevent'''
print("The tevent testsuite is part of smbtorture in samba4")
2010-04-05 09:58:23 +10:00
def dist():
'''makes a tarball for distribution'''
samba_dist.dist()
2010-11-03 12:09:23 +11:00
def reconfigure(ctx):
'''reconfigure if config scripts have changed'''
import samba_utils
samba_utils.reconfigure(ctx)