d80b7209b0f814da93337927ed418cc527a21f2a
[samba.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 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
17
18 samba_dist.DIST_DIRS('lib/tdb:. lib/replace:lib/replace buildtools:buildtools')
19
20 def set_options(opt):
21     opt.BUILTIN_DEFAULT('replace')
22     opt.BUNDLED_EXTENSION_DEFAULT('tdb', noextenion='tdb')
23     opt.RECURSE('lib/replace')
24
25 def configure(conf):
26     conf.RECURSE('lib/replace')
27
28     if conf.CHECK_BUNDLED_SYSTEM('tdb', minversion=VERSION,
29                                  implied_deps='replace'):
30         conf.define('USING_SYSTEM_TDB', 1)
31
32     conf.SAMBA_CONFIG_H()
33
34 def build(bld):
35     bld.RECURSE('lib/replace')
36
37     COMMON_SRC = bld.SUBDIR('common',
38                             '''check.c error.c tdb.c traverse.c
39                             freelistcheck.c lock.c dump.c freelist.c
40                             io.c open.c transaction.c''')
41
42     if not bld.CONFIG_SET('USING_SYSTEM_TDB'):
43         bld.SAMBA_LIBRARY('tdb',
44                           COMMON_SRC,
45                           deps='replace rt',
46                           includes='include',
47                           vnum=VERSION)
48
49     bld.SAMBA_BINARY('tdbtorture',
50                      'tools/tdbtorture.c',
51                      'tdb')
52
53     bld.SAMBA_BINARY('tdbdump',
54                      'tools/tdbdump.c',
55                      'tdb')
56
57     bld.SAMBA_BINARY('tdbbackup',
58                      'tools/tdbbackup.c',
59                      'tdb')
60
61     bld.SAMBA_BINARY('tdbtool',
62                      'tools/tdbtool.c',
63                      'tdb')
64
65     s4_build = getattr(bld.env, '_SAMBA_BUILD_', 0) == 4
66
67     bld.SAMBA_PYTHON('pytdb',
68                      'pytdb.c',
69                      deps='tdb',
70                      enabled=s4_build,
71                      realname='tdb.so')
72
73
74 def test(ctx):
75     '''run tdb testsuite'''
76     import Utils
77     cmd = os.path.join(Utils.g_module.blddir, 'tdbtorture')
78     os.system(cmd)
79
80 def dist():
81     '''makes a tarball for distribution'''
82     samba_dist.dist()