diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-04-19 11:10:53 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-04-19 11:10:53 +0200 |
commit | 9034f7c51ef6437ce9d4547ba5bde217b4740fb2 (patch) | |
tree | bfaa297fda78b6cafe4487e2281420a4cf77c81a /libbuild2/cc/install-rule.cxx | |
parent | 457f65414031f45174f3c35230a0c0e1de88b51a (diff) |
Use target recipe for auxiliary data storage during match-apply
In particular, we now have separate auxiliary data storage for inner
and outer operations.
Diffstat (limited to 'libbuild2/cc/install-rule.cxx')
-rw-r--r-- | libbuild2/cc/install-rule.cxx | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/libbuild2/cc/install-rule.cxx b/libbuild2/cc/install-rule.cxx index d83bf70..0b4d1e1 100644 --- a/libbuild2/cc/install-rule.cxx +++ b/libbuild2/cc/install-rule.cxx @@ -160,6 +160,20 @@ namespace build2 file_rule::match (a, t); } + // Wrap the file_rule's recipe into a data-carrying recipe. + // + struct install_match_data + { + build2::recipe recipe; + link_rule::libs_paths libs_paths; + + target_state + operator() (action a, const target& t) + { + return recipe (a, t); + } + }; + recipe install_rule:: apply (action a, target& t) const { @@ -173,7 +187,7 @@ namespace build2 // Signal to the link rule that this is update for install. And if the // update has already been executed, verify it was done for install. // - auto& md (t.data<link_rule::match_data> ()); + auto& md (t.data<link_rule::match_data> (a.inner_action ())); if (md.for_install) { @@ -198,10 +212,12 @@ namespace build2 { const string* p (cast_null<string> (t["bin.lib.prefix"])); const string* s (cast_null<string> (t["bin.lib.suffix"])); - t.data ( + + return install_match_data { + move (r), link_.derive_libs_paths (*f, p != nullptr ? p->c_str (): nullptr, - s != nullptr ? s->c_str (): nullptr)); + s != nullptr ? s->c_str (): nullptr)}; } } } @@ -219,7 +235,7 @@ namespace build2 // Here we may have a bunch of symlinks that we need to install. // const scope& rs (t.root_scope ()); - auto& lp (t.data<link_rule::libs_paths> ()); + auto& lp (t.data<install_match_data> (perform_install_id).libs_paths); auto ln = [&rs, &id] (const path& f, const path& l) { @@ -253,7 +269,7 @@ namespace build2 // Here we may have a bunch of symlinks that we need to uninstall. // const scope& rs (t.root_scope ()); - auto& lp (t.data<link_rule::libs_paths> ()); + auto& lp (t.data<install_match_data> (perform_uninstall_id).libs_paths); auto rm = [&rs, &id] (const path& l) { |