summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-03-20 16:27:48 +1100
committerAndrew Tridgell <tridge@samba.org>2010-04-06 20:26:47 +1000
commit8f1b809d2ccb083cb84532e98b04a12fb1039e22 (patch)
treee2e453049331e712e3312bc1c30e33c6ae683c54 /buildtools
parent9cb39847c068305d544bcacd6887c57412e16586 (diff)
downloadsamba-8f1b809d2ccb083cb84532e98b04a12fb1039e22.tar.gz
samba-8f1b809d2ccb083cb84532e98b04a12fb1039e22.tar.bz2
samba-8f1b809d2ccb083cb84532e98b04a12fb1039e22.zip
build: nearly there on samba4 build
Diffstat (limited to 'buildtools')
-rwxr-xr-xbuildtools/compare_config_h.sh5
-rwxr-xr-xbuildtools/mktowscript/mktowscript.pl4
-rwxr-xr-xbuildtools/waf-svnbin90543 -> 90898 bytes
-rw-r--r--buildtools/wafsamba/samba_asn1.py34
-rw-r--r--buildtools/wafsamba/samba_autoconf.py37
-rw-r--r--buildtools/wafsamba/samba_autoproto.py7
-rw-r--r--buildtools/wafsamba/samba_pidl.py11
-rw-r--r--buildtools/wafsamba/samba_utils.py59
-rw-r--r--buildtools/wafsamba/wafsamba.py413
9 files changed, 239 insertions, 331 deletions
diff --git a/buildtools/compare_config_h.sh b/buildtools/compare_config_h.sh
index 09f47b2b99..6daa743ed2 100755
--- a/buildtools/compare_config_h.sh
+++ b/buildtools/compare_config_h.sh
@@ -8,6 +8,5 @@ grep ^.define $HOME/samba_old/source4/include/config.h | sort > old-config.h
comm -23 old-config.h waf-config.h
-echo
-
-diff -u old-config.h waf-config.h
+#echo
+#diff -u old-config.h waf-config.h
diff --git a/buildtools/mktowscript/mktowscript.pl b/buildtools/mktowscript/mktowscript.pl
index 98c1b7ed32..a05506bcbd 100755
--- a/buildtools/mktowscript/mktowscript.pl
+++ b/buildtools/mktowscript/mktowscript.pl
@@ -50,6 +50,10 @@ sub strlist($)
$s =~ s/\bLIBTALLOC\b/talloc/g;
$s =~ s/\bTALLOC\b/talloc/g;
$s =~ s/\bLIBTEVENT\b/tevent/g;
+ $s =~ s/\bTEVENT\b/tevent/g;
+ $s =~ s/\bTSOCKET\b/LIBTSOCKET/g;
+ $s =~ s/\bGENSEC\b/gensec/g;
+ $s =~ s/\bLIBTDB\b/tdb/g;
$s =~ s/\bRESOLV\b/resolv/g;
return trim(join(' ', split(/\s+/, $s)));
diff --git a/buildtools/waf-svn b/buildtools/waf-svn
index dc7ee21865..740082d654 100755
--- a/buildtools/waf-svn
+++ b/buildtools/waf-svn
Binary files differ
diff --git a/buildtools/wafsamba/samba_asn1.py b/buildtools/wafsamba/samba_asn1.py
index 3af43b8912..27dc43931f 100644
--- a/buildtools/wafsamba/samba_asn1.py
+++ b/buildtools/wafsamba/samba_asn1.py
@@ -3,6 +3,7 @@
from TaskGen import taskgen, before
import Build, os, string, Utils
from samba_utils import *
+from samba_autoconf import *
# not sure if we need this exec_rule stuff ..., i'll leave it in for now
@@ -16,7 +17,8 @@ def add_comp(self):
def SAMBA_ASN1(bld, name, source,
options='',
directory='',
- option_file=None):
+ option_file=None,
+ includes=''):
'''Build a ASN1 file using the asn1 compiler.
This will produce 2 output files'''
bname = os.path.basename(source)[0:-5];
@@ -59,7 +61,7 @@ def SAMBA_ASN1(bld, name, source,
shell = True,
source = source,
target = out_files,
- name=name)
+ name=name + '_ASN1')
t.env.ASN1NAME = asn1name
t.env.ASN1OPTIONS = options
@@ -67,24 +69,40 @@ def SAMBA_ASN1(bld, name, source,
if option_file is not None:
t.env.OPTION_FILE = "--option-file=%s" % os.path.normpath(os.path.join(bld.curdir, option_file))
+ cfile = out_files[0][0:-2] + '.c'
+ hfile = out_files[1][0:-3] + '.h',
# now generate a .c file from the .x file
t = bld(rule='''( echo '#include "config.h"' && cat ${SRC} ) > ${TGT}''',
source = out_files[0],
- target = out_files[0][0:-2] + '.c',
+ target = cfile,
shell = True,
ext_out = '.c',
ext_in = '.x',
- depends_on = name,
- name = name + "_C")
+ depends_on = name + '_ASN1',
+ name = name + '_C')
# and generate a .h file from the .hx file
t = bld(rule='cp ${SRC} ${TGT}',
source = out_files[1],
ext_out = '.c',
ext_in = '.x',
- target = out_files[1][0:-3] + '.h',
- depends_on = name,
- name = name + "_H")
+ target = hfile,
+ depends_on = name + '_ASN1',
+ name = name + '_H')
+
+ bld.SET_BUILD_GROUP('main')
+
+ includes = TO_LIST(includes)
+ includes.append(os.path.dirname(out_files[0]))
+
+ t = bld(features = 'cc',
+ source = cfile,
+ target = name,
+ ccflags = CURRENT_CFLAGS(bld, name, ''),
+ depends_on = '',
+ samba_deps = TO_LIST('HEIMDAL_ROKEN'),
+ samba_includes = includes,
+ local_include = True)
Build.BuildContext.SAMBA_ASN1 = SAMBA_ASN1
diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py
index 76878a166b..f7519858cc 100644
--- a/buildtools/wafsamba/samba_autoconf.py
+++ b/buildtools/wafsamba/samba_autoconf.py
@@ -33,7 +33,7 @@ def CHECK_HEADER(conf, h, add_headers=True):
def CHECK_HEADERS(conf, list, add_headers=True):
'''check for a list of headers'''
ret = True
- for hdr in to_list(list):
+ for hdr in TO_LIST(list):
if not CHECK_HEADER(conf, hdr, add_headers):
ret = False
return ret
@@ -43,7 +43,8 @@ def CHECK_HEADERS(conf, list, add_headers=True):
def CHECK_TYPES(conf, list):
'''check for a list of types'''
ret = True
- for t in to_list(list):
+ lst = TO_LIST(list)
+ for t in TO_LIST(list):
if not conf.check(type_name=t, header_name=conf.env.hlist):
ret = False
return ret
@@ -80,7 +81,7 @@ def CHECK_VARIABLE(conf, v, define=None, always=False, headers=None):
'''check for a variable declaration (or define)'''
hdrs=''
if headers is not None:
- hlist = to_list(headers)
+ hlist = TO_LIST(headers)
else:
hlist = conf.env.hlist
for h in hlist:
@@ -113,7 +114,7 @@ def CHECK_DECLS(conf, vars, reverse=False, headers=None):
When reverse==True then use HAVE_xxx_DECL instead of HAVE_DECL_xxx
'''
ret = True
- for v in to_list(vars):
+ for v in TO_LIST(vars):
if not reverse:
define='HAVE_DECL_%s' % v.upper()
else:
@@ -135,7 +136,7 @@ def CHECK_FUNC(conf, f, checklink=False):
def CHECK_FUNCS(conf, list, checklink=False):
'''check for a list of functions'''
ret = True
- for f in to_list(list):
+ for f in TO_LIST(list):
if not CHECK_FUNC(conf, f, checklink):
ret = False
return ret
@@ -146,12 +147,12 @@ def CHECK_SIZEOF(conf, vars, headers=None, define=None):
'''check the size of a type'''
hdrs=''
if headers is not None:
- hlist = to_list(headers)
+ hlist = TO_LIST(headers)
else:
hlist = conf.env.hlist
for h in hlist:
hdrs += '#include <%s>\n' % h
- for v in to_list(vars):
+ for v in TO_LIST(vars):
if define is None:
define_name = 'SIZEOF_%s' % string.replace(v.upper(), ' ', '_')
else:
@@ -179,7 +180,7 @@ def CHECK_CODE(conf, code, define,
'''check if some code compiles and/or runs'''
hdrs=''
if headers is not None:
- hlist = to_list(headers)
+ hlist = TO_LIST(headers)
else:
hlist = conf.env.hlist
for h in hlist:
@@ -207,7 +208,7 @@ def CHECK_CODE(conf, code, define,
execute=execute,
define_name = define,
mandatory = mandatory,
- ccflags=to_list(cflags),
+ ccflags=TO_LIST(cflags),
includes=includes,
msg=msg):
conf.DEFINE(define, 1)
@@ -224,7 +225,7 @@ def CHECK_STRUCTURE_MEMBER(conf, structname, member,
'''check for a structure member'''
hdrs=''
if headers is not None:
- hlist = to_list(headers)
+ hlist = TO_LIST(headers)
else:
hlist = conf.env.hlist
for h in hlist:
@@ -286,21 +287,21 @@ def CHECK_FUNCS_IN(conf, list, library, mandatory=False, checklibc=False):
# first see if the functions are in libc
if checklibc:
remaining = []
- for f in to_list(list):
+ for f in TO_LIST(list):
if not CHECK_FUNC(conf, f):
remaining.append(f)
else:
- remaining = to_list(list)
+ remaining = TO_LIST(list)
if remaining == []:
- LOCAL_CACHE_SET(conf, 'EMPTY_TARGETS', library.upper(), True)
+ SET_TARGET_TYPE(conf, library, 'EMPTY')
return True
if not conf.check(lib=library, uselib_store=library):
conf.ASSERT(not mandatory,
"Mandatory library '%s' not found for functions '%s'" % (library, list))
# if it isn't a mandatory library, then remove it from dependency lists
- LOCAL_CACHE_SET(conf, 'EMPTY_TARGETS', library.upper(), True)
+ SET_TARGET_TYPE(conf, library, 'EMPTY')
return False
conf.define('HAVE_LIB%s' % string.replace(library.upper(),'-','_'), 1)
@@ -343,7 +344,7 @@ def CONFIG_PATH(conf, name, default):
def ADD_CFLAGS(conf, flags):
if not 'EXTRA_CFLAGS' in conf.env:
conf.env['EXTRA_CFLAGS'] = []
- conf.env['EXTRA_CFLAGS'].extend(to_list(flags))
+ conf.env['EXTRA_CFLAGS'].extend(TO_LIST(flags))
##############################################################
# add some extra include directories to all builds
@@ -351,16 +352,16 @@ def ADD_CFLAGS(conf, flags):
def ADD_EXTRA_INCLUDES(conf, includes):
if not 'EXTRA_INCLUDES' in conf.env:
conf.env['EXTRA_INCLUDES'] = []
- conf.env['EXTRA_INCLUDES'].extend(to_list(includes))
+ conf.env['EXTRA_INCLUDES'].extend(TO_LIST(includes))
##############################################################
# work out the current flags. local flags are added first
-def CURRENT_CFLAGS(bld, cflags):
+def CURRENT_CFLAGS(bld, target, cflags):
if not 'EXTRA_CFLAGS' in bld.env:
list = []
else:
list = bld.env['EXTRA_CFLAGS'];
- ret = to_list(cflags)
+ ret = TO_LIST(cflags)
ret.extend(list)
return ret
diff --git a/buildtools/wafsamba/samba_autoproto.py b/buildtools/wafsamba/samba_autoproto.py
index 19e4dbf94e..71274ead75 100644
--- a/buildtools/wafsamba/samba_autoproto.py
+++ b/buildtools/wafsamba/samba_autoproto.py
@@ -5,7 +5,10 @@ import Build, os, string, Utils
from samba_utils import *
# rule for heimdal prototype generation
-def HEIMDAL_AUTOPROTO(bld, header, source, options='-q -P comment -o'):
+def HEIMDAL_AUTOPROTO(bld, header, source, options=None, group='main'):
+ bld.SET_BUILD_GROUP(group)
+ if options is None:
+ options='-q -P comment -o'
t = bld(rule='${PERL} -W ../heimdal/cf/make-proto.pl ${OPTIONS} ${TGT[0].abspath(env)} ${SRC}',
source=source,
target=header,
@@ -26,8 +29,8 @@ def SAMBA_AUTOPROTO(bld, header, source):
source = source,
target = header,
ext_out='.c',
+ before ='cc',
rule = '../script/mkproto.pl --srcdir=.. --builddir=. --public=/dev/null --private=${TGT} ${SRC}'
)
Build.BuildContext.SAMBA_AUTOPROTO = SAMBA_AUTOPROTO
-
diff --git a/buildtools/wafsamba/samba_pidl.py b/buildtools/wafsamba/samba_pidl.py
index 938a0dc839..d37e7f1d23 100644
--- a/buildtools/wafsamba/samba_pidl.py
+++ b/buildtools/wafsamba/samba_pidl.py
@@ -30,11 +30,11 @@ def SAMBA_PIDL(bld, pname, source, options='', output_dir='.'):
table_header_idx = None
out_files = []
- options_list = to_list(options)
+ options_list = TO_LIST(options)
for o in options_list:
if o in options_map:
- ofiles = to_list(options_map[o])
+ ofiles = TO_LIST(options_map[o])
for f in ofiles:
out_files.append(os.path.join(output_dir, f % bname))
if f == 'ndr_%s.h':
@@ -53,7 +53,7 @@ def SAMBA_PIDL(bld, pname, source, options='', output_dir='.'):
name = name)
t.env.PIDL = "../pidl/pidl"
- t.env.OPTIONS = to_list(options)
+ t.env.OPTIONS = TO_LIST(options)
t.env.OUTPUTDIR = 'bin/' + bld.BUILD_PATH(output_dir)
@@ -67,7 +67,7 @@ Build.BuildContext.SAMBA_PIDL = SAMBA_PIDL
def SAMBA_PIDL_LIST(bld, name, source, options='', output_dir='.'):
'''A wrapper for building a set of IDL files'''
- for p in to_list(source):
+ for p in TO_LIST(source):
bld.SAMBA_PIDL(name, p, options=options, output_dir=output_dir)
Build.BuildContext.SAMBA_PIDL_LIST = SAMBA_PIDL_LIST
@@ -91,13 +91,12 @@ def SAMBA_PIDL_TABLES(bld, name, target):
headers = bld.env.PIDL_HEADERS
t = bld(
features = 'collect',
- rule = '${SRC} --output ${TGT} > ${TGT}',
+ rule = '${SRC} --output ${TGT} | sed "s|default/||" > ${TGT}',
ext_out = '.c',
before = 'cc',
shell = True,
source = '../../librpc/tables.pl',
target = target,
name = name)
- print name
Build.BuildContext.SAMBA_PIDL_TABLES = SAMBA_PIDL_TABLES
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 7a1d56e22a..5db9f2542a 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -8,6 +8,7 @@ from Logs import debug
from TaskGen import extension
import shlex
+# TODO: make this a --option
LIB_PATH="shared"
@@ -30,16 +31,6 @@ def SET_TARGET_TYPE(ctx, target, value):
"Target '%s' re-defined as %s - was %s" % (target, value, cache[target]))
debug("task_gen: Skipping duplicate target %s (curdir=%s)" % (target, ctx.curdir))
return False
- assumed = LOCAL_CACHE(ctx, 'ASSUMED_TARGET')
- if target in assumed:
- #if assumed[target] != value:
- # print "Target '%s' was assumed of type '%s' but is '%s'" % (target, assumed[target], value)
- ASSERT(ctx, assumed[target] == value,
- "Target '%s' was assumed of type '%s' but is '%s'" % (target, assumed[target], value))
- predeclared = LOCAL_CACHE(ctx, 'PREDECLARED_TARGET')
- if target in predeclared:
- ASSERT(ctx, predeclared[target] == value,
- "Target '%s' was predeclared of type '%s' but is '%s'" % (target, predeclared[target], value))
LOCAL_CACHE_SET(ctx, 'TARGET_TYPE', target, value)
debug("task_gen: Target '%s' created of type '%s' in %s" % (target, value, ctx.curdir))
return True
@@ -110,17 +101,11 @@ Build.BuildContext.ASSERT = ASSERT
# create a list of files by pre-pending each with a subdir name
def SUBDIR(bld, subdir, list):
ret = ''
- for l in to_list(list):
+ for l in TO_LIST(list):
ret = ret + subdir + '/' + l + ' '
return ret
Build.BuildContext.SUBDIR = SUBDIR
-##############################################
-# remove .. elements from a path list
-def NORMPATH(bld, ilist):
- return " ".join([os.path.normpath(p) for p in to_list(ilist)])
-Build.BuildContext.NORMPATH = NORMPATH
-
#######################################################
# d1 += d2
def dict_concat(d1, d2):
@@ -158,7 +143,7 @@ def ADD_COMMAND(opt, name, function):
Options.Handler.ADD_COMMAND = ADD_COMMAND
-@feature('*')
+@feature('cc', 'cshlib', 'cprogram')
@before('apply_core','exec_rule')
def process_depends_on(self):
'''The new depends_on attribute for build rules
@@ -174,7 +159,7 @@ def process_depends_on(self):
self.includes += " " + y.more_includes
-#@feature('cprogram cc cshlib')
+#@feature('cprogram', 'cc', 'cshlib')
#@before('apply_core')
#def process_generated_dependencies(self):
# '''Ensure that any dependent source generation happens
@@ -186,12 +171,6 @@ def process_depends_on(self):
# y.post()
-def FIND_TASKGEN(bld, name):
- '''find a waf task generator given a target name'''
- return bld.name_to_obj(name)
-Build.BuildContext.FIND_TASKGEN = FIND_TASKGEN
-
-
#import TaskGen, Task
#
#old_post_run = Task.Task.post_run
@@ -230,22 +209,39 @@ def dbg(self):
if self.target == 'HEIMDAL_HEIM_ASN1':
print "@@@@@@@@@@@@@@2", self.includes, self.env._CCINCFLAGS
-
-def to_list(str):
+def unique_list(seq):
+ '''return a uniquified list in the same order as the existing list'''
+ seen = {}
+ result = []
+ for item in seq:
+ if item in seen: continue
+ seen[item] = True
+ result.append(item)
+ return result
+
+def TO_LIST(str):
'''Split a list, preserving quoted strings and existing lists'''
if isinstance(str, list):
return str
- return shlex.split(str)
+ lst = str.split()
+ # the string may have had quotes in it, now we
+ # check if we did have quotes, and use the slower shlex
+ # if we need to
+ for e in lst:
+ if e[0] == '"':
+ return shlex.split(str)
+ return lst
@conf
-def SUBST_ENV_VAR(conf, varname):
+def SUBST_ENV_VAR(ctx, varname):
'''Substitute an environment variable for any embedded variables'''
- return Utils.subst_vars(conf.env[varname], conf.env)
+ return Utils.subst_vars(ctx.env[varname], ctx.env)
+Build.BuildContext.SUBST_ENV_VAR = SUBST_ENV_VAR
def ENFORCE_GROUP_ORDERING(bld):
'''enforce group ordering for the project. This
- makes the group ordering apply even when you specify
+ makes the group ordering apply only when you specify
a target with --target'''
if Options.options.compile_targets:
@feature('*')
@@ -280,4 +276,3 @@ Build.BuildContext.ENFORCE_GROUP_ORDERING = ENFORCE_GROUP_ORDERING
# raise Utils.WafError('object %r was not found in uselib_local (required by add_objects %r)' % (x, self.name))
# y.post()
# self.env.append_unique('INC_PATHS', y.env.INC_PATHS)
-
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py
index 2498eedd75..e90bd35ef4 100644
--- a/buildtools/wafsamba/wafsamba.py
+++ b/buildtools/wafsamba/wafsamba.py
@@ -8,12 +8,13 @@ from TaskGen import extension
# bring in the other samba modules
from samba_utils import *
-# should be enabled from the above?
from samba_autoconf import *
from samba_patterns import *
from samba_pidl import *
from samba_asn1 import *
from samba_autoproto import *
+from samba_python import *
+from samba_deps import *
LIB_PATH="shared"
@@ -35,154 +36,17 @@ def ADD_INIT_FUNCTION(bld, subsystem, init_function):
bld.ASSERT(subsystem is not None, "You must specify a subsystem for init_function '%s'" % init_function)
cache = LOCAL_CACHE(bld, 'INIT_FUNCTIONS')
if not subsystem in cache:
- cache[subsystem] = ''
- cache[subsystem] += '%s,' % init_function
+ cache[subsystem] = []
+ cache[subsystem].append(init_function)
Build.BuildContext.ADD_INIT_FUNCTION = ADD_INIT_FUNCTION
-################################################################
-# recursively build the dependency list for a target
-def FULL_DEPENDENCIES(bld, cache, target, chain, path):
- if not target in cache:
- return {}
- deps = cache[target].copy()
- for t in cache[target]:
- bld.ASSERT(t not in chain, "Circular dependency for %s: %s->%s" % (t, path, t));
- c2 = chain.copy()
- c2[t] = True
- dict_concat(deps, FULL_DEPENDENCIES(bld, cache, t, c2, "%s->%s" % (path, t)))
- return deps
-
-############################################################
-# check our build dependencies for circular dependencies
-def CHECK_TARGET_DEPENDENCY(bld, target):
- cache = LOCAL_CACHE(bld, 'LIB_DEPS')
- return FULL_DEPENDENCIES(bld, cache, target, { target:True }, target)
-
-############################################################
-# check that all dependencies have been declared
-def CHECK_DEPENDENCIES(bld):
- cache = LOCAL_CACHE(bld, 'LIB_DEPS')
- target_cache = LOCAL_CACHE(bld, 'TARGET_TYPE')
- debug('deps: Checking dependencies')
- for t in cache:
- deps = CHECK_TARGET_DEPENDENCY(bld, t)
- for d in deps:
- #if not d in target_cache:
- # print "WARNING: Dependency '%s' of target '%s' not declared" % (d, t)
- ASSERT(bld, d in target_cache,
- "Dependency '%s' of target '%s' not declared" % (d, t))
- debug("deps: Dependencies checked for %u targets" % len(target_cache))
-Build.BuildContext.CHECK_DEPENDENCIES = CHECK_DEPENDENCIES
-
-
-############################################################
-# pre-declare a target as being of a particular type
-def PREDECLARE(bld, target, type):
- cache = LOCAL_CACHE(bld, 'PREDECLARED_TARGET')
- target_cache = LOCAL_CACHE(bld, 'TARGET_TYPE')
- ASSERT(bld, not target in target_cache, "Target '%s' is already declared" % target)
- ASSERT(bld, not target in cache, "Target '%s' already predeclared" % target)
- cache[target] = type
-Build.BuildContext.PREDECLARE = PREDECLARE
-
-
-
-################################################################
-# add to the dependency list. Return a new dependency list with
-# any circular dependencies removed
-# returns a tuple containing (systemdeps, localdeps, add_objects)
-def ADD_DEPENDENCIES(bld, name, deps):
- debug('deps: Calculating dependencies for %s' % name)
- lib_deps = LOCAL_CACHE(bld, 'LIB_DEPS')
- if not name in lib_deps:
- lib_deps[name] = {}
- list = to_list(deps)
- list2 = []
- for d in list:
- lib_deps[name][d] = True;
- try:
- CHECK_TARGET_DEPENDENCY(bld, name)
- list2.append(d)
- except AssertionError:
- sys.stderr.write("Removing dependency %s from target %s\n" % (d, name))
- del(lib_deps[name][d])
-
- target_cache = LOCAL_CACHE(bld, 'TARGET_TYPE')
-
- # extract out the system dependencies
- sysdeps = []
- localdeps = []
- add_objects = []
- cache = LOCAL_CACHE(bld, 'EMPTY_TARGETS')
- predeclare = LOCAL_CACHE(bld, 'PREDECLARED_TARGET')
- for d in list2:
- recurse = False
- # strip out any dependencies on empty libraries
- if d in cache:
- debug("deps: Removing empty dependency '%s' from '%s'" % (d, name))
- continue
- type = None
-
- if d in target_cache:
- type = target_cache[d]
- elif d in predeclare:
- type = predeclare[d]
- else:
- type = 'SUBSYSTEM'
- LOCAL_CACHE_SET(bld, 'ASSUMED_TARGET', d, type)
-
- if type == 'SYSLIB':
- sysdeps.append(d)
- elif type == 'LIBRARY':
- localdeps.append(d)
- elif type == 'SUBSYSTEM':
- add_objects.append(d)
- recurse = True
- elif type == 'MODULE':
- add_objects.append(d)
- recurse = True
- elif type == 'PYTHON':
- pass
- elif type == 'ASN1':
- pass
- elif type == 'BINARY':
- pass
- else:
- ASSERT(bld, False, "Unknown target type '%s' for dependency %s" % (
- type, d))
-
- # for some types we have to build the list recursively
- if recurse and (d in lib_deps):
- rec_deps = ' '.join(lib_deps[d].keys())
- (rec_sysdeps, rec_localdeps, rec_add_objects) = ADD_DEPENDENCIES(bld, d, rec_deps)
- sysdeps.extend(to_list(rec_sysdeps))
- localdeps.extend(to_list(rec_localdeps))
- add_objects.extend(to_list(rec_add_objects))
-
- debug('deps: Dependencies for %s: sysdeps: %u localdeps: %u add_objects=%u' % (
- name, len(sysdeps), len(localdeps), len(add_objects)))
- return (' '.join(sysdeps), ' '.join(localdeps), ' '.join(add_objects))
-
-
-#################################################################
-# return a include list for a set of library dependencies
-def SAMBA_LIBRARY_INCLUDE_LIST(bld, deps):
- ret = bld.curdir + ' '
- cache = LOCAL_CACHE(bld, 'INCLUDE_LIST')
- for l in to_list(deps):
- if l in cache:
- ret = ret + cache[l] + ' '
- if 'EXTRA_INCLUDES' in bld.env:
- ret += ' ' + ' '.join(bld.env['EXTRA_INCLUDES'])
- return ret
-Build.BuildContext.SAMBA_LIBRARY_INCLUDE_LIST = SAMBA_LIBRARY_INCLUDE_LIST
#################################################################
# define a Samba library
def SAMBA_LIBRARY(bld, libname, source,
deps='',
public_deps='',
- includes='.',
+ includes='',
public_headers=None,
vnum=None,
cflags='',
@@ -190,58 +54,34 @@ def SAMBA_LIBRARY(bld, libname, source,
realname=None,
autoproto=None,
group='main',
- depends_on=''):
- if not SET_TARGET_TYPE(bld, libname, 'LIBRARY'):
- return
+ depends_on='',
+ local_include=True):
# remember empty libraries, so we can strip the dependencies
if (source == '') or (source == []):
- LOCAL_CACHE_SET(bld, 'EMPTY_TARGETS', libname, True)
+ SET_TARGET_TYPE(bld, libname, 'EMPTY')
return
- (sysdeps, localdeps, add_objects) = ADD_DEPENDENCIES(bld, libname, deps)
-
-# bld.SET_TARGET_INCLUDE_LIST(libname, includes)
-
- ilist = includes + ' ' + bld.SAMBA_LIBRARY_INCLUDE_LIST(deps)
- ilist = bld.NORMPATH(ilist)
+ if not SET_TARGET_TYPE(bld, libname, 'LIBRARY'):
+ return
-# print "LIBRARY %s add_objects=%s deps=%s uselib_local=%s ilist=%s" % (libname, add_objects, deps, localdeps, ilist)
+ deps += ' ' + public_deps
# this print below should show that we're runnig this code
- bld.SET_BUILD_GROUP(group) # <- here
- bld(
- features = 'cc cshlib',
- source = source,
- target=libname,
- uselib_local = localdeps,
- uselib = sysdeps,
- add_objects = add_objects,
- ccflags = CURRENT_CFLAGS(bld, cflags),
- includes=ilist + ' . #',
- export_incdirs = includes,
- depends_on=depends_on,
- vnum=vnum)
-
- # I have to set it each time? I expect it to be still
- # set from the few lines above
-
- # put a link to the library in bin/shared
- soext=""
- if vnum is not None:
- soext = '.' + vnum.split('.')[0]
-
+ bld.SET_BUILD_GROUP(group)
t = bld(
- source = 'lib%s.so' % libname,
- rule = 'ln -sf ../${SRC}%s %s/lib%s.so%s' % (soext, LIB_PATH, libname, soext),
-# rule = 'ln -sf ../%s.so%s %s/lib%s.so%s' % (libname, soext, LIB_PATH, libname, soext),
- shell = True,
- after = 'cc_link',
- always = True,
- name = libname + '.link',
+ features = 'cc cshlib symlink_lib',
+ source = source,
+ target = libname,
+ ccflags = CURRENT_CFLAGS(bld, libname, cflags),
+ depends_on = depends_on,
+ samba_deps = TO_LIST(deps),
+ samba_includes = includes,
+ local_include = local_include,
+ vnum = vnum
)
- #print t.rule
- LOCAL_CACHE_SET(bld, 'INCLUDE_LIST', libname, ilist)
+ if autoproto is not None:
+ bld.SAMBA_AUTOPROTO(autoproto, source)
Build.BuildContext.SAMBA_LIBRARY = SAMBA_LIBRARY
@@ -259,64 +99,36 @@ def SAMBA_BINARY(bld, binname, source,
use_hostcc=None,
compiler=None,
group='main',
- manpages=None):
- ilist = includes + ' ' + bld.SAMBA_LIBRARY_INCLUDE_LIST(deps)
- ilist = bld.NORMPATH(ilist)
+ manpages=None,
+ local_include=True,
+ subsystem=None,
+ needs_python=False):
if not SET_TARGET_TYPE(bld, binname, 'BINARY'):
return
- (sysdeps, localdeps, add_objects) = ADD_DEPENDENCIES(bld, binname, deps)
-
- cache = LOCAL_CACHE(bld, 'INIT_FUNCTIONS')
- if modules is not None:
- for m in to_list(modules):
- bld.ASSERT(m in cache,
- "No init_function defined for module '%s' in binary '%s'" % (m, binname))
- cflags += ' -DSTATIC_%s_MODULES="%s"' % (m, cache[m])
-
-# print "BINARY %s add_objects=%s deps=%s uselib_local=%s" % (binname, add_objects, deps, localdeps)
+ features = 'cc cprogram copy_bin'
+ if needs_python:
+ features += ' pyembed'
bld.SET_BUILD_GROUP(group)
bld(
- features = 'cc cprogram',
- source = source,
- target = binname,
- uselib_local = localdeps,
- uselib = sysdeps,
- includes = ilist + ' . #',
- ccflags = CURRENT_CFLAGS(bld, cflags),
- add_objects = add_objects,
- top=True)
-
- if not Options.is_install:
- bld(
- source = binname,
- rule = 'rm -f %s && cp ${SRC} .' % (binname),
- shell = True,
- after = 'cc_link',
- always = True,
- ext_in = '.bin',
- name = binname + ".copy",
- depends_on = binname
- )
-Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY
-
-
-#################################################################
-# define a Samba python module
-def SAMBA_PYTHON(bld, name, source,
- deps='',
- public_deps='',
- realname=''):
-
- if not SET_TARGET_TYPE(bld, name, 'PYTHON'):
- return
+ features = features,
+ source = source,
+ target = binname,
+ ccflags = CURRENT_CFLAGS(bld, binname, cflags),
+ samba_deps = TO_LIST(deps),
+ samba_includes = includes,
+ local_include = local_include,
+ samba_modules = modules,
+ top = True,
+ samba_subsystem= subsystem
+ )
- (sysdeps, localdeps, add_objects) = ADD_DEPENDENCIES(bld, name, deps)
+ if autoproto is not None:
+ bld.SAMBA_AUTOPROTO(autoproto, source)
+Build.BuildContext.SAMBA_BINARY = SAMBA_BINARY
- return
-Build.BuildContext.SAMBA_PYTHON = SAMBA_PYTHON
#################################################################
# define a Samba ET target
@@ -340,33 +152,66 @@ Build.BuildContext.SAMBA_ERRTABLE = SAMBA_ERRTABLE
# define a Samba module.
def SAMBA_MODULE(bld, modname, source,
deps='',
- includes='.',
+ includes='',
subsystem=None,
init_function=None,
autoproto=None,
+ autoproto_extra_source='',
aliases=None,
cflags='',
- output_type=None):
+ output_type=None,
+ local_include=True,
+ enabled=True):
+
+ if output_type == 'MERGED_OBJ':
+ # treat merged object modules as subsystems for now
+ SAMBA_SUBSYSTEM(bld, modname, source,
+ deps=deps,
+ includes=includes,
+ autoproto=autoproto,
+ autoproto_extra_source=autoproto_extra_source,
+ cflags=cflags,
+ local_include=local_include,
+ enabled=enabled)
+ # even though we're treating it as a subsystem, we need to
+ # add it to the init_function list
+ # TODO: we should also create an implicit dependency
+ # between the subsystem target and this target
+ bld.ADD_INIT_FUNCTION(subsystem, init_function)
+ return
- if not SET_TARGET_TYPE(bld, modname, 'MODULE'):
+ if not enabled:
+ SET_TARGET_TYPE(bld, modname, 'DISABLED')
return
# remember empty modules, so we can strip the dependencies
if (source == '') or (source == []):
- LOCAL_CACHE_SET(bld, 'EMPTY_TARGETS', modname, True)
+ SET_TARGET_TYPE(bld, modname, 'EMPTY')
return
- (sysdeps, localdeps, add_objects) = ADD_DEPENDENCIES(bld, modname, deps)
+ if not SET_TARGET_TYPE(bld, modname, 'MODULE'):
+ return
+
+
+ bld.ADD_INIT_FUNCTION(subsystem, init_function)
+
+ if subsystem is not None:
+ deps += ' ' + subsystem
- ilist = includes + ' ' + bld.SAMBA_LIBRARY_INCLUDE_LIST(deps)
- ilist = bld.NORMPATH(ilist)
bld.SET_BUILD_GROUP('main')
bld(
- features = 'cc',
- source = source,
- target=modname,
- ccflags = CURRENT_CFLAGS(bld, cflags),
- includes=ilist + ' . #')
+ features = 'cc',
+ source = source,
+ target = modname,
+ ccflags = CURRENT_CFLAGS(bld, modname, cflags),
+ samba_includes = includes,
+ local_include = local_include,
+ samba_deps = TO_LIST(deps)
+ )
+
+ if autoproto is not None:
+ bld.SAMBA_AUTOPROTO(autoproto, source + ' ' + autoproto_extra_source)
+
Build.BuildContext.SAMBA_MODULE = SAMBA_MODULE
@@ -375,55 +220,85 @@ Build.BuildContext.SAMBA_MODULE = SAMBA_MODULE
def SAMBA_SUBSYSTEM(bld, modname, source,
deps='',
public_deps='',
- includes='.',
+ includes='',
public_headers=None,
cflags='',
group='main',
config_option=None,
init_function_sentinal=None,
heimdal_autoproto=None,
+ heimdal_autoproto_options=None,
heimdal_autoproto_private=None,
autoproto=None,
- depends_on=''):
-
- if not SET_TARGET_TYPE(bld, modname, 'SUBSYSTEM'):
+ autoproto_extra_source='',
+ depends_on='',
+ local_include=True,
+ local_include_first=True,
+ enabled=True):
+
+ if not enabled:
+ SET_TARGET_TYPE(bld, modname, 'DISABLED')
return
# if the caller specifies a config_option, then we create a blank
# subsystem if that configuration option was found at configure time
if (config_option is not None) and bld.CONFIG_SET(config_option):
- source = ''
+ SET_TARGET_TYPE(bld, modname, 'EMPTY')
+ return
# remember empty subsystems, so we can strip the dependencies
if (source == '') or (source == []):
- LOCAL_CACHE_SET(bld, 'EMPTY_TARGETS', modname, True)
+ SET_TARGET_TYPE(bld, modname, 'EMPTY')
+ return
+
+ if not SET_TARGET_TYPE(bld, modname, 'SUBSYSTEM'):
return
- (sysdeps, localdeps, add_objects) = ADD_DEPENDENCIES(bld, modname, deps)
+ deps += ' ' + public_deps
- ilist = includes + ' ' + bld.SAMBA_LIBRARY_INCLUDE_LIST(deps)
- ilist = bld.NORMPATH(ilist)
bld.SET_BUILD_GROUP(group)
+
t = bld(
- features = 'cc',
- source = source,
- target=modname,
- ccflags = CURRENT_CFLAGS(bld, cflags),
- includes=ilist + ' . #',
- depends_on=depends_on)
- LOCAL_CACHE_SET(bld, 'INCLUDE_LIST', modname, ilist)
+ features = 'cc',
+ source = source,
+ target = modname,
+ ccflags = CURRENT_CFLAGS(bld, modname, cflags),
+ depends_on = depends_on,
+ samba_deps = TO_LIST(deps),
+ samba_includes = includes,
+ local_include = local_include,
+ local_include_first = local_include_first
+ )
if heimdal_autoproto is not None:
- bld.HEIMDAL_AUTOPROTO(heimdal_autoproto, source)
+ bld.HEIMDAL_AUTOPROTO(heimdal_autoproto, source, options=heimdal_autoproto_options)
if heimdal_autoproto_private is not None:
bld.HEIMDAL_AUTOPROTO_PRIVATE(heimdal_autoproto_private, source)
if autoproto is not None:
- bld.SAMBA_AUTOPROTO(autoproto, source)
+ bld.SAMBA_AUTOPROTO(autoproto, source + ' ' + autoproto_extra_source)
return t
Build.BuildContext.SAMBA_SUBSYSTEM = SAMBA_SUBSYSTEM
+def SAMBA_GENERATOR(bld, name, rule, source, target,
+ group='build_source'):
+ '''A generic source generator target'''
+
+ if not SET_TARGET_TYPE(bld, name, 'GENERATOR'):
+ return
+
+ bld.SET_BUILD_GROUP(group)
+ bld(
+ rule=rule,
+ source=source,
+ target=target,
+ before='cc',
+ ext_out='.c')
+Build.BuildContext.SAMBA_GENERATOR = SAMBA_GENERATOR
+
+
+
###############################################################
# add a new set of build rules from a subdirectory
# the @runonce decorator ensures we don't end up
@@ -471,3 +346,17 @@ def SET_BUILD_GROUP(bld, group):
bld.set_group(group)
Build.BuildContext.SET_BUILD_GROUP = SET_BUILD_GROUP
+
+def h_file(filename):
+ import stat
+ st = os.stat(filename)
+ if stat.S_ISDIR(st[stat.ST_MODE]): raise IOError('not a file')
+ m = Utils.md5()
+ m.update(str(st.st_mtime))
+ m.update(str(st.st_size))
+ m.update(filename)
+ return m.digest()
+
+@conf
+def ENABLE_TIMESTAMP_DEPENDENCIES(conf):
+ Utils.h_file = h_file