s4-waf: allow standalone tarball build of libraries
[kai/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 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
19
20
21 LIBREPLACE_DIR= srcdir + '/lib/replace'
22
23 def set_options(opt):
24     opt.BUILTIN_DEFAULT('replace')
25     opt.BUNDLED_EXTENSION_DEFAULT('tdb', noextenion='tdb')
26     opt.recurse(LIBREPLACE_DIR)
27
28 def configure(conf):
29     conf.DIST_DIRS('lib/tdb:. lib/replace:lib/replace buildtools:buildtools')
30     conf.sub_config(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.BUILD_SUBDIR(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