Now make_connection_snum() is a static function that takes a
[Samba/gebeck_regimport.git] / lib / tdb / wscript
blobebbab2cc92101b82c04e631695ecfae4cc4ba722
1 #!/usr/bin/env python
3 APPNAME = 'tdb'
4 VERSION = '1.2.9'
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_PKG('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.find_program('python', var='PYTHON')
49 conf.check_tool('python')
50 conf.check_python_version((2,4,2))
51 conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
52 if not conf.env.HAVE_PYTHON_H:
53 Logs.warn('Disabling pytdb as python devel libs not found')
54 conf.env.disable_python = True
56 conf.SAMBA_CONFIG_H()
58 conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
60 def build(bld):
61 bld.RECURSE('lib/replace')
63 COMMON_SRC = bld.SUBDIR('common',
64 '''check.c error.c tdb.c traverse.c
65 freelistcheck.c lock.c dump.c freelist.c
66 io.c open.c transaction.c hash.c summary.c''')
68 if bld.env.standalone_tdb:
69 bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
70 private_library = False
71 else:
72 private_library = True
74 if not bld.CONFIG_SET('USING_SYSTEM_TDB'):
75 bld.SAMBA_LIBRARY('tdb',
76 COMMON_SRC,
77 deps='replace',
78 includes='include',
79 abi_directory='ABI',
80 abi_match='tdb_*',
81 hide_symbols=True,
82 vnum=VERSION,
83 public_headers='include/tdb.h',
84 public_headers_install=not private_library,
85 pc_files='tdb.pc',
86 private_library=private_library)
88 bld.SAMBA_BINARY('tdbtorture',
89 'tools/tdbtorture.c',
90 'tdb',
91 install=False)
93 bld.SAMBA_BINARY('tdbrestore',
94 'tools/tdbrestore.c',
95 'tdb', manpages='manpages/tdbrestore.8')
97 bld.SAMBA_BINARY('tdbdump',
98 'tools/tdbdump.c',
99 'tdb', manpages='manpages/tdbdump.8')
101 bld.SAMBA_BINARY('tdbbackup',
102 'tools/tdbbackup.c',
103 'tdb',
104 manpages='manpages/tdbbackup.8')
106 bld.SAMBA_BINARY('tdbtool',
107 'tools/tdbtool.c',
108 'tdb', manpages='manpages/tdbtool.8')
110 if not bld.CONFIG_SET('USING_SYSTEM_PYTDB'):
111 bld.SAMBA_PYTHON('pytdb',
112 'pytdb.c',
113 deps='tdb',
114 enabled=not bld.env.disable_python,
115 realname='tdb.so',
116 cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
120 def test(ctx):
121 '''run tdb testsuite'''
122 import Utils, samba_utils, shutil
123 test_prefix = "%s/st" % (Utils.g_module.blddir)
124 shutil.rmtree(test_prefix, ignore_errors=True)
125 os.makedirs(test_prefix)
126 os.environ['TEST_DATA_PREFIX'] = test_prefix
127 cmd = os.path.join(Utils.g_module.blddir, 'tdbtorture')
128 ret = samba_utils.RUN_COMMAND(cmd)
129 print("testsuite returned %d" % ret)
130 sys.exit(ret)
132 def dist():
133 '''makes a tarball for distribution'''
134 samba_dist.dist()
136 def reconfigure(ctx):
137 '''reconfigure if config scripts have changed'''
138 import samba_utils
139 samba_utils.reconfigure(ctx)