2010-03-17 21:46:38 +11:00
#! /usr/bin/env python
2010-03-17 20:26:03 +11:00
srcdir = '..'
blddir = 'bin'
2010-04-04 09:57:33 +10:00
APPNAME='samba'
2010-03-18 13:17:43 +11:00
import sys, os
2010-02-26 22:21:50 +11:00
sys.path.insert(0, srcdir+"/buildtools/wafsamba")
2010-05-04 10:08:43 +02:00
import wafsamba, Options, samba_dist, Scripting
2010-03-17 20:26:03 +11:00
2010-05-28 15:20:03 +10:00
version = wafsamba.samba_version_file("./VERSION")
VERSION=version.STRING
2010-04-04 11:00:42 +10:00
samba_dist.DIST_DIRS('.')
2010-05-28 18:50:25 +10:00
#This is a list of files that we don't want in the package, for
#whatever reason. Directories should be listed with a trailing / to
#avoid over-exclusion.
2010-05-28 18:54:57 +10:00
#This list includes files that would confuse the recipient of a
#samba-4.0.0 branded tarball (until the merge is complete) and the
#core elements of the autotools build system (which is known to
#produce buggy binaries).
2010-05-28 18:50:25 +10:00
samba_dist.DIST_BLACKLIST('README Manifest Read-Manifest-Now Roadmap source3/ ' +
2010-05-28 18:54:57 +10:00
'packaging/ docs-xml/ examples/ swat/ WHATSNEW.txt MAINTAINERS ' +
'source4/autogen-autotools.sh source4/Makefile.in source4/configure.ac')
2010-03-29 22:05:54 +11:00
# install in /usr/local/samba by default
Options.default_prefix = '/usr/local/samba'
2010-03-17 20:26:03 +11:00
def set_options(opt):
2010-06-18 22:43:37 +02:00
opt.BUILTIN_DEFAULT('replace')
2010-03-28 17:46:59 +11:00
opt.BUNDLED_EXTENSION_DEFAULT('samba4')
2010-04-04 13:08:05 +10:00
opt.RECURSE('../lib/replace')
opt.RECURSE('dynconfig')
opt.RECURSE('scripting/python')
opt.RECURSE('lib/ldb')
opt.RECURSE('selftest')
opt.RECURSE('lib/tls')
opt.RECURSE('../lib/nss_wrapper')
opt.RECURSE('../lib/socket_wrapper')
opt.RECURSE('../lib/uid_wrapper')
opt.RECURSE('../pidl')
2010-03-17 20:38:03 +11:00
2010-04-29 07:47:57 +10:00
gr = opt.option_group('developer options')
gr.add_option('--enable-build-farm',
help='enable special build farm options',
action='store_true', dest='BUILD_FARM')
2010-03-17 20:26:03 +11:00
def configure(conf):
2010-03-28 14:10:15 +11:00
conf.DEFINE('PACKAGE_NAME', 'samba', quote=True)
2010-05-28 15:20:03 +10:00
conf.DEFINE('PACKAGE_STRING', 'Samba ' + version.STRING, quote=True)
2010-03-28 14:10:15 +11:00
conf.DEFINE('PACKAGE_TARNAME', 'samba', quote=True)
conf.DEFINE('PACKAGE_URL', "http://www.samba.org/", quote=True)
2010-05-28 15:20:03 +10:00
conf.DEFINE('PACKAGE_VERSION', version.STRING, quote=True)
2010-03-28 14:10:15 +11:00
conf.DEFINE('PACKAGE_BUGREPORT', 'http://bugzilla.samba.org/', quote=True)
2010-03-08 00:25:22 +11:00
2010-03-20 16:27:48 +11:00
conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
2010-05-28 15:20:03 +10:00
conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
2010-03-20 16:27:48 +11:00
conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
2010-03-28 14:10:15 +11:00
2010-03-20 16:27:48 +11:00
if Options.options.developer:
conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
2010-04-29 07:47:57 +10:00
# this enables smbtorture.static for s3 in the build farm
conf.env.BUILD_FARM = Options.options.BUILD_FARM or os.environ.get('RUN_FROM_BUILD_FARM')
2010-03-20 16:27:48 +11:00
# set a lower limit on recursing in waf preprocessor
conf.env.preprocessor_recursion_limit = 10
2010-03-28 14:16:12 +11:00
conf.ADD_EXTRA_INCLUDES('#source4 #lib #source4/lib #source4/include')
2010-03-20 16:27:48 +11:00
2010-04-04 13:08:05 +10:00
conf.RECURSE('../lib/replace')
2010-03-20 16:27:48 +11:00
2010-03-17 21:46:38 +11:00
conf.find_program('python', var='PYTHON', mandatory=True)
2010-03-17 21:53:29 +11:00
conf.find_program('perl', var='PERL', mandatory=True)
2010-05-31 01:25:56 +02:00
conf.find_program('xsltproc', var='XSLTPROC')
2010-03-20 16:27:48 +11:00
# enable tool to build python extensions
conf.check_tool('python')
conf.check_python_version((2,4,2))
2010-04-21 16:21:30 +10:00
conf.check_python_headers(mandatory=True)
2010-03-20 16:27:48 +11:00
2010-04-04 13:08:05 +10:00
conf.RECURSE('dynconfig')
conf.RECURSE('scripting/python')
conf.RECURSE('lib/ldb')
conf.RECURSE('heimdal_build')
conf.RECURSE('lib/tls')
conf.RECURSE('ntvfs/sysdep')
conf.RECURSE('../lib/util')
conf.RECURSE('../lib/zlib')
conf.RECURSE('../lib/util/charset')
conf.RECURSE('auth')
conf.RECURSE('../lib/nss_wrapper')
conf.RECURSE('../nsswitch')
conf.RECURSE('../lib/socket_wrapper')
conf.RECURSE('../lib/uid_wrapper')
conf.RECURSE('../lib/popt')
conf.RECURSE('lib/smbreadline')
conf.RECURSE('../pidl')
2010-04-15 08:28:20 +02:00
conf.RECURSE('selftest')
2010-03-17 20:26:03 +11:00
2010-03-31 18:05:57 +11:00
# we don't want PYTHONDIR in config.h, as otherwise changing
# --prefix causes a complete rebuild
del(conf.env.defines['PYTHONDIR'])
2010-02-23 08:09:46 +11:00
conf.SAMBA_CONFIG_H('include/config.h')
2010-03-17 10:58:07 +11:00
2010-03-18 13:17:43 +11:00
def etags(ctx):
'''build TAGS file using etags'''
import Utils
source_root = os.path.dirname(Utils.g_module.root_path)
cmd = 'etags $(find %s/.. -name "*.[ch]")' % source_root
2010-04-08 07:45:46 +10:00
print("Running: %s" % cmd)
2010-03-18 13:17:43 +11:00
os.system(cmd)
2010-03-19 10:10:36 +01:00
def ctags(ctx):
2010-03-19 20:30:14 +11:00
"build 'tags' file using ctags"
2010-03-19 10:10:36 +01:00
import Utils
source_root = os.path.dirname(Utils.g_module.root_path)
cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h")' % source_root
2010-04-08 07:45:46 +10:00
print("Running: %s" % cmd)
2010-03-19 10:10:36 +01:00
os.system(cmd)
2010-03-19 09:10:59 +11:00
# putting this here enabled build in the list
# of commands in --help
def build(bld):
'''build all targets'''
pass
2010-03-29 17:12:04 +11:00
def pydoctor(ctx):
'''build python apidocs'''
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'
2010-04-08 07:45:46 +10:00
print("Running: %s" % cmd)
2010-03-29 17:12:04 +11:00
os.system(cmd)
def wafdocs(ctx):
'''build wafsamba apidocs'''
from samba_utils import recursive_dirlist
os.system('pwd')
list = recursive_dirlist('../buildtools/wafsamba', '.', pattern='*.py')
cmd='LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --project-name=wafsamba --project-url=http://www.samba.org --make-html --docformat=restructuredtext'
2010-04-08 07:45:46 +10:00
print(list)
2010-03-29 17:12:04 +11:00
for f in list:
cmd += ' --add-module %s' % f
2010-04-08 07:45:46 +10:00
print("Running: %s" % cmd)
2010-03-29 17:12:04 +11:00
os.system(cmd)
2010-04-04 09:57:33 +10:00
def dist():
'''makes a tarball for distribution'''
samba_dist.dist()
2010-04-05 11:26:24 +10:00
def distcheck():
'''test that distribution tarball builds and installs'''
import Scripting
d = Scripting.distcheck
d(subdir='source4')
2010-05-04 10:08:43 +02:00
def wildcard_cmd(cmd):
'''called on a unknown command'''
from samba_wildcard import run_named_build_task
run_named_build_task(cmd)
def main():
from samba_wildcard import wildcard_main
wildcard_main(wildcard_cmd)
Scripting.main = main
2010-04-05 11:26:24 +10:00
2010-05-06 14:51:28 +02:00
def reconfigure(ctx):
'''reconfigure if config scripts have changed'''
import samba_utils
samba_utils.reconfigure(ctx)