9 import sys
, os
, tempfile
10 sys
.path
.insert(0, top
+"/buildtools/wafsamba")
12 import wafsamba
, samba_dist
, samba_git
, samba_version
, samba_utils
13 from waflib
import Options
, Scripting
, Logs
, Context
, Errors
14 from waflib
.Tools
import bison
16 samba_dist
.DIST_DIRS('.')
17 samba_dist
.DIST_BLACKLIST('.gitignore .bzrignore source4/selftest/provisions')
19 DEFAULT_PRIVATE_LIBS
= ["ldb"]
21 # install in /usr/local/samba by default
22 default_prefix
= Options
.default_prefix
= '/usr/local/samba'
24 # This callback optionally takes a list of paths as arguments:
25 # --with-system_mitkrb5 /path/to/krb5 /another/path
26 def system_mitkrb5_callback(option
, opt
, value
, parser
):
27 setattr(parser
.values
, option
.dest
, True)
29 for arg
in parser
.rargs
:
30 # stop on --foo like options
31 if arg
[:2] == "--" and len(arg
) > 2:
35 del parser
.rargs
[:len(value
)]
36 setattr(parser
.values
, option
.dest
, value
)
39 opt
.BUILTIN_DEFAULT('NONE')
40 opt
.PRIVATE_EXTENSION_DEFAULT('private-samba')
41 opt
.RECURSE('lib/replace')
42 opt
.RECURSE('dynconfig')
43 opt
.RECURSE('packaging')
44 opt
.RECURSE('lib/ldb')
45 opt
.RECURSE('selftest')
46 opt
.RECURSE('source4/dsdb/samdb/ldb_modules')
48 opt
.RECURSE('source3')
49 opt
.RECURSE('lib/util')
55 # Most of the calls to opt.add_option() use default=True for the --with case
57 # To assist users and distributors to build Samba with the full feature
58 # set, the build system will abort if our dependent libraries and their
59 # header files are not found on the target system. This will mean for
60 # example, that xattr, acl and ldap headers must be installed for the
61 # default build to complete. The configure system will check for these
62 # headers, and the error message will indicate the option (such as
63 # --without-acl-support) that can be specified to skip this requirement.
65 # This will assist users and in particular distributors in building fully
66 # functional packages, while allowing those on systems truly without these
67 # facilities to continue to build Samba after careful consideration.
69 # It also ensures our container image generation in bootstrap/ is correct
70 # as otherwise a missing package there would just silently work
72 opt
.samba_add_onoff_option('pthreadpool', with_name
="enable", without_name
="disable", default
=True)
74 opt
.add_option('--with-system-mitkrb5',
75 help='build Samba with system MIT Kerberos. ' +
76 'You may specify list of paths where Kerberos is installed (e.g. /usr/local /usr/kerberos) to search krb5-config',
77 action
='callback', callback
=system_mitkrb5_callback
, dest
='with_system_mitkrb5', default
=False)
79 opt
.add_option('--with-experimental-mit-ad-dc',
80 help='Enable the experimental MIT Kerberos-backed AD DC. ' +
81 'Note that security patches are not issued for this configuration',
83 dest
='with_experimental_mit_ad_dc',
86 opt
.add_option('--with-system-mitkdc',
87 help=('Specify the path to the krb5kdc binary from MIT Kerberos'),
89 dest
='with_system_mitkdc',
92 opt
.add_option('--with-system-heimdalkrb5',
93 help=('build Samba with system Heimdal Kerberos. ' +
94 'Requires --without-ad-dc' and
95 'conflicts with --with-system-mitkrb5'),
97 dest
='with_system_heimdalkrb5',
100 opt
.add_option('--without-ad-dc',
101 help='disable AD DC functionality (enables only Samba FS (File Server, Winbind, NMBD) and client utilities.',
102 action
='store_true', dest
='without_ad_dc', default
=False)
104 opt
.add_option('--with-pie',
105 help=("Build Position Independent Executables " +
106 "(default if supported by compiler)"),
107 action
="store_true", dest
='enable_pie')
108 opt
.add_option('--without-pie',
109 help=("Disable Position Independent Executable builds"),
110 action
="store_false", dest
='enable_pie')
112 opt
.add_option('--with-relro',
113 help=("Build with full RELocation Read-Only (RELRO)" +
114 "(default if supported by compiler)"),
115 action
="store_true", dest
='enable_relro')
116 opt
.add_option('--without-relro',
117 help=("Disable RELRO builds"),
118 action
="store_false", dest
='enable_relro')
120 opt
.add_option('--with-kernel-keyring',
121 help=('Enable kernely keyring support for credential storage ' +
122 '(default if keyutils libraries are available)'),
123 action
='store_true', dest
='enable_keyring')
124 opt
.add_option('--without-kernel-keyring',
125 help=('Disable kernely keyring support for credential storage'),
126 action
='store_false', dest
='enable_keyring')
128 opt
.samba_add_onoff_option('ldap')
130 opt
.option_group('developer options')
132 opt
.load('python') # options for disabling pyc or pyo compilation
133 # enable options related to building python extensions
135 opt
.add_option('--with-json',
136 action
='store_true', dest
='with_json',
137 help=("Build with JSON support (default=True). This "
138 "requires the jansson development headers."))
139 opt
.add_option('--without-json',
140 action
='store_false', dest
='with_json',
141 help=("Build without JSON support."))
143 opt
.samba_add_onoff_option('smb1-server',
144 dest
='with_smb1server',
145 help=("Build smbd with SMB1 support (default=yes)."))
147 opt
.add_option('--vendor-name',
148 help=('Specify a vendor (or packager) name to include in the version string'),
150 dest
='SAMBA_VERSION_VENDOR_SUFFIX',
153 opt
.add_option('--vendor-patch-revision',
154 help=('Specify a vendor (or packager) patch revision number include in the version string (requires --vendor-name)'),
156 dest
='SAMBA_VERSION_VENDOR_PATCH',
160 if Options
.options
.SAMBA_VERSION_VENDOR_SUFFIX
:
161 conf
.env
.SAMBA_VERSION_VENDOR_SUFFIX
= Options
.options
.SAMBA_VERSION_VENDOR_SUFFIX
163 if Options
.options
.SAMBA_VERSION_VENDOR_PATCH
:
164 if not Options
.options
.SAMBA_VERSION_VENDOR_SUFFIX
:
165 raise conf
.fatal('--vendor-patch-revision requires --vendor-version')
166 conf
.env
.SAMBA_VERSION_VENDOR_PATCH
= Options
.options
.SAMBA_VERSION_VENDOR_PATCH
168 version
= samba_version
.load_version(env
=conf
.env
)
170 conf
.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
171 conf
.DEFINE('_SAMBA_BUILD_', version
.MAJOR
, add_to_cflags
=True)
172 conf
.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags
=True)
174 if Options
.options
.developer
:
175 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
176 conf
.env
.DEVELOPER
= True
177 # if we are in a git tree without a pre-commit hook, install a
179 # we need git for 'waf dist'
181 conf
.find_program('git', var
='GIT')
182 if 'GIT' in conf
.env
:
183 githooksdir
= conf
.CHECK_COMMAND('%s rev-parse --git-path hooks' % conf
.env
.GIT
[0],
184 msg
='Finding githooks directory',
187 if githooksdir
and os
.path
.isdir(githooksdir
):
188 pre_commit_hook
= os
.path
.join(githooksdir
, 'pre-commit')
189 if not os
.path
.exists(pre_commit_hook
):
190 Logs
.info("Installing script/git-hooks/pre-commit-hook as %s" %
192 shutil
.copy(os
.path
.join(Context
.g_module
.top
, 'script/git-hooks/pre-commit-hook'),
195 conf
.ADD_EXTRA_INCLUDES('#include/public #source4 #lib #source4/lib #source4/include #include #lib/replace')
197 conf
.env
.replace_add_global_pthread
= True
198 conf
.RECURSE('lib/replace')
200 conf
.RECURSE('examples/fuse')
201 conf
.RECURSE('examples/winexe')
203 conf
.SAMBA_CHECK_PERL(mandatory
=True)
204 conf
.CHECK_XSLTPROC_MANPAGES()
206 if conf
.env
.disable_python
:
207 if not (Options
.options
.without_ad_dc
):
208 raise Errors
.WafError('--disable-python requires --without-ad-dc')
210 conf
.SAMBA_CHECK_PYTHON()
211 conf
.SAMBA_CHECK_PYTHON_HEADERS()
213 if sys
.platform
== 'darwin' and not conf
.env
['HAVE_ENVIRON_DECL']:
214 # Mac OSX needs to have this and it's also needed that the python is compiled with this
215 # otherwise you face errors about common symbols
216 if not conf
.CHECK_SHLIB_W_PYTHON("Checking if -fno-common is needed"):
217 conf
.ADD_CFLAGS('-fno-common')
218 if not conf
.CHECK_SHLIB_W_PYTHON("Checking if -undefined dynamic_lookup is not need"):
219 conf
.env
.append_value('cshlib_LINKFLAGS', ['-undefined', 'dynamic_lookup'])
221 if sys
.platform
== 'darwin':
222 conf
.ADD_LDFLAGS('-framework CoreFoundation')
224 conf
.RECURSE('dynconfig')
225 conf
.RECURSE('selftest')
227 conf
.PROCESS_SEPARATE_RULE('system_gnutls')
229 conf
.CHECK_CFG(package
='zlib', minversion
='1.2.3',
230 args
='--cflags --libs',
232 conf
.CHECK_FUNCS_IN('inflateInit2', 'z')
234 if Options
.options
.enable_keyring
is not False:
235 conf
.env
['WITH_KERNEL_KEYRING'] = 'auto'
236 if Options
.options
.enable_keyring
is True:
237 conf
.env
['WITH_KERNEL_KEYRING'] = True
239 conf
.env
['WITH_KERNEL_KEYRING'] = False
241 if conf
.CHECK_FOR_THIRD_PARTY():
242 conf
.RECURSE('third_party')
245 if not conf
.CHECK_POPT():
246 raise Errors
.WafError('popt development packages have not been found.\nIf third_party is installed, check that it is in the proper place.')
248 conf
.define('USING_SYSTEM_POPT', 1)
250 if not conf
.CHECK_CMOCKA():
251 raise Errors
.WafError('cmocka development packages has not been found.\nIf third_party is installed, check that it is in the proper place.')
253 conf
.define('USING_SYSTEM_CMOCKA', 1)
255 if conf
.CONFIG_GET('ENABLE_SELFTEST'):
256 if not conf
.CHECK_SOCKET_WRAPPER():
257 raise Errors
.WafError('socket_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.')
259 conf
.define('USING_SYSTEM_SOCKET_WRAPPER', 1)
261 if not conf
.CHECK_NSS_WRAPPER():
262 raise Errors
.WafError('nss_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.')
264 conf
.define('USING_SYSTEM_NSS_WRAPPER', 1)
266 if not conf
.CHECK_RESOLV_WRAPPER():
267 raise Errors
.WafError('resolv_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.')
269 conf
.define('USING_SYSTEM_RESOLV_WRAPPER', 1)
271 if not conf
.CHECK_UID_WRAPPER():
272 raise Errors
.WafError('uid_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.')
274 conf
.define('USING_SYSTEM_UID_WRAPPER', 1)
276 if not conf
.CHECK_PAM_WRAPPER():
277 raise Errors
.WafError('pam_wrapper package has not been found.\nIf third_party is installed, check that it is in the proper place.')
279 conf
.define('USING_SYSTEM_PAM_WRAPPER', 1)
282 if Options
.options
.with_ldap
:
283 conf
.CHECK_HEADERS('ldap.h lber.h ldap_pvt.h')
284 conf
.CHECK_TYPE('ber_tag_t', 'unsigned int', headers
='ldap.h lber.h')
285 conf
.CHECK_FUNCS_IN('ber_scanf ber_sockbuf_add_io', 'lber')
286 conf
.CHECK_VARIABLE('LDAP_OPT_SOCKBUF', headers
='ldap.h')
288 # if we LBER_OPT_LOG_PRINT_FN we can intercept ldap logging and print it out
290 conf
.CHECK_VARIABLE('LBER_OPT_LOG_PRINT_FN',
291 define
='HAVE_LBER_LOG_PRINT_FN', headers
='lber.h')
293 conf
.CHECK_FUNCS_IN('ldap_init ldap_init_fd ldap_initialize ldap_set_rebind_proc', 'ldap')
294 conf
.CHECK_FUNCS_IN('ldap_add_result_entry', 'ldap')
296 # Check if ldap_set_rebind_proc() takes three arguments
297 if conf
.CHECK_CODE('ldap_set_rebind_proc(0, 0, 0)',
298 'LDAP_SET_REBIND_PROC_ARGS',
299 msg
="Checking whether ldap_set_rebind_proc takes 3 arguments",
300 headers
='ldap.h lber.h', link
=False):
301 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '3')
303 conf
.DEFINE('LDAP_SET_REBIND_PROC_ARGS', '2')
305 # last but not least, if ldap_init() exists, we want to use ldap
306 if conf
.CONFIG_SET('HAVE_LDAP_INIT') and conf
.CONFIG_SET('HAVE_LDAP_H'):
307 conf
.DEFINE('HAVE_LDAP', '1')
308 conf
.DEFINE('LDAP_DEPRECATED', '1')
309 conf
.env
['HAVE_LDAP'] = '1'
310 # if ber_sockbuf_add_io() and LDAP_OPT_SOCKBUF are available, we can add
311 # SASL wrapping hooks
312 if conf
.CONFIG_SET('HAVE_BER_SOCKBUF_ADD_IO') and \
313 conf
.CONFIG_SET('HAVE_LDAP_OPT_SOCKBUF'):
314 conf
.DEFINE('HAVE_LDAP_TRANSPORT_WRAPPING', 1)
315 conf
.env
.ENABLE_LDAP_BACKEND
= True
317 conf
.fatal("LDAP support not found. "
318 "Try installing libldap2-dev or openldap-devel. "
319 "Otherwise, use --without-ldap to build without "
321 "LDAP support is required for the LDAP passdb backend, "
322 "LDAP idmap backends and ADS. "
323 "ADS support improves communication with "
324 "Active Directory domain controllers.")
326 conf
.SET_TARGET_TYPE('ldap', 'EMPTY')
327 conf
.SET_TARGET_TYPE('lber', 'EMPTY')
329 conf
.RECURSE('lib/tdb')
330 conf
.RECURSE('lib/tevent')
331 conf
.RECURSE('lib/ldb')
333 if conf
.CHECK_LDFLAGS(['-Wl,--wrap=test']):
334 conf
.env
['HAVE_LDWRAP'] = True
335 conf
.define('HAVE_LDWRAP', 1)
337 if not (Options
.options
.without_ad_dc
):
338 conf
.DEFINE('AD_DC_BUILD_IS_ENABLED', 1)
340 # Check for flex before doing the embedded heimdal checks so we can bail if we don't have it.
341 Logs
.info("Checking for flex")
342 conf
.find_program('flex', var
='FLEX')
344 conf
.CHECK_COMMAND('%s --version' % conf
.env
.FLEX
[0],
345 msg
='Using flex version',
348 conf
.env
.FLEXFLAGS
= ['-t']
350 # #line statements in these generated files cause issues for lcov
351 conf
.env
.FLEXFLAGS
+= ["--noline"]
353 Logs
.info("Checking for bison")
354 bison
.configure(conf
)
355 if conf
.env
['BISON']:
356 conf
.CHECK_COMMAND('%s --version | head -n1' % conf
.env
.BISON
[0],
357 msg
='Using bison version',
361 # #line statements in these generated files cause issues for lcov
362 conf
.env
.BISONFLAGS
+= ["--no-line"]
364 if Options
.options
.with_system_mitkrb5
:
365 if not Options
.options
.with_experimental_mit_ad_dc
and \
366 not Options
.options
.without_ad_dc
:
367 raise Errors
.WafError('The MIT Kerberos build of Samba as an AD DC ' +
368 'is experimental. Therefore '
369 '--with-system-mitkrb5 requires either ' +
370 '--with-experimental-mit-ad-dc or ' +
373 conf
.PROCESS_SEPARATE_RULE('system_mitkrb5')
375 if not (Options
.options
.without_ad_dc
or Options
.options
.with_system_mitkrb5
):
376 conf
.DEFINE('AD_DC_BUILD_IS_ENABLED', 1)
378 if Options
.options
.with_system_heimdalkrb5
:
379 if Options
.options
.with_system_mitkrb5
:
380 raise Errors
.WafError('--with-system-heimdalkrb5 conflicts with ' +
381 '--with-system-mitkrb5')
382 if not Options
.options
.without_ad_dc
:
383 raise Errors
.WafError('--with-system-heimdalkrb5 requires ' +
385 conf
.env
.SYSTEM_LIBS
+= ('heimdal', 'asn1', 'com_err', 'roken',
386 'hx509', 'wind', 'gssapi', 'hcrypto',
387 'krb5', 'heimbase', 'asn1_compile',
388 'compile_et', 'kdc', 'hdb', 'heimntlm')
389 conf
.PROCESS_SEPARATE_RULE('system_heimdal')
391 if not conf
.CONFIG_GET('KRB5_VENDOR'):
392 conf
.PROCESS_SEPARATE_RULE('embedded_heimdal')
394 conf
.RECURSE('source4/dsdb/samdb/ldb_modules')
395 conf
.RECURSE('source4/ntvfs/sysdep')
396 conf
.RECURSE('lib/util')
397 conf
.RECURSE('lib/util/charset')
398 conf
.RECURSE('source4/auth')
399 conf
.RECURSE('nsswitch')
400 conf
.RECURSE('libcli/smbreadline')
402 if conf
.CONFIG_GET('ENABLE_SELFTEST'):
403 if not (Options
.options
.without_ad_dc
):
404 conf
.DEFINE('WITH_NTVFS_FILESERVER', 1)
405 conf
.RECURSE('testsuite/unittests')
407 if Options
.options
.with_pthreadpool
:
408 if conf
.CONFIG_SET('HAVE_PTHREAD'):
409 conf
.DEFINE('WITH_PTHREADPOOL', '1')
411 Logs
.warn("pthreadpool support cannot be enabled when pthread support was not found")
412 conf
.undefine('WITH_PTHREADPOOL')
414 conf
.SET_TARGET_TYPE('jansson', 'EMPTY')
416 if Options
.options
.with_json
is not False:
417 if conf
.CHECK_CFG(package
='jansson', args
='--cflags --libs',
418 msg
='Checking for jansson'):
419 conf
.CHECK_FUNCS_IN('json_object', 'jansson')
421 if not conf
.CONFIG_GET('HAVE_JSON_OBJECT'):
422 if Options
.options
.with_json
is not False:
423 conf
.fatal("Jansson JSON support not found. "
424 "Try installing libjansson-dev or jansson-devel. "
425 "Otherwise, use --without-json to build without "
427 "JSON support is required for the JSON "
428 "formatted audit log feature, the AD DC, and "
429 "the JSON printers of the net utility")
430 if not Options
.options
.without_ad_dc
:
431 raise Errors
.WafError('--without-json requires --without-ad-dc. '
432 'Jansson JSON library is required for '
433 'building the AD DC')
434 Logs
.info("Building without Jansson JSON log support")
436 conf
.RECURSE('source3')
437 conf
.RECURSE('lib/texpect')
438 conf
.RECURSE('lib/tsocket')
439 conf
.RECURSE('python')
440 if conf
.env
.with_ctdb
:
442 conf
.RECURSE('lib/socket')
443 conf
.RECURSE('lib/mscat')
444 conf
.RECURSE('packaging')
445 conf
.RECURSE('lib/krb5_wrap')
447 conf
.SAMBA_CHECK_UNDEFINED_SYMBOL_FLAGS()
449 # gentoo always adds this. We want our normal build to be as
450 # strict as the strictest OS we support, so adding this here
451 # allows us to find problems on our development hosts faster.
452 # It also results in faster load time.
454 if (not Options
.options
.address_sanitizer
455 and conf
.CHECK_LDFLAGS('-Wl,--as-needed')):
456 conf
.env
.append_unique('LINKFLAGS', '-Wl,--as-needed')
458 if not conf
.CHECK_NEED_LC("-lc not needed"):
459 conf
.ADD_LDFLAGS('-lc', testflags
=False)
461 if not conf
.CHECK_CODE('#include "tests/summary.c"',
462 define
='SUMMARY_PASSES',
464 msg
='Checking configure summary'):
465 raise Errors
.WafError('configure summary failed')
467 if Options
.options
.enable_pie
is not False:
468 if Options
.options
.enable_pie
is True:
471 # not specified, only build PIEs if supported by compiler
473 if conf
.check_cc(cflags
='-fPIE', ldflags
='-pie', mandatory
=need_pie
,
474 msg
="Checking compiler for PIE support"):
475 conf
.env
['ENABLE_PIE'] = True
477 if Options
.options
.enable_relro
is not False:
478 if Options
.options
.enable_relro
is True:
481 # not specified, only build RELROs if supported by compiler
483 if conf
.check_cc(cflags
='', ldflags
='-Wl,-z,relro,-z,now', mandatory
=need_relro
,
484 msg
="Checking compiler for full RELRO support"):
485 conf
.env
['ENABLE_RELRO'] = True
487 if conf
.CONFIG_GET('ENABLE_SELFTEST') and \
488 Options
.options
.with_smb1server
is False and \
489 Options
.options
.without_ad_dc
is not True:
490 conf
.fatal('--without-smb1-server cannot be specified with '
491 '--enable-selftest/--enable-developer if '
492 '--without-ad-dc is NOT set!')
494 if Options
.options
.with_smb1server
is not False:
495 conf
.DEFINE('WITH_SMB1SERVER', '1')
498 # FreeBSD is broken. It doesn't include 'extern char **environ'
499 # in any shared library, but statically inside crt0.o.
501 # If we're running on a FreeBSD with the GNU linker ld we
502 # can get around this by explicitly telling the linker to
503 # ignore 'environ' as an unresolved symbol in a shared library.
505 # However, the clang linker ld.lld-XX is broken in that it
506 # doesn't have that option.
508 # First try to see if have '-Wl,--ignore-unresolved-symbol,environ'
509 # and just use that if so.
511 # If not, we have to use '-Wl,--allow-shlib-undefined' instead
512 # and remove all instances of '-Wl,-no-undefined'.
514 if sys
.platform
.startswith('freebsd'):
515 # Do we have Wl,--ignore-unresolved-symbol,environ ?
516 flag_added
= conf
.ADD_LDFLAGS('-Wl,--ignore-unresolved-symbol,environ', testflags
=True)
518 # No, fall back to -Wl,--allow-shlib-undefined.
519 conf
.ADD_LDFLAGS('-Wl,--allow-shlib-undefined', testflags
=True)
520 # Remove any uses of '-Wl,-no-undefined'
521 conf
.env
['EXTRA_LDFLAGS'] = list(filter(('-Wl,-no-undefined').__ne
__, conf
.env
['EXTRA_LDFLAGS']))
522 # And make sure we don't try and remove it again when 'allow_undefined_symbols=true'
523 conf
.env
.undefined_ldflags
= []
525 conf
.SAMBA_CONFIG_H('include/config.h')
528 '''build TAGS file using etags'''
529 source_root
= os
.path
.dirname(Context
.g_module
.root_path
)
530 cmd
= r
'rm -f %s/TAGS && (find %s -name "*.[ch]" | egrep -v \.inst\. | xargs -n 100 etags -a)' % (source_root
, source_root
)
531 print("Running: %s" % cmd
)
532 status
= os
.system(cmd
)
533 if os
.WEXITSTATUS(status
):
534 raise Errors
.WafError('etags failed')
537 "build 'tags' file using ctags"
538 source_root
= os
.path
.dirname(Context
.g_module
.root_path
)
539 cmd
= r
'ctags --python-kinds=-i $(find %s -name "*.[ch]" | grep -v "*_proto\.h" | egrep -v \.inst\.) $(find %s -name "*.py")' % (source_root
, source_root
)
540 print("Running: %s" % cmd
)
541 status
= os
.system(cmd
)
542 if os
.WEXITSTATUS(status
):
543 raise Errors
.WafError('ctags failed')
546 # putting this here enabled build in the list
547 # of commands in --help
549 '''build all targets'''
550 samba_version
.load_version(env
=bld
.env
, is_install
=bld
.is_install
)
554 '''run pep8 validator'''
555 cmd
='PYTHONPATH=bin/python pep8 -r bin/python/samba'
556 print("Running: %s" % cmd
)
557 status
= os
.system(cmd
)
558 if os
.WEXITSTATUS(status
):
559 raise Errors
.WafError('pep8 failed')
563 '''makes a tarball for distribution'''
564 sambaversion
= samba_version
.load_version(env
=None)
566 os
.system("make -C ctdb manpages")
567 samba_dist
.DIST_FILES('ctdb/doc:ctdb/doc', extend
=True)
569 os
.system("DOC_VERSION='" + sambaversion
.STRING
+ "' " + Context
.g_module
.top
+ "/release-scripts/build-manpages-nogit")
570 samba_dist
.DIST_FILES('bin/docs:docs', extend
=True)
572 if sambaversion
.IS_SNAPSHOT
:
573 # write .distversion file and add to tar
574 if not os
.path
.isdir(Context
.g_module
.out
):
575 os
.makedirs(Context
.g_module
.out
)
576 distversionf
= tempfile
.NamedTemporaryFile(mode
='w', prefix
='.distversion',dir=Context
.g_module
.out
)
577 for field
in sambaversion
.vcs_fields
:
578 distveroption
= field
+ '=' + str(sambaversion
.vcs_fields
[field
])
579 distversionf
.write(distveroption
+ '\n')
581 samba_dist
.DIST_FILES('%s:.distversion' % distversionf
.name
, extend
=True)
590 '''test that distribution tarball builds and installs'''
591 samba_version
.load_version(env
=None)
593 def printversion(ctx
):
595 ver
= samba_version
.load_version(env
=None)
596 print('Samba Version: ' + ver
.STRING_WITH_NICKNAME
)
598 def wildcard_cmd(cmd
):
599 '''called on a unknown command'''
600 from samba_wildcard
import run_named_build_task
601 run_named_build_task(cmd
)
604 from samba_wildcard
import wildcard_main
606 wildcard_main(wildcard_cmd
)
607 Scripting
.main
= main
609 def reconfigure(ctx
):
610 '''reconfigure if config scripts have changed'''
611 samba_utils
.reconfigure(ctx
)
614 if os
.path
.isdir(os
.path
.join(top
, ".git")):
615 # Check if there are submodules that are checked out but out of date.
616 for submodule
, status
in samba_git
.read_submodule_status(top
):
617 if status
== "out-of-date":
618 raise Errors
.WafError("some submodules are out of date. Please run 'git submodule update'")