diff options
-rw-r--r-- | buildtools/wafsamba/samba_deps.py | 24 | ||||
-rw-r--r-- | buildtools/wafsamba/samba_utils.py | 1 | ||||
-rw-r--r-- | buildtools/wafsamba/wafsamba.py | 1 | ||||
-rw-r--r-- | source4/wscript | 81 |
4 files changed, 102 insertions, 5 deletions
diff --git a/buildtools/wafsamba/samba_deps.py b/buildtools/wafsamba/samba_deps.py index cc013eed6b..24807f844e 100644 --- a/buildtools/wafsamba/samba_deps.py +++ b/buildtools/wafsamba/samba_deps.py @@ -146,9 +146,9 @@ def build_includes(self): if getattr(self, 'local_include', True) == True and not getattr(self, 'local_include_first', True): includes.append('.') - self.includes = unique_list(includes) - debug('deps: includes for target %s: includes=%s', - self.sname, self.includes) + self.env['INC_PATHS'] = unique_list(includes) + debug('deps: includes for target %s: INC_PATHS=%s', + self.sname, self.env['INC_PATHS']) @@ -572,9 +572,10 @@ def calculate_final_deps(bld, tgt_list): ###################################################################### # this provides a way to save our dependency calculations between runs -savedeps_version = 1 +savedeps_version = 2 savedeps_inputs = ['samba_deps', 'samba_includes', 'local_include', 'local_include_first', 'samba_cflags'] savedeps_outputs = ['uselib', 'uselib_local', 'add_objects', 'includes', 'ccflags'] +savedeps_outenv = ['INC_PATHS'] savedeps_caches = ['GLOBAL_DEPENDENCIES', 'TARGET_ALIAS', 'TARGET_TYPE', 'INIT_FUNCTIONS'] def save_samba_deps(bld, tgt_list): @@ -587,6 +588,7 @@ def save_samba_deps(bld, tgt_list): denv.savedeps_outputs = savedeps_outputs denv.input = {} denv.output = {} + denv.outenv = {} denv.caches = {} for c in savedeps_caches: @@ -611,6 +613,13 @@ def save_samba_deps(bld, tgt_list): if tdeps != {}: denv.output[t.sname] = tdeps + tdeps = {} + for attr in savedeps_outenv: + if attr in t.env: + tdeps[attr] = t.env[attr] + if tdeps != {}: + denv.outenv[t.sname] = tdeps + depsfile = os.path.join(bld.bdir, "sambadeps") denv.store(depsfile) @@ -656,6 +665,13 @@ def load_samba_deps(bld, tgt_list): for a in tdeps: setattr(t, a, tdeps[a]) + # put output env vars in place + for t in tgt_list: + if not t.sname in denv.outenv: continue + tdeps = denv.outenv[t.sname] + for a in tdeps: + t.env[a] = tdeps[a] + debug('deps: loaded saved dependencies') return True diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py index d01edcf3b4..5fbb801ef6 100644 --- a/buildtools/wafsamba/samba_utils.py +++ b/buildtools/wafsamba/samba_utils.py @@ -301,4 +301,3 @@ def mkdir_p(dir): return mkdir_p(os.path.dirname(dir)) os.mkdir(dir) - diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index db4b7b80d2..302e0676b1 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -447,3 +447,4 @@ def SAMBA_SCRIPT(bld, name, pattern, installdir, installname=None): t.env.LINK_TARGET = target Build.BuildContext.SAMBA_SCRIPT = SAMBA_SCRIPT + diff --git a/source4/wscript b/source4/wscript index aecea2df5f..bac4e06aec 100644 --- a/source4/wscript +++ b/source4/wscript @@ -63,3 +63,84 @@ def configure(conf): conf.sub_config('lib/smbreadline') conf.SAMBA_CONFIG_H('include/config.h') + + + +from TaskGen import feature, before, after + +kak = {} +@feature('cc', 'cxx') +@after('apply_type_vars', 'apply_lib_vars', 'apply_core') +def apply_incpaths(self): + """used by the scanner + after processing the uselib for CPPPATH + after apply_core because some processing may add include paths + """ + lst = [] + # TODO move the uselib processing out of here + for lib in self.to_list(self.uselib): + for path in self.env['CPPPATH_' + lib]: + if not path in lst: + lst.append(path) + if preproc.go_absolute: + for path in preproc.standard_includes: + if not path in lst: + lst.append(path) + + for path in self.to_list(self.includes): + if not path in lst: + if preproc.go_absolute or not os.path.isabs(path): + lst.append(path) + else: + self.env.prepend_value('CPPPATH', path) + + for path in lst: + try: + #print len(kak.items()) + node = kak[(self.path.id, path)] + except KeyError: + + node = None + if os.path.isabs(path): + if preproc.go_absolute: + node = self.bld.root.find_dir(path) + elif path[0] == '#': + node = self.bld.srcnode + if len(path) > 1: + node = node.find_dir(path[1:]) + else: + node = self.path.find_dir(path) + + kak[(self.path.id, path)] = node + if node: + self.env.append_value('INC_PATHS', node) + # TODO WAF 1.6 + if USE_TOP_LEVEL: + self.env.append_value('INC_PATHS', self.bld.srcnode) + + + +cac = {} +@feature('cc') +@after('apply_incpaths') +def apply_obj_vars_cc(self): + """after apply_incpaths for INC_PATHS""" + env = self.env + app = env.append_unique + cpppath_st = env['CPPPATH_ST'] + + global cac + + # local flags come first + # set the user-defined includes paths + for i in env['INC_PATHS']: + + try: + app('_CCINCFLAGS', cac[i.id]) + except KeyError: + cac[i.id] = [cpppath_st % i.bldpath(env), cpppath_st % i.srcpath(env)] + app('_CCINCFLAGS', cac[i.id]) + + # set the library include paths + for i in env['CPPPATH']: + app('_CCINCFLAGS', cpppath_st % i) |