s3: Simplify smb_splice_chain
[Samba/id10ts.git] / lib / tdb2 / wscript
bloba7edda431a371562bfce3187cecc4fde46267069
1 #!/usr/bin/env python
3 APPNAME = 'tdb'
4 VERSION = '2.0.0'
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 lib/ccan:lib/ccan buildtools:buildtools')
20 def set_options(opt):
21 opt.BUILTIN_DEFAULT('replace,ccan')
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 [True]"),
26 action="store_true", dest='BUILD_TDB2', default=True)
27 opt.add_option('--disable-tdb2',
28 help=("Use old tdb1 API instead of tdb2"),
29 action="store_false", dest='BUILD_TDB2')
30 if opt.IN_LAUNCH_DIR():
31 opt.add_option('--disable-python',
32 help=("disable the pytdb module"),
33 action="store_true", dest='disable_python', default=False)
35 def configure(conf):
36 if Options.options.BUILD_TDB2:
37 conf.DEFINE('BUILD_TDB2', 1)
38 conf.RECURSE('lib/replace')
39 conf.RECURSE('lib/ccan')
41 conf.env.standalone_tdb2 = conf.IN_LAUNCH_DIR()
42 conf.env.disable_python = getattr(Options.options, 'disable_python', False)
44 if not conf.env.standalone_tdb2:
45 if conf.CHECK_BUNDLED_SYSTEM('tdb', minversion=VERSION,
46 implied_deps='replace'):
47 conf.define('USING_SYSTEM_TDB2', 1)
48 if conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytdb', 'tdb', minversion=VERSION):
49 conf.define('USING_SYSTEM_PYTDB', 1)
51 if not conf.env.disable_python:
52 # also disable if we don't have the python libs installed
53 conf.find_program('python', var='PYTHON')
54 conf.check_tool('python')
55 conf.check_python_version((2,4,2))
56 conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
57 if not conf.env.HAVE_PYTHON_H:
58 Logs.warn('Disabling pytdb as python devel libs not found')
59 conf.env.disable_python = True
61 # This make #include <ccan/...> work.
62 conf.ADD_EXTRA_INCLUDES('''#lib''')
64 conf.SAMBA_CONFIG_H()
66 def build(bld):
67 if bld.env.BUILD_TDB2:
68 bld.RECURSE('lib/replace')
69 bld.RECURSE('lib/ccan')
71 if bld.env.standalone_tdb2:
72 bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
73 private_library = False
74 else:
75 private_library = True
77 SRC = '''check.c free.c hash.c io.c lock.c open.c
78 summary.c tdb.c transaction.c traverse.c
79 tdb1_check.c tdb1_freelist.c tdb1_hash.c
80 tdb1_io.c tdb1_lock.c tdb1_open.c
81 tdb1_summary.c tdb1_tdb.c tdb1_transaction.c
82 tdb1_traverse.c'''
84 if not bld.CONFIG_SET('USING_SYSTEM_TDB2'):
85 bld.SAMBA_LIBRARY('tdb',
86 SRC,
87 deps='replace ccan',
88 includes='.',
89 abi_directory='ABI',
90 abi_match='tdb_* tdb1_incompatible_hash',
91 hide_symbols=True,
92 vnum=VERSION,
93 public_headers='tdb2.h',
94 public_headers_install=not private_library,
95 pc_files='tdb2.pc',
96 private_library=private_library)
98 bld.SAMBA_BINARY('tdbtorture',
99 'tools/tdb2torture.c',
100 deps='tdb',
101 install=False)
103 bld.SAMBA_BINARY('tdbtool',
104 'tools/tdb2tool.c',
105 deps='tdb')
107 bld.SAMBA_BINARY('tdbdump',
108 'tools/tdb2dump.c',
109 deps='tdb')
111 bld.SAMBA_BINARY('tdbrestore',
112 'tools/tdb2restore.c',
113 deps='tdb')
115 bld.SAMBA_BINARY('tdbbackup',
116 'tools/tdb2backup.c',
117 deps='tdb')
119 if not bld.CONFIG_SET('USING_SYSTEM_PYTDB'):
120 bld.SAMBA_PYTHON('pytdb',
121 source='pytdb.c',
122 deps='tdb',
123 enabled=not bld.env.disable_python,
124 realname='tdb.so',
125 cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
127 def dist():
128 '''makes a tarball for distribution'''
129 samba_dist.dist()
131 def reconfigure(ctx):
132 '''reconfigure if config scripts have changed'''
133 import samba_utils
134 samba_utils.reconfigure(ctx)