2010-03-17 13:46:38 +03:00
#! /usr/bin/env python
2010-03-17 12:26:03 +03:00
srcdir = '..'
blddir = 'bin'
2010-04-04 03:57:33 +04:00
APPNAME='samba'
2010-06-28 07:40:32 +04:00
VERSION=None
2010-04-04 03:57:33 +04:00
2010-03-18 05:17:43 +03:00
import sys, os
2010-02-26 14:21:50 +03:00
sys.path.insert(0, srcdir+"/buildtools/wafsamba")
2010-12-08 03:25:28 +03:00
import wafsamba, Options, samba_dist, Scripting, Utils, samba_version
2010-06-28 07:40:32 +04:00
2010-05-28 09:20:03 +04:00
2010-04-04 05:00:42 +04:00
samba_dist.DIST_DIRS('.')
2010-05-28 12:50:25 +04: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 12:54:57 +04: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 12:50:25 +04:00
samba_dist.DIST_BLACKLIST('README Manifest Read-Manifest-Now Roadmap source3/ ' +
2010-12-10 00:46:08 +03:00
'packaging/ docs-xml/ examples/ swat/ WHATSNEW.txt MAINTAINERS ')
2010-03-29 15:05:54 +04:00
# install in /usr/local/samba by default
Options.default_prefix = '/usr/local/samba'
2010-03-17 12:26:03 +03:00
def set_options(opt):
2010-10-30 07:16:07 +04:00
opt.BUILTIN_DEFAULT('NONE')
2010-10-24 01:26:43 +04:00
opt.PRIVATE_EXTENSION_DEFAULT('samba4')
2010-04-04 07:08:05 +04:00
opt.RECURSE('../lib/replace')
opt.RECURSE('dynconfig')
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 12:38:03 +03:00
2010-04-29 01:47:57 +04: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-12-09 00:38:12 +03:00
opt.tool_options('python') # options for disabling pyc or pyo compilation
# enable options related to building python extensions
2010-04-29 01:47:57 +04:00
2010-03-17 12:26:03 +03:00
def configure(conf):
2010-12-08 03:25:28 +03:00
version = samba_version.load_version(env=conf.env)
2010-06-28 07:40:32 +04:00
2010-03-20 08:27:48 +03:00
conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
2010-05-28 09:20:03 +04:00
conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
2010-03-20 08:27:48 +03:00
conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
2010-03-28 07:10:15 +04:00
2010-03-20 08:27:48 +03:00
if Options.options.developer:
conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
2010-04-29 01:47:57 +04: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-28 07:16:12 +04:00
conf.ADD_EXTRA_INCLUDES('#source4 #lib #source4/lib #source4/include')
2010-03-20 08:27:48 +03:00
2010-04-04 07:08:05 +04:00
conf.RECURSE('../lib/replace')
2010-03-20 08:27:48 +03:00
2010-03-17 13:46:38 +03:00
conf.find_program('python', var='PYTHON', mandatory=True)
2010-03-17 13:53:29 +03:00
conf.find_program('perl', var='PERL', mandatory=True)
2010-05-31 03:25:56 +04:00
conf.find_program('xsltproc', var='XSLTPROC')
2010-03-20 08:27:48 +03:00
# enable tool to build python extensions
conf.check_tool('python')
conf.check_python_version((2,4,2))
2010-12-10 01:42:32 +03:00
conf.SAMBA_CHECK_PYTHON_HEADERS(mandatory=True)
2010-03-20 08:27:48 +03:00
2010-10-30 20:22:22 +04:00
if sys.platform == 'darwin' and not conf.env['HAVE_ENVIRON_DECL']:
2010-11-27 17:11:35 +03:00
# Mac OSX needs to have this and it's also needed that the python is compiled with this
# otherwise you face errors about common symbols
if not conf.CHECK_SHLIB_W_PYTHON("Checking if -fno-common is needed"):
conf.ADD_CFLAGS('-fno-common')
2010-10-30 16:50:33 +04:00
if not conf.CHECK_SHLIB_W_PYTHON("Checking if -undefined dynamic_lookup is not need"):
conf.env.append_value('shlib_LINKFLAGS', ['-undefined', 'dynamic_lookup'])
2010-10-12 06:05:36 +04:00
if int(conf.env['PYTHON_VERSION'][0]) >= 3:
raise Utils.WafError('Python version 3.x is not supported by Samba yet')
2010-04-04 07:08:05 +04:00
conf.RECURSE('dynconfig')
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')
2010-09-23 07:18:45 +04:00
conf.RECURSE('../lib/subunit/c')
2010-10-01 12:34:14 +04:00
conf.RECURSE('../libcli/smbreadline')
2010-04-04 07:08:05 +04:00
conf.RECURSE('../pidl')
2010-04-15 10:28:20 +04:00
conf.RECURSE('selftest')
2010-03-17 12:26:03 +03:00
2010-10-25 04:29:12 +04:00
# we don't want any libraries or modules to rely on runtime
# resolution of symbols
2010-12-13 00:55:08 +03:00
if sys.platform != "openbsd4":
conf.ADD_LDFLAGS('-Wl,-no-undefined', testflags=True)
2010-10-25 04:29:12 +04:00
2010-11-03 02:50:16 +03:00
# gentoo always adds this. We want our normal build to be as
# strict as the strictest OS we support, so adding this here
# allows us to find problems on our development hosts faster.
# It also results in faster load time.
2010-12-13 00:55:08 +03:00
if sys.platform != "openbsd4":
conf.ADD_LDFLAGS('-Wl,--as-needed', testflags=True)
2010-12-10 23:16:28 +03:00
if not conf.CHECK_NEED_LC("-lc not needed"):
conf.ADD_LDFLAGS('-lc', testflags=False)
2010-11-03 02:50:16 +03:00
2010-03-31 11:05:57 +04: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 00:09:46 +03:00
conf.SAMBA_CONFIG_H('include/config.h')
2010-03-17 02:58:07 +03:00
2010-03-18 05:17:43 +03:00
def etags(ctx):
'''build TAGS file using etags'''
import Utils
source_root = os.path.dirname(Utils.g_module.root_path)
2010-11-05 01:01:47 +03:00
cmd = 'etags $(find %s/.. -name "*.[ch]" | egrep -v \.inst\.)' % source_root
2010-04-08 01:45:46 +04:00
print("Running: %s" % cmd)
2010-03-18 05:17:43 +03:00
os.system(cmd)
2010-03-19 12:10:36 +03:00
def ctags(ctx):
2010-03-19 12:30:14 +03:00
"build 'tags' file using ctags"
2010-03-19 12:10:36 +03:00
import Utils
source_root = os.path.dirname(Utils.g_module.root_path)
2010-11-05 01:01:47 +03:00
cmd = 'ctags $(find %s/.. -name "*.[ch]" | grep -v "*_proto\.h" | egrep -v \.inst\.)' % source_root
2010-04-08 01:45:46 +04:00
print("Running: %s" % cmd)
2010-03-19 12:10:36 +03:00
os.system(cmd)
2010-03-19 01:10:59 +03:00
# putting this here enabled build in the list
# of commands in --help
def build(bld):
'''build all targets'''
2010-12-08 03:25:28 +03:00
samba_version.load_version(env=bld.env)
2010-03-19 01:10:59 +03:00
pass
2010-03-29 10:12:04 +04:00
def pydoctor(ctx):
'''build python apidocs'''
2010-11-05 04:30:01 +03:00
cmd='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 01:45:46 +04:00
print("Running: %s" % cmd)
2010-03-29 10:12:04 +04: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')
2010-11-05 04:30:01 +03:00
cmd='PYTHONPATH=bin/python pydoctor --project-name=wafsamba --project-url=http://www.samba.org --make-html --docformat=restructuredtext'
2010-04-08 01:45:46 +04:00
print(list)
2010-03-29 10:12:04 +04:00
for f in list:
cmd += ' --add-module %s' % f
2010-04-08 01:45:46 +04:00
print("Running: %s" % cmd)
2010-03-29 10:12:04 +04:00
os.system(cmd)
2010-04-04 03:57:33 +04:00
def dist():
'''makes a tarball for distribution'''
2010-12-08 03:25:28 +03:00
samba_version.load_version(env=None)
2010-04-04 03:57:33 +04:00
samba_dist.dist()
2010-04-05 05:26:24 +04:00
def distcheck():
'''test that distribution tarball builds and installs'''
2010-12-08 03:25:28 +03:00
samba_version.load_version(env=None)
2010-04-05 05:26:24 +04:00
import Scripting
d = Scripting.distcheck
d(subdir='source4')
2010-05-04 12:08:43 +04: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 05:26:24 +04:00
2010-05-06 16:51:28 +04:00
def reconfigure(ctx):
'''reconfigure if config scripts have changed'''
import samba_utils
samba_utils.reconfigure(ctx)