tevent: change version to 0.9.12
[sfrench/samba-autobuild/.git] / lib / tevent / wscript
1 #!/usr/bin/env python
2
3 APPNAME = 'tevent'
4 VERSION = '0.9.12'
5
6 blddir = 'bin'
7
8 import sys, os
9
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')
15
16 import wafsamba, samba_dist, Options, Logs
17
18 samba_dist.DIST_DIRS('lib/tevent:. lib/replace:lib/replace lib/talloc:lib/talloc buildtools:buildtools')
19
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')
25     if opt.IN_LAUNCH_DIR():
26         opt.add_option('--disable-python',
27                        help=("disable the pytevent module"),
28                        action="store_true", dest='disable_python', default=False)
29
30
31 def configure(conf):
32     conf.RECURSE('lib/replace')
33     conf.RECURSE('lib/talloc')
34
35     conf.env.standalone_tevent = conf.IN_LAUNCH_DIR()
36
37     if not conf.env.standalone_tevent:
38         if conf.CHECK_BUNDLED_SYSTEM('tevent', minversion=VERSION,
39                                      onlyif='talloc', implied_deps='replace talloc'):
40             conf.define('USING_SYSTEM_TEVENT', 1)
41
42     if conf.CHECK_FUNCS('epoll_create', headers='sys/epoll.h'):
43         conf.DEFINE('HAVE_EPOLL', 1)
44
45     conf.env.disable_python = getattr(Options.options, 'disable_python', False)
46
47     if not conf.env.disable_python:
48         # also disable if we don't have the python libs installed
49         conf.find_program('python', var='PYTHON')
50         conf.check_tool('python')
51         conf.check_python_version((2,4,2))
52         conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
53         if not conf.env.HAVE_PYTHON_H:
54             Logs.warn('Disabling pytevent as python devel libs not found')
55             conf.env.disable_python = True
56
57     conf.SAMBA_CONFIG_H()
58
59 def build(bld):
60     bld.RECURSE('lib/replace')
61     bld.RECURSE('lib/talloc')
62
63     SRC = '''tevent.c tevent_debug.c tevent_fd.c tevent_immediate.c
64              tevent_queue.c tevent_req.c tevent_select.c
65              tevent_poll.c
66              tevent_signal.c tevent_standard.c tevent_timed.c tevent_util.c tevent_wakeup.c'''
67
68     if bld.CONFIG_SET('HAVE_EPOLL'):
69         SRC += ' tevent_epoll.c'
70
71     if bld.env.standalone_tevent:
72         bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
73         bld.PKG_CONFIG_FILES('tevent.pc', vnum=VERSION)
74         private_library = False
75     else:
76         private_library = True
77
78     if not bld.CONFIG_SET('USING_SYSTEM_TEVENT'):
79         bld.SAMBA_LIBRARY('tevent',
80                           SRC,
81                           deps='replace talloc',
82                           enabled= not bld.CONFIG_SET('USING_SYSTEM_TEVENT'),
83                           includes='.',
84                           abi_directory='ABI',
85                           abi_match='tevent_* _tevent_*',
86                           vnum=VERSION,
87                           public_headers='tevent.h',
88                           public_headers_install=not private_library,
89                           private_library=private_library)
90
91     bld.SAMBA_PYTHON('pytevent',
92                      'pytevent.c',
93                      deps='tevent',
94                      enabled=True,
95                      realname='_tevent.so')
96
97
98 def test(ctx):
99     '''test tevent'''
100     print("The tevent testsuite is part of smbtorture in samba4")
101
102
103 def dist():
104     '''makes a tarball for distribution'''
105     samba_dist.dist()
106
107 def reconfigure(ctx):
108     '''reconfigure if config scripts have changed'''
109     import samba_utils
110     samba_utils.reconfigure(ctx)