summaryrefslogtreecommitdiff
path: root/site_scons
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@10gen.com>2012-01-20 19:34:13 -0800
committerAndy Schwerin <schwerin@10gen.com>2012-01-20 22:33:40 -0800
commitfe7421e8f00f00cc723bbe0144319f6fac274562 (patch)
treefefe0d5b4157cf22ba05516f368b453b92f18394 /site_scons
parent71dc4e17a122f9fcd1c9d0594ec0657ac593296d (diff)
downloadmongo-fe7421e8f00f00cc723bbe0144319f6fac274562.tar.gz
SCons: Modify the libdeps module to support two methods for linking libdeps into programs.
This is used to fix linking of programs on Windows that depend on static initializer execution in object files that don't contain symbols referenced directly by the program at compile time (i.e., Command registration). It also unifies the compilation of these sorts of programs on Windows and POSIX systems, eliminating the use of a MergeLibrary when linking mongod and mongos. This extension to libdeps could also be used to reimagine MergeLibrary to have an implementation shared between Posix and Windows systems. The existing MergeLibrary system uses relocatable objects on Posix systems, and thus could behave differently from the one on Windows, with respect to the exeuction of static initializers. That change is recommended future work.
Diffstat (limited to 'site_scons')
-rw-r--r--site_scons/libdeps.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/site_scons/libdeps.py b/site_scons/libdeps.py
index f27f56341aa..dc0726ee310 100644
--- a/site_scons/libdeps.py
+++ b/site_scons/libdeps.py
@@ -132,6 +132,12 @@ def get_libdeps(source, target, env, for_signature):
target = env.Flatten([target])
return list(__get_libdeps(target[0], 'LIBDEPS'))
+def get_libdeps_objs(source, target, env, for_signature):
+ objs = set()
+ for lib in get_libdeps(source, target, env, for_signature):
+ objs.update(lib.sources_set)
+ return list(objs)
+
def get_syslibdeps(source, target, env, for_signature):
if for_signature:
return[]
@@ -173,7 +179,13 @@ def libdeps_emitter(target, source, env):
def setup_environment(env):
"""Set up the given build environment to do LIBDEPS tracking."""
- env['_LIBDEPS'] = get_libdeps
+ try:
+ env['_LIBDEPS']
+ except KeyError:
+ env['_LIBDEPS'] = '$_LIBDEPS_LIBS'
+
+ env['_LIBDEPS_LIBS'] = get_libdeps
+ env['_LIBDEPS_OBJS'] = get_libdeps_objs
env['_SYSLIBDEPS'] = ' ${_stripixes(LIBLINKPREFIX, SYSLIBDEPS, LIBLINKSUFFIX, LIBPREFIXES, LIBSUFFIXES, __env__)} '
env['_SHLIBDEPS'] = '$SHLIBDEP_GROUP_START ${_concat(SHLIBDEPPREFIX, __env__.subst(_LIBDEPS, target=TARGET, source=SOURCE), SHLIBDEPSUFFIX, __env__, target=TARGET, source=SOURCE)} $SHLIBDEP_GROUP_END'