s3-ldap: Update LDAP schemata to include sambaTrustedDomain.
[nivanova/samba-autobuild/.git] / lib / talloc / wscript
1 #!/usr/bin/env python
2
3 APPNAME = 'talloc'
4 VERSION = '2.0.5'
5
6
7 blddir = 'bin'
8
9 import Logs
10 import os, sys
11
12 # find the buildtools directory
13 srcdir = '.'
14 while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
15     srcdir = '../' + srcdir
16 sys.path.insert(0, srcdir + '/buildtools/wafsamba')
17
18 import sys
19 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
20 import wafsamba, samba_dist, Options
21
22 # setup what directories to put in a tarball
23 samba_dist.DIST_DIRS('lib/talloc:. lib/replace:lib/replace buildtools:buildtools')
24
25
26 def set_options(opt):
27     opt.BUILTIN_DEFAULT('replace')
28     opt.PRIVATE_EXTENSION_DEFAULT('talloc', noextension='talloc')
29     opt.RECURSE('lib/replace')
30     opt.add_option('--enable-talloc-compat1',
31                    help=("Build talloc 1.x.x compat library [False]"),
32                    action="store_true", dest='TALLOC_COMPAT1', default=False)
33     if opt.IN_LAUNCH_DIR():
34         opt.add_option('--disable-python',
35                        help=("disable the pytalloc module"),
36                        action="store_true", dest='disable_python', default=False)
37
38
39 def configure(conf):
40     conf.RECURSE('lib/replace')
41
42     conf.env.standalone_talloc = conf.IN_LAUNCH_DIR()
43
44     conf.env.disable_python = getattr(Options.options, 'disable_python', False)
45
46     if not conf.env.standalone_talloc:
47         if conf.CHECK_BUNDLED_SYSTEM('talloc', minversion=VERSION,
48                                      implied_deps='replace'):
49             conf.define('USING_SYSTEM_TALLOC', 1)
50         if conf.CHECK_BUNDLED_SYSTEM('pytalloc-util', minversion=VERSION,
51                                      implied_deps='talloc replace'):
52             conf.define('USING_SYSTEM_PYTALLOC_UTIL', 1)
53
54     conf.env.TALLOC_COMPAT1 = Options.options.TALLOC_COMPAT1
55
56     conf.CHECK_XSLTPROC_MANPAGES()
57
58     if not conf.env.disable_python:
59         # also disable if we don't have the python libs installed
60         conf.check_tool('python')
61         conf.check_python_version((2,4,2))
62         conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
63         if not conf.env.HAVE_PYTHON_H:
64             Logs.warn('Disabling pytalloc-util as python devel libs not found')
65             conf.env.disable_python = True
66
67     conf.SAMBA_CONFIG_H()
68
69
70 def build(bld):
71     bld.RECURSE('lib/replace')
72
73     if bld.env.standalone_talloc:
74         bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
75         bld.env.TALLOC_VERSION = VERSION
76         bld.PKG_CONFIG_FILES('talloc.pc', vnum=VERSION)
77         bld.INSTALL_FILES('${INCLUDEDIR}', 'talloc.h')
78         private_library = False
79
80         # should we also install the symlink to libtalloc1.so here?
81         bld.SAMBA_LIBRARY('talloc-compat1-%s' % (VERSION),
82                           'compat/talloc_compat1.c',
83                           public_deps='talloc',
84                           soname='libtalloc.so.1',
85                           enabled=bld.env.TALLOC_COMPAT1)
86
87         if not bld.env.disable_python:
88             bld.PKG_CONFIG_FILES('pytalloc-util.pc', vnum=VERSION)
89     else:
90         private_library = True
91
92     if not bld.CONFIG_SET('USING_SYSTEM_TALLOC'):
93
94         bld.SAMBA_LIBRARY('talloc',
95                           'talloc.c',
96                           deps='replace',
97                           abi_directory='ABI',
98                           abi_match='talloc* _talloc*',
99                           hide_symbols=True,
100                           vnum=VERSION,
101                           private_library=private_library,
102                           manpages='talloc.3')
103
104     if not bld.CONFIG_SET('USING_SYSTEM_PYTALLOC_UTIL') and not bld.env.disable_python:
105
106         bld.SAMBA_LIBRARY('pytalloc-util',
107             source='pytalloc_util.c',
108             public_deps='talloc',
109             pyext=True,
110             vnum=VERSION,
111             private_library=private_library,
112             )
113         bld.INSTALL_FILES('${INCLUDEDIR}', 'pytalloc.h')
114         bld.SAMBA_PYTHON('pytalloc',
115                          'pytalloc.c',
116                          deps='talloc pytalloc-util',
117                          enabled=True,
118                          realname='talloc.so')
119
120     if not getattr(bld.env, '_SAMBA_BUILD_', 0) == 4:
121         # s4 already has the talloc testsuite builtin to smbtorture
122         bld.SAMBA_BINARY('talloc_testsuite',
123                          'testsuite_main.c testsuite.c',
124                          deps='talloc',
125                          install=False)
126
127
128 def test(ctx):
129     '''run talloc testsuite'''
130     import Utils, samba_utils
131     cmd = os.path.join(Utils.g_module.blddir, 'talloc_testsuite')
132     ret = samba_utils.RUN_COMMAND(cmd)
133     print("testsuite returned %d" % ret)
134     sys.exit(ret)
135
136 def dist():
137     '''makes a tarball for distribution'''
138     samba_dist.dist()
139
140 def reconfigure(ctx):
141     '''reconfigure if config scripts have changed'''
142     import samba_utils
143     samba_utils.reconfigure(ctx)
144
145
146 def pydoctor(ctx):
147     '''build python apidocs'''
148     cmd='PYTHONPATH=bin/python pydoctor --project-name=talloc --project-url=http://talloc.samba.org/ --make-html --docformat=restructuredtext --introspect-c-modules --add-module bin/python/talloc.*'
149     print("Running: %s" % cmd)
150     os.system(cmd)