2010-03-28 01:48:49 +03:00
#!/usr/bin/env python
2010-04-04 03:57:33 +04:00
APPNAME = 'talloc'
2010-12-03 05:07:03 +03:00
VERSION = '2.0.4'
2010-03-17 12:31:46 +03:00
2010-04-13 11:32:14 +04:00
2010-03-17 12:32:15 +03:00
blddir = 'bin'
2010-02-20 08:25:37 +03:00
2010-10-24 23:37:08 +04:00
import Logs
2010-04-04 05:40:05 +04:00
import os, sys
2010-04-04 04:18:39 +04:00
# find the buildtools directory
2010-04-04 07:16:49 +04:00
srcdir = '.'
while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5:
srcdir = '../' + srcdir
sys.path.insert(0, srcdir + '/buildtools/wafsamba')
2010-03-17 12:31:46 +03:00
2010-03-28 08:42:28 +04:00
import sys
sys.path.insert(0, srcdir+"/buildtools/wafsamba")
2010-04-13 11:32:14 +04:00
import wafsamba, samba_dist, Options
2010-03-28 08:42:28 +04:00
2010-04-04 05:00:42 +04:00
# setup what directories to put in a tarball
samba_dist.DIST_DIRS('lib/talloc:. lib/replace:lib/replace buildtools:buildtools')
2010-02-20 08:25:37 +03:00
def set_options(opt):
2010-03-28 08:42:28 +04:00
opt.BUILTIN_DEFAULT('replace')
2010-10-24 01:26:43 +04:00
opt.PRIVATE_EXTENSION_DEFAULT('talloc', noextension='talloc')
2010-04-04 07:16:49 +04:00
opt.RECURSE('lib/replace')
2010-04-13 11:32:14 +04:00
opt.add_option('--enable-talloc-compat1',
help=("Build talloc 1.x.x compat library [False]"),
action="store_true", dest='TALLOC_COMPAT1', default=False)
2010-10-24 23:37:08 +04:00
if opt.IN_LAUNCH_DIR():
opt.add_option('--disable-python',
2010-11-05 05:00:45 +03:00
help=("disable the pytalloc module"),
2010-10-24 23:37:08 +04:00
action="store_true", dest='disable_python', default=False)
2010-02-20 08:25:37 +03:00
def configure(conf):
2010-04-04 07:16:49 +04:00
conf.RECURSE('lib/replace')
2010-03-28 09:38:27 +04:00
2010-04-03 16:26:35 +04:00
conf.env.standalone_talloc = conf.IN_LAUNCH_DIR()
2010-10-24 23:37:08 +04:00
conf.env.disable_python = getattr(Options.options, 'disable_python', False)
2010-04-13 15:33:04 +04:00
if not conf.env.standalone_talloc:
if conf.CHECK_BUNDLED_SYSTEM('talloc', minversion=VERSION,
implied_deps='replace'):
conf.define('USING_SYSTEM_TALLOC', 1)
2010-10-24 23:37:08 +04:00
if conf.CHECK_BUNDLED_SYSTEM('pytalloc-util', minversion=VERSION,
implied_deps='talloc replace'):
conf.define('USING_SYSTEM_PYTALLOC_UTIL', 1)
2010-04-13 15:33:04 +04:00
2010-04-13 11:32:14 +04:00
conf.env.TALLOC_COMPAT1 = Options.options.TALLOC_COMPAT1
2010-10-30 10:27:12 +04:00
conf.CHECK_XSLTPROC_MANPAGES()
2010-04-13 11:32:14 +04:00
2010-10-24 23:37:08 +04:00
if not conf.env.disable_python:
# also disable if we don't have the python libs installed
conf.check_tool('python')
conf.check_python_version((2,4,2))
conf.check_python_headers(mandatory=False)
if not conf.env.HAVE_PYTHON_H:
Logs.warn('Disabling pytalloc-util as python devel libs not found')
conf.env.disable_python = True
2010-02-20 08:25:37 +03:00
2010-10-24 23:37:08 +04:00
conf.SAMBA_CONFIG_H()
2010-03-28 09:38:27 +04:00
2010-02-20 08:25:37 +03:00
def build(bld):
2010-04-04 07:16:49 +04:00
bld.RECURSE('lib/replace')
2010-02-20 08:25:37 +03:00
2010-10-24 22:50:47 +04:00
if bld.env.standalone_talloc:
bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
bld.env.TALLOC_VERSION = VERSION
bld.PKG_CONFIG_FILES('talloc.pc', vnum=VERSION)
bld.INSTALL_FILES('${INCLUDEDIR}', 'talloc.h')
private_library = False
vnum = VERSION
# should we also install the symlink to libtalloc1.so here?
2010-10-27 04:56:10 +04:00
bld.SAMBA_LIBRARY('talloc-compat1-%s' % (VERSION),
2010-10-24 22:50:47 +04:00
'compat/talloc_compat1.c',
2010-10-27 04:56:10 +04:00
public_deps='talloc',
soname='libtalloc.so.1',
enabled=bld.env.TALLOC_COMPAT1)
2010-10-24 23:37:08 +04:00
if not bld.env.disable_python:
bld.PKG_CONFIG_FILES('pytalloc-util.pc', vnum=VERSION)
2010-10-24 22:50:47 +04:00
else:
private_library = True
vnum = None
2010-03-28 09:38:27 +04:00
if not bld.CONFIG_SET('USING_SYSTEM_TALLOC'):
2010-04-13 11:32:14 +04:00
2010-03-28 09:38:27 +04:00
bld.SAMBA_LIBRARY('talloc',
'talloc.c',
deps='replace',
2010-04-18 06:46:04 +04:00
abi_file='ABI/talloc-%s.sigs' % VERSION,
abi_match='talloc* _talloc*',
hide_symbols=True,
2010-10-24 22:50:47 +04:00
vnum=vnum,
private_library=private_library,
2010-10-21 01:59:06 +04:00
manpages='talloc.3')
2010-02-20 08:25:37 +03:00
2010-10-24 23:37:08 +04:00
if not bld.CONFIG_SET('USING_SYSTEM_PYTALLOC_UTIL') and not bld.env.disable_python:
2010-10-24 22:58:47 +04:00
2010-10-24 23:53:59 +04:00
bld.SAMBA_LIBRARY('pytalloc-util',
2010-11-05 04:35:55 +03:00
source='pytalloc_util.c',
2010-10-24 23:15:12 +04:00
public_deps='talloc',
2010-12-08 14:42:02 +03:00
abi_file='ABI/pytalloc-util-%s.sigs' % VERSION,
abi_match='py* Py*',
2010-10-24 22:58:47 +04:00
pyext=True,
2010-12-08 14:42:02 +03:00
vnum=vnum,
private_library=private_library,
2010-10-24 22:58:47 +04:00
)
2010-11-01 19:40:25 +03:00
bld.INSTALL_FILES('${INCLUDEDIR}', 'pytalloc.h')
2010-11-05 05:00:45 +03:00
bld.SAMBA_PYTHON('pytalloc',
'pytalloc.c',
deps='talloc pytalloc-util',
enabled=True,
realname='talloc.so')
2010-10-24 22:58:47 +04:00
2010-03-29 11:48:50 +04:00
if not getattr(bld.env, '_SAMBA_BUILD_', 0) == 4:
# s4 already has the talloc testsuite builtin to smbtorture
bld.SAMBA_BINARY('talloc_testsuite',
'testsuite_main.c testsuite.c',
deps='talloc',
install=False)
2010-04-03 16:26:35 +04:00
2010-04-13 11:32:14 +04:00
2010-04-04 16:11:30 +04:00
def test(ctx):
'''run talloc testsuite'''
2010-10-07 05:25:42 +04:00
import Utils, samba_utils
2010-04-04 16:11:30 +04:00
cmd = os.path.join(Utils.g_module.blddir, 'talloc_testsuite')
2010-10-07 05:25:42 +04:00
ret = samba_utils.RUN_COMMAND(cmd)
print("testsuite returned %d" % ret)
sys.exit(ret)
2010-04-05 03:58:23 +04:00
def dist():
'''makes a tarball for distribution'''
samba_dist.dist()
2010-11-03 04:09:23 +03:00
def reconfigure(ctx):
'''reconfigure if config scripts have changed'''
import samba_utils
samba_utils.reconfigure(ctx)