3a54e554154848cef833c3cc3354157f21c275a8
[nivanova/samba-autobuild/.git] / source4 / lib / ldb / wscript
1 VERSION = '0.9.10'
2
3 srcdir = '../../..'
4 blddir = 'bin'
5
6 import sys
7 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
8 import wafsamba
9
10 LIBTDB_DIR= srcdir + '/lib/tdb'
11 LIBTEVENT_DIR= srcdir + '/lib/tevent'
12
13 def set_options(opt):
14     opt.recurse(LIBTDB_DIR)
15     opt.recurse(LIBTEVENT_DIR)
16
17 def configure(conf):
18     conf.sub_config(LIBTDB_DIR)
19     conf.sub_config(LIBTEVENT_DIR)
20     # where does the default LIBDIR end up? in conf.env somewhere?
21     #
22     conf.CONFIG_PATH('LDB_MODULESDIR', conf.SUBST_ENV_VAR('MODULESDIR') + '/ldb')
23     conf.SAMBA_CONFIG_H()
24
25 def build(bld):
26     bld.BUILD_SUBDIR(LIBTDB_DIR)
27     bld.BUILD_SUBDIR(LIBTEVENT_DIR)
28
29     # in Samba4 we build some extra modules, and add extra
30     # capabilities to the ldb cmdline tools
31     s4_build = getattr(bld.env, '_SAMBA_BUILD_', 0) == 4
32
33     LDB_MAP_SRC = bld.SUBDIR('ldb_map',
34                              'ldb_map.c ldb_map_inbound.c ldb_map_outbound.c')
35
36     COMMON_SRC = bld.SUBDIR('common',
37                             '''ldb.c ldb_ldif.c ldb_parse.c ldb_msg.c ldb_utf8.c
38                             ldb_debug.c ldb_dn.c ldb_match.c
39                             ldb_attributes.c attrib_handlers.c ldb_controls.c qsort.c''')
40
41     bld.SAMBA_SUBSYSTEM('LIBLDB',
42                         includes='include',
43                         deps='tevent',
44                         source='common/ldb_modules.c')
45
46     bld.SAMBA_MODULE('ldb_asq',
47                      'modules/asq.c',
48                      init_function='LDB_MODULE(asq)',
49                      subsystem='LIBLDB')
50
51     bld.SAMBA_MODULE('ldb_server_sort',
52                      'modules/sort.c',
53                      init_function='LDB_MODULE(server_sort)',
54                      subsystem='LIBLDB')
55
56     bld.SAMBA_MODULE('ldb_paged_results',
57                      'modules/paged_results.c',
58                      init_function='LDB_MODULE(paged_results)',
59                      subsystem='LIBLDB')
60
61     bld.SAMBA_MODULE('ldb_paged_searches',
62                      'modules/paged_searches.c',
63                      init_function='LDB_MODULE(paged_searches)',
64                      enabled = s4_build,
65                      subsystem='LIBLDB')
66
67     bld.SAMBA_MODULE('ldb_rdn_name',
68                      'modules/rdn_name.c',
69                      init_function='LDB_MODULE(rdn_name)',
70                      subsystem='LIBLDB')
71
72     bld.SAMBA_MODULE('ldb_sample',
73                      'tests/sample_module.c',
74                      init_function='LDB_MODULE(sample)',
75                      subsystem='LIBLDB')
76
77     bld.SAMBA_MODULE('ldb_skel',
78                      'modules/skel.c',
79                      init_function='LDB_MODULE(skel)',
80                      subsystem='LIBLDB')
81
82     bld.SAMBA_MODULE('ldb_sqlite3',
83                      'sqlite3/ldb_sqlite3.c',
84                      init_function='LDB_BACKEND(sqlite3)',
85                      enabled=False,
86                      subsystem='LIBLDB')
87
88     bld.SAMBA_MODULE('ldb_tdb',
89                      bld.SUBDIR('ldb_tdb',
90                                 '''ldb_tdb.c ldb_pack.c ldb_search.c ldb_index.c
91                                 ldb_cache.c ldb_tdb_wrap.c'''),
92                      init_function='LDB_BACKEND(tdb)',
93                      deps='tdb',
94                      subsystem='LIBLDB')
95
96     bld.SAMBA_MODULE('ldb_ildap', 'ldb_ildap/ldb_ildap.c',
97                      init_function='LDB_BACKEND(ldapi),LDB_BACKEND(ldaps),LDB_BACKEND(ldap)',
98                      deps='talloc LIBCLI_LDAP CREDENTIALS',
99                      enabled=s4_build,
100                      subsystem='LIBLDB')
101
102     ldb_deps = 'tevent LIBLDB'
103     if s4_build:
104         ldb_deps += ' LDBSAMBA POPT_CREDENTIALS POPT_SAMBA LIBCMDLINE_CREDENTIALS gensec'
105
106     bld.SAMBA_LIBRARY('ldb',
107                       COMMON_SRC + ' ' + LDB_MAP_SRC,
108                       deps=ldb_deps,
109                       includes='include',
110                       public_headers='include/ldb.h include/ldb_errors.h',
111                       vnum=VERSION)
112
113     bld.SAMBA_SUBSYSTEM('LIBLDB_CMDLINE',
114                         'tools/ldbutil.c tools/cmdline.c',
115                         'ldb dl popt')
116
117     LDB_TOOLS='ldbadd ldbsearch ldbdel ldbmodify ldbedit ldbrename'
118     for t in LDB_TOOLS.split():
119         bld.SAMBA_BINARY(t, 'tools/%s.c' % t, deps='LIBLDB_CMDLINE')
120
121     # ldbtest doesn't get installed
122     bld.SAMBA_BINARY('ldbtest', 'tools/ldbtest.c', deps='LIBLDB_CMDLINE', install=False)
123
124     if s4_build:
125         bld.SAMBA_PYTHON('pyldb', 'pyldb.c',
126                          deps='ldb',
127                          realname='ldb.so')