aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-11-01 09:56:21 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-11-01 09:56:21 +0200
commit834e835eb362cd94a3e86c260589368cea65af47 (patch)
treebcbe2b790abb035504f703cb7444f701a9eba32a
parentbc0d26129a33967576485092c292451f4d4d5115 (diff)
For runtime-only libs{} installation keep all names except link
-rw-r--r--libbuild2/cc/install-rule.cxx86
1 files changed, 42 insertions, 44 deletions
diff --git a/libbuild2/cc/install-rule.cxx b/libbuild2/cc/install-rule.cxx
index 3d20272..1d30a9f 100644
--- a/libbuild2/cc/install-rule.cxx
+++ b/libbuild2/cc/install-rule.cxx
@@ -363,11 +363,6 @@ namespace build2
link_rule::libs_paths lsp;
if (ls != nullptr && !ls->path ().empty ()) // Not binless.
{
- // Note: we could omit deriving the paths if cur_options doesn't
- // have the buildtime option. But then we would have to duplicate
- // this code in reapply() below (where this bit could be added).
- // So let's keep it simple if a bit inefficient for now.
- //
const string* p (cast_null<string> (t["bin.lib.prefix"]));
const string* s (cast_null<string> (t["bin.lib.suffix"]));
@@ -468,30 +463,33 @@ namespace build2
{
const auto& md (t.data<install_match_data> (perform_install_id));
- if ((md.options & lib::option_install_buildtime) != 0)
- {
- // Here we may have a bunch of symlinks that we need to install.
- //
- const scope& rs (t.root_scope ());
- const link_rule::libs_paths& lp (md.libs_paths);
+ // Here we may have a bunch of symlinks that we need to install.
+ //
+ // Note that for runtime-only install we only omit the name that is
+ // used for linking (e.g., libfoo.so).
+ //
+ const scope& rs (t.root_scope ());
+ const link_rule::libs_paths& lp (md.libs_paths);
- auto ln = [&t, &rs, &id] (const path& f, const path& l)
- {
- install_l (rs, id, l.leaf (), t, f.leaf (), 2 /* verbosity */);
- return true;
- };
+ auto ln = [&t, &rs, &id] (const path& f, const path& l)
+ {
+ install_l (rs, id, l.leaf (), t, f.leaf (), 2 /* verbosity */);
+ return true;
+ };
- const path& lk (lp.link);
- const path& ld (lp.load);
- const path& so (lp.soname);
- const path& in (lp.interm);
+ const path& lk (lp.link);
+ const path& ld (lp.load);
+ const path& so (lp.soname);
+ const path& in (lp.interm);
- const path* f (lp.real);
+ const path* f (lp.real);
- if (!in.empty ()) {r = ln (*f, in) || r; f = &in;}
- if (!so.empty ()) {r = ln (*f, so) || r; f = &so;}
- if (!ld.empty ()) {r = ln (*f, ld) || r; f = &ld;}
- if (!lk.empty ()) {r = ln (*f, lk) || r; }
+ if (!in.empty ()) {r = ln (*f, in) || r; f = &in;}
+ if (!so.empty ()) {r = ln (*f, so) || r; f = &so;}
+ if (!ld.empty ()) {r = ln (*f, ld) || r; f = &ld;}
+ if ((md.options & lib::option_install_buildtime) != 0)
+ {
+ if (!lk.empty ()) {r = ln (*f, lk) || r;}
}
}
@@ -507,29 +505,29 @@ namespace build2
{
const auto& md (t.data<install_match_data> (perform_uninstall_id));
- if ((md.options & lib::option_install_buildtime) != 0)
- {
- // Here we may have a bunch of symlinks that we need to uninstall.
- //
- const scope& rs (t.root_scope ());
- const link_rule::libs_paths& lp (md.libs_paths);
+ // Here we may have a bunch of symlinks that we need to uninstall.
+ //
+ const scope& rs (t.root_scope ());
+ const link_rule::libs_paths& lp (md.libs_paths);
- auto rm = [&rs, &id] (const path& f, const path& l)
- {
- return uninstall_l (rs, id, l.leaf (), f.leaf (), 2 /* verbosity */);
- };
+ auto rm = [&rs, &id] (const path& f, const path& l)
+ {
+ return uninstall_l (rs, id, l.leaf (), f.leaf (), 2 /* verbosity */);
+ };
- const path& lk (lp.link);
- const path& ld (lp.load);
- const path& so (lp.soname);
- const path& in (lp.interm);
+ const path& lk (lp.link);
+ const path& ld (lp.load);
+ const path& so (lp.soname);
+ const path& in (lp.interm);
- const path* f (lp.real);
+ const path* f (lp.real);
- if (!in.empty ()) {r = rm (*f, in) || r; f = &in;}
- if (!so.empty ()) {r = rm (*f, so) || r; f = &so;}
- if (!ld.empty ()) {r = rm (*f, ld) || r; f = &ld;}
- if (!lk.empty ()) {r = rm (*f, lk) || r; }
+ if (!in.empty ()) {r = rm (*f, in) || r; f = &in;}
+ if (!so.empty ()) {r = rm (*f, so) || r; f = &so;}
+ if (!ld.empty ()) {r = rm (*f, ld) || r; f = &ld;}
+ if ((md.options & lib::option_install_buildtime) != 0)
+ {
+ if (!lk.empty ()) {r = rm (*f, lk) || r;}
}
}