summaryrefslogtreecommitdiff
path: root/site_scons
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2015-07-28 11:52:27 -0400
committerAndrew Morrow <acm@mongodb.com>2015-07-28 18:14:22 -0400
commit5891f4bc97ccd5a34f7731dc2011e9b5b24ea102 (patch)
treec175f7a28e5378fe8b67aa0ab60c85abd154955a /site_scons
parentd38fb5cbcdb1564dee5a4c015ecdb597beb5364a (diff)
downloadmongo-5891f4bc97ccd5a34f7731dc2011e9b5b24ea102.tar.gz
SERVER-13966 Differentiate library and program reverse dependencies
Diffstat (limited to 'site_scons')
-rw-r--r--site_scons/libdeps.py64
1 files changed, 38 insertions, 26 deletions
diff --git a/site_scons/libdeps.py b/site_scons/libdeps.py
index 87d96606cef..257cce8f33c 100644
--- a/site_scons/libdeps.py
+++ b/site_scons/libdeps.py
@@ -224,20 +224,17 @@ def libdeps_emitter(target, source, env):
of the "target" list is made a prerequisite of the elements of LIBDEPS_DEPENDENTS.
"""
+ lib_builder = env['BUILDERS']['StaticLibrary']
+ lib_node_factory = lib_builder.target_factory or env.File
+
+ prog_builder = env['BUILDERS']['Program']
+ prog_node_factory = prog_builder.target_factory or env.File
+
libdep_files = []
- lib_suffix = env.subst('$LIBSUFFIX', target=target, source=source)
- lib_prefix = env.subst('$LIBPREFIX', target=target, source=source)
for prereq in env.Flatten([env.get(libdeps_env_var, [])]):
- full_path = env.subst(str(prereq), target=target, source=source)
- dir_name = os.path.dirname(full_path)
- file_name = os.path.basename(full_path)
- if not file_name.startswith(lib_prefix):
- file_name = '${LIBPREFIX}' + file_name
- if not file_name.endswith(lib_suffix):
- file_name += '${LIBSUFFIX}'
-
- node_factory = env['BUILDERS']['StaticLibrary'].target_factory or env.File
- libdep_files.append(node_factory(os.path.join(dir_name, file_name)))
+ prereqWithIxes = SCons.Util.adjustixes(
+ prereq, lib_builder.get_prefix(env), lib_builder.get_suffix(env))
+ libdep_files.append(lib_node_factory(prereqWithIxes))
for t in target:
# target[0] must be a Node and not a string, or else libdeps will fail to
@@ -245,7 +242,16 @@ def libdeps_emitter(target, source, env):
__append_direct_libdeps(t, libdep_files)
for dependent in env.Flatten([env.get('LIBDEPS_DEPENDENTS', [])]):
- __append_direct_libdeps(env.File(dependent), [target[0]])
+ dependentWithIxes = SCons.Util.adjustixes(
+ dependent, lib_builder.get_prefix(env), lib_builder.get_suffix(env))
+ dependentNode = lib_node_factory(dependentWithIxes)
+ __append_direct_libdeps(dependentNode, [target[0]])
+
+ for dependent in env.Flatten([env.get('PROGDEPS_DEPENDENTS', [])]):
+ dependentWithIxes = SCons.Util.adjustixes(
+ dependent, prog_builder.get_prefix(env), prog_builder.get_suffix(env))
+ dependentNode = prog_node_factory(dependentWithIxes)
+ __append_direct_libdeps(dependentNode, [target[0]])
return target, source
@@ -267,20 +273,17 @@ def shlibdeps_emitter(target, source, env):
of the "target" list is made a prerequisite of the elements of LIBDEPS_DEPENDENTS.
"""
+ lib_builder = env['BUILDERS']['SharedLibrary']
+ lib_node_factory = lib_builder.target_factory or env.File
+
+ prog_builder = env['BUILDERS']['Program']
+ prog_node_factory = prog_builder.target_factory or env.File
+
libdep_files = []
- lib_suffix = env.subst('$SHLIBSUFFIX', target=target, source=source)
- lib_prefix = env.subst('$SHLIBPREFIX', target=target, source=source)
for prereq in env.Flatten([env.get(libdeps_env_var, [])]):
- full_path = env.subst(str(prereq), target=target, source=source)
- dir_name = os.path.dirname(full_path)
- file_name = os.path.basename(full_path)
- if not file_name.startswith(lib_prefix):
- file_name = '${SHLIBPREFIX}' + file_name
- if not file_name.endswith(lib_suffix):
- file_name += '${SHLIBSUFFIX}'
-
- node_factory = env['BUILDERS']['SharedLibrary'].target_factory or env.File
- libdep_files.append(node_factory(os.path.join(dir_name, file_name)))
+ prereqWithIxes = SCons.Util.adjustixes(
+ prereq, lib_builder.get_prefix(env), lib_builder.get_suffix(env))
+ libdep_files.append(lib_node_factory(prereqWithIxes))
for t in target:
# target[0] must be a Node and not a string, or else libdeps will fail to
@@ -288,7 +291,16 @@ def shlibdeps_emitter(target, source, env):
__append_direct_libdeps(t, libdep_files)
for dependent in env.Flatten([env.get('LIBDEPS_DEPENDENTS', [])]):
- __append_direct_libdeps(env.File(dependent), [target[0]])
+ dependentWithIxes = SCons.Util.adjustixes(
+ dependent, lib_builder.get_prefix(env), lib_builder.get_suffix(env))
+ dependentNode = lib_node_factory(dependentWithIxes)
+ __append_direct_libdeps(dependentNode, [target[0]])
+
+ for dependent in env.Flatten([env.get('PROGDEPS_DEPENDENTS', [])]):
+ dependentWithIxes = SCons.Util.adjustixes(
+ dependent, prog_builder.get_prefix(env), prog_builder.get_suffix(env))
+ dependentNode = prog_node_factory(dependentWithIxes)
+ __append_direct_libdeps(dependentNode, [target[0]])
return target, source