From 73ce2fd28b095983be6a9ba95e2a8c4568444667 Mon Sep 17 00:00:00 2001 From: Andrew Morrow Date: Tue, 10 Sep 2013 11:56:57 -0400 Subject: SERVER-9766 Don't fail the build on missing system libraries unless they are in demand --- site_scons/libdeps.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'site_scons/libdeps.py') 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) -- cgit v1.2.1