2010-03-28 09:48:49 +11:00
#!/usr/bin/env python
2010-04-04 10:06:34 +10:00
APPNAME = 'tdb'
2010-10-17 19:39:09 +02:00
VERSION = '1.2.7'
2010-03-17 20:31:46 +11:00
2010-03-17 20:32:15 +11:00
blddir = 'bin'
2010-02-21 00:24:40 +11:00
2010-04-04 10:18:39 +10:00
import sys, os
# find the buildtools directory
2010-04-04 13:16:49 +10:00
srcdir = '.'
while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
srcdir = '../' + srcdir
sys.path.insert(0, srcdir + '/buildtools/wafsamba')
2010-04-04 10:18:39 +10:00
2010-04-13 20:13:00 +10:00
import wafsamba, samba_dist, Options, Logs
2010-04-04 11:00:42 +10:00
samba_dist.DIST_DIRS('lib/tdb:. lib/replace:lib/replace buildtools:buildtools')
2010-02-26 22:21:50 +11:00
2010-02-21 00:24:40 +11:00
def set_options(opt):
2010-03-28 15:42:28 +11:00
opt.BUILTIN_DEFAULT('replace')
2010-10-23 23:26:43 +02:00
opt.PRIVATE_EXTENSION_DEFAULT('tdb', noextension='tdb')
2010-04-04 13:16:49 +10:00
opt.RECURSE('lib/replace')
2010-04-13 20:13:00 +10:00
if opt.IN_LAUNCH_DIR():
opt.add_option('--disable-python',
help=("disable the pytdb module"),
action="store_true", dest='disable_python', default=False)
2010-02-21 00:24:40 +11:00
def configure(conf):
2010-04-04 13:16:49 +10:00
conf.RECURSE('lib/replace')
2010-03-28 16:38:27 +11:00
2010-04-13 20:13:00 +10:00
conf.env.standalone_tdb = conf.IN_LAUNCH_DIR()
2010-04-13 21:33:04 +10:00
if not conf.env.standalone_tdb:
if conf.CHECK_BUNDLED_SYSTEM('tdb', minversion=VERSION,
implied_deps='replace'):
conf.define('USING_SYSTEM_TDB', 1)
2010-10-04 13:39:32 +02:00
if conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytdb', 'tdb', minversion=VERSION):
conf.define('USING_SYSTEM_PYTDB', 1)
2010-04-13 21:33:04 +10:00
2010-04-13 20:13:00 +10:00
conf.env.disable_python = getattr(Options.options, 'disable_python', False)
2010-06-24 16:03:02 +10:00
conf.CHECK_XSLTPROC_MANPAGES()
2010-04-13 20:13:00 +10:00
if not conf.env.disable_python:
# also disable if we don't have the python libs installed
conf.check_tool('python')
conf.check_python_version((2,4,2))
2010-04-21 16:17:08 +10:00
conf.check_python_headers(mandatory=False)
2010-04-13 20:13:00 +10:00
if not conf.env.HAVE_PYTHON_H:
Logs.warn('Disabling pytdb as python devel libs not found')
conf.env.disable_python = True
2010-03-17 20:31:46 +11:00
conf.SAMBA_CONFIG_H()
2010-02-21 00:24:40 +11:00
def build(bld):
2010-04-04 13:16:49 +10:00
bld.RECURSE('lib/replace')
2010-02-21 00:24:40 +11:00
2010-03-17 20:31:46 +11:00
COMMON_SRC = bld.SUBDIR('common',
'''check.c error.c tdb.c traverse.c
freelistcheck.c lock.c dump.c freelist.c
2010-09-24 15:34:06 +09:30
io.c open.c transaction.c hash.c''')
2010-02-21 00:24:40 +11:00
2010-10-24 11:50:47 -07:00
if bld.env.standalone_tdb:
bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
bld.PKG_CONFIG_FILES('tdb.pc', vnum=VERSION)
bld.INSTALL_FILES('${INCLUDEDIR}', 'include/tdb.h', flat=True)
vnum = VERSION
private_library = False
else:
private_library = True
vnum = None
2010-03-28 16:38:27 +11:00
if not bld.CONFIG_SET('USING_SYSTEM_TDB'):
bld.SAMBA_LIBRARY('tdb',
COMMON_SRC,
2010-08-31 13:06:39 +02:00
deps='replace',
2010-03-28 16:38:27 +11:00
includes='include',
2010-04-18 12:46:33 +10:00
abi_file='ABI/tdb-%s.sigs' % VERSION,
abi_match='tdb_*',
2010-04-20 13:53:35 +10:00
hide_symbols=True,
2010-10-24 11:50:47 -07:00
vnum=vnum,
private_library=private_library)
2010-02-21 00:24:40 +11:00
2010-05-31 04:20:44 +02:00
bld.SAMBA_BINARY('tdbtorture',
'tools/tdbtorture.c',
'tdb',
install=False)
2010-09-18 10:56:10 +04:00
bld.SAMBA_BINARY('tdbrestore',
'tools/tdbrestore.c',
'tdb', manpages='manpages/tdbrestore.8')
2010-05-31 04:20:44 +02:00
bld.SAMBA_BINARY('tdbdump',
'tools/tdbdump.c',
'tdb', manpages='manpages/tdbdump.8')
bld.SAMBA_BINARY('tdbbackup',
'tools/tdbbackup.c',
'tdb',
manpages='manpages/tdbbackup.8')
bld.SAMBA_BINARY('tdbtool',
'tools/tdbtool.c',
'tdb', manpages='manpages/tdbtool.8')
2010-03-17 17:20:02 +11:00
2010-10-04 13:38:39 +02:00
if not bld.CONFIG_SET('USING_SYSTEM_PYTDB'):
bld.SAMBA_PYTHON('pytdb',
'pytdb.c',
deps='tdb',
enabled=not bld.env.disable_python,
realname='tdb.so',
cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
2010-03-17 17:20:02 +11:00
2010-04-13 20:13:00 +10:00
2010-04-04 22:11:30 +10:00
def test(ctx):
'''run tdb testsuite'''
2010-10-07 12:25:42 +11:00
import Utils, samba_utils
2010-04-04 22:11:30 +10:00
cmd = os.path.join(Utils.g_module.blddir, 'tdbtorture')
2010-10-07 12:25:42 +11:00
ret = samba_utils.RUN_COMMAND(cmd)
print("testsuite returned %d" % ret)
sys.exit(ret)
2010-04-05 09:58:23 +10:00
def dist():
'''makes a tarball for distribution'''
samba_dist.dist()
2010-11-03 12:09:23 +11:00
def reconfigure(ctx):
'''reconfigure if config scripts have changed'''
import samba_utils
samba_utils.reconfigure(ctx)