s3: Lift the smbd_messaging_context from check_published_printers
[Samba/gbeck.git] / source4 / wscript
blob6bf8663d6c7d04ad63cf2c60e54776f4d4664111
1 #! /usr/bin/env python
3 srcdir = '..'
4 blddir = 'bin'
6 APPNAME='samba'
7 VERSION=None
9 import sys, os
10 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
11 import wafsamba, Options, samba_dist, Scripting
14 def load_version(have_git=False):
15 '''load samba versions either from ./VERSION or git
16 return a version object for detailed breakdown'''
17 import samba_utils, Utils
18 if not have_git:
19 env = samba_utils.LOAD_ENVIRONMENT()
20 have_git = 'GIT' in env
21 version = wafsamba.samba_version_file("./VERSION", have_git=have_git)
22 Utils.g_module.VERSION = version.STRING
23 return version
26 samba_dist.DIST_DIRS('.')
28 #This is a list of files that we don't want in the package, for
29 #whatever reason. Directories should be listed with a trailing / to
30 #avoid over-exclusion.
32 #This list includes files that would confuse the recipient of a
33 #samba-4.0.0 branded tarball (until the merge is complete) and the
34 #core elements of the autotools build system (which is known to
35 #produce buggy binaries).
36 samba_dist.DIST_BLACKLIST('README Manifest Read-Manifest-Now Roadmap source3/ ' +
37 'packaging/ docs-xml/ examples/ swat/ WHATSNEW.txt MAINTAINERS ' +
38 'source4/autogen-autotools.sh source4/Makefile.in source4/configure.ac')
39 # install in /usr/local/samba by default
40 Options.default_prefix = '/usr/local/samba'
43 def set_options(opt):
44 opt.BUILTIN_DEFAULT('replace')
45 opt.BUNDLED_EXTENSION_DEFAULT('samba4')
46 opt.RECURSE('../lib/replace')
47 opt.RECURSE('dynconfig')
48 opt.RECURSE('scripting/python')
49 opt.RECURSE('lib/ldb')
50 opt.RECURSE('selftest')
51 opt.RECURSE('lib/tls')
52 opt.RECURSE('../lib/nss_wrapper')
53 opt.RECURSE('../lib/socket_wrapper')
54 opt.RECURSE('../lib/uid_wrapper')
55 opt.RECURSE('../pidl')
57 gr = opt.option_group('developer options')
58 gr.add_option('--enable-build-farm',
59 help='enable special build farm options',
60 action='store_true', dest='BUILD_FARM')
63 def configure(conf):
64 version = load_version(have_git=True)
66 conf.DEFINE('PACKAGE_NAME', 'samba', quote=True)
67 conf.DEFINE('PACKAGE_STRING', 'Samba ' + version.STRING, quote=True)
68 conf.DEFINE('PACKAGE_TARNAME', 'samba', quote=True)
69 conf.DEFINE('PACKAGE_URL', "http://www.samba.org/", quote=True)
70 conf.DEFINE('PACKAGE_VERSION', version.STRING, quote=True)
71 conf.DEFINE('PACKAGE_BUGREPORT', 'http://bugzilla.samba.org/', quote=True)
73 conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
74 conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
75 conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
77 if Options.options.developer:
78 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
80 # this enables smbtorture.static for s3 in the build farm
81 conf.env.BUILD_FARM = Options.options.BUILD_FARM or os.environ.get('RUN_FROM_BUILD_FARM')
83 # set a lower limit on recursing in waf preprocessor
84 conf.env.preprocessor_recursion_limit = 10
86 conf.ADD_EXTRA_INCLUDES('#source4 #lib #source4/lib #source4/include')
88 conf.RECURSE('../lib/replace')
90 conf.find_program('python', var='PYTHON', mandatory=True)
91 conf.find_program('perl', var='PERL', mandatory=True)
92 conf.find_program('xsltproc', var='XSLTPROC')
94 # enable tool to build python extensions
95 conf.check_tool('python')
96 conf.check_python_version((2,4,2))
97 conf.check_python_headers(mandatory=True)
99 conf.RECURSE('dynconfig')
100 conf.RECURSE('scripting/python')
101 conf.RECURSE('lib/ldb')
102 conf.RECURSE('heimdal_build')
103 conf.RECURSE('lib/tls')
104 conf.RECURSE('ntvfs/sysdep')
105 conf.RECURSE('../lib/util')
106 conf.RECURSE('../lib/zlib')
107 conf.RECURSE('../lib/util/charset')
108 conf.RECURSE('auth')
109 conf.RECURSE('../lib/nss_wrapper')
110 conf.RECURSE('../nsswitch')
111 conf.RECURSE('../lib/socket_wrapper')
112 conf.RECURSE('../lib/uid_wrapper')
113 conf.RECURSE('../lib/popt')
114 conf.RECURSE('lib/smbreadline')
115 conf.RECURSE('../pidl')
116 conf.RECURSE('selftest')
118 # we don't want PYTHONDIR in config.h, as otherwise changing
119 # --prefix causes a complete rebuild
120 del(conf.env.defines['PYTHONDIR'])
121 conf.SAMBA_CONFIG_H('include/config.h')
124 def etags(ctx):
125 '''build TAGS file using etags'''
126 import Utils
127 source_root = os.path.dirname(Utils.g_module.root_path)
128 cmd = 'etags $(find %s/.. -name "*.[ch]")' % source_root
129 print("Running: %s" % cmd)
130 os.system(cmd)
132 def ctags(ctx):
133 "build 'tags' file using ctags"
134 import Utils
135 source_root = os.path.dirname(Utils.g_module.root_path)
136 cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
137 print("Running: %s" % cmd)
138 os.system(cmd)
140 # putting this here enabled build in the list
141 # of commands in --help
142 def build(bld):
143 '''build all targets'''
144 load_version()
145 pass
148 def pydoctor(ctx):
149 '''build python apidocs'''
150 cmd='LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --project-name=Samba --project-url=http://www.samba.org --make-html --docformat=restructuredtext --add-package bin/python/samba'
151 print("Running: %s" % cmd)
152 os.system(cmd)
154 def wafdocs(ctx):
155 '''build wafsamba apidocs'''
156 from samba_utils import recursive_dirlist
157 os.system('pwd')
158 list = recursive_dirlist('../buildtools/wafsamba', '.', pattern='*.py')
160 cmd='LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --project-name=wafsamba --project-url=http://www.samba.org --make-html --docformat=restructuredtext'
161 print(list)
162 for f in list:
163 cmd += ' --add-module %s' % f
164 print("Running: %s" % cmd)
165 os.system(cmd)
168 def dist():
169 '''makes a tarball for distribution'''
170 load_version()
171 samba_dist.dist()
173 def distcheck():
174 '''test that distribution tarball builds and installs'''
175 load_version()
176 import Scripting
177 d = Scripting.distcheck
178 d(subdir='source4')
180 def wildcard_cmd(cmd):
181 '''called on a unknown command'''
182 from samba_wildcard import run_named_build_task
183 run_named_build_task(cmd)
185 def main():
186 from samba_wildcard import wildcard_main
187 wildcard_main(wildcard_cmd)
188 Scripting.main = main
190 def reconfigure(ctx):
191 '''reconfigure if config scripts have changed'''
192 import samba_utils
193 samba_utils.reconfigure(ctx)