9 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
10 import wafsamba, Options, samba_dist, Scripting
12 version = wafsamba.samba_version_file("./VERSION")
14 VERSION=version.STRING
16 samba_dist.DIST_DIRS('.')
18 #This is a list of files that we don't want in the package, for
19 #whatever reason. Directories should be listed with a trailing / to
20 #avoid over-exclusion.
21 samba_dist.DIST_BLACKLIST('README Manifest Read-Manifest-Now Roadmap source3/ ' +
22 'packaging/ docs-xml/ examples/ swat/ WHATSNEW.txt MAINTAINERS')
23 # install in /usr/local/samba by default
24 Options.default_prefix = '/usr/local/samba'
28 opt.BUILTIN_DEFAULT('NONE')
29 opt.BUNDLED_EXTENSION_DEFAULT('samba4')
30 opt.RECURSE('../lib/replace')
31 opt.RECURSE('dynconfig')
32 opt.RECURSE('scripting/python')
33 opt.RECURSE('lib/ldb')
34 opt.RECURSE('selftest')
35 opt.RECURSE('lib/tls')
36 opt.RECURSE('../lib/nss_wrapper')
37 opt.RECURSE('../lib/socket_wrapper')
38 opt.RECURSE('../lib/uid_wrapper')
39 opt.RECURSE('../pidl')
41 gr = opt.option_group('developer options')
42 gr.add_option('--enable-build-farm',
43 help='enable special build farm options',
44 action='store_true', dest='BUILD_FARM')
48 conf.DEFINE('PACKAGE_NAME', 'samba', quote=True)
49 conf.DEFINE('PACKAGE_STRING', 'Samba ' + version.STRING, quote=True)
50 conf.DEFINE('PACKAGE_TARNAME', 'samba', quote=True)
51 conf.DEFINE('PACKAGE_URL', "http://www.samba.org/", quote=True)
52 conf.DEFINE('PACKAGE_VERSION', version.STRING, quote=True)
53 conf.DEFINE('PACKAGE_BUGREPORT', 'http://bugzilla.samba.org/', quote=True)
55 conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
56 conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
57 conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
59 if Options.options.developer:
60 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
62 # this enables smbtorture.static for s3 in the build farm
63 conf.env.BUILD_FARM = Options.options.BUILD_FARM or os.environ.get('RUN_FROM_BUILD_FARM')
65 # set a lower limit on recursing in waf preprocessor
66 conf.env.preprocessor_recursion_limit = 10
68 conf.ADD_EXTRA_INCLUDES('#source4 #lib #source4/lib #source4/include')
70 conf.RECURSE('../lib/replace')
72 conf.find_program('python', var='PYTHON', mandatory=True)
73 conf.find_program('perl', var='PERL', mandatory=True)
75 # enable tool to build python extensions
76 conf.check_tool('python')
77 conf.check_python_version((2,4,2))
78 conf.check_python_headers(mandatory=True)
80 conf.RECURSE('dynconfig')
81 conf.RECURSE('scripting/python')
82 conf.RECURSE('lib/ldb')
83 conf.RECURSE('heimdal_build')
84 conf.RECURSE('lib/tls')
85 conf.RECURSE('ntvfs/sysdep')
86 conf.RECURSE('../lib/util')
87 conf.RECURSE('../lib/zlib')
88 conf.RECURSE('../lib/util/charset')
90 conf.RECURSE('../lib/nss_wrapper')
91 conf.RECURSE('../nsswitch')
92 conf.RECURSE('../lib/socket_wrapper')
93 conf.RECURSE('../lib/uid_wrapper')
94 conf.RECURSE('../lib/popt')
95 conf.RECURSE('lib/smbreadline')
96 conf.RECURSE('../pidl')
97 conf.RECURSE('selftest')
99 # we don't want PYTHONDIR in config.h, as otherwise changing
100 # --prefix causes a complete rebuild
101 del(conf.env.defines['PYTHONDIR'])
102 conf.SAMBA_CONFIG_H('include/config.h')
106 '''build TAGS file using etags'''
108 source_root = os.path.dirname(Utils.g_module.root_path)
109 cmd = 'etags $(find %s/.. -name "*.[ch]")' % source_root
110 print("Running: %s" % cmd)
114 "build 'tags' file using ctags"
116 source_root = os.path.dirname(Utils.g_module.root_path)
117 cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
118 print("Running: %s" % cmd)
121 # putting this here enabled build in the list
122 # of commands in --help
124 '''build all targets'''
129 '''build python apidocs'''
130 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'
131 print("Running: %s" % cmd)
135 '''build wafsamba apidocs'''
136 from samba_utils import recursive_dirlist
138 list = recursive_dirlist('../buildtools/wafsamba', '.', pattern='*.py')
140 cmd='LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --project-name=wafsamba --project-url=http://www.samba.org --make-html --docformat=restructuredtext'
143 cmd += ' --add-module %s' % f
144 print("Running: %s" % cmd)
149 '''makes a tarball for distribution'''
153 '''test that distribution tarball builds and installs'''
155 d = Scripting.distcheck
158 def wildcard_cmd(cmd):
159 '''called on a unknown command'''
160 from samba_wildcard import run_named_build_task
161 run_named_build_task(cmd)
164 from samba_wildcard import wildcard_main
165 wildcard_main(wildcard_cmd)
166 Scripting.main = main
168 def reconfigure(ctx):
169 '''reconfigure if config scripts have changed'''
171 samba_utils.reconfigure(ctx)