From 39a17ba7ef506192218f24047f129cb635efb02b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 4 Apr 2019 10:58:36 +0200 Subject: Add ability to disable automatic rpath, support for custom rpath-link Specifically, the new config.bin.rpath.auto variable can be used to disable automatic addition of prerequisite library rpaths, for example: $ b config.bin.rpath.auto=false Note that in this case rpath-link is still added where normally required and for targets that support it (Linux and *BSD). The new config.bin.rpath_link and config.bin.rpath_link.auto have the same semantics as config.bin.rpath* but for rpath-link. --- build2/bin/init.cxx | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'build2/bin') diff --git a/build2/bin/init.cxx b/build2/bin/init.cxx index 52197d2..f334769 100644 --- a/build2/bin/init.cxx +++ b/build2/bin/init.cxx @@ -61,11 +61,25 @@ namespace build2 vp.insert ("config.bin.target", true); vp.insert ("config.bin.pattern", true); + // Library types to build. + // vp.insert ("config.bin.lib", true); + + // Library types to use (in priority order). + // vp.insert ("config.bin.exe.lib", true); vp.insert ("config.bin.liba.lib", true); vp.insert ("config.bin.libs.lib", true); - vp.insert ("config.bin.rpath", true); + + // The rpath[_link].auto flag controls automatic rpath behavior, for + // example, addition of rpaths for prerequisite libraries (see the cc + // module for an example). Default is true. + // + vp.insert ("config.bin.rpath", true); + vp.insert ("config.bin.rpath.auto", true); + + vp.insert ("config.bin.rpath_link", true); + vp.insert ("config.bin.rpath_link.auto", true); vp.insert ("config.bin.prefix", true); vp.insert ("config.bin.suffix", true); @@ -75,10 +89,16 @@ namespace build2 vp.insert ("config.bin.exe.suffix", true); vp.insert ("bin.lib"); + vp.insert ("bin.exe.lib"); vp.insert ("bin.liba.lib"); vp.insert ("bin.libs.lib"); + vp.insert ("bin.rpath"); + vp.insert ("bin.rpath.auto"); + + vp.insert ("bin.rpath_link"); + vp.insert ("bin.rpath_link.auto"); // Link whole archive. Note: non-overridable with target visibility. // @@ -183,14 +203,33 @@ namespace build2 v = *required (rs, "config.bin.libs.lib", libs_lib).first; } - // config.bin.rpath + // config.bin.rpath[_link] // - // This one is optional and we merge it into bin.rpath, if any. - // See the cxx module for details on merging. + // These ones are optional and we merge them into bin.rpath[_link], if + // any. // rs.assign ("bin.rpath") += cast_null ( optional (rs, "config.bin.rpath")); + rs.assign ("bin.rpath_link") += cast_null ( + optional (rs, "config.bin.rpath_link")); + + // config.bin.rpath[_link].auto + // + { + lookup l; + + rs.assign ("bin.rpath.auto") = + (l = omitted (rs, "config.bin.rpath.auto").first) + ? cast (l) + : true; + + rs.assign ("bin.rpath_link.auto") = + (l = omitted (rs, "config.bin.rpath_link.auto").first) + ? cast (l) + : true; + } + // config.bin.{lib,exe}.{prefix,suffix} // // These ones are not used very often so we will omit them from the -- cgit v1.1