]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ccan: Only build ccan-failtest when we are in developer mode
authorAndrew Bartlett <abartlet@samba.org>
Thu, 7 Jun 2012 13:07:52 +0000 (22:37 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 7 Jun 2012 16:53:12 +0000 (18:53 +0200)
From: Andrew Bartlett <abartlet@samba.org>

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 <rusty@rustcorp.com.au>
Autobuild-User(master): Rusty Russell <rusty@rustcorp.com.au>
Autobuild-Date(master): Thu Jun  7 18:53:12 CEST 2012 on sn-devel-104

lib/ccan/wscript
lib/tdb2/wscript

index 24034bb4ac99ace55e4c8b327e722bd6981a65aa..8a2b3e79b72d6a26f41aacc7aed0f36d3b248e1d 100644 (file)
@@ -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)
index a1885fc3c894b4f203a715ba4f60ee3d479004ad..b925893cb4c857e7706ddca15384808b36d0a779 100644 (file)
@@ -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)