s3: lib: Add new clistr_smb2_extract_snapshot_token() function.
[Samba.git] / buildtools / wafsamba / samba3.py
blob227ee27705da64e8f0a2a2e63a049594e6b9d4c6
1 # a waf tool to add autoconf-like macros to the configure section
2 # and for SAMBA_ macros for building libraries, binaries etc
4 import os
5 from waflib import Build
6 from samba_utils import TO_LIST
7 from samba_autoconf import library_flags
9 def SAMBA3_IS_STATIC_MODULE(bld, module):
10 '''Check whether module is in static list'''
11 if module in bld.env['static_modules']:
12 return True
13 return False
14 Build.BuildContext.SAMBA3_IS_STATIC_MODULE = SAMBA3_IS_STATIC_MODULE
16 def SAMBA3_IS_SHARED_MODULE(bld, module):
17 '''Check whether module is in shared list'''
18 if module in bld.env['shared_modules']:
19 return True
20 return False
21 Build.BuildContext.SAMBA3_IS_SHARED_MODULE = SAMBA3_IS_SHARED_MODULE
23 def SAMBA3_IS_ENABLED_MODULE(bld, module):
24 '''Check whether module is in either shared or static list '''
25 return SAMBA3_IS_STATIC_MODULE(bld, module) or SAMBA3_IS_SHARED_MODULE(bld, module)
26 Build.BuildContext.SAMBA3_IS_ENABLED_MODULE = SAMBA3_IS_ENABLED_MODULE
30 def s3_fix_kwargs(bld, kwargs):
31 '''fix the build arguments for s3 build rules to include the
32 necessary includes, subdir and cflags options '''
33 s3dir = os.path.join(bld.env.srcdir, 'source3')
34 s3reldir = os.path.relpath(s3dir, bld.path.abspath())
36 # the extra_includes list is relative to the source3 directory
37 extra_includes = [ '.', 'include', 'lib' ]
38 # local heimdal paths must only be included when using our embedded Heimdal
39 if bld.CONFIG_SET("USING_EMBEDDED_HEIMDAL"):
40 extra_includes += [ '../third_party/heimdal/lib/com_err',
41 '../third_party/heimdal/lib/base',
42 '../third_party/heimdal/lib/krb5',
43 '../third_party/heimdal/lib/gssapi/gssapi',
44 '../third_party/heimdal_build/include',
45 '../bin/default/third_party/heimdal/lib/asn1' ]
47 if bld.CONFIG_SET('USING_SYSTEM_TDB'):
48 (tdb_includes, tdb_ldflags, tdb_cpppath) = library_flags(bld, 'tdb')
49 extra_includes += tdb_cpppath
50 else:
51 extra_includes += [ '../lib/tdb/include' ]
53 if bld.CONFIG_SET('USING_SYSTEM_TEVENT'):
54 (tevent_includes, tevent_ldflags, tevent_cpppath) = library_flags(bld, 'tevent')
55 extra_includes += tevent_cpppath
56 else:
57 extra_includes += [ '../lib/tevent' ]
59 if bld.CONFIG_SET('USING_SYSTEM_TALLOC'):
60 (talloc_includes, talloc_ldflags, talloc_cpppath) = library_flags(bld, 'talloc')
61 extra_includes += talloc_cpppath
62 else:
63 extra_includes += [ '../lib/talloc' ]
65 if bld.CONFIG_SET('USING_SYSTEM_POPT'):
66 (popt_includes, popt_ldflags, popt_cpppath) = library_flags(bld, 'popt')
67 extra_includes += popt_cpppath
68 else:
69 extra_includes += [ '../lib/popt' ]
71 # s3 builds assume that they will have a bunch of extra include paths
72 includes = []
73 for d in extra_includes:
74 includes += [ os.path.join(s3reldir, d) ]
76 # the rule may already have some includes listed
77 if 'includes' in kwargs:
78 includes += TO_LIST(kwargs['includes'])
79 kwargs['includes'] = includes
81 # these wrappers allow for mixing of S3 and S4 build rules in the one build
83 def SAMBA3_LIBRARY(bld, name, *args, **kwargs):
84 s3_fix_kwargs(bld, kwargs)
85 return bld.SAMBA_LIBRARY(name, *args, **kwargs)
86 Build.BuildContext.SAMBA3_LIBRARY = SAMBA3_LIBRARY
88 def SAMBA3_PLUGIN(bld, name, *args, **kwargs):
89 s3_fix_kwargs(bld, kwargs)
90 return bld.SAMBA_PLUGIN(name, *args, **kwargs)
91 Build.BuildContext.SAMBA3_PLUGIN = SAMBA3_PLUGIN
93 def SAMBA3_MODULE(bld, name, *args, **kwargs):
94 s3_fix_kwargs(bld, kwargs)
95 return bld.SAMBA_MODULE(name, *args, **kwargs)
96 Build.BuildContext.SAMBA3_MODULE = SAMBA3_MODULE
98 def SAMBA3_SUBSYSTEM(bld, name, *args, **kwargs):
99 s3_fix_kwargs(bld, kwargs)
100 return bld.SAMBA_SUBSYSTEM(name, *args, **kwargs)
101 Build.BuildContext.SAMBA3_SUBSYSTEM = SAMBA3_SUBSYSTEM
103 def SAMBA3_BINARY(bld, name, *args, **kwargs):
104 s3_fix_kwargs(bld, kwargs)
105 return bld.SAMBA_BINARY(name, *args, **kwargs)
106 Build.BuildContext.SAMBA3_BINARY = SAMBA3_BINARY
108 def SAMBA3_PYTHON(bld, name, *args, **kwargs):
109 s3_fix_kwargs(bld, kwargs)
110 return bld.SAMBA_PYTHON(name, *args, **kwargs)
111 Build.BuildContext.SAMBA3_PYTHON = SAMBA3_PYTHON