12 # find the buildtools directory
14 while not os
.path
.exists(srcdir
+'/buildtools') and len(srcdir
.split('/')) < 5:
15 srcdir
= srcdir
+ '/..'
16 sys
.path
.insert(0, srcdir
+ '/buildtools/wafsamba')
19 sys
.path
.insert(0, srcdir
+"/buildtools/wafsamba")
20 import wafsamba
, samba_dist
, Options
22 # setup what directories to put in a tarball
23 samba_dist
.DIST_DIRS("""lib/talloc:. lib/replace:lib/replace
24 buildtools:buildtools third_party/waf:third_party/waf""")
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)
41 conf
.RECURSE('lib/replace')
43 conf
.env
.standalone_talloc
= conf
.IN_LAUNCH_DIR()
45 conf
.env
.disable_python
= getattr(Options
.options
, 'disable_python', False)
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)
55 conf
.env
.TALLOC_COMPAT1
= False
56 if conf
.env
.standalone_talloc
:
57 conf
.env
.TALLOC_COMPAT1
= Options
.options
.TALLOC_COMPAT1
59 conf
.CHECK_XSLTPROC_MANPAGES()
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
71 conf
.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
75 bld
.RECURSE('lib/replace')
77 if bld
.env
.standalone_talloc
:
78 bld
.env
.PKGCONFIGDIR
= '${LIBDIR}/pkgconfig'
79 bld
.env
.TALLOC_VERSION
= VERSION
80 private_library
= False
82 # should we also install the symlink to libtalloc1.so here?
83 bld
.SAMBA_LIBRARY('talloc-compat1-%s' % (VERSION
),
84 'compat/talloc_compat1.c',
86 soname
='libtalloc.so.1',
89 enabled
=bld
.env
.TALLOC_COMPAT1
)
91 testsuite_deps
= 'talloc'
92 if bld
.CONFIG_SET('HAVE_PTHREAD'):
93 testsuite_deps
+= ' pthread'
95 bld
.SAMBA_BINARY('talloc_testsuite',
96 'testsuite_main.c testsuite.c',
101 private_library
= True
103 if not bld
.CONFIG_SET('USING_SYSTEM_TALLOC'):
105 bld
.SAMBA_LIBRARY('talloc',
109 abi_match
='talloc* _talloc*',
112 public_headers
='talloc.h',
113 pc_files
='talloc.pc',
114 public_headers_install
=not private_library
,
115 private_library
=private_library
,
116 manpages
='man/talloc.3')
118 if not bld
.CONFIG_SET('USING_SYSTEM_PYTALLOC_UTIL') and not bld
.env
.disable_python
:
119 for env
in bld
.gen_python_environments(['PKGCONFIGDIR']):
120 name
= bld
.pyembed_libname('pytalloc-util')
122 bld
.SAMBA_LIBRARY(name
,
123 source
='pytalloc_util.c',
124 public_deps
='talloc',
129 abi_match
='pytalloc_*',
130 private_library
=private_library
,
131 public_headers
='pytalloc.h',
132 pc_files
='pytalloc-util.pc'
134 bld
.SAMBA_PYTHON('pytalloc',
136 deps
='talloc ' + name
,
138 realname
='talloc.so')
140 bld
.SAMBA_PYTHON('test_pytalloc',
144 realname
='_test_pytalloc.so',
149 '''run talloc testsuite'''
150 import Utils
, samba_utils
151 cmd
= os
.path
.join(Utils
.g_module
.blddir
, 'talloc_testsuite')
152 ret
= samba_utils
.RUN_COMMAND(cmd
)
153 print("testsuite returned %d" % ret
)
154 pyret
= samba_utils
.RUN_PYTHON_TESTS(['test_pytalloc.py'])
155 print("python testsuite returned %d" % pyret
)
156 sys
.exit(ret
or pyret
)
159 '''makes a tarball for distribution'''
162 def reconfigure(ctx
):
163 '''reconfigure if config scripts have changed'''
165 samba_utils
.reconfigure(ctx
)
169 '''build python apidocs'''
170 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.*'
171 print("Running: %s" % cmd
)