source: vendor/current/lib/talloc/wscript

Last change on this file was 988, checked in by Silvan Scherrer, 9 years ago

Samba Server: update vendor to version 4.4.3

File size: 6.6 KB
Line 
1#!/usr/bin/env python
2
3APPNAME = 'talloc'
4VERSION = '2.1.6'
5
6
7blddir = 'bin'
8
9import Logs
10import os, sys
11
12# find the buildtools directory
13srcdir = '.'
14while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
15 srcdir = srcdir + '/..'
16sys.path.insert(0, srcdir + '/buildtools/wafsamba')
17
18import sys
19sys.path.insert(0, srcdir+"/buildtools/wafsamba")
20import wafsamba, samba_dist, Options
21
22# setup what directories to put in a tarball
23samba_dist.DIST_DIRS("""lib/talloc:. lib/replace:lib/replace
24buildtools:buildtools third_party/waf:third_party/waf""")
25
26
27def set_options(opt):
28 opt.BUILTIN_DEFAULT('replace')
29 opt.PRIVATE_EXTENSION_DEFAULT('talloc', noextension='talloc')
30 opt.RECURSE('lib/replace')
31 if opt.IN_LAUNCH_DIR():
32 opt.add_option('--enable-talloc-compat1',
33 help=("Build talloc 1.x.x compat library [False]"),
34 action="store_true", dest='TALLOC_COMPAT1', default=False)
35 opt.add_option('--disable-python',
36 help=("disable the pytalloc module"),
37 action="store_true", dest='disable_python', default=False)
38
39
40def configure(conf):
41 conf.RECURSE('lib/replace')
42
43 conf.env.standalone_talloc = conf.IN_LAUNCH_DIR()
44
45 conf.env.disable_python = getattr(Options.options, 'disable_python', False)
46
47 if not conf.env.standalone_talloc:
48 if conf.CHECK_BUNDLED_SYSTEM_PKG('talloc', minversion=VERSION,
49 implied_deps='replace'):
50 conf.define('USING_SYSTEM_TALLOC', 1)
51 if conf.CHECK_BUNDLED_SYSTEM_PKG('pytalloc-util', minversion=VERSION,
52 implied_deps='talloc replace'):
53 conf.define('USING_SYSTEM_PYTALLOC_UTIL', 1)
54
55 conf.env.TALLOC_COMPAT1 = False
56 if conf.env.standalone_talloc:
57 conf.env.TALLOC_COMPAT1 = Options.options.TALLOC_COMPAT1
58
59 conf.CHECK_XSLTPROC_MANPAGES()
60
61 if not conf.env.disable_python:
62 # also disable if we don't have the python libs installed
63 conf.SAMBA_CHECK_PYTHON(mandatory=False, version=(2,4,2))
64 conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
65 if not conf.env.HAVE_PYTHON_H:
66 Logs.warn('Disabling pytalloc-util as python devel libs not found')
67 conf.env.disable_python = True
68
69 conf.CHECK_HEADERS('sys/auxv.h')
70 conf.CHECK_FUNCS('getauxval')
71
72 conf.SAMBA_CONFIG_H()
73
74 conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
75
76
77def build(bld):
78 bld.RECURSE('lib/replace')
79
80 if bld.env.standalone_talloc:
81 bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
82 bld.env.TALLOC_VERSION = VERSION
83 private_library = False
84
85 # should we also install the symlink to libtalloc1.so here?
86 bld.SAMBA_LIBRARY('talloc-compat1-%s' % (VERSION),
87 'compat/talloc_compat1.c',
88 public_deps='talloc',
89 soname='libtalloc.so.1',
90 pc_files=[],
91 public_headers=[],
92 enabled=bld.env.TALLOC_COMPAT1)
93
94 testsuite_deps = 'talloc'
95 if bld.CONFIG_SET('HAVE_PTHREAD'):
96 testsuite_deps += ' pthread'
97
98 bld.SAMBA_BINARY('talloc_testsuite',
99 'testsuite_main.c testsuite.c',
100 testsuite_deps,
101 install=False)
102
103 bld.SAMBA_BINARY('talloc_test_magic_differs_helper',
104 'test_magic_differs_helper.c',
105 'talloc', install=False)
106
107 else:
108 private_library = True
109
110 if not bld.CONFIG_SET('USING_SYSTEM_TALLOC'):
111
112 bld.SAMBA_LIBRARY('talloc',
113 'talloc.c',
114 deps='replace',
115 abi_directory='ABI',
116 abi_match='talloc* _talloc*',
117 hide_symbols=True,
118 vnum=VERSION,
119 public_headers=('' if private_library else 'talloc.h'),
120 pc_files='talloc.pc',
121 public_headers_install=not private_library,
122 private_library=private_library,
123 manpages='man/talloc.3')
124
125 if not bld.CONFIG_SET('USING_SYSTEM_PYTALLOC_UTIL') and not bld.env.disable_python:
126 for env in bld.gen_python_environments(['PKGCONFIGDIR']):
127 name = bld.pyembed_libname('pytalloc-util')
128
129 bld.SAMBA_LIBRARY(name,
130 source='pytalloc_util.c',
131 public_deps='talloc',
132 pyembed=True,
133 vnum=VERSION,
134 hide_symbols=True,
135 abi_directory='ABI',
136 abi_match='pytalloc_* _pytalloc_*',
137 private_library=private_library,
138 public_headers=('' if private_library else 'pytalloc.h'),
139 pc_files='pytalloc-util.pc'
140 )
141 bld.SAMBA_PYTHON('pytalloc',
142 'pytalloc.c',
143 deps='talloc ' + name,
144 enabled=True,
145 realname='talloc.so')
146
147 bld.SAMBA_PYTHON('test_pytalloc',
148 'test_pytalloc.c',
149 deps='pytalloc',
150 enabled=True,
151 realname='_test_pytalloc.so',
152 install=False)
153
154
155def test(ctx):
156 '''run talloc testsuite'''
157 import Utils, samba_utils
158 cmd = os.path.join(Utils.g_module.blddir, 'talloc_testsuite')
159 ret = samba_utils.RUN_COMMAND(cmd)
160 print("testsuite returned %d" % ret)
161 magic_helper_cmd = os.path.join(Utils.g_module.blddir, 'talloc_test_magic_differs_helper')
162 magic_cmd = os.path.join(srcdir, 'lib', 'talloc',
163 'test_magic_differs.sh')
164
165 magic_ret = samba_utils.RUN_COMMAND(magic_cmd + " " + magic_helper_cmd)
166 print("magic differs test returned %d" % magic_ret)
167 pyret = samba_utils.RUN_PYTHON_TESTS(['test_pytalloc.py'])
168 print("python testsuite returned %d" % pyret)
169 sys.exit(ret or magic_ret or pyret)
170
171def dist():
172 '''makes a tarball for distribution'''
173 samba_dist.dist()
174
175def reconfigure(ctx):
176 '''reconfigure if config scripts have changed'''
177 import samba_utils
178 samba_utils.reconfigure(ctx)
179
180
181def pydoctor(ctx):
182 '''build python apidocs'''
183 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.*'
184 print("Running: %s" % cmd)
185 os.system(cmd)
Note: See TracBrowser for help on using the repository browser.