s3-waf: Fix install location of testparm and wbinfo
[Samba/gebeck_regimport.git] / source4 / wscript
blob05bee1a6fed48880ebb9d79e9c9697ef600f335c
1 #! /usr/bin/env python
3 srcdir = '..'
4 blddir = 'bin'
6 APPNAME='samba'
7 VERSION='4.0.0-alpha13'
9 import sys, os
10 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
11 import wafsamba, Options, samba_dist, Scripting
13 samba_dist.DIST_DIRS('.')
15 # install in /usr/local/samba by default
16 Options.default_prefix = '/usr/local/samba'
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')
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')
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)
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)
51 if Options.options.developer:
52 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
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')
57 # set a lower limit on recursing in waf preprocessor
58 conf.env.preprocessor_recursion_limit = 10
60 conf.ADD_EXTRA_INCLUDES('#source4 #lib #source4/lib #source4/include')
62 conf.RECURSE('../lib/replace')
64 conf.find_program('python', var='PYTHON', mandatory=True)
65 conf.find_program('perl', var='PERL', mandatory=True)
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)
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')
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')
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)
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)
113 # putting this here enabled build in the list
114 # of commands in --help
115 def build(bld):
116 '''build all targets'''
117 pass
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)
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')
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)
140 def dist():
141 '''makes a tarball for distribution'''
142 samba_dist.dist()
144 def distcheck():
145 '''test that distribution tarball builds and installs'''
146 import Scripting
147 d = Scripting.distcheck
148 d(subdir='source4')
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)
155 def main():
156 from samba_wildcard import wildcard_main
157 wildcard_main(wildcard_cmd)
158 Scripting.main = main
160 def reconfigure(ctx):
161 '''reconfigure if config scripts have changed'''
162 import samba_utils
163 samba_utils.reconfigure(ctx)