[SCM] Samba Shared Repository - branch master updated

Andrew Tridgell tridge at samba.org
Mon Apr 12 07:50:45 MDT 2010


The branch, master has been updated
       via  c168e5c... s4-ldb: enable waf build of ldb without ldap backend
       via  d12605c... build: added cross-compilation configure options
      from  83312a9... Fixed a problem with provision missing the default_dir/etc directory.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c168e5ce507951c0e54e5a612b70fb82b2df3e63
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Apr 12 22:56:44 2010 +1000

    s4-ldb: enable waf build of ldb without ldap backend
    
    this is useful for cross-compilation testing, where getting all the
    ldap deps installed can be hard

commit d12605c679cf4f2c5057c548de1210e7fa03a2f1
Author: Andrew Tridgell <tridge at samba.org>
Date:   Mon Apr 12 22:06:51 2010 +1000

    build: added cross-compilation configure options
    
    this enables use of a cross-compilation emulator, so configure tests
    run on an emulator of the target platform

-----------------------------------------------------------------------

Summary of changes:
 buildtools/wafsamba/samba_autoconf.py |    4 +++
 buildtools/wafsamba/samba_cross.py    |   34 +++++++++++++++++++++++++++++++++
 buildtools/wafsamba/wscript           |   15 ++++++++++++++
 source4/lib/ldb/wscript               |    5 ++-
 4 files changed, 56 insertions(+), 2 deletions(-)
 create mode 100644 buildtools/wafsamba/samba_cross.py


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index d12fb9d..cbb10a2 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -4,6 +4,7 @@ import Build, os, Options, preproc, Logs
 import string
 from Configure import conf
 from samba_utils import *
+import samba_cross
 
 missing_headers = set()
 
@@ -367,6 +368,8 @@ def CHECK_CODE(conf, code, define,
     cflags = TO_LIST(cflags)
     cflags.extend(ccflags)
 
+    exec_args = conf.SAMBA_CROSS_ARGS()
+
     ret = conf.check(fragment=fragment,
                      execute=execute,
                      define_name = define,
@@ -378,6 +381,7 @@ def CHECK_CODE(conf, code, define,
                      type=type,
                      msg=msg,
                      quote=quote,
+                     exec_args=exec_args,
                      define_ret=define_ret)
     if not ret and CONFIG_SET(conf, define):
         # sometimes conf.check() returns false, but it
diff --git a/buildtools/wafsamba/samba_cross.py b/buildtools/wafsamba/samba_cross.py
new file mode 100644
index 0000000..70d74e0
--- /dev/null
+++ b/buildtools/wafsamba/samba_cross.py
@@ -0,0 +1,34 @@
+# functions for handling cross-compilation
+
+import pproc, Utils
+from Configure import conf
+from pproc import Popen
+
+real_Popen = None
+
+class cross_Popen(Popen):
+    '''cross-compilation wrapper for Popen'''
+    def __init__(*k, **kw):
+        (obj, args) = k
+        if '--cross-execute' in args:
+            # when --cross-execute is set, then change the arguments
+            # to use the cross emulator
+            i = args.index('--cross-execute')
+            newargs = args[i+1].split()
+            newargs.extend(args[0:i])
+            args = newargs
+        Popen.__init__(*(obj, args), **kw)
+
+
+ at conf
+def SAMBA_CROSS_ARGS(conf):
+    '''get exec_args to pass when running cross compiled binaries'''
+    if not conf.env.CROSS_COMPILE or not conf.env.CROSS_EXECUTE:
+        return []
+
+    global real_Popen
+    if real_Popen is None:
+        real_Popen  = Utils.pproc.Popen
+        Utils.pproc.Popen = cross_Popen
+
+    return ['--cross-execute', conf.env.CROSS_EXECUTE]
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 2e42139..87e7070 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -68,6 +68,17 @@ def set_options(opt):
 		   help=("Enable even more compiler warnings"),
 		   action='store_true', dest='pedantic', default=False)
 
+    opt.add_option('--cross-compile',
+		   help=("configure for cross-compilation"),
+		   action='store_true', dest='CROSS_COMPILE', default=False)
+    opt.add_option('--cross-execute',
+		   help=("command prefix to use for cross-execution in configure"),
+		   action='store', dest='CROSS_EXECUTE', default='')
+    opt.add_option('--hostcc',
+		   help=("set host compiler when cross compiling"),
+		   action='store', dest='HOSTCC', default=False)
+
+
 @wafsamba.runonce
 def configure(conf):
     conf.env.hlist = []
@@ -105,6 +116,10 @@ def configure(conf):
     conf.env.BUNDLED_EXTENSION = Options.options.BUNDLED_EXTENSION
     conf.env.BUNDLED_EXTENSION_EXCEPTION = Options.options.BUNDLED_EXTENSION_EXCEPTION.split(',')
 
+    conf.env.CROSS_COMPILE = Options.options.CROSS_COMPILE
+    conf.env.CROSS_EXECUTE = Options.options.CROSS_EXECUTE
+    conf.env.HOSTCC        = Options.options.HOSTCC
+
     # see if we can compile and run a simple C program
     conf.CHECK_CODE('printf("hello world\\n")',
                     define='HAVE_SIMPLE_C_PROG',
diff --git a/source4/lib/ldb/wscript b/source4/lib/ldb/wscript
index 911eb77..d796bc0 100644
--- a/source4/lib/ldb/wscript
+++ b/source4/lib/ldb/wscript
@@ -44,7 +44,8 @@ def configure(conf):
                                      implied_deps='replace talloc tdb tevent'):
             conf.define('USING_SYSTEM_LDB', 1)
         # we need this for the ldap backend
-        conf.CHECK_FUNCS_IN('ber_flush ldap_open', 'lber ldap', headers='lber.h ldap.h', mandatory=True)
+        if conf.CHECK_FUNCS_IN('ber_flush ldap_open', 'lber ldap', headers='lber.h ldap.h'):
+            conf.env.ENABLE_LDAP_BACKEND = True
 
     conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
 
@@ -133,7 +134,7 @@ def build(bld):
     bld.SAMBA_MODULE('ldb_ldap', 'ldb_ldap/ldb_ldap.c',
                      init_function='LDB_BACKEND(ldapi),LDB_BACKEND(ldaps),LDB_BACKEND(ldap)',
                      deps='talloc lber ldap',
-                     enabled=not s4_build,
+                     enabled=bld.env.ENABLE_LDAP_BACKEND,
                      subsystem='LIBLDB')
 
     # we're not currently linking against the ldap libs, but ldb.pc.in


-- 
Samba Shared Repository


More information about the samba-cvs mailing list