From 834e835eb362cd94a3e86c260589368cea65af47 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 1 Nov 2023 09:56:21 +0200 Subject: For runtime-only libs{} installation keep all names except link --- libbuild2/cc/install-rule.cxx | 86 +++++++++++++++++++++---------------------- 1 file changed, 42 insertions(+), 44 deletions(-) (limited to 'libbuild2/cc') 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 (t["bin.lib.prefix"])); const string* s (cast_null (t["bin.lib.suffix"])); @@ -468,30 +463,33 @@ namespace build2 { const auto& md (t.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 = ∈} - 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 = ∈} + 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 (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 = ∈} - 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 = ∈} + 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;} } } -- cgit v1.1