s4:lib/stream: make use of smb_len_tcp()
[Samba.git] / lib / tdb2 / wscript
blobbe5b8e267c759fc24df97b8925c6eee138b376b6
1 #!/usr/bin/env python
3 APPNAME = 'tdb'
4 VERSION = '2.0-alpha'
6 blddir = 'bin'
8 import sys, os
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')
16 import wafsamba, samba_dist, Options, Logs
18 samba_dist.DIST_DIRS('lib/tdb2:. lib/replace:lib/replace buildtools:buildtools')
20 def set_options(opt):
21 opt.BUILTIN_DEFAULT('replace')
22 opt.PRIVATE_EXTENSION_DEFAULT('tdb2', noextension='tdb2')
23 opt.RECURSE('lib/replace')
24 opt.add_option('--enable-tdb2',
25 help=("Use tdb2 API instead of tdb1 [False]"),
26 action="store_true", dest='BUILD_TDB2', default=False)
27 if opt.IN_LAUNCH_DIR():
28 opt.add_option('--disable-python',
29 help=("disable the pytdb module"),
30 action="store_true", dest='disable_python', default=False)
32 def configure(conf):
33 if conf.env.BUILD_TDB2:
34 conf.DEFINE('BUILD_TDB2', 1)
35 conf.RECURSE('lib/replace')
36 conf.RECURSE('lib/ccan')
38 conf.env.standalone_tdb2 = conf.IN_LAUNCH_DIR()
39 conf.env.disable_python = getattr(Options.options, 'disable_python', False)
41 # if not conf.env.standalone_tdb2:
42 # if conf.CHECK_BUNDLED_SYSTEM('tdb', minversion=VERSION,
43 # implied_deps='replace'):
44 # conf.define('USING_SYSTEM_TDB2', 1)
46 conf.SAMBA_CONFIG_H()
48 def build(bld):
49 if bld.env.BUILD_TDB2:
50 bld.RECURSE('lib/replace')
52 if bld.env.standalone_tdb2:
53 bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
54 bld.PKG_CONFIG_FILES('tdb2.pc', vnum=VERSION)
55 bld.INSTALL_FILES('${INCLUDEDIR}', 'tdb2.h', flat=True)
56 private_library = False
57 else:
58 private_library = True
60 if not bld.CONFIG_SET('USING_SYSTEM_TDB2'):
61 # FIXME: hide_symbols=True, abi_directory='ABI', abi_match='tdb_*', vnum=VERSION,
62 bld.SAMBA_LIBRARY('tdb',
63 '''check.c free.c hash.c io.c lock.c open.c
64 summary.c tdb.c transaction.c traverse.c
65 tdb1_check.c tdb1_freelist.c tdb1_hash.c
66 tdb1_io.c tdb1_lock.c tdb1_open.c
67 tdb1_summary.c tdb1_tdb.c tdb1_transaction.c
68 tdb1_traverse.c''',
69 deps='replace ccan',
70 private_library=private_library)
72 bld.SAMBA_BINARY('tdb2torture',
73 'tools/tdb2torture.c',
74 'tdb',
75 install=False)
77 bld.SAMBA_BINARY('tdb2tool',
78 'tools/tdb2tool.c',
79 'tdb')
81 bld.SAMBA_BINARY('tdb2dump',
82 'tools/tdb2dump.c',
83 'tdb')
85 bld.SAMBA_BINARY('tdb2restore',
86 'tools/tdb2restore.c',
87 'tdb')
89 bld.SAMBA_PYTHON('pytdb',
90 'pytdb.c',
91 deps='tdb',
92 enabled=not bld.env.disable_python,
93 realname='tdb.so',
94 cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
96 def dist():
97 '''makes a tarball for distribution'''
98 samba_dist.dist()
100 def reconfigure(ctx):
101 '''reconfigure if config scripts have changed'''
102 import samba_utils
103 samba_utils.reconfigure(ctx)