s3:rpc_server: don't do any magic in is_known_pipename() anymore
[Samba/gebeck_regimport.git] / wscript
blob56dee2ea0c25af65e4426b2f5e10979c21da0d9d
1 #! /usr/bin/env python
3 srcdir = '.'
4 blddir = 'bin'
6 APPNAME='samba'
7 VERSION=None
9 import sys, os
10 sys.path.insert(0, srcdir+"/buildtools/wafsamba")
11 import wafsamba, Options, samba_dist, Scripting, Utils, samba_version
14 samba_dist.DIST_DIRS('.')
15 samba_dist.DIST_BLACKLIST('.gitignore .bzrignore')
17 # install in /usr/local/samba by default
18 Options.default_prefix = '/usr/local/samba'
20 def set_options(opt):
21 opt.BUILTIN_DEFAULT('NONE')
22 opt.PRIVATE_EXTENSION_DEFAULT('samba4')
23 opt.RECURSE('lib/replace')
24 opt.RECURSE('dynconfig')
25 opt.RECURSE('lib/ldb')
26 opt.RECURSE('selftest')
27 opt.RECURSE('source4/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 opt.RECURSE('source3')
33 opt.RECURSE('lib/util')
35 opt.add_option('--with-system-mitkrb5',
36 help='enable system MIT krb5 build (includes Samba 4 client and Samba 3 code base)',
37 action='store_true', dest='with_system_mitkrb5', default=False)
39 opt.add_option('--without-ad-dc',
40 help='disable AD DC functionality (enables Samba 4 client and Samba 3 code base). Requires system MIT krb5',
41 action='store_true', dest='with_system_mitkrb5', default=False)
43 gr = opt.option_group('developer options')
44 gr.add_option('--enable-build-farm',
45 help='enable special build farm options',
46 action='store_true', dest='BUILD_FARM')
48 opt.tool_options('python') # options for disabling pyc or pyo compilation
49 # enable options related to building python extensions
52 def configure(conf):
53 version = samba_version.load_version(env=conf.env)
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)
59 if Options.options.developer:
60 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
61 conf.env.DEVELOPER = True
63 # this enables smbtorture.static for s3 in the build farm
64 conf.env.BUILD_FARM = Options.options.BUILD_FARM or os.environ.get('RUN_FROM_BUILD_FARM')
66 conf.ADD_EXTRA_INCLUDES('#include/public #source4 #lib #source4/lib #source4/include #include #lib/replace')
68 conf.RECURSE('lib/replace')
70 conf.find_program('python', var='PYTHON', mandatory=True)
71 conf.find_program('perl', var='PERL', mandatory=True)
72 conf.find_program('xsltproc', var='XSLTPROC')
74 # enable tool to build python extensions
75 conf.check_tool('python')
76 conf.check_python_version((2,4,2))
77 conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True)
79 if sys.platform == 'darwin' and not conf.env['HAVE_ENVIRON_DECL']:
80 # Mac OSX needs to have this and it's also needed that the python is compiled with this
81 # otherwise you face errors about common symbols
82 if not conf.CHECK_SHLIB_W_PYTHON("Checking if -fno-common is needed"):
83 conf.ADD_CFLAGS('-fno-common')
84 if not conf.CHECK_SHLIB_W_PYTHON("Checking if -undefined dynamic_lookup is not need"):
85 conf.env.append_value('shlib_LINKFLAGS', ['-undefined', 'dynamic_lookup'])
87 if sys.platform == 'darwin':
88 conf.ADD_LDFLAGS('-framework CoreFoundation')
90 if int(conf.env['PYTHON_VERSION'][0]) >= 3:
91 raise Utils.WafError('Python version 3.x is not supported by Samba yet')
93 conf.RECURSE('dynconfig')
94 conf.RECURSE('lib/ldb')
96 if Options.options.with_system_mitkrb5:
97 conf.PROCESS_SEPARATE_RULE('system_mitkrb5')
98 else:
99 conf.DEFINE('AD_DC_BUILD_IS_ENABLED', 1)
100 # Only process heimdal_build for non-MIT KRB5 builds
101 # When MIT KRB5 checks are done as above, conf.env.KRB5_VENDOR will be set
102 # to the lowcased output of 'krb5-config --vendor'.
103 # If it is not set or the output is 'heimdal', we are dealing with
104 # system-provided or embedded Heimdal build
105 if conf.CONFIG_GET('KRB5_VENDOR') in (None, 'heimdal'):
106 conf.RECURSE('source4/heimdal_build')
107 conf.RECURSE('source4/lib/tls')
108 conf.RECURSE('source4/ntvfs/sysdep')
109 conf.RECURSE('lib/util')
110 conf.RECURSE('lib/ccan')
111 conf.RECURSE('lib/zlib')
112 conf.RECURSE('lib/util/charset')
113 conf.RECURSE('source4/auth')
114 conf.RECURSE('lib/nss_wrapper')
115 conf.RECURSE('nsswitch')
116 conf.RECURSE('lib/socket_wrapper')
117 conf.RECURSE('lib/uid_wrapper')
118 conf.RECURSE('lib/popt')
119 conf.RECURSE('lib/iniparser/src')
120 conf.RECURSE('lib/subunit/c')
121 conf.RECURSE('libcli/smbreadline')
122 conf.RECURSE('lib/crypto')
123 conf.RECURSE('pidl')
124 conf.RECURSE('selftest')
125 conf.RECURSE('source3')
127 conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
129 # gentoo always adds this. We want our normal build to be as
130 # strict as the strictest OS we support, so adding this here
131 # allows us to find problems on our development hosts faster.
132 # It also results in faster load time.
134 if sys.platform != "openbsd4":
135 conf.env.asneeded_ldflags = conf.ADD_LDFLAGS('-Wl,--as-needed', testflags=True)
137 if not conf.CHECK_NEED_LC("-lc not needed"):
138 conf.ADD_LDFLAGS('-lc', testflags=False)
140 # we don't want PYTHONDIR in config.h, as otherwise changing
141 # --prefix causes a complete rebuild
142 del(conf.env.defines['PYTHONDIR'])
143 del(conf.env.defines['PYTHONARCHDIR'])
145 if not conf.CHECK_CODE('#include "tests/summary.c"',
146 define='SUMMARY_PASSES',
147 addmain=False,
148 execute=True,
149 msg='Checking configure summary'):
150 raise Utils.WafError('configure summary failed')
152 conf.SAMBA_CONFIG_H('include/config.h')
155 def etags(ctx):
156 '''build TAGS file using etags'''
157 import Utils
158 source_root = os.path.dirname(Utils.g_module.root_path)
159 cmd = 'etags $(find %s -name "*.[ch]" | egrep -v \.inst\.)' % source_root
160 print("Running: %s" % cmd)
161 os.system(cmd)
163 def ctags(ctx):
164 "build 'tags' file using ctags"
165 import Utils
166 source_root = os.path.dirname(Utils.g_module.root_path)
167 cmd = 'ctags --python-kinds=-i $(find %s -name "*.[ch]" | grep -v "*_proto\.h" | egrep -v \.inst\.) $(find %s -name "*.py")' % (source_root, source_root)
168 print("Running: %s" % cmd)
169 os.system(cmd)
171 # putting this here enabled build in the list
172 # of commands in --help
173 def build(bld):
174 '''build all targets'''
175 samba_version.load_version(env=bld.env, is_install=bld.is_install)
176 pass
179 def pydoctor(ctx):
180 '''build python apidocs'''
181 bp = os.path.abspath('bin/python')
182 mpaths = {}
183 for m in ['talloc', 'tdb', 'ldb']:
184 f = os.popen("PYTHONPATH=%s python -c 'import %s; print %s.__file__'" % (bp, m, m), 'r')
185 try:
186 mpaths[m] = f.read().strip()
187 finally:
188 f.close()
189 cmd='PYTHONPATH=%s pydoctor --introspect-c-modules --project-name=Samba --project-url=http://www.samba.org --make-html --docformat=restructuredtext --add-package bin/python/samba --add-module %s --add-module %s --add-module %s' % (
190 bp, mpaths['tdb'], mpaths['ldb'], mpaths['talloc'])
191 print("Running: %s" % cmd)
192 os.system(cmd)
195 def pep8(ctx):
196 '''run pep8 validator'''
197 cmd='PYTHONPATH=bin/python pep8 -r bin/python/samba'
198 print("Running: %s" % cmd)
199 os.system(cmd)
202 def wafdocs(ctx):
203 '''build wafsamba apidocs'''
204 from samba_utils import recursive_dirlist
205 os.system('pwd')
206 list = recursive_dirlist('../buildtools/wafsamba', '.', pattern='*.py')
208 cmd='PYTHONPATH=bin/python pydoctor --project-name=wafsamba --project-url=http://www.samba.org --make-html --docformat=restructuredtext'
209 print(list)
210 for f in list:
211 cmd += ' --add-module %s' % f
212 print("Running: %s" % cmd)
213 os.system(cmd)
216 def dist():
217 '''makes a tarball for distribution'''
218 samba_version.load_version(env=None)
219 samba_dist.dist()
221 def distcheck():
222 '''test that distribution tarball builds and installs'''
223 samba_version.load_version(env=None)
224 import Scripting
225 d = Scripting.distcheck
226 d(subdir='source4')
228 def wildcard_cmd(cmd):
229 '''called on a unknown command'''
230 from samba_wildcard import run_named_build_task
231 run_named_build_task(cmd)
233 def main():
234 from samba_wildcard import wildcard_main
235 wildcard_main(wildcard_cmd)
236 Scripting.main = main
238 def reconfigure(ctx):
239 '''reconfigure if config scripts have changed'''
240 import samba_utils
241 samba_utils.reconfigure(ctx)