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 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)
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('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)
54 conf
.env
.TALLOC_COMPAT1
= Options
.options
.TALLOC_COMPAT1
56 conf
.CHECK_XSLTPROC_MANPAGES()
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
71 bld
.RECURSE('lib/replace')
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 private_library
= False
79 # should we also install the symlink to libtalloc1.so here?
80 bld
.SAMBA_LIBRARY('talloc-compat1-%s' % (VERSION
),
81 'compat/talloc_compat1.c',
83 soname
='libtalloc.so.1',
84 enabled
=bld
.env
.TALLOC_COMPAT1
)
86 if not bld
.env
.disable_python
:
87 bld
.PKG_CONFIG_FILES('pytalloc-util.pc', vnum
=VERSION
)
89 private_library
= True
91 if not bld
.CONFIG_SET('USING_SYSTEM_TALLOC'):
93 bld
.SAMBA_LIBRARY('talloc',
97 abi_match
='talloc* _talloc*',
100 public_headers
='talloc.h',
101 public_headers_install
=not private_library
,
102 private_library
=private_library
,
105 if not bld
.CONFIG_SET('USING_SYSTEM_PYTALLOC_UTIL') and not bld
.env
.disable_python
:
107 bld
.SAMBA_LIBRARY('pytalloc-util',
108 source
='pytalloc_util.c',
109 public_deps
='talloc',
112 private_library
=private_library
,
113 public_headers
='pytalloc.h'
115 bld
.SAMBA_PYTHON('pytalloc',
117 deps
='talloc pytalloc-util',
119 realname
='talloc.so')
121 if not getattr(bld
.env
, '_SAMBA_BUILD_', 0) == 4:
122 # s4 already has the talloc testsuite builtin to smbtorture
123 bld
.SAMBA_BINARY('talloc_testsuite',
124 'testsuite_main.c testsuite.c',
130 '''run talloc testsuite'''
131 import Utils
, samba_utils
132 cmd
= os
.path
.join(Utils
.g_module
.blddir
, 'talloc_testsuite')
133 ret
= samba_utils
.RUN_COMMAND(cmd
)
134 print("testsuite returned %d" % ret
)
138 '''makes a tarball for distribution'''
141 def reconfigure(ctx
):
142 '''reconfigure if config scripts have changed'''
144 samba_utils
.reconfigure(ctx
)
148 '''build python apidocs'''
149 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.*'
150 print("Running: %s" % cmd
)