tevent: version 0.9.35
[Samba.git] / lib / tevent / wscript
blob2c67f1f57eea879b33050650d8784d697140a4ac
1 #!/usr/bin/env python
3 APPNAME = 'tevent'
4 VERSION = '0.9.35'
6 blddir = 'bin'
8 import sys, os
10 # find the buildtools directory
11 srcdir = '.'
12 while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
13 srcdir = srcdir + '/..'
14 sys.path.insert(0, srcdir + '/buildtools/wafsamba')
16 import wafsamba, samba_dist, samba_utils, Options, Logs
18 samba_dist.DIST_DIRS('lib/tevent:. lib/replace:lib/replace lib/talloc:lib/talloc buildtools:buildtools third_party/waf:third_party/waf')
20 def set_options(opt):
21 opt.BUILTIN_DEFAULT('replace')
22 opt.PRIVATE_EXTENSION_DEFAULT('tevent', noextension='tevent')
23 opt.RECURSE('lib/replace')
24 opt.RECURSE('lib/talloc')
27 def configure(conf):
28 conf.RECURSE('lib/replace')
29 conf.RECURSE('lib/talloc')
31 conf.env.standalone_tevent = conf.IN_LAUNCH_DIR()
33 if not conf.env.standalone_tevent:
34 if conf.CHECK_BUNDLED_SYSTEM_PKG('tevent', minversion=VERSION,
35 onlyif='talloc', implied_deps='replace talloc'):
36 conf.define('USING_SYSTEM_TEVENT', 1)
37 if not conf.env.disable_python and \
38 conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytevent', 'tevent', minversion=VERSION):
39 conf.define('USING_SYSTEM_PYTEVENT', 1)
41 if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'):
42 conf.DEFINE('HAVE_EPOLL', 1)
44 tevent_num_signals = 64
45 v = conf.CHECK_VALUEOF('NSIG', headers='signal.h')
46 if v is not None:
47 tevent_num_signals = max(tevent_num_signals, v)
48 v = conf.CHECK_VALUEOF('_NSIG', headers='signal.h')
49 if v is not None:
50 tevent_num_signals = max(tevent_num_signals, v)
51 v = conf.CHECK_VALUEOF('SIGRTMAX', headers='signal.h')
52 if v is not None:
53 tevent_num_signals = max(tevent_num_signals, v)
54 v = conf.CHECK_VALUEOF('SIGRTMIN', headers='signal.h')
55 if v is not None:
56 tevent_num_signals = max(tevent_num_signals, v*2)
58 if not conf.CONFIG_SET('USING_SYSTEM_TEVENT'):
59 conf.DEFINE('TEVENT_NUM_SIGNALS', tevent_num_signals)
61 if not conf.env.disable_python:
62 # also disable if we don't have the python libs installed
63 conf.find_program('python', var='PYTHON')
64 conf.check_tool('python')
65 conf.check_python_version((2,4,2))
66 conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
67 if not conf.env.HAVE_PYTHON_H:
68 Logs.warn('Disabling pytevent as python devel libs not found')
69 conf.env.disable_python = True
71 conf.SAMBA_CONFIG_H()
73 conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
75 def build(bld):
76 bld.RECURSE('lib/replace')
77 bld.RECURSE('lib/talloc')
79 SRC = '''tevent.c tevent_debug.c tevent_fd.c tevent_immediate.c
80 tevent_queue.c tevent_req.c
81 tevent_poll.c tevent_threads.c
82 tevent_signal.c tevent_standard.c tevent_timed.c tevent_util.c tevent_wakeup.c'''
84 if bld.CONFIG_SET('HAVE_EPOLL'):
85 SRC += ' tevent_epoll.c'
87 if bld.CONFIG_SET('HAVE_SOLARIS_PORTS'):
88 SRC += ' tevent_port.c'
90 if bld.env.standalone_tevent:
91 bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
92 private_library = False
93 else:
94 private_library = True
96 if not bld.CONFIG_SET('USING_SYSTEM_TEVENT'):
97 tevent_deps = 'replace talloc'
98 if bld.CONFIG_SET('HAVE_PTHREAD'):
99 tevent_deps += ' pthread'
101 bld.SAMBA_LIBRARY('tevent',
102 SRC,
103 deps=tevent_deps,
104 enabled= not bld.CONFIG_SET('USING_SYSTEM_TEVENT'),
105 includes='.',
106 abi_directory='ABI',
107 abi_match='tevent_* _tevent_*',
108 vnum=VERSION,
109 public_headers=('' if private_library else 'tevent.h'),
110 public_headers_install=not private_library,
111 pc_files='tevent.pc',
112 private_library=private_library)
114 if not bld.CONFIG_SET('USING_SYSTEM_PYTEVENT') and not bld.env.disable_python:
115 for env in bld.gen_python_environments(['PKGCONFIGDIR']):
116 bld.SAMBA_PYTHON('_tevent',
117 'pytevent.c',
118 deps='tevent',
119 realname='_tevent.so',
120 cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
123 bld.INSTALL_WILDCARD('${PYTHONARCHDIR}', 'tevent.py', flat=False)
125 # install out various python scripts for use by make test
126 bld.SAMBA_SCRIPT('tevent_python',
127 pattern='tevent.py',
128 installdir='python')
131 def test(ctx):
132 '''test tevent'''
133 print("The tevent testsuite is part of smbtorture in samba4")
135 samba_utils.ADD_LD_LIBRARY_PATH('bin/shared')
136 samba_utils.ADD_LD_LIBRARY_PATH('bin/shared/private')
138 pyret = samba_utils.RUN_PYTHON_TESTS(['bindings.py'])
139 sys.exit(pyret)
142 def dist():
143 '''makes a tarball for distribution'''
144 samba_dist.dist()
146 def reconfigure(ctx):
147 '''reconfigure if config scripts have changed'''
148 import samba_utils
149 samba_utils.reconfigure(ctx)