summaryrefslogtreecommitdiff
path: root/site_scons
diff options
context:
space:
mode:
authorAndrew Morrow <acm@10gen.com>2013-09-10 11:56:57 -0400
committerAndrew Morrow <acm@10gen.com>2013-09-11 16:46:52 -0400
commit73ce2fd28b095983be6a9ba95e2a8c4568444667 (patch)
treeb383afcc481b3ddc1e8be20c1a89cdb176b1004f /site_scons
parentf0deda49e359f644e4045f9588b4d39e9398a095 (diff)
downloadmongo-73ce2fd28b095983be6a9ba95e2a8c4568444667.tar.gz
SERVER-9766 Don't fail the build on missing system libraries unless they are in demand
Diffstat (limited to 'site_scons')
-rw-r--r--site_scons/libdeps.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/site_scons/libdeps.py b/site_scons/libdeps.py
index c97a1add537..bc1c2e315bb 100644
--- a/site_scons/libdeps.py
+++ b/site_scons/libdeps.py
@@ -58,6 +58,7 @@ import SCons.Util
libdeps_env_var = 'LIBDEPS'
syslibdeps_env_var = 'SYSLIBDEPS'
+missing_syslibdep = 'MISSING_LIBDEP_'
def sorted_by_str(iterable):
"""Shorthand for sorting an iterable according to its string representation.
@@ -128,10 +129,19 @@ def __get_syslibdeps(node):
for lib in __get_libdeps(node):
for syslib in node.get_env().Flatten(lib.get_env().get(syslibdeps_env_var, [])):
if syslib:
+ if type(syslib) in (str, unicode) and syslib.startswith(missing_syslibdep):
+ print("Target '%s' depends on the availability of a "
+ "system provided library for '%s', "
+ "but no suitable library was found during configuration." %
+ (str(node), syslib[len(missing_syslibdep):]))
+ node.get_env().Exit(1)
syslibdeps.append(syslib)
setattr(node.attributes, cached_var_name, syslibdeps)
return getattr(node.attributes, cached_var_name)
+def __missing_syslib(name):
+ return missing_syslibdep + name
+
def update_scanner(builder):
"""Update the scanner for "builder" to also scan library dependencies."""
@@ -263,3 +273,17 @@ def setup_environment(env):
update_scanner(env['BUILDERS'][builder_name])
except KeyError:
pass
+
+def setup_conftests(conf):
+ def FindSysLibDep(context, name, libs, **kwargs):
+ var = "LIBDEPS_" + name.upper() + "_SYSLIBDEP"
+ kwargs['autoadd'] = False
+ for lib in libs:
+ result = context.sconf.CheckLib(lib, **kwargs)
+ context.did_show_result = 1
+ if result:
+ context.env[var] = lib
+ return context.Result(result)
+ context.env[var] = __missing_syslib(name)
+ return context.Result(result)
+ conf.AddTest('FindSysLibDep', FindSysLibDep)