2010-03-28 01:48:49 +03:00
#!/usr/bin/env python
2010-04-04 03:57:33 +04:00
APPNAME = 'talloc'
2011-09-15 19:05:11 +04:00
VERSION = '2.0.7'
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:
2011-11-12 19:36:07 +04:00
if conf.CHECK_BUNDLED_SYSTEM_PKG('talloc', minversion=VERSION,
2010-04-13 15:33:04 +04:00
implied_deps='replace'):
conf.define('USING_SYSTEM_TALLOC', 1)
2011-11-12 19:36:07 +04:00
if conf.CHECK_BUNDLED_SYSTEM_PKG('pytalloc-util', minversion=VERSION,
2010-10-24 23:37:08 +04:00
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
2011-07-26 23:07:20 +04:00
conf.find_program('python', var='PYTHON')
2010-10-24 23:37:08 +04:00
conf.check_tool('python')
conf.check_python_version((2,4,2))
2010-12-10 01:42:32 +03:00
conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=False)
2010-10-24 23:37:08 +04:00
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
private_library = False
# 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',
2011-08-21 05:19:17 +04:00
pc_files=[],
public_headers=[],
2010-10-27 04:56:10 +04:00
enabled=bld.env.TALLOC_COMPAT1)
2011-10-22 11:38:22 +04:00
bld.SAMBA_BINARY('talloc_testsuite',
'testsuite_main.c testsuite.c',
deps='talloc',
install=False)
2010-10-24 22:50:47 +04:00
else:
private_library = True
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-12-09 03:10:45 +03:00
abi_directory='ABI',
2010-04-18 06:46:04 +04:00
abi_match='talloc* _talloc*',
hide_symbols=True,
2010-12-09 13:58:20 +03:00
vnum=VERSION,
2011-02-28 10:55:52 +03:00
public_headers='talloc.h',
2011-08-21 05:19:17 +04:00
pc_files='talloc.pc',
2011-03-03 09:19:33 +03:00
public_headers_install=not private_library,
2010-10-24 22:50:47 +04:00
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 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',
2011-11-12 18:38:45 +04:00
pyembed=True,
2010-12-09 13:58:20 +03:00
vnum=VERSION,
2011-08-10 17:15:18 +04:00
hide_symbols=True,
abi_directory='ABI',
abi_match='pytalloc_*',
2010-12-08 14:42:02 +03:00
private_library=private_library,
2011-08-21 05:02:58 +04:00
public_headers='pytalloc.h',
pc_files='pytalloc-util.pc'
2010-10-24 22:58:47 +04:00
)
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-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)
2010-12-11 03:05:13 +03:00
def pydoctor(ctx):
'''build python apidocs'''
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.*'
print("Running: %s" % cmd)
os.system(cmd)