10 sys
.path
.insert(0, srcdir
+"/buildtools/wafsamba")
11 import wafsamba
, Options
, samba_dist
, Scripting
, Utils
, samba_version
14 samba_dist
.DIST_DIRS('.')
16 #This is a list of files that we don't want in the package, for
17 #whatever reason. Directories should be listed with a trailing / to
18 #avoid over-exclusion.
20 #This list includes files that would confuse the recipient of a
21 #samba-4.0.0 branded tarball (until the merge is complete) and the
22 #core elements of the autotools build system (which is known to
23 #produce buggy binaries).
24 samba_dist
.DIST_BLACKLIST('README Manifest Read-Manifest-Now Roadmap source3/ ' +
25 'packaging/ docs-xml/ examples/ swat/ WHATSNEW.txt MAINTAINERS ')
26 # install in /usr/local/samba by default
27 Options
.default_prefix
= '/usr/local/samba'
31 os
.putenv('TOPLEVEL_BUILD', '1')
33 opt
.BUILTIN_DEFAULT('NONE')
34 opt
.PRIVATE_EXTENSION_DEFAULT('samba4')
35 opt
.RECURSE('lib/replace')
36 opt
.RECURSE('source4/dynconfig')
37 opt
.RECURSE('source4/lib/ldb')
38 opt
.RECURSE('source4/selftest')
39 opt
.RECURSE('source4/lib/tls')
40 opt
.RECURSE('lib/nss_wrapper')
41 opt
.RECURSE('lib/socket_wrapper')
42 opt
.RECURSE('lib/uid_wrapper')
44 opt
.RECURSE('source3')
46 gr
= opt
.option_group('developer options')
47 gr
.add_option('--enable-build-farm',
48 help='enable special build farm options',
49 action
='store_true', dest
='BUILD_FARM')
51 opt
.tool_options('python') # options for disabling pyc or pyo compilation
52 # enable options related to building python extensions
56 conf
.env
.toplevel_build
= True
57 version
= samba_version
.load_version(env
=conf
.env
)
59 conf
.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
60 conf
.DEFINE('_SAMBA_BUILD_', version
.MAJOR
, add_to_cflags
=True)
61 conf
.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags
=True)
63 if Options
.options
.developer
:
64 conf
.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
66 # this enables smbtorture.static for s3 in the build farm
67 conf
.env
.BUILD_FARM
= Options
.options
.BUILD_FARM
or os
.environ
.get('RUN_FROM_BUILD_FARM')
69 conf
.ADD_EXTRA_INCLUDES('#source4 #lib #source4/lib #source4/include #include')
71 conf
.RECURSE('lib/replace')
73 conf
.find_program('python', var
='PYTHON', mandatory
=True)
74 conf
.find_program('perl', var
='PERL', mandatory
=True)
75 conf
.find_program('xsltproc', var
='XSLTPROC')
77 # enable tool to build python extensions
78 conf
.check_tool('python')
79 conf
.check_python_version((2,4,2))
80 conf
.SAMBA_CHECK_PYTHON_HEADERS(mandatory
=True)
82 if sys
.platform
== 'darwin' and not conf
.env
['HAVE_ENVIRON_DECL']:
83 # Mac OSX needs to have this and it's also needed that the python is compiled with this
84 # otherwise you face errors about common symbols
85 if not conf
.CHECK_SHLIB_W_PYTHON("Checking if -fno-common is needed"):
86 conf
.ADD_CFLAGS('-fno-common')
87 if not conf
.CHECK_SHLIB_W_PYTHON("Checking if -undefined dynamic_lookup is not need"):
88 conf
.env
.append_value('shlib_LINKFLAGS', ['-undefined', 'dynamic_lookup'])
89 if int(conf
.env
['PYTHON_VERSION'][0]) >= 3:
90 raise Utils
.WafError('Python version 3.x is not supported by Samba yet')
92 conf
.RECURSE('source4/dynconfig')
93 conf
.RECURSE('source4/lib/ldb')
94 conf
.RECURSE('source4/heimdal_build')
95 conf
.RECURSE('source4/lib/tls')
96 conf
.RECURSE('source4/ntvfs/sysdep')
97 conf
.RECURSE('lib/util')
98 conf
.RECURSE('lib/zlib')
99 conf
.RECURSE('lib/util/charset')
100 conf
.RECURSE('source4/auth')
101 conf
.RECURSE('lib/nss_wrapper')
102 conf
.RECURSE('nsswitch')
103 conf
.RECURSE('lib/socket_wrapper')
104 conf
.RECURSE('lib/uid_wrapper')
105 conf
.RECURSE('lib/popt')
106 conf
.RECURSE('lib/subunit/c')
107 conf
.RECURSE('libcli/smbreadline')
109 conf
.RECURSE('source4/selftest')
110 conf
.RECURSE('source3')
112 # we don't want any libraries or modules to rely on runtime
113 # resolution of symbols
114 if sys
.platform
!= "openbsd4":
115 conf
.env
.undefined_ldflags
= conf
.ADD_LDFLAGS('-Wl,-no-undefined', testflags
=True)
117 # gentoo always adds this. We want our normal build to be as
118 # strict as the strictest OS we support, so adding this here
119 # allows us to find problems on our development hosts faster.
120 # It also results in faster load time.
121 if sys
.platform
!= "openbsd4":
122 conf
.env
.asneeded_ldflags
= conf
.ADD_LDFLAGS('-Wl,--as-needed', testflags
=True)
124 if not conf
.CHECK_NEED_LC("-lc not needed"):
125 conf
.ADD_LDFLAGS('-lc', testflags
=False)
127 # we don't want PYTHONDIR in config.h, as otherwise changing
128 # --prefix causes a complete rebuild
129 del(conf
.env
.defines
['PYTHONDIR'])
130 del(conf
.env
.defines
['PYTHONARCHDIR'])
132 conf
.SAMBA_CONFIG_H('include/config.h')
136 '''build TAGS file using etags'''
138 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
139 cmd
= 'etags $(find %s -name "*.[ch]" | egrep -v \.inst\.)' % source_root
140 print("Running: %s" % cmd
)
144 "build 'tags' file using ctags"
146 source_root
= os
.path
.dirname(Utils
.g_module
.root_path
)
147 cmd
= 'ctags $(find %s -name "*.[ch]" | grep -v "*_proto\.h" | egrep -v \.inst\.)' % source_root
148 print("Running: %s" % cmd
)
151 # putting this here enabled build in the list
152 # of commands in --help
154 '''build all targets'''
155 samba_version
.load_version(env
=bld
.env
)
160 '''build python apidocs'''
161 cmd
='PYTHONPATH=bin/python pydoctor --project-name=Samba --project-url=http://www.samba.org --make-html --docformat=restructuredtext --add-package bin/python/samba'
162 print("Running: %s" % cmd
)
166 '''build wafsamba apidocs'''
167 from samba_utils
import recursive_dirlist
169 list = recursive_dirlist('../buildtools/wafsamba', '.', pattern
='*.py')
171 cmd
='PYTHONPATH=bin/python pydoctor --project-name=wafsamba --project-url=http://www.samba.org --make-html --docformat=restructuredtext'
174 cmd
+= ' --add-module %s' % f
175 print("Running: %s" % cmd
)
180 '''makes a tarball for distribution'''
181 samba_version
.load_version(env
=None)
185 '''test that distribution tarball builds and installs'''
186 samba_version
.load_version(env
=None)
188 d
= Scripting
.distcheck
191 def wildcard_cmd(cmd
):
192 '''called on a unknown command'''
193 from samba_wildcard
import run_named_build_task
194 run_named_build_task(cmd
)
197 from samba_wildcard
import wildcard_main
198 wildcard_main(wildcard_cmd
)
199 Scripting
.main
= main
201 def reconfigure(ctx
):
202 '''reconfigure if config scripts have changed'''
204 samba_utils
.reconfigure(ctx
)