summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2011-02-17 14:11:33 +1100
committerAndrew Tridgell <tridge@samba.org>2011-02-18 15:09:47 +1100
commitba942c8bfeff87b11af0ffb1e55dc77d4d5c64f0 (patch)
tree0f622d70e8a68e950121a6556332814230047a73 /buildtools/wafsamba
parentc7456013b970cf07a517c006d7f38713631d838d (diff)
downloadsamba-ba942c8bfeff87b11af0ffb1e55dc77d4d5c64f0.tar.gz
samba-ba942c8bfeff87b11af0ffb1e55dc77d4d5c64f0.tar.bz2
samba-ba942c8bfeff87b11af0ffb1e55dc77d4d5c64f0.zip
waf: added SAMBA3_*() build rules to samba3.py
these provide samba build rule wrappers for Samba3 specific subsystems Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r--buildtools/wafsamba/samba3.py74
1 files changed, 72 insertions, 2 deletions
diff --git a/buildtools/wafsamba/samba3.py b/buildtools/wafsamba/samba3.py
index 5008abb949..6759450f60 100644
--- a/buildtools/wafsamba/samba3.py
+++ b/buildtools/wafsamba/samba3.py
@@ -1,9 +1,9 @@
# a waf tool to add autoconf-like macros to the configure section
# and for SAMBA_ macros for building libraries, binaries etc
-import Options
-import Build
+import Options, Build, os
from optparse import SUPPRESS_HELP
+from samba_utils import os_path_relpath, TO_LIST
def SAMBA3_ADD_OPTION(opt, option, help=(), dest=None, default=True,
with_name="with", without_name="without"):
@@ -41,3 +41,73 @@ def SAMBA3_IS_ENABLED_MODULE(bld, module):
'''Check whether module is in either shared or static list '''
return SAMBA3_IS_STATIC_MODULE(bld, module) or SAMBA3_IS_SHARED_MODULE(bld, module)
Build.BuildContext.SAMBA3_IS_ENABLED_MODULE = SAMBA3_IS_ENABLED_MODULE
+
+
+
+def s3_fix_kwargs(bld, kwargs):
+ '''fix the build arguments for s3 build rules to include the
+ necessary includes, subdir and cflags options '''
+ s3dir = os.path.join(bld.env.srcdir, 'source3')
+ s3reldir = os_path_relpath(s3dir, bld.curdir)
+
+ # cope with the fact that the s3 waf rules were originally written
+ # assuming relative paths to source3/. This only triggers when using the
+ # wscript rules in s3build/
+ if bld.curdir.endswith("/s3build") and not 'subdir' in kwargs:
+ kwargs['subdir'] = s3reldir
+
+ # the extra_includes list is relative to the source3 directory
+ extra_includes = [ '.', 'include', 'lib' ]
+ if bld.env.use_intree_heimdal:
+ extra_includes += [ '../source4/heimdal/lib/com_err',
+ '../source4/heimdal/lib/gssapi',
+ '../source4/heimdal_build' ]
+
+ if not bld.CONFIG_SET('USING_SYSTEM_TDB'):
+ extra_includes += [ '../lib/tdb/include' ]
+
+ if not bld.CONFIG_SET('USING_SYSTEM_TEVENT'):
+ extra_includes += [ '../lib/tevent' ]
+
+ if not bld.CONFIG_SET('USING_SYSTEM_TALLOC'):
+ extra_includes += [ '../lib/talloc' ]
+
+ # s3 builds assume that they will have a bunch of extra include paths
+ includes = []
+ for d in extra_includes:
+ includes += [ os.path.join(s3reldir, d) ]
+
+ # the rule may already have some includes listed
+ if 'includes' in kwargs:
+ includes += TO_LIST(kwargs['includes'])
+ kwargs['includes'] = includes
+
+ # some S3 code assumes that CONFIGFILE is set
+ cflags = ['-DCONFIGFILE="%s"' % bld.env['CONFIGFILE']]
+ if 'cflags' in kwargs:
+ cflags += TO_LIST(kwargs['cflags'])
+ kwargs['cflags'] = cflags
+
+# these wrappers allow for mixing of S3 and S4 build rules in the one build
+
+def SAMBA3_LIBRARY(bld, name, *args, **kwargs):
+ s3_fix_kwargs(bld, kwargs)
+ kwargs['allow_undefined_symbols'] = True
+ return bld.SAMBA_LIBRARY(name, *args, **kwargs)
+Build.BuildContext.SAMBA3_LIBRARY = SAMBA3_LIBRARY
+
+def SAMBA3_MODULE(bld, name, *args, **kwargs):
+ s3_fix_kwargs(bld, kwargs)
+ kwargs['allow_undefined_symbols'] = True
+ return bld.SAMBA_MODULE(name, *args, **kwargs)
+Build.BuildContext.SAMBA3_MODULE = SAMBA3_MODULE
+
+def SAMBA3_SUBSYSTEM(bld, name, *args, **kwargs):
+ s3_fix_kwargs(bld, kwargs)
+ return bld.SAMBA_SUBSYSTEM(name, *args, **kwargs)
+Build.BuildContext.SAMBA3_SUBSYSTEM = SAMBA3_SUBSYSTEM
+
+def SAMBA3_BINARY(bld, name, *args, **kwargs):
+ s3_fix_kwargs(bld, kwargs)
+ return bld.SAMBA_BINARY(name, *args, **kwargs)
+Build.BuildContext.SAMBA3_BINARY = SAMBA3_BINARY