s4-waf: move to a universal method of recursing into subdirs
[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'
12 while not os.path.exists(buildtools) and len(buildtools.split('/')) < 5:
13     buildtools = '../' + buildtools
14 srcdir = os.path.dirname(buildtools) or '.'
15
16 sys.path.insert(0, buildtools + "/wafsamba")
17 import wafsamba, samba_dist
18
19 samba_dist.DIST_DIRS('lib/tdb:. lib/replace:lib/replace buildtools:buildtools')
20
21
22 LIBREPLACE_DIR= '../replace'
23
24 def set_options(opt):
25     opt.BUILTIN_DEFAULT('replace')
26     opt.BUNDLED_EXTENSION_DEFAULT('tdb', noextenion='tdb')
27     opt.RECURSE(LIBREPLACE_DIR)
28
29 def configure(conf):
30     conf.RECURSE(LIBREPLACE_DIR)
31
32     if conf.CHECK_BUNDLED_SYSTEM('tdb', minversion=VERSION,
33                                  implied_deps='replace'):
34         conf.define('USING_SYSTEM_TDB', 1)
35
36     conf.SAMBA_CONFIG_H()
37
38 def build(bld):
39     bld.RECURSE(LIBREPLACE_DIR)
40
41     COMMON_SRC = bld.SUBDIR('common',
42                             '''check.c error.c tdb.c traverse.c
43                             freelistcheck.c lock.c dump.c freelist.c
44                             io.c open.c transaction.c''')
45
46     if not bld.CONFIG_SET('USING_SYSTEM_TDB'):
47         bld.SAMBA_LIBRARY('tdb',
48                           COMMON_SRC,
49                           deps='replace rt',
50                           includes='include',
51                           vnum=VERSION)
52
53     bld.SAMBA_BINARY('tdbtorture',
54                      'tools/tdbtorture.c',
55                      'tdb')
56
57     bld.SAMBA_BINARY('tdbdump',
58                      'tools/tdbdump.c',
59                      'tdb')
60
61     bld.SAMBA_BINARY('tdbbackup',
62                      'tools/tdbbackup.c',
63                      'tdb')
64
65     bld.SAMBA_BINARY('tdbtool',
66                      'tools/tdbtool.c',
67                      'tdb')
68
69     s4_build = getattr(bld.env, '_SAMBA_BUILD_', 0) == 4
70
71     bld.SAMBA_PYTHON('pytdb',
72                      'pytdb.c',
73                      deps='tdb',
74                      enabled=s4_build,
75                      realname='tdb.so')
76