s4-waf: avoid having to run waf configure before waf dist
[nivanova/samba-autobuild/.git] / lib / tdb / wscript
1 #!/usr/bin/env python
2
3 APPNAME = 'tdb'
4 VERSION = '1.2.1'
5
6 blddir = 'bin'
7
8 import sys, os
9
10 # find the buildtools directory
11 buildtools = 'buildtools ../../buildtools'
12 for d in buildtools.split():
13     if os.path.exists(d):
14         srcdir = os.path.dirname(d) or '.'
15         break
16
17 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
18 import wafsamba, samba_dist
19
20 samba_dist.DIST_DIRS('lib/tdb:. lib/replace:lib/replace buildtools:buildtools')
21
22
23 LIBREPLACE_DIR= srcdir + '/lib/replace'
24
25 def set_options(opt):
26     opt.BUILTIN_DEFAULT('replace')
27     opt.BUNDLED_EXTENSION_DEFAULT('tdb', noextenion='tdb')
28     opt.recurse(LIBREPLACE_DIR)
29
30 def configure(conf):
31     conf.sub_config(LIBREPLACE_DIR)
32
33     if conf.CHECK_BUNDLED_SYSTEM('tdb', minversion=VERSION,
34                                  implied_deps='replace'):
35         conf.define('USING_SYSTEM_TDB', 1)
36
37     conf.SAMBA_CONFIG_H()
38
39 def build(bld):
40     bld.BUILD_SUBDIR(LIBREPLACE_DIR)
41
42     COMMON_SRC = bld.SUBDIR('common',
43                             '''check.c error.c tdb.c traverse.c
44                             freelistcheck.c lock.c dump.c freelist.c
45                             io.c open.c transaction.c''')
46
47     if not bld.CONFIG_SET('USING_SYSTEM_TDB'):
48         bld.SAMBA_LIBRARY('tdb',
49                           COMMON_SRC,
50                           deps='replace rt',
51                           includes='include',
52                           vnum=VERSION)
53
54     bld.SAMBA_BINARY('tdbtorture',
55                      'tools/tdbtorture.c',
56                      'tdb')
57
58     bld.SAMBA_BINARY('tdbdump',
59                      'tools/tdbdump.c',
60                      'tdb')
61
62     bld.SAMBA_BINARY('tdbbackup',
63                      'tools/tdbbackup.c',
64                      'tdb')
65
66     bld.SAMBA_BINARY('tdbtool',
67                      'tools/tdbtool.c',
68                      'tdb')
69
70     s4_build = getattr(bld.env, '_SAMBA_BUILD_', 0) == 4
71
72     bld.SAMBA_PYTHON('pytdb',
73                      'pytdb.c',
74                      deps='tdb',
75                      enabled=s4_build,
76                      realname='tdb.so')
77