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 buildtools:buildtools')
27 opt
.BUILTIN_DEFAULT('replace')
28 opt
.PRIVATE_EXTENSION_DEFAULT('talloc', noextension
='talloc')
29 opt
.RECURSE('lib/replace')
30 if opt
.IN_LAUNCH_DIR():
31 opt
.add_option('--enable-talloc-compat1',
32 help=("Build talloc 1.x.x compat library [False]"),
33 action
="store_true", dest
='TALLOC_COMPAT1', default
=False)
34 opt
.add_option('--disable-python',
35 help=("disable the pytalloc module"),
36 action
="store_true", dest
='disable_python', default
=False)
40 conf
.RECURSE('lib/replace')
42 conf
.env
.standalone_talloc
= conf
.IN_LAUNCH_DIR()
44 conf
.env
.disable_python
= getattr(Options
.options
, 'disable_python', False)
46 if not conf
.env
.standalone_talloc
:
47 if conf
.CHECK_BUNDLED_SYSTEM_PKG('talloc', minversion
=VERSION
,
48 implied_deps
='replace'):
49 conf
.define('USING_SYSTEM_TALLOC', 1)
50 if conf
.CHECK_BUNDLED_SYSTEM_PKG('pytalloc-util', minversion
=VERSION
,
51 implied_deps
='talloc replace'):
52 conf
.define('USING_SYSTEM_PYTALLOC_UTIL', 1)
54 conf
.env
.TALLOC_COMPAT1
= False
55 if conf
.env
.standalone_talloc
:
56 conf
.env
.TALLOC_COMPAT1
= Options
.options
.TALLOC_COMPAT1
58 conf
.CHECK_XSLTPROC_MANPAGES()
60 if not conf
.env
.disable_python
:
61 # also disable if we don't have the python libs installed
62 conf
.find_program('python', var
='PYTHON')
63 conf
.check_tool('python')
64 conf
.check_python_version((2,4,2))
65 conf
.SAMBA_CHECK_PYTHON_HEADERS(mandatory
=False)
66 if not conf
.env
.HAVE_PYTHON_H
:
67 Logs
.warn('Disabling pytalloc-util as python devel libs not found')
68 conf
.env
.disable_python
= True
72 conf
.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
76 bld
.RECURSE('lib/replace')
78 if bld
.env
.standalone_talloc
:
79 bld
.env
.PKGCONFIGDIR
= '${LIBDIR}/pkgconfig'
80 bld
.env
.TALLOC_VERSION
= VERSION
81 private_library
= False
83 # should we also install the symlink to libtalloc1.so here?
84 bld
.SAMBA_LIBRARY('talloc-compat1-%s' % (VERSION
),
85 'compat/talloc_compat1.c',
87 soname
='libtalloc.so.1',
90 enabled
=bld
.env
.TALLOC_COMPAT1
)
92 bld
.SAMBA_BINARY('talloc_testsuite',
93 'testsuite_main.c testsuite.c',
98 private_library
= True
100 if not bld
.CONFIG_SET('USING_SYSTEM_TALLOC'):
102 bld
.SAMBA_LIBRARY('talloc',
106 abi_match
='talloc* _talloc*',
109 public_headers
='talloc.h',
110 pc_files
='talloc.pc',
111 public_headers_install
=not private_library
,
112 private_library
=private_library
,
113 manpages
='man/talloc.3')
115 if not bld
.CONFIG_SET('USING_SYSTEM_PYTALLOC_UTIL') and not bld
.env
.disable_python
:
116 bld
.SAMBA_LIBRARY('pytalloc-util',
117 source
='pytalloc_util.c',
118 public_deps
='talloc',
123 abi_match
='pytalloc_*',
124 private_library
=private_library
,
125 public_headers
='pytalloc.h',
126 pc_files
='pytalloc-util.pc'
128 bld
.SAMBA_PYTHON('pytalloc',
130 deps
='talloc pytalloc-util',
132 realname
='talloc.so')
135 '''run talloc testsuite'''
136 import Utils
, samba_utils
137 cmd
= os
.path
.join(Utils
.g_module
.blddir
, 'talloc_testsuite')
138 ret
= samba_utils
.RUN_COMMAND(cmd
)
139 print("testsuite returned %d" % ret
)
143 '''makes a tarball for distribution'''
146 def reconfigure(ctx
):
147 '''reconfigure if config scripts have changed'''
149 samba_utils
.reconfigure(ctx
)
153 '''build python apidocs'''
154 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.*'
155 print("Running: %s" % cmd
)