From 35a2d020a0c3b0ba638874bc0cdbd215c76bf606 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 7 Jun 2012 22:37:52 +0930 Subject: ccan: Only build ccan-failtest when we are in developer mode From: Andrew Bartlett This code is incredibly useful, but is only needed in test code and may not be perfectly portable. It has compiled on all systems bar Solaris so far, but rather than make it a requirement to build Samba, just keep it for development. Andrew Bartlett Signed-off-by: Rusty Russell Autobuild-User(master): Rusty Russell Autobuild-Date(master): Thu Jun 7 18:53:12 CEST 2012 on sn-devel-104 --- lib/ccan/wscript | 18 ++++++++++++---- lib/tdb2/wscript | 64 +++++++++++++++++++++++++++++++------------------------- 2 files changed, 50 insertions(+), 32 deletions(-) (limited to 'lib') diff --git a/lib/ccan/wscript b/lib/ccan/wscript index 24034bb4ac..8a2b3e79b7 100644 --- a/lib/ccan/wscript +++ b/lib/ccan/wscript @@ -1,6 +1,6 @@ #!/usr/bin/env python -import Logs, sys +import Logs, sys, Options def configure(conf): conf.DEFINE('HAVE_CCAN', 1) @@ -121,8 +121,18 @@ def configure(conf): conf.CHECK_FUNCS_IN('backtrace backtrace_symbols', 'execinfo', checklibc=True, headers='execinfo.h') def build(bld): + + for ccan_dir in ["hash", "htable", "ilog", "likely", "list", "read_write_all", "str", "tally", "time"]: + bld.SAMBA_SUBSYSTEM('ccan-%s' % ccan_dir, + source=bld.path.ant_glob('%s/*.c' % ccan_dir)) + + if bld.env.DEVELOPER_MODE: + bld.SAMBA_LIBRARY('ccan-failtest', + source=bld.path.ant_glob('failtest/*.c'), + deps='execinfo ccan ccan-failtest ccan-htable ccan-list ccan-read_write_all ccan-time', + private_library=True) + bld.SAMBA_LIBRARY('ccan', - vnum="0.1-init-1161-g661d41f", - source=bld.path.ant_glob('*/*.c'), - deps='execinfo', + source='', + deps='ccan-hash ccan-ilog ccan-likely ccan-tally', private_library=True) diff --git a/lib/tdb2/wscript b/lib/tdb2/wscript index a1885fc3c8..b925893cb4 100644 --- a/lib/tdb2/wscript +++ b/lib/tdb2/wscript @@ -21,6 +21,9 @@ def set_options(opt): opt.BUILTIN_DEFAULT('replace,ccan') opt.PRIVATE_EXTENSION_DEFAULT('tdb2', noextension='tdb2') opt.RECURSE('lib/replace') + opt.add_option('--enable-developer', + help=("Turn on developer warnings and debugging"), + action="store_true", dest='developer', default=False) opt.add_option('--enable-tdb2', help=("Use tdb2 API instead of tdb1 [True]"), action="store_true", dest='BUILD_TDB2', default=True) @@ -39,6 +42,9 @@ def set_options(opt): action="store_true", dest='disable_python', default=False) def configure(conf): + if Options.options.developer: + conf.env.DEVELOPER_MODE = True + conf.env.TEST_RUN_SRC=['test/run-001-encode.c', 'test/run-001-fls.c', 'test/run-01-new_database.c', @@ -205,33 +211,6 @@ def build(bld): 'tools/tdb2backup.c', deps='tdb') - # FIXME: We need CCAN for some API tests, but waf thinks it's - # already available via tdb2. It is, but not publicly. - # Workaround is to build a private, non-hiding version. - bld.SAMBA_SUBSYSTEM('tdb2-testing', - SRC, - deps='replace ccan', - includes='.') - - bld.SAMBA_SUBSYSTEM('tdb2-test-helpers', bld.env.TEST_HELPER_SRC, - deps='replace') - bld.SAMBA_SUBSYSTEM('tdb2-run-helpers', bld.env.TEST_RUN_HELPER_SRC, - deps='replace') - bld.SAMBA_SUBSYSTEM('tdb2-api-helpers', bld.env.TEST_API_HELPER_SRC, - deps='replace tdb2-testing') - - for f in bld.env.TEST_RUN_SRC: - base = os.path.splitext(os.path.basename(f))[0] - bld.SAMBA_BINARY('tdb2-' + base, f, - deps='ccan replace tdb2-test-helpers tdb2-run-helpers', - install=False) - - for f in bld.env.TEST_API_SRC: - base = os.path.splitext(os.path.basename(f))[0] - bld.SAMBA_BINARY('tdb2-' + base, f, - deps='ccan replace tdb2-test-helpers tdb2-api-helpers', - install=False) - if not bld.CONFIG_SET('USING_SYSTEM_PYTDB'): bld.SAMBA_PYTHON('pytdb', source='pytdb.c', @@ -240,6 +219,34 @@ def build(bld): realname='tdb.so', cflags='-DPACKAGE_VERSION=\"%s\"' % VERSION) + if bld.env.DEVELOPER_MODE: + # FIXME: We need CCAN for some API tests, but waf thinks it's + # already available via tdb2. It is, but not publicly. + # Workaround is to build a private, non-hiding version. + bld.SAMBA_SUBSYSTEM('tdb2-testing', + SRC, + deps='replace ccan', + includes='.') + + bld.SAMBA_SUBSYSTEM('tdb2-test-helpers', bld.env.TEST_HELPER_SRC, + deps='replace') + bld.SAMBA_SUBSYSTEM('tdb2-run-helpers', bld.env.TEST_RUN_HELPER_SRC, + deps='replace') + bld.SAMBA_SUBSYSTEM('tdb2-api-helpers', bld.env.TEST_API_HELPER_SRC, + deps='replace tdb2-testing') + + for f in bld.env.TEST_RUN_SRC: + base = os.path.splitext(os.path.basename(f))[0] + bld.SAMBA_BINARY('tdb2-' + base, f, + deps='ccan replace tdb2-test-helpers tdb2-run-helpers ccan-failtest', + install=False) + + for f in bld.env.TEST_API_SRC: + base = os.path.splitext(os.path.basename(f))[0] + bld.SAMBA_BINARY('tdb2-' + base, f, + deps='ccan replace tdb2-test-helpers tdb2-api-helpers', + install=False) + def testonly(ctx): '''run tdb2 testsuite''' import Utils, samba_utils, shutil @@ -247,7 +254,8 @@ def testonly(ctx): env = samba_utils.LOAD_ENVIRONMENT() - if env.BUILD_TDB2 and env.standalone_tdb2: + if env.BUILD_TDB2 and env.standalone_tdb2 and env.DEVELOPER_MODE: + # FIXME: This is horrible :( test_prefix = "%s/st" % (Utils.g_module.blddir) shutil.rmtree(test_prefix, ignore_errors=True) -- cgit