diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-10-21 08:27:07 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-10-21 19:03:23 +1100 |
commit | 29c0b86126c2eb4e5c921f63b10e796bce647e1a (patch) | |
tree | e45eb44d71fae26924a39143e1f6008049b37700 /buildtools/wafsamba | |
parent | 9a2c9c2fc264627494b16923f3055d4aa09ae835 (diff) | |
download | samba-29c0b86126c2eb4e5c921f63b10e796bce647e1a.tar.gz samba-29c0b86126c2eb4e5c921f63b10e796bce647e1a.tar.bz2 samba-29c0b86126c2eb4e5c921f63b10e796bce647e1a.zip |
waf: re-work the module alias code
we now create a base library, and then create the alias modules as
wrappers around that base. That prevents double instantiation of any
object files in the modules
Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r-- | buildtools/wafsamba/wafsamba.py | 74 |
1 files changed, 52 insertions, 22 deletions
diff --git a/buildtools/wafsamba/wafsamba.py b/buildtools/wafsamba/wafsamba.py index 42f006eaf0..bc8fd75b0c 100644 --- a/buildtools/wafsamba/wafsamba.py +++ b/buildtools/wafsamba/wafsamba.py @@ -364,40 +364,70 @@ def SAMBA_MODULE(bld, modname, source, SET_TARGET_TYPE(bld, modname, 'DISABLED') return - modnames = [modname] + TO_LIST(aliases) - for modname in modnames: - obj_target = modname + '.objlist' - - realname = modname - if subsystem is not None: - deps += ' ' + subsystem - while realname.startswith("lib"+subsystem+"_"): - realname = realname[len("lib"+subsystem+"_"):] - while realname.startswith(subsystem+"_"): - realname = realname[len(subsystem+"_"):] - - realname = bld.make_libname(realname) - while realname.startswith("lib"): - realname = realname[len("lib"):] - - build_link_name = "modules/%s/%s" % (subsystem, realname) - + if aliases is not None: + # if we have aliases, then create a private base library, and a set + # of modules on top of that library if init_function: cflags += " -D%s=samba_init_module" % init_function - bld.SAMBA_LIBRARY(modname, + basename = modname + '-base' + bld.SAMBA_LIBRARY(basename, source, deps=deps, cflags=cflags, - realname = realname, autoproto = autoproto, local_include=local_include, vars=vars, - link_name=build_link_name, - install_path="${MODULESDIR}/%s" % subsystem, pyembed=pyembed, + private_library=True ) + aliases = TO_LIST(aliases) + aliases.append(modname) + + for alias in aliases: + bld.SAMBA_MODULE(alias, + source=[], + internal_module=False, + subsystem=subsystem, + init_function=init_function, + deps=basename) + return + + + obj_target = modname + '.objlist' + + realname = modname + if subsystem is not None: + deps += ' ' + subsystem + while realname.startswith("lib"+subsystem+"_"): + realname = realname[len("lib"+subsystem+"_"):] + while realname.startswith(subsystem+"_"): + realname = realname[len(subsystem+"_"):] + + realname = bld.make_libname(realname) + while realname.startswith("lib"): + realname = realname[len("lib"):] + + build_link_name = "modules/%s/%s" % (subsystem, realname) + + if init_function: + cflags += " -D%s=samba_init_module" % init_function + + bld.SAMBA_LIBRARY(modname, + source, + deps=deps, + cflags=cflags, + realname = realname, + autoproto = autoproto, + local_include=local_include, + vars=vars, + link_name=build_link_name, + install_path="${MODULESDIR}/%s" % subsystem, + pyembed=pyembed, + ) + + Build.BuildContext.SAMBA_MODULE = SAMBA_MODULE |