880069ed0e248833d528ca17346254d5c0d86643
[kamenim/samba.git] / source4 / wscript
1 #! /usr/bin/env python
2
3 srcdir = '..'
4 blddir = 'bin'
5
6 APPNAME='samba'
7 VERSION='4.0.0-alpha13'
8
9 import sys, os
10 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
11 import wafsamba, Options, samba_dist, Scripting
12
13 samba_dist.DIST_DIRS('.')
14
15 # install in /usr/local/samba by default
16 Options.default_prefix = '/usr/local/samba'
17
18
19 def set_options(opt):
20     opt.BUILTIN_DEFAULT('NONE')
21     opt.BUNDLED_EXTENSION_DEFAULT('samba4')
22     opt.RECURSE('../lib/replace')
23     opt.RECURSE('dynconfig')
24     opt.RECURSE('scripting/python')
25     opt.RECURSE('lib/ldb')
26     opt.RECURSE('selftest')
27     opt.RECURSE('lib/tls')
28     opt.RECURSE('../lib/nss_wrapper')
29     opt.RECURSE('../lib/socket_wrapper')
30     opt.RECURSE('../lib/uid_wrapper')
31     opt.RECURSE('../pidl')
32
33     gr = opt.option_group('developer options')
34     gr.add_option('--enable-build-farm',
35                    help='enable special build farm options',
36                    action='store_true', dest='BUILD_FARM')
37
38
39 def configure(conf):
40     conf.DEFINE('PACKAGE_NAME', 'samba', quote=True)
41     conf.DEFINE('PACKAGE_STRING', 'samba 4', quote=True)
42     conf.DEFINE('PACKAGE_TARNAME',  'samba', quote=True)
43     conf.DEFINE('PACKAGE_URL', "http://www.samba.org/", quote=True)
44     conf.DEFINE('PACKAGE_VERSION', "4", quote=True)
45     conf.DEFINE('PACKAGE_BUGREPORT', 'http://bugzilla.samba.org/', quote=True)
46
47     conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
48     conf.DEFINE('_SAMBA_BUILD_', 4, add_to_cflags=True)
49     conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
50
51     if Options.options.developer:
52         conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
53
54     # this enables smbtorture.static for s3 in the build farm
55     conf.env.BUILD_FARM = Options.options.BUILD_FARM or os.environ.get('RUN_FROM_BUILD_FARM')
56
57     # set a lower limit on recursing in waf preprocessor
58     conf.env.preprocessor_recursion_limit = 10
59
60     conf.ADD_EXTRA_INCLUDES('#source4 #lib #source4/lib #source4/include')
61
62     conf.RECURSE('../lib/replace')
63
64     conf.find_program('python', var='PYTHON', mandatory=True)
65     conf.find_program('perl', var='PERL', mandatory=True)
66
67     # enable tool to build python extensions
68     conf.check_tool('python')
69     conf.check_python_version((2,4,2))
70     conf.check_python_headers(mandatory=True)
71
72     conf.RECURSE('dynconfig')
73     conf.RECURSE('scripting/python')
74     conf.RECURSE('lib/ldb')
75     conf.RECURSE('heimdal_build')
76     conf.RECURSE('lib/tls')
77     conf.RECURSE('ntvfs/sysdep')
78     conf.RECURSE('../lib/util')
79     conf.RECURSE('../lib/zlib')
80     conf.RECURSE('../lib/util/charset')
81     conf.RECURSE('auth')
82     conf.RECURSE('../lib/nss_wrapper')
83     conf.RECURSE('../nsswitch')
84     conf.RECURSE('../lib/socket_wrapper')
85     conf.RECURSE('../lib/uid_wrapper')
86     conf.RECURSE('../lib/popt')
87     conf.RECURSE('lib/smbreadline')
88     conf.RECURSE('../pidl')
89     conf.RECURSE('selftest')
90
91     # we don't want PYTHONDIR in config.h, as otherwise changing
92     # --prefix causes a complete rebuild
93     del(conf.env.defines['PYTHONDIR'])
94     conf.SAMBA_CONFIG_H('include/config.h')
95
96
97 def etags(ctx):
98     '''build TAGS file using etags'''
99     import Utils
100     source_root = os.path.dirname(Utils.g_module.root_path)
101     cmd = 'etags $(find %s/.. -name "*.[ch]")' % source_root
102     print("Running: %s" % cmd)
103     os.system(cmd)
104
105 def ctags(ctx):
106     "build 'tags' file using ctags"
107     import Utils
108     source_root = os.path.dirname(Utils.g_module.root_path)
109     cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
110     print("Running: %s" % cmd)
111     os.system(cmd)
112
113 # putting this here enabled build in the list
114 # of commands in --help
115 def build(bld):
116     '''build all targets'''
117     pass
118
119
120 def pydoctor(ctx):
121     '''build python apidocs'''
122     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'
123     print("Running: %s" % cmd)
124     os.system(cmd)
125
126 def wafdocs(ctx):
127     '''build wafsamba apidocs'''
128     from samba_utils import recursive_dirlist
129     os.system('pwd')
130     list = recursive_dirlist('../buildtools/wafsamba', '.', pattern='*.py')
131
132     cmd='LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --project-name=wafsamba --project-url=http://www.samba.org --make-html --docformat=restructuredtext'
133     print(list)
134     for f in list:
135         cmd += ' --add-module %s' % f
136     print("Running: %s" % cmd)
137     os.system(cmd)
138
139
140 def dist():
141     '''makes a tarball for distribution'''
142     samba_dist.dist()
143
144 def distcheck():
145     '''test that distribution tarball builds and installs'''
146     import Scripting
147     d = Scripting.distcheck
148     d(subdir='source4')
149
150 def wildcard_cmd(cmd):
151     '''called on a unknown command'''
152     from samba_wildcard import run_named_build_task
153     run_named_build_task(cmd)
154
155 def main():
156     from samba_wildcard import wildcard_main
157     wildcard_main(wildcard_cmd)
158 Scripting.main = main
159