~ubuntu-branches/debian/jessie/ldb/jessie

« back to all changes in this revision

Viewing changes to .pc/02_hurd/wscript

  • Committer: Package Import Robot
  • Author(s): Jelmer Vernooij
  • Date: 2014-07-05 23:32:23 UTC
  • mfrom: (1.3.16)
  • Revision ID: package-import@ubuntu.com-20140705233223-dss2i2wmfksxbivh
Tags: 1:1.1.18-1
* New upstream release.
 + Depend on tdb >= 1.3.2.
 + Fixes __attribute__((visibility)) check to not use nested functions.
   Closes: #749987
* Use canonical URL in Vcs-Git field.
* Specify branch in Vcs-Git field.
* Add 02_hurd: link against pthread on the Hurd, to fix ldb module
  loading. Closes: #749095

Show diffs side-by-side

added added

removed removed

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