From 367ba43b63eacb2bffaf8c53c77a343481482939 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 13 Apr 2010 20:13:00 +1000 Subject: [PATCH] tdb-waf: added build of manpages and config options for RPM build Building a RPM from the fedora spec file now works with minimal changes Pair-Programmed-With: Andrew Bartlett --- buildtools/wafsamba/samba_autoconf.py | 1 + lib/tdb/wscript | 47 +++++++++++++++++++++++++-- 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index cbb10a27caf..9d0229e1479 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -534,6 +534,7 @@ def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False, def IN_LAUNCH_DIR(conf): '''return True if this rule is being run from the launch directory''' return os.path.realpath(conf.curdir) == os.path.realpath(Options.launch_dir) +Options.Handler.IN_LAUNCH_DIR = IN_LAUNCH_DIR @conf diff --git a/lib/tdb/wscript b/lib/tdb/wscript index d80b7209b0f..c5706a2f161 100644 --- a/lib/tdb/wscript +++ b/lib/tdb/wscript @@ -13,7 +13,7 @@ while not os.path.exists(srcdir+'/buildtools') and len(srcdir.split('/')) < 5: srcdir = '../' + srcdir sys.path.insert(0, srcdir + '/buildtools/wafsamba') -import wafsamba, samba_dist +import wafsamba, samba_dist, Options, Logs samba_dist.DIST_DIRS('lib/tdb:. lib/replace:lib/replace buildtools:buildtools') @@ -21,6 +21,11 @@ def set_options(opt): opt.BUILTIN_DEFAULT('replace') opt.BUNDLED_EXTENSION_DEFAULT('tdb', noextenion='tdb') opt.RECURSE('lib/replace') + if opt.IN_LAUNCH_DIR(): + opt.add_option('--disable-python', + help=("disable the pytdb module"), + action="store_true", dest='disable_python', default=False) + def configure(conf): conf.RECURSE('lib/replace') @@ -29,6 +34,21 @@ def configure(conf): implied_deps='replace'): conf.define('USING_SYSTEM_TDB', 1) + conf.env.standalone_tdb = conf.IN_LAUNCH_DIR() + conf.env.disable_python = getattr(Options.options, 'disable_python', False) + + if conf.env.standalone_tdb: + conf.find_program('xsltproc', var='XSLTPROC') + + 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() + if not conf.env.HAVE_PYTHON_H: + Logs.warn('Disabling pytdb as python devel libs not found') + conf.env.disable_python = True + conf.SAMBA_CONFIG_H() def build(bld): @@ -48,7 +68,8 @@ def build(bld): bld.SAMBA_BINARY('tdbtorture', 'tools/tdbtorture.c', - 'tdb') + 'tdb', + install=False) bld.SAMBA_BINARY('tdbdump', 'tools/tdbdump.c', @@ -67,9 +88,29 @@ def build(bld): bld.SAMBA_PYTHON('pytdb', 'pytdb.c', deps='tdb', - enabled=s4_build, + enabled=not bld.env.disable_python, realname='tdb.so') + if bld.env.standalone_tdb: + bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig' + bld.env.TALLOC_VERSION = VERSION + bld.PKG_CONFIG_FILES('tdb.pc', vnum=VERSION) + bld.INSTALL_FILES('${INCLUDEDIR}', 'include/tdb.h', flat=True) + + if bld.env.XSLTPROC: + manpages = 'manpages/tdbbackup.8 manpages/tdbdump.8 manpages/tdbtool.8' + + bld.env.TDB_MAN_XSL = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl' + + for m in manpages.split(): + source = m + '.xml' + bld.SAMBA_GENERATOR(m, + source=source, + target=m, + rule='${XSLTPROC} -o ${TGT} ${TDB_MAN_XSL} ${SRC}' + ) + bld.INSTALL_FILES('${MANDIR}/man8', m, flat=True) + def test(ctx): '''run tdb testsuite''' -- 2.34.1