s4-waf: nsstest only needs replace.
[Samba.git] / lib / tdb / wscript
blobf00d119c9ba6fc55ee1347612a556d86f4f57f5f
1 #!/usr/bin/env python
3 APPNAME = 'tdb'
4 VERSION = '1.2.7'
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/tdb:. lib/replace:lib/replace buildtools:buildtools')
20 def set_options(opt):
21 opt.BUILTIN_DEFAULT('replace')
22 opt.PRIVATE_EXTENSION_DEFAULT('tdb', noextension='tdb')
23 opt.RECURSE('lib/replace')
24 if opt.IN_LAUNCH_DIR():
25 opt.add_option('--disable-python',
26 help=("disable the pytdb module"),
27 action="store_true", dest='disable_python', default=False)
30 def configure(conf):
31 conf.RECURSE('lib/replace')
33 conf.env.standalone_tdb = conf.IN_LAUNCH_DIR()
35 if not conf.env.standalone_tdb:
36 if conf.CHECK_BUNDLED_SYSTEM('tdb', minversion=VERSION,
37 implied_deps='replace'):
38 conf.define('USING_SYSTEM_TDB', 1)
39 if conf.CHECK_BUNDLED_SYSTEM_PYTHON('pytdb', 'tdb', minversion=VERSION):
40 conf.define('USING_SYSTEM_PYTDB', 1)
42 conf.env.disable_python = getattr(Options.options, 'disable_python', False)
44 conf.CHECK_XSLTPROC_MANPAGES()
46 if not conf.env.disable_python:
47 # also disable if we don't have the python libs installed
48 conf.check_tool('python')
49 conf.check_python_version((2,4,2))
50 conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
51 if not conf.env.HAVE_PYTHON_H:
52 Logs.warn('Disabling pytdb as python devel libs not found')
53 conf.env.disable_python = True
55 conf.SAMBA_CONFIG_H()
57 def build(bld):
58 bld.RECURSE('lib/replace')
60 COMMON_SRC = bld.SUBDIR('common',
61 '''check.c error.c tdb.c traverse.c
62 freelistcheck.c lock.c dump.c freelist.c
63 io.c open.c transaction.c hash.c''')
65 if bld.env.standalone_tdb:
66 bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
67 bld.PKG_CONFIG_FILES('tdb.pc', vnum=VERSION)
68 bld.INSTALL_FILES('${INCLUDEDIR}', 'include/tdb.h', flat=True)
69 private_library = False
70 else:
71 private_library = True
73 if not bld.CONFIG_SET('USING_SYSTEM_TDB'):
74 bld.SAMBA_LIBRARY('tdb',
75 COMMON_SRC,
76 deps='replace',
77 includes='include',
78 abi_directory='ABI',
79 abi_match='tdb_*',
80 hide_symbols=True,
81 vnum=VERSION,
82 private_library=private_library)
84 bld.SAMBA_BINARY('tdbtorture',
85 'tools/tdbtorture.c',
86 'tdb',
87 install=False)
89 bld.SAMBA_BINARY('tdbrestore',
90 'tools/tdbrestore.c',
91 'tdb', manpages='manpages/tdbrestore.8')
93 bld.SAMBA_BINARY('tdbdump',
94 'tools/tdbdump.c',
95 'tdb', manpages='manpages/tdbdump.8')
97 bld.SAMBA_BINARY('tdbbackup',
98 'tools/tdbbackup.c',
99 'tdb',
100 manpages='manpages/tdbbackup.8')
102 bld.SAMBA_BINARY('tdbtool',
103 'tools/tdbtool.c',
104 'tdb', manpages='manpages/tdbtool.8')
106 if not bld.CONFIG_SET('USING_SYSTEM_PYTDB'):
107 bld.SAMBA_PYTHON('pytdb',
108 'pytdb.c',
109 deps='tdb',
110 enabled=not bld.env.disable_python,
111 realname='tdb.so',
112 cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
116 def test(ctx):
117 '''run tdb testsuite'''
118 import Utils, samba_utils
119 cmd = os.path.join(Utils.g_module.blddir, 'tdbtorture')
120 ret = samba_utils.RUN_COMMAND(cmd)
121 print("testsuite returned %d" % ret)
122 sys.exit(ret)
124 def dist():
125 '''makes a tarball for distribution'''
126 samba_dist.dist()
128 def reconfigure(ctx):
129 '''reconfigure if config scripts have changed'''
130 import samba_utils
131 samba_utils.reconfigure(ctx)