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
18 samba_dist.DIST_DIRS('''source4/lib/ldb:. lib/replace:lib/replace lib/talloc:lib/talloc
19 lib/tdb:lib/tdb lib/tevent:lib/tevent lib/popt:lib/popt
20 buildtools:buildtools''')
24 opt.BUILTIN_DEFAULT('replace')
25 opt.BUNDLED_EXTENSION_DEFAULT('ldb', noextenion='ldb')
26 opt.RECURSE('lib/tdb')
27 opt.RECURSE('lib/tevent')
30 conf.RECURSE('lib/tdb')
31 conf.RECURSE('lib/tevent')
32 conf.RECURSE('lib/popt')
34 # where does the default LIBDIR end up? in conf.env somewhere?
36 conf.CONFIG_PATH('LDB_MODULESDIR', conf.SUBST_ENV_VAR('MODULESDIR') + '/ldb')
38 s4_build = getattr(conf.env, '_SAMBA_BUILD_', 0) == 4
40 conf.env.standalone_ldb = conf.IN_LAUNCH_DIR()
42 if not conf.env.standalone_ldb:
43 if conf.CHECK_BUNDLED_SYSTEM('ldb', minversion=VERSION,
44 onlyif='talloc tdb tevent',
45 implied_deps='replace talloc tdb tevent'):
46 conf.define('USING_SYSTEM_LDB', 1)
48 if conf.env.standalone_ldb:
49 conf.find_program('xsltproc', var='XSLTPROC')
51 # we need this for the ldap backend
52 if conf.CHECK_FUNCS_IN('ber_flush ldap_open ldap_initialize', 'lber ldap', headers='lber.h ldap.h'):
53 conf.env.ENABLE_LDAP_BACKEND = True
55 conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
60 bld.RECURSE('lib/tdb')
61 bld.RECURSE('lib/tevent')
62 bld.RECURSE('lib/popt')
64 # in Samba4 we build some extra modules, and add extra
65 # capabilities to the ldb cmdline tools
66 s4_build = getattr(bld.env, '_SAMBA_BUILD_', 0) == 4
68 LDB_MAP_SRC = bld.SUBDIR('ldb_map',
69 'ldb_map.c ldb_map_inbound.c ldb_map_outbound.c')
71 COMMON_SRC = bld.SUBDIR('common',
72 '''ldb.c ldb_ldif.c ldb_parse.c ldb_msg.c ldb_utf8.c
73 ldb_debug.c ldb_dn.c ldb_match.c ldb_modules.c
74 ldb_attributes.c attrib_handlers.c ldb_controls.c qsort.c''')
77 # this is only in the s4 build
78 bld.SAMBA_MODULE('ldb_ildap', 'ldb_ildap/ldb_ildap.c',
79 init_function='LDB_BACKEND(ldapi),LDB_BACKEND(ldaps),LDB_BACKEND(ldap)',
80 deps='talloc LIBCLI_LDAP CREDENTIALS',
81 internal_module=not bld.CONFIG_SET('USING_SYSTEM_LDB'),
85 # this is not included in the s4 build
86 bld.SAMBA_MODULE('ldb_ldap', 'ldb_ldap/ldb_ldap.c',
87 init_function='LDB_BACKEND(ldapi),LDB_BACKEND(ldaps),LDB_BACKEND(ldap)',
88 deps='talloc lber ldap',
89 enabled=bld.env.ENABLE_LDAP_BACKEND,
92 # we're not currently linking against the ldap libs, but ldb.pc.in
94 bld.env.LDAP_LIBS = ''
96 if not 'PACKAGE_VERSION' in bld.env:
97 bld.env.PACKAGE_VERSION = VERSION
98 bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
101 abi_file='ABI/ldb-samba4-%s.sigs' % VERSION
103 abi_file='ABI/ldb-%s.sigs' % VERSION
105 bld.SAMBA_PYTHON('pyldb_util', deps='ldb',
106 source='pyldb_util.c')
108 if not bld.CONFIG_SET('USING_SYSTEM_LDB'):
109 modules_dir = bld.EXPAND_VARIABLES('${LDB_MODULESDIR}')
110 bld.SAMBA_LIBRARY('ldb',
111 COMMON_SRC + ' ' + LDB_MAP_SRC,
114 public_headers='include/ldb.h include/ldb_errors.h '\
115 'include/ldb_module.h include/ldb_handlers.h',
117 cflags='-DLDB_MODULESDIR=\"%s\"' % modules_dir,
119 abi_match='!ldb_*module_ops !ldb_*backend_ops ldb_*',
120 vnum=VERSION, manpages='man/ldb.3',
121 is_bundled=not bld.env.standalone_ldb)
123 bld.SAMBA_PYTHON('pyldb', 'pyldb.c',
124 deps='ldb pyldb_util',
127 bld.SAMBA_MODULE('ldb_paged_results',
128 'modules/paged_results.c',
130 init_function='LDB_MODULE(paged_results)',
133 bld.SAMBA_MODULE('ldb_asq',
136 init_function='LDB_MODULE(asq)',
139 bld.SAMBA_MODULE('ldb_server_sort',
142 init_function='LDB_MODULE(server_sort)',
145 bld.SAMBA_MODULE('ldb_paged_searches',
146 'modules/paged_searches.c',
148 init_function='LDB_MODULE(paged_searches)',
152 bld.SAMBA_MODULE('ldb_rdn_name',
153 'modules/rdn_name.c',
155 init_function='LDB_MODULE(rdn_name)',
158 bld.SAMBA_MODULE('ldb_sample',
159 'tests/sample_module.c',
161 init_function='LDB_MODULE(sample)',
164 bld.SAMBA_MODULE('ldb_skel',
167 init_function='LDB_MODULE(skel)',
170 bld.SAMBA_MODULE('ldb_sqlite3',
171 'sqlite3/ldb_sqlite3.c',
173 init_function='LDB_BACKEND(sqlite3)',
177 bld.SAMBA_MODULE('ldb_tdb',
178 bld.SUBDIR('ldb_tdb',
179 '''ldb_tdb.c ldb_pack.c ldb_search.c ldb_index.c
180 ldb_cache.c ldb_tdb_wrap.c'''),
181 init_function='LDB_BACKEND(tdb)',
187 extra_cmdline_deps = ' LDBSAMBA POPT_SAMBA POPT_CREDENTIALS ' \
188 'LIBCMDLINE_CREDENTIALS gensec'
190 extra_cmdline_deps = ''
192 bld.SAMBA_SUBSYSTEM('LIBLDB_CMDLINE',
193 'tools/ldbutil.c tools/cmdline.c',
194 'ldb dl popt' + extra_cmdline_deps)
196 LDB_TOOLS='ldbadd ldbsearch ldbdel ldbmodify ldbedit ldbrename'
197 for t in LDB_TOOLS.split():
198 bld.SAMBA_BINARY(t, 'tools/%s.c' % t, deps='LIBLDB_CMDLINE',
199 manpages='man/%s.1' % t)
201 # ldbtest doesn't get installed
202 bld.SAMBA_BINARY('ldbtest', 'tools/ldbtest.c', deps='LIBLDB_CMDLINE',
207 '''run ldb testsuite'''
209 cmd = 'tests/test-tdb.sh'
213 '''makes a tarball for distribution'''