9 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
12 LIBTDB_DIR= srcdir + '/lib/tdb'
13 LIBTEVENT_DIR= srcdir + '/lib/tevent'
16 opt.recurse(LIBTDB_DIR)
17 opt.recurse(LIBTEVENT_DIR)
20 conf.sub_config(LIBTDB_DIR)
21 conf.sub_config(LIBTEVENT_DIR)
22 # where does the default LIBDIR end up? in conf.env somewhere?
24 conf.CONFIG_PATH('LDB_MODULESDIR', conf.SUBST_ENV_VAR('MODULESDIR') + '/ldb')
26 s4_build = getattr(conf.env, '_SAMBA_BUILD_', 0) == 4
29 # we need this for the ldap backend
30 conf.CHECK_FUNCS_IN('ber_flush ldap_open', 'lber ldap', headers='lber.h ldap.h', mandatory=True)
35 bld.BUILD_SUBDIR(LIBTDB_DIR)
36 bld.BUILD_SUBDIR(LIBTEVENT_DIR)
38 # in Samba4 we build some extra modules, and add extra
39 # capabilities to the ldb cmdline tools
40 s4_build = getattr(bld.env, '_SAMBA_BUILD_', 0) == 4
42 LDB_MAP_SRC = bld.SUBDIR('ldb_map',
43 'ldb_map.c ldb_map_inbound.c ldb_map_outbound.c')
45 COMMON_SRC = bld.SUBDIR('common',
46 '''ldb.c ldb_ldif.c ldb_parse.c ldb_msg.c ldb_utf8.c
47 ldb_debug.c ldb_dn.c ldb_match.c
48 ldb_attributes.c attrib_handlers.c ldb_controls.c qsort.c''')
50 bld.SAMBA_SUBSYSTEM('LIBLDB',
53 source='common/ldb_modules.c')
55 bld.SAMBA_MODULE('ldb_asq',
57 init_function='LDB_MODULE(asq)',
60 bld.SAMBA_MODULE('ldb_server_sort',
62 init_function='LDB_MODULE(server_sort)',
65 bld.SAMBA_MODULE('ldb_paged_results',
66 'modules/paged_results.c',
67 init_function='LDB_MODULE(paged_results)',
70 bld.SAMBA_MODULE('ldb_paged_searches',
71 'modules/paged_searches.c',
72 init_function='LDB_MODULE(paged_searches)',
76 bld.SAMBA_MODULE('ldb_rdn_name',
78 init_function='LDB_MODULE(rdn_name)',
81 bld.SAMBA_MODULE('ldb_sample',
82 'tests/sample_module.c',
83 init_function='LDB_MODULE(sample)',
86 bld.SAMBA_MODULE('ldb_skel',
88 init_function='LDB_MODULE(skel)',
91 bld.SAMBA_MODULE('ldb_sqlite3',
92 'sqlite3/ldb_sqlite3.c',
93 init_function='LDB_BACKEND(sqlite3)',
97 bld.SAMBA_MODULE('ldb_tdb',
99 '''ldb_tdb.c ldb_pack.c ldb_search.c ldb_index.c
100 ldb_cache.c ldb_tdb_wrap.c'''),
101 init_function='LDB_BACKEND(tdb)',
105 # this is only in the s4 build
106 bld.SAMBA_MODULE('ldb_ildap', 'ldb_ildap/ldb_ildap.c',
107 init_function='LDB_BACKEND(ldapi),LDB_BACKEND(ldaps),LDB_BACKEND(ldap)',
108 deps='talloc LIBCLI_LDAP CREDENTIALS',
112 # this is not included in the s4 build
113 bld.SAMBA_MODULE('ldb_ldap', 'ldb_ldap/ldb_ldap.c',
114 init_function='LDB_BACKEND(ldapi),LDB_BACKEND(ldaps),LDB_BACKEND(ldap)',
115 deps='talloc lber ldap',
116 enabled=not s4_build,
119 # we're not currently linking against the ldap libs, but ldb.pc.in
121 bld.env.LDAP_LIBS = ''
123 if not 'PACKAGE_VERSION' in bld.env:
124 bld.env.PACKAGE_VERSION = VERSION
125 bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
127 ldb_deps = 'tevent LIBLDB'
129 # the s4 build of ldb is really quite different from the normal build
130 # so we give the library a different name to prevent problems with apps
131 # that may depend on the distro version of ldb
133 bld.TARGET_ALIAS(lib_name, 'ldb')
134 ldb_deps += ' LDBSAMBA POPT_CREDENTIALS POPT_SAMBA LIBCMDLINE_CREDENTIALS gensec'
138 bld.SAMBA_LIBRARY(lib_name,
139 COMMON_SRC + ' ' + LDB_MAP_SRC,
142 public_headers='include/ldb.h include/ldb_errors.h',
146 bld.SAMBA_SUBSYSTEM('LIBLDB_CMDLINE',
147 'tools/ldbutil.c tools/cmdline.c',
150 LDB_TOOLS='ldbadd ldbsearch ldbdel ldbmodify ldbedit ldbrename'
151 for t in LDB_TOOLS.split():
152 bld.SAMBA_BINARY(t, 'tools/%s.c' % t, deps='LIBLDB_CMDLINE')
154 # ldbtest doesn't get installed
155 bld.SAMBA_BINARY('ldbtest', 'tools/ldbtest.c', deps='LIBLDB_CMDLINE', install=False)
158 bld.SAMBA_PYTHON('pyldb', 'pyldb.c',