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