s4:selftest/wscript: --enable-selftest and --with-selftest-prefix are configure options
[kai/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
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 def configure(conf):
34     conf.DEFINE('PACKAGE_NAME', 'samba', quote=True)
35     conf.DEFINE('PACKAGE_STRING', 'samba 4', quote=True)
36     conf.DEFINE('PACKAGE_TARNAME',  'samba', quote=True)
37     conf.DEFINE('PACKAGE_URL', "http://www.samba.org/", quote=True)
38     conf.DEFINE('PACKAGE_VERSION', "4", quote=True)
39     conf.DEFINE('PACKAGE_BUGREPORT', 'http://bugzilla.samba.org/', quote=True)
40
41     conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
42     conf.DEFINE('_SAMBA_BUILD_', 4, add_to_cflags=True)
43     conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
44
45     if Options.options.developer:
46         conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
47
48     # set a lower limit on recursing in waf preprocessor
49     conf.env.preprocessor_recursion_limit = 10
50
51     conf.ADD_EXTRA_INCLUDES('#source4 #lib #source4/lib #source4/include')
52
53     conf.RECURSE('../lib/replace')
54
55     conf.find_program('python', var='PYTHON', mandatory=True)
56     conf.find_program('perl', var='PERL', mandatory=True)
57
58     # enable tool to build python extensions
59     conf.check_tool('python')
60     conf.check_python_version((2,4,2))
61     conf.check_python_headers()
62
63     conf.RECURSE('dynconfig')
64     conf.RECURSE('scripting/python')
65     conf.RECURSE('lib/ldb')
66     conf.RECURSE('heimdal_build')
67     conf.RECURSE('lib/tls')
68     conf.RECURSE('ntvfs/sysdep')
69     conf.RECURSE('../lib/util')
70     conf.RECURSE('../lib/zlib')
71     conf.RECURSE('../lib/util/charset')
72     conf.RECURSE('auth')
73     conf.RECURSE('../lib/nss_wrapper')
74     conf.RECURSE('../nsswitch')
75     conf.RECURSE('../lib/socket_wrapper')
76     conf.RECURSE('../lib/uid_wrapper')
77     conf.RECURSE('../lib/popt')
78     conf.RECURSE('lib/smbreadline')
79     conf.RECURSE('../pidl')
80     conf.RECURSE('selftest')
81
82     # we don't want PYTHONDIR in config.h, as otherwise changing
83     # --prefix causes a complete rebuild
84     del(conf.env.defines['PYTHONDIR'])
85     conf.SAMBA_CONFIG_H('include/config.h')
86
87
88 def etags(ctx):
89     '''build TAGS file using etags'''
90     import Utils
91     source_root = os.path.dirname(Utils.g_module.root_path)
92     cmd = 'etags $(find %s/.. -name "*.[ch]")' % source_root
93     print("Running: %s" % cmd)
94     os.system(cmd)
95
96 def ctags(ctx):
97     "build 'tags' file using ctags"
98     import Utils
99     source_root = os.path.dirname(Utils.g_module.root_path)
100     cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
101     print("Running: %s" % cmd)
102     os.system(cmd)
103
104 # putting this here enabled build in the list
105 # of commands in --help
106 def build(bld):
107     '''build all targets'''
108     pass
109
110
111 def pydoctor(ctx):
112     '''build python apidocs'''
113     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'
114     print("Running: %s" % cmd)
115     os.system(cmd)
116
117 def wafdocs(ctx):
118     '''build wafsamba apidocs'''
119     from samba_utils import recursive_dirlist
120     os.system('pwd')
121     list = recursive_dirlist('../buildtools/wafsamba', '.', pattern='*.py')
122
123     cmd='LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --project-name=wafsamba --project-url=http://www.samba.org --make-html --docformat=restructuredtext'
124     print(list)
125     for f in list:
126         cmd += ' --add-module %s' % f
127     print("Running: %s" % cmd)
128     os.system(cmd)
129
130
131 def dist():
132     '''makes a tarball for distribution'''
133     samba_dist.dist()
134
135 def distcheck():
136     '''test that distribution tarball builds and installs'''
137     import Scripting
138     d = Scripting.distcheck
139     d(subdir='source4')
140
141