s3-waf: Match the defines from the autotools build on PACKAGE_*
[Samba/gebeck_regimport.git] / source4 / wscript
blob5d6392cefe2d1bff7767343de31207488a73a338
1 #! /usr/bin/env python
3 srcdir = '..'
4 blddir = 'bin'
6 APPNAME='samba'
8 import sys, os
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.
22 #This list includes files that would confuse the recipient of a
23 #samba-4.0.0 branded tarball (until the merge is complete) and the
24 #core elements of the autotools build system (which is known to
25 #produce buggy binaries).
26 samba_dist.DIST_BLACKLIST('README Manifest Read-Manifest-Now Roadmap source3/ ' +
27 'packaging/ docs-xml/ examples/ swat/ WHATSNEW.txt MAINTAINERS ' +
28 'source4/autogen-autotools.sh source4/Makefile.in source4/configure.ac')
29 # install in /usr/local/samba by default
30 Options.default_prefix = '/usr/local/samba'
33 def set_options(opt):
34 opt.BUILTIN_DEFAULT('NONE')
35 opt.BUNDLED_EXTENSION_DEFAULT('samba4')
36 opt.RECURSE('../lib/replace')
37 opt.RECURSE('dynconfig')
38 opt.RECURSE('scripting/python')
39 opt.RECURSE('lib/ldb')
40 opt.RECURSE('selftest')
41 opt.RECURSE('lib/tls')
42 opt.RECURSE('../lib/nss_wrapper')
43 opt.RECURSE('../lib/socket_wrapper')
44 opt.RECURSE('../lib/uid_wrapper')
45 opt.RECURSE('../pidl')
47 gr = opt.option_group('developer options')
48 gr.add_option('--enable-build-farm',
49 help='enable special build farm options',
50 action='store_true', dest='BUILD_FARM')
53 def configure(conf):
54 conf.DEFINE('PACKAGE_NAME', 'samba', quote=True)
55 conf.DEFINE('PACKAGE_STRING', 'Samba ' + version.STRING, quote=True)
56 conf.DEFINE('PACKAGE_TARNAME', 'samba', quote=True)
57 conf.DEFINE('PACKAGE_URL', "http://www.samba.org/", quote=True)
58 conf.DEFINE('PACKAGE_VERSION', version.STRING, quote=True)
59 conf.DEFINE('PACKAGE_BUGREPORT', 'http://bugzilla.samba.org/', quote=True)
61 conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
62 conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
63 conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
65 if Options.options.developer:
66 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
68 # this enables smbtorture.static for s3 in the build farm
69 conf.env.BUILD_FARM = Options.options.BUILD_FARM or os.environ.get('RUN_FROM_BUILD_FARM')
71 # set a lower limit on recursing in waf preprocessor
72 conf.env.preprocessor_recursion_limit = 10
74 conf.ADD_EXTRA_INCLUDES('#source4 #lib #source4/lib #source4/include')
76 conf.RECURSE('../lib/replace')
78 conf.find_program('python', var='PYTHON', mandatory=True)
79 conf.find_program('perl', var='PERL', mandatory=True)
81 # enable tool to build python extensions
82 conf.check_tool('python')
83 conf.check_python_version((2,4,2))
84 conf.check_python_headers(mandatory=True)
86 conf.RECURSE('dynconfig')
87 conf.RECURSE('scripting/python')
88 conf.RECURSE('lib/ldb')
89 conf.RECURSE('heimdal_build')
90 conf.RECURSE('lib/tls')
91 conf.RECURSE('ntvfs/sysdep')
92 conf.RECURSE('../lib/util')
93 conf.RECURSE('../lib/zlib')
94 conf.RECURSE('../lib/util/charset')
95 conf.RECURSE('auth')
96 conf.RECURSE('../lib/nss_wrapper')
97 conf.RECURSE('../nsswitch')
98 conf.RECURSE('../lib/socket_wrapper')
99 conf.RECURSE('../lib/uid_wrapper')
100 conf.RECURSE('../lib/popt')
101 conf.RECURSE('lib/smbreadline')
102 conf.RECURSE('../pidl')
103 conf.RECURSE('selftest')
105 # we don't want PYTHONDIR in config.h, as otherwise changing
106 # --prefix causes a complete rebuild
107 del(conf.env.defines['PYTHONDIR'])
108 conf.SAMBA_CONFIG_H('include/config.h')
111 def etags(ctx):
112 '''build TAGS file using etags'''
113 import Utils
114 source_root = os.path.dirname(Utils.g_module.root_path)
115 cmd = 'etags $(find %s/.. -name "*.[ch]")' % source_root
116 print("Running: %s" % cmd)
117 os.system(cmd)
119 def ctags(ctx):
120 "build 'tags' file using ctags"
121 import Utils
122 source_root = os.path.dirname(Utils.g_module.root_path)
123 cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
124 print("Running: %s" % cmd)
125 os.system(cmd)
127 # putting this here enabled build in the list
128 # of commands in --help
129 def build(bld):
130 '''build all targets'''
131 pass
134 def pydoctor(ctx):
135 '''build python apidocs'''
136 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'
137 print("Running: %s" % cmd)
138 os.system(cmd)
140 def wafdocs(ctx):
141 '''build wafsamba apidocs'''
142 from samba_utils import recursive_dirlist
143 os.system('pwd')
144 list = recursive_dirlist('../buildtools/wafsamba', '.', pattern='*.py')
146 cmd='LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --project-name=wafsamba --project-url=http://www.samba.org --make-html --docformat=restructuredtext'
147 print(list)
148 for f in list:
149 cmd += ' --add-module %s' % f
150 print("Running: %s" % cmd)
151 os.system(cmd)
154 def dist():
155 '''makes a tarball for distribution'''
156 samba_dist.dist()
158 def distcheck():
159 '''test that distribution tarball builds and installs'''
160 import Scripting
161 d = Scripting.distcheck
162 d(subdir='source4')
164 def wildcard_cmd(cmd):
165 '''called on a unknown command'''
166 from samba_wildcard import run_named_build_task
167 run_named_build_task(cmd)
169 def main():
170 from samba_wildcard import wildcard_main
171 wildcard_main(wildcard_cmd)
172 Scripting.main = main
174 def reconfigure(ctx):
175 '''reconfigure if config scripts have changed'''
176 import samba_utils
177 samba_utils.reconfigure(ctx)