Final part of patchset to fix bug #8556 - ACL permissions ignored when SMBsetatr...
[Samba/gbeck.git] / wscript
blob5ccb74d91dbae36666176f414fd372ff476261b5
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('.')
16 # install in /usr/local/samba by default
17 Options.default_prefix = '/usr/local/samba'
19 def set_options(opt):
20 opt.BUILTIN_DEFAULT('NONE')
21 opt.PRIVATE_EXTENSION_DEFAULT('samba4')
22 opt.RECURSE('lib/replace')
23 opt.RECURSE('dynconfig')
24 opt.RECURSE('lib/ldb')
25 opt.RECURSE('selftest')
26 opt.RECURSE('source4/lib/tls')
27 opt.RECURSE('lib/nss_wrapper')
28 opt.RECURSE('lib/socket_wrapper')
29 opt.RECURSE('lib/uid_wrapper')
30 opt.RECURSE('pidl')
31 opt.RECURSE('source3')
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')
38 opt.tool_options('python') # options for disabling pyc or pyo compilation
39 # enable options related to building python extensions
42 def configure(conf):
43 version = samba_version.load_version(env=conf.env)
45 conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
46 conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
47 conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
49 if Options.options.developer:
50 conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
51 conf.env.DEVELOPER = True
53 # this enables smbtorture.static for s3 in the build farm
54 conf.env.BUILD_FARM = Options.options.BUILD_FARM or os.environ.get('RUN_FROM_BUILD_FARM')
56 conf.ADD_EXTRA_INCLUDES('#include/public #source4 #lib #source4/lib #source4/include #include #lib/replace')
58 conf.RECURSE('lib/replace')
60 conf.find_program('python', var='PYTHON', mandatory=True)
61 conf.find_program('perl', var='PERL', mandatory=True)
62 conf.find_program('xsltproc', var='XSLTPROC')
64 # enable tool to build python extensions
65 conf.check_tool('python')
66 conf.check_python_version((2,4,2))
67 conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True)
69 if sys.platform == 'darwin' and not conf.env['HAVE_ENVIRON_DECL']:
70 # Mac OSX needs to have this and it's also needed that the python is compiled with this
71 # otherwise you face errors about common symbols
72 if not conf.CHECK_SHLIB_W_PYTHON("Checking if -fno-common is needed"):
73 conf.ADD_CFLAGS('-fno-common')
74 if not conf.CHECK_SHLIB_W_PYTHON("Checking if -undefined dynamic_lookup is not need"):
75 conf.env.append_value('shlib_LINKFLAGS', ['-undefined', 'dynamic_lookup'])
77 if sys.platform == 'darwin':
78 conf.ADD_LDFLAGS('-framework CoreFoundation')
80 if int(conf.env['PYTHON_VERSION'][0]) >= 3:
81 raise Utils.WafError('Python version 3.x is not supported by Samba yet')
83 conf.RECURSE('dynconfig')
84 conf.RECURSE('lib/ldb')
85 conf.RECURSE('source4/heimdal_build')
86 conf.RECURSE('source4/lib/tls')
87 conf.RECURSE('source4/ntvfs/sysdep')
88 conf.RECURSE('lib/util')
89 conf.RECURSE('lib/ccan')
90 conf.RECURSE('lib/zlib')
91 conf.RECURSE('lib/util/charset')
92 conf.RECURSE('source4/auth')
93 conf.RECURSE('lib/nss_wrapper')
94 conf.RECURSE('nsswitch')
95 conf.RECURSE('lib/socket_wrapper')
96 conf.RECURSE('lib/uid_wrapper')
97 conf.RECURSE('lib/popt')
98 conf.RECURSE('lib/subunit/c')
99 conf.RECURSE('libcli/smbreadline')
100 conf.RECURSE('pidl')
101 conf.RECURSE('selftest')
102 conf.RECURSE('source3')
104 conf.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
106 # gentoo always adds this. We want our normal build to be as
107 # strict as the strictest OS we support, so adding this here
108 # allows us to find problems on our development hosts faster.
109 # It also results in faster load time.
111 if sys.platform != "openbsd4":
112 conf.env.asneeded_ldflags = conf.ADD_LDFLAGS('-Wl,--as-needed', testflags=True)
114 if not conf.CHECK_NEED_LC("-lc not needed"):
115 conf.ADD_LDFLAGS('-lc', testflags=False)
117 # we don't want PYTHONDIR in config.h, as otherwise changing
118 # --prefix causes a complete rebuild
119 del(conf.env.defines['PYTHONDIR'])
120 del(conf.env.defines['PYTHONARCHDIR'])
122 conf.SAMBA_CONFIG_H('include/config.h')
125 def etags(ctx):
126 '''build TAGS file using etags'''
127 import Utils
128 source_root = os.path.dirname(Utils.g_module.root_path)
129 cmd = 'etags $(find %s -name "*.[ch]" | egrep -v \.inst\.)' % source_root
130 print("Running: %s" % cmd)
131 os.system(cmd)
133 def ctags(ctx):
134 "build 'tags' file using ctags"
135 import Utils
136 source_root = os.path.dirname(Utils.g_module.root_path)
137 cmd = 'ctags --python-kinds=-i $(find %s -name "*.[ch]" | grep -v "*_proto\.h" | egrep -v \.inst\.) $(find %s -name "*.py")' % (source_root, source_root)
138 print("Running: %s" % cmd)
139 os.system(cmd)
141 # putting this here enabled build in the list
142 # of commands in --help
143 def build(bld):
144 '''build all targets'''
145 samba_version.load_version(env=bld.env, is_install=bld.is_install)
146 pass
149 def pydoctor(ctx):
150 '''build python apidocs'''
151 cmd='PYTHONPATH=bin/python pydoctor --project-name=Samba --project-url=http://www.samba.org --make-html --docformat=restructuredtext --add-package bin/python/samba'
152 print("Running: %s" % cmd)
153 os.system(cmd)
155 def wafdocs(ctx):
156 '''build wafsamba apidocs'''
157 from samba_utils import recursive_dirlist
158 os.system('pwd')
159 list = recursive_dirlist('../buildtools/wafsamba', '.', pattern='*.py')
161 cmd='PYTHONPATH=bin/python pydoctor --project-name=wafsamba --project-url=http://www.samba.org --make-html --docformat=restructuredtext'
162 print(list)
163 for f in list:
164 cmd += ' --add-module %s' % f
165 print("Running: %s" % cmd)
166 os.system(cmd)
169 def dist():
170 '''makes a tarball for distribution'''
171 samba_version.load_version(env=None)
172 samba_dist.dist()
174 def distcheck():
175 '''test that distribution tarball builds and installs'''
176 samba_version.load_version(env=None)
177 import Scripting
178 d = Scripting.distcheck
179 d(subdir='source4')
181 def wildcard_cmd(cmd):
182 '''called on a unknown command'''
183 from samba_wildcard import run_named_build_task
184 run_named_build_task(cmd)
186 def main():
187 from samba_wildcard import wildcard_main
188 wildcard_main(wildcard_cmd)
189 Scripting.main = main
191 def reconfigure(ctx):
192 '''reconfigure if config scripts have changed'''
193 import samba_utils
194 samba_utils.reconfigure(ctx)