source: vendor/3.6.0/source4/lib/ldb/wscript

Last change on this file was 740, checked in by Silvan Scherrer, 13 years ago

Samba Server: update vendor to 3.6.0

File size: 10.8 KB
Line 
1#!/usr/bin/env python
2
3APPNAME = 'ldb'
4VERSION = '1.0.2'
5
6blddir = 'bin'
7
8import sys, os
9
10# find the buildtools directory
11srcdir = '.'
12while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
13 srcdir = '../' + srcdir
14sys.path.insert(0, srcdir + '/buildtools/wafsamba')
15
16import wafsamba, samba_dist, Options
17
18samba_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''')
21
22
23def set_options(opt):
24 opt.BUILTIN_DEFAULT('replace')
25 opt.PRIVATE_EXTENSION_DEFAULT('ldb', noextension='ldb')
26 opt.RECURSE('lib/tdb')
27 opt.RECURSE('lib/tevent')
28 opt.RECURSE('lib/replace')
29
30def configure(conf):
31 conf.RECURSE('lib/tdb')
32 conf.RECURSE('lib/tevent')
33 conf.RECURSE('lib/popt')
34 conf.RECURSE('lib/replace')
35
36 # where does the default LIBDIR end up? in conf.env somewhere?
37 #
38 conf.CONFIG_PATH('LDB_MODULESDIR', conf.SUBST_ENV_VAR('MODULESDIR') + '/ldb')
39
40 conf.env.standalone_ldb = conf.IN_LAUNCH_DIR()
41
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)
47 if conf.CHECK_BUNDLED_SYSTEM('pyldb-util', minversion=VERSION,
48 onlyif='talloc tdb tevent ldb',
49 implied_deps='replace talloc tdb tevent ldb'):
50 conf.define('USING_SYSTEM_PYLDB_UTIL', 1)
51
52 if conf.env.standalone_ldb:
53 conf.CHECK_XSLTPROC_MANPAGES()
54
55 # we need this for the ldap backend
56 if conf.CHECK_FUNCS_IN('ber_flush ldap_open ldap_initialize', 'lber ldap', headers='lber.h ldap.h'):
57 conf.env.ENABLE_LDAP_BACKEND = True
58
59 conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
60
61 # we don't want any libraries or modules to rely on runtime
62 # resolution of symbols
63 if sys.platform != "openbsd4":
64 conf.ADD_LDFLAGS('-Wl,-no-undefined', testflags=True)
65
66 conf.SAMBA_CONFIG_H()
67
68def build(bld):
69 bld.RECURSE('lib/tdb')
70 bld.RECURSE('lib/tevent')
71 bld.RECURSE('lib/popt')
72 bld.RECURSE('lib/replace')
73
74 if bld.env.standalone_ldb:
75 private_library = False
76 ldb_pc_files='ldb.pc'
77 pyldb_pc_files='pyldb-util.pc'
78 else:
79 private_library = True
80 ldb_pc_files=None
81 pyldb_pc_files=None
82
83 LDB_MAP_SRC = bld.SUBDIR('ldb_map',
84 'ldb_map.c ldb_map_inbound.c ldb_map_outbound.c')
85
86 COMMON_SRC = bld.SUBDIR('common',
87 '''ldb_modules.c ldb_ldif.c ldb_parse.c ldb_msg.c ldb_utf8.c
88 ldb_debug.c ldb_dn.c ldb_match.c ldb_options.c
89 ldb_attributes.c attrib_handlers.c ldb_controls.c qsort.c''')
90
91 bld.SAMBA_MODULE('ldb_ldap', 'ldb_ldap/ldb_ldap.c',
92 init_function='ldb_ldap_init',
93 module_init_name='ldb_init_module',
94 deps='talloc lber ldap ldb',
95 enabled=bld.env.ENABLE_LDAP_BACKEND,
96 internal_module=False,
97 subsystem='ldb')
98
99 # we're not currently linking against the ldap libs, but ldb.pc.in
100 # has @LDAP_LIBS@
101 bld.env.LDAP_LIBS = ''
102
103 if not 'PACKAGE_VERSION' in bld.env:
104 bld.env.PACKAGE_VERSION = VERSION
105 bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
106
107 if not bld.CONFIG_SET('USING_SYSTEM_PYLDB_UTIL'):
108 bld.SAMBA_LIBRARY('pyldb-util',
109 deps='ldb pytalloc-util',
110 source='pyldb_util.c',
111 public_headers='pyldb.h',
112 public_headers_install=not private_library,
113 vnum=VERSION,
114 private_library=private_library,
115 pc_files=pyldb_pc_files,
116 pyext=True)
117
118 if not bld.CONFIG_SET('USING_SYSTEM_LDB'):
119 if Options.is_install:
120 modules_dir = bld.EXPAND_VARIABLES('${LDB_MODULESDIR}')
121 else:
122 # when we run from the source directory, we want to use
123 # the current modules, not the installed ones
124 modules_dir = os.path.join(os.getcwd(), 'bin/modules/ldb')
125
126 abi_match = '!ldb_*module_ops !ldb_*backend_ops ldb_*'
127
128 bld.SAMBA_LIBRARY('ldb',
129 COMMON_SRC + ' ' + LDB_MAP_SRC,
130 deps='tevent LIBLDB_MAIN',
131 includes='include',
132 public_headers='include/ldb.h include/ldb_errors.h '\
133 'include/ldb_module.h include/ldb_handlers.h',
134 public_headers_install=not private_library,
135 pc_files=ldb_pc_files,
136 vnum=VERSION,
137 private_library=private_library,
138 manpages='man/ldb.3',
139 abi_directory = 'ABI',
140 abi_match = abi_match)
141
142 # generate a include/ldb_version.h
143 t = bld.SAMBA_GENERATOR('ldb_version.h',
144 rule='echo "#define LDB_VERSION \\"${LDB_VERSION}\\"" > ${TGT}',
145 target='include/ldb_version.h',
146 public_headers='include/ldb_version.h',
147 public_headers_install=not private_library)
148 t.env.LDB_VERSION = VERSION
149 bld.add_manual_dependency(bld.path.find_or_declare('include/ldb_version.h'), VERSION)
150
151
152
153 bld.SAMBA_PYTHON('pyldb', 'pyldb.c',
154 deps='ldb pyldb-util',
155 realname='ldb.so',
156 cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION)
157
158 bld.SAMBA_MODULE('ldb_paged_results',
159 'modules/paged_results.c',
160 init_function='ldb_paged_results_init',
161 module_init_name='ldb_init_module',
162 internal_module=False,
163 deps='ldb',
164 subsystem='ldb')
165
166 bld.SAMBA_MODULE('ldb_asq',
167 'modules/asq.c',
168 init_function='ldb_asq_init',
169 module_init_name='ldb_init_module',
170 internal_module=False,
171 deps='ldb',
172 subsystem='ldb')
173
174 bld.SAMBA_MODULE('ldb_server_sort',
175 'modules/sort.c',
176 init_function='ldb_server_sort_init',
177 internal_module=False,
178 module_init_name='ldb_init_module',
179 deps='ldb',
180 subsystem='ldb')
181
182 bld.SAMBA_MODULE('ldb_paged_searches',
183 'modules/paged_searches.c',
184 init_function='ldb_paged_searches_init',
185 internal_module=False,
186 module_init_name='ldb_init_module',
187 deps='ldb',
188 subsystem='ldb')
189
190 bld.SAMBA_MODULE('ldb_rdn_name',
191 'modules/rdn_name.c',
192 init_function='ldb_rdn_name_init',
193 internal_module=False,
194 module_init_name='ldb_init_module',
195 deps='ldb',
196 subsystem='ldb')
197
198 bld.SAMBA_MODULE('ldb_sample',
199 'tests/sample_module.c',
200 init_function='ldb_sample_init',
201 internal_module=False,
202 module_init_name='ldb_init_module',
203 deps='ldb',
204 subsystem='ldb')
205
206 bld.SAMBA_MODULE('ldb_skel',
207 'modules/skel.c',
208 init_function='ldb_skel_init',
209 internal_module=False,
210 module_init_name='ldb_init_module',
211 deps='ldb',
212 subsystem='ldb')
213
214 bld.SAMBA_MODULE('ldb_sqlite3',
215 'sqlite3/ldb_sqlite3.c',
216 init_function='ldb_sqlite3_init',
217 internal_module=False,
218 module_init_name='ldb_init_module',
219 enabled=False,
220 deps='ldb',
221 subsystem='ldb')
222
223 bld.SAMBA_MODULE('ldb_tdb',
224 bld.SUBDIR('ldb_tdb',
225 '''ldb_tdb.c ldb_pack.c ldb_search.c ldb_index.c
226 ldb_cache.c ldb_tdb_wrap.c'''),
227 init_function='ldb_tdb_init',
228 module_init_name='ldb_init_module',
229 internal_module=False,
230 deps='tdb ldb',
231 subsystem='ldb')
232
233 # have a separate subsystem for common/ldb.c, so it can rebuild
234 # for install with a different -DLDB_MODULESDIR=
235 bld.SAMBA_SUBSYSTEM('LIBLDB_MAIN',
236 'common/ldb.c',
237 deps='tevent',
238 includes='include',
239 cflags=['-DLDB_MODULESDIR=\"%s\"' % modules_dir])
240
241 LDB_TOOLS='ldbadd ldbsearch ldbdel ldbmodify ldbedit ldbrename'
242 for t in LDB_TOOLS.split():
243 bld.SAMBA_BINARY(t, 'tools/%s.c' % t, deps='ldb-cmdline ldb',
244 manpages='man/%s.1' % t)
245
246 # ldbtest doesn't get installed
247 bld.SAMBA_BINARY('ldbtest', 'tools/ldbtest.c', deps='ldb-cmdline ldb',
248 install=False)
249
250 bld.SAMBA_LIBRARY('ldb-cmdline',
251 source='tools/ldbutil.c tools/cmdline.c',
252 deps='ldb dl popt',
253 private_library=True)
254
255
256def test(ctx):
257 '''run ldb testsuite'''
258 import Utils, samba_utils, shutil
259 test_prefix = "%s/st" % (Utils.g_module.blddir)
260 shutil.rmtree(test_prefix, ignore_errors=True)
261 os.makedirs(test_prefix)
262 os.environ['TEST_DATA_PREFIX'] = test_prefix
263 cmd = 'tests/test-tdb.sh'
264 ret = samba_utils.RUN_COMMAND(cmd)
265 print("testsuite returned %d" % ret)
266 # FIXME: Run python testsuite
267 sys.exit(ret)
268
269def dist():
270 '''makes a tarball for distribution'''
271 samba_dist.dist()
272
273def reconfigure(ctx):
274 '''reconfigure if config scripts have changed'''
275 import samba_utils
276 samba_utils.reconfigure(ctx)
Note: See TracBrowser for help on using the repository browser.