9 # find the buildtools directory
10 buildtools = 'buildtools ../../../buildtools'
11 for d in buildtools.split():
13 srcdir = os.path.dirname(d) or '.'
16 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
17 import wafsamba, samba_dist
19 samba_dist.DIST_DIRS('''lib/ldb:. lib/replace:lib/replace lib/talloc:lib/talloc
20 lib/tdb:lib/tdb lib/tevent:lib/tevent buildtools:buildtools''')
23 LIBTDB_DIR= srcdir + '/lib/tdb'
24 LIBTEVENT_DIR= srcdir + '/lib/tevent'
25 LIBPOPT_DIR= srcdir + '/lib/popt'
28 opt.BUILTIN_DEFAULT('replace')
29 opt.BUNDLED_EXTENSION_DEFAULT('ldb', noextenion='ldb')
30 opt.recurse(LIBTDB_DIR)
31 opt.recurse(LIBTEVENT_DIR)
34 conf.sub_config(LIBTDB_DIR)
35 conf.sub_config(LIBTEVENT_DIR)
36 conf.sub_config(LIBPOPT_DIR)
37 # where does the default LIBDIR end up? in conf.env somewhere?
39 conf.CONFIG_PATH('LDB_MODULESDIR', conf.SUBST_ENV_VAR('MODULESDIR') + '/ldb')
41 s4_build = getattr(conf.env, '_SAMBA_BUILD_', 0) == 4
45 if conf.CHECK_BUNDLED_SYSTEM('ldb', minversion=VERSION,
46 onlyif='talloc tdb tevent',
47 implied_deps='replace talloc tdb tevent'):
48 conf.define('USING_SYSTEM_LDB', 1)
49 # we need this for the ldap backend
50 conf.CHECK_FUNCS_IN('ber_flush ldap_open', 'lber ldap', headers='lber.h ldap.h', mandatory=True)
52 conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
57 bld.BUILD_SUBDIR(LIBTDB_DIR)
58 bld.BUILD_SUBDIR(LIBTEVENT_DIR)
59 bld.BUILD_SUBDIR(LIBPOPT_DIR)
61 # in Samba4 we build some extra modules, and add extra
62 # capabilities to the ldb cmdline tools
63 s4_build = getattr(bld.env, '_SAMBA_BUILD_', 0) == 4
65 LDB_MAP_SRC = bld.SUBDIR('ldb_map',
66 'ldb_map.c ldb_map_inbound.c ldb_map_outbound.c')
68 COMMON_SRC = bld.SUBDIR('common',
69 '''ldb.c ldb_ldif.c ldb_parse.c ldb_msg.c ldb_utf8.c
70 ldb_debug.c ldb_dn.c ldb_match.c
71 ldb_attributes.c attrib_handlers.c ldb_controls.c qsort.c''')
73 bld.SAMBA_SUBSYSTEM('LIBLDB',
76 source='common/ldb_modules.c')
78 bld.SAMBA_MODULE('ldb_asq',
80 init_function='LDB_MODULE(asq)',
83 bld.SAMBA_MODULE('ldb_server_sort',
85 init_function='LDB_MODULE(server_sort)',
88 bld.SAMBA_MODULE('ldb_paged_results',
89 'modules/paged_results.c',
90 init_function='LDB_MODULE(paged_results)',
93 bld.SAMBA_MODULE('ldb_paged_searches',
94 'modules/paged_searches.c',
95 init_function='LDB_MODULE(paged_searches)',
99 bld.SAMBA_MODULE('ldb_rdn_name',
100 'modules/rdn_name.c',
101 init_function='LDB_MODULE(rdn_name)',
104 bld.SAMBA_MODULE('ldb_sample',
105 'tests/sample_module.c',
106 init_function='LDB_MODULE(sample)',
109 bld.SAMBA_MODULE('ldb_skel',
111 init_function='LDB_MODULE(skel)',
114 bld.SAMBA_MODULE('ldb_sqlite3',
115 'sqlite3/ldb_sqlite3.c',
116 init_function='LDB_BACKEND(sqlite3)',
120 bld.SAMBA_MODULE('ldb_tdb',
121 bld.SUBDIR('ldb_tdb',
122 '''ldb_tdb.c ldb_pack.c ldb_search.c ldb_index.c
123 ldb_cache.c ldb_tdb_wrap.c'''),
124 init_function='LDB_BACKEND(tdb)',
128 # this is only in the s4 build
129 bld.SAMBA_MODULE('ldb_ildap', 'ldb_ildap/ldb_ildap.c',
130 init_function='LDB_BACKEND(ldapi),LDB_BACKEND(ldaps),LDB_BACKEND(ldap)',
131 deps='talloc LIBCLI_LDAP CREDENTIALS',
135 # this is not included in the s4 build
136 bld.SAMBA_MODULE('ldb_ldap', 'ldb_ldap/ldb_ldap.c',
137 init_function='LDB_BACKEND(ldapi),LDB_BACKEND(ldaps),LDB_BACKEND(ldap)',
138 deps='talloc lber ldap',
139 enabled=not s4_build,
142 # we're not currently linking against the ldap libs, but ldb.pc.in
144 bld.env.LDAP_LIBS = ''
146 if not 'PACKAGE_VERSION' in bld.env:
147 bld.env.PACKAGE_VERSION = VERSION
148 bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
150 ldb_deps = 'tevent LIBLDB'
152 ldb_deps += ' LDBSAMBA POPT_CREDENTIALS POPT_SAMBA LIBCMDLINE_CREDENTIALS gensec'
154 if not bld.CONFIG_SET('USING_SYSTEM_LDB'):
155 modules_dir = bld.EXPAND_VARIABLES('${LDB_MODULESDIR}')
156 bld.SAMBA_LIBRARY('ldb',
157 COMMON_SRC + ' ' + LDB_MAP_SRC,
160 public_headers='include/ldb.h include/ldb_errors.h',
162 cflags='-DLDB_MODULESDIR=\"%s\"' % modules_dir,
165 bld.SAMBA_SUBSYSTEM('LIBLDB_CMDLINE',
166 'tools/ldbutil.c tools/cmdline.c',
169 LDB_TOOLS='ldbadd ldbsearch ldbdel ldbmodify ldbedit ldbrename'
170 for t in LDB_TOOLS.split():
171 bld.SAMBA_BINARY(t, 'tools/%s.c' % t, deps='LIBLDB_CMDLINE')
173 # ldbtest doesn't get installed
174 bld.SAMBA_BINARY('ldbtest', 'tools/ldbtest.c', deps='LIBLDB_CMDLINE', install=False)
177 bld.SAMBA_PYTHON('pyldb', 'pyldb.c',