waf Add DIST_BLACKLIST to list files that we cannot include in a release
[metze/samba/wip.git] / source4 / wscript
1 #! /usr/bin/env python
2
3 srcdir = '..'
4 blddir = 'bin'
5
6 APPNAME='samba'
7
8 import sys, os
9 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
10 import wafsamba, Options, samba_dist, Scripting
11
12 version = wafsamba.samba_version_file("./VERSION")
13
14 VERSION=version.STRING
15
16 samba_dist.DIST_DIRS('.')
17
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'
25
26
27 def set_options(opt):
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')
40
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')
45
46
47 def configure(conf):
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)
54
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)
58
59     if Options.options.developer:
60         conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
61
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')
64
65     # set a lower limit on recursing in waf preprocessor
66     conf.env.preprocessor_recursion_limit = 10
67
68     conf.ADD_EXTRA_INCLUDES('#source4 #lib #source4/lib #source4/include')
69
70     conf.RECURSE('../lib/replace')
71
72     conf.find_program('python', var='PYTHON', mandatory=True)
73     conf.find_program('perl', var='PERL', mandatory=True)
74
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)
79
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')
89     conf.RECURSE('auth')
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')
98
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')
103
104
105 def etags(ctx):
106     '''build TAGS file using etags'''
107     import Utils
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)
111     os.system(cmd)
112
113 def ctags(ctx):
114     "build 'tags' file using ctags"
115     import Utils
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)
119     os.system(cmd)
120
121 # putting this here enabled build in the list
122 # of commands in --help
123 def build(bld):
124     '''build all targets'''
125     pass
126
127
128 def pydoctor(ctx):
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)
132     os.system(cmd)
133
134 def wafdocs(ctx):
135     '''build wafsamba apidocs'''
136     from samba_utils import recursive_dirlist
137     os.system('pwd')
138     list = recursive_dirlist('../buildtools/wafsamba', '.', pattern='*.py')
139
140     cmd='LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --project-name=wafsamba --project-url=http://www.samba.org --make-html --docformat=restructuredtext'
141     print(list)
142     for f in list:
143         cmd += ' --add-module %s' % f
144     print("Running: %s" % cmd)
145     os.system(cmd)
146
147
148 def dist():
149     '''makes a tarball for distribution'''
150     samba_dist.dist()
151
152 def distcheck():
153     '''test that distribution tarball builds and installs'''
154     import Scripting
155     d = Scripting.distcheck
156     d(subdir='source4')
157
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)
162
163 def main():
164     from samba_wildcard import wildcard_main
165     wildcard_main(wildcard_cmd)
166 Scripting.main = main
167
168 def reconfigure(ctx):
169     '''reconfigure if config scripts have changed'''
170     import samba_utils
171     samba_utils.reconfigure(ctx)