From d33558b7335a469942e204f73de6faed81f8041f Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 15 Aug 2019 09:57:42 +0200 Subject: Add support for bin.lib.load_suffix This allow the creation of yet another symlink to the shared library that is meant to be used for dynamic loading. For example, we may want to embed the main program interface number into its plugins to make sure that we only load compatible versions. --- build2/cc/link-rule.cxx | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'build2/cc/link-rule.cxx') diff --git a/build2/cc/link-rule.cxx b/build2/cc/link-rule.cxx index 5ca7865..acc5b7e 100644 --- a/build2/cc/link-rule.cxx +++ b/build2/cc/link-rule.cxx @@ -365,7 +365,7 @@ namespace build2 // Now determine the paths. // - path lk, so, in; + path lk, ld, so, in; // We start with the basic path. // @@ -418,12 +418,25 @@ namespace build2 append_ext (lk); } + // See if we need the load name. + // + if (const string* s = cast_null (ls["bin.lib.load_suffix"])) + { + if (!s->empty ()) + { + b += *s; + ld = b; + append_ext (ld); + } + } + if (!v.empty ()) b += v; const path& re (ls.derive_path (move (b))); - return libs_paths {move (lk), move (so), move (in), &re, move (cp)}; + return libs_paths { + move (lk), move (ld), move (so), move (in), &re, move (cp)}; } // Look for binary-full utility library recursively until we hit a @@ -2553,10 +2566,11 @@ namespace build2 return s.empty () || m.string ().compare (0, s.size (), s) != 0; }; - if (test (*paths.real) && - test (paths.interm) && - test (paths.soname) && - test (paths.link)) + if (test (*paths.real) && + test ( paths.interm) && + test ( paths.soname) && + test ( paths.load) && + test ( paths.link)) { try_rmfile (m); try_rmfile (m + ".d"); @@ -2863,6 +2877,7 @@ namespace build2 const libs_paths& paths (md.libs_data); const path& lk (paths.link); + const path& ld (paths.load); const path& so (paths.soname); const path& in (paths.interm); @@ -2870,6 +2885,7 @@ namespace build2 if (!in.empty ()) {ln (f->leaf (), in); f = ∈} if (!so.empty ()) {ln (f->leaf (), so); f = &so;} + if (!ld.empty ()) {ln (f->leaf (), ld); f = &ld;} if (!lk.empty ()) {ln (f->leaf (), lk);} } else if (lt.static_library ()) @@ -2978,6 +2994,7 @@ namespace build2 }; add (lp.link); + add (lp.load); add (lp.soname); add (lp.interm); } -- cgit v1.1