10 # find the buildtools directory
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')
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)
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''')
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
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
84 if not bld
.CONFIG_SET('USING_SYSTEM_TDB2'):
85 bld
.SAMBA_LIBRARY('tdb',
90 abi_match
='tdb_* tdb1_incompatible_hash',
93 public_headers
='tdb2.h',
94 public_headers_install
=not private_library
,
95 private_library
=private_library
)
97 bld
.SAMBA_BINARY('tdbtorture',
98 'tools/tdb2torture.c',
102 bld
.SAMBA_BINARY('tdbtool',
106 bld
.SAMBA_BINARY('tdbdump',
110 bld
.SAMBA_BINARY('tdbrestore',
111 'tools/tdb2restore.c',
114 bld
.SAMBA_BINARY('tdbbackup',
115 'tools/tdb2backup.c',
118 if not bld
.CONFIG_SET('USING_SYSTEM_PYTDB'):
119 bld
.SAMBA_PYTHON('pytdb',
122 enabled
=not bld
.env
.disable_python
,
124 cflags
='-DPACKAGE_VERSION=\"%s\"' % VERSION
)
127 '''makes a tarball for distribution'''
130 def reconfigure(ctx
):
131 '''reconfigure if config scripts have changed'''
133 samba_utils
.reconfigure(ctx
)