aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2023-11-01 09:44:05 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2023-11-01 10:36:28 +0200
commit7bcb45cba78795dccdb2684f6f290daeb8bab488 (patch)
treecd7dfc7182b82dc302bf62d539ac49b1ca7581dc /libbuild2
parentae9baf01f2a9627b7f1f2dc9db349d89c992f740 (diff)
Handle match options for post hoc libs{} prerequisites in cc::install_rule
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/cc/install-rule.cxx72
-rw-r--r--libbuild2/cc/install-rule.hxx6
2 files changed, 78 insertions, 0 deletions
diff --git a/libbuild2/cc/install-rule.cxx b/libbuild2/cc/install-rule.cxx
index 7327711..28d1a58 100644
--- a/libbuild2/cc/install-rule.cxx
+++ b/libbuild2/cc/install-rule.cxx
@@ -18,6 +18,9 @@ namespace build2
{
using namespace bin;
+ using posthoc_prerequisite_target =
+ context::posthoc_target::prerequisite_target;
+
// install_rule
//
install_rule::
@@ -376,6 +379,30 @@ namespace build2
}
void install_rule::
+ apply_posthoc (action a, target& t, match_extra& me) const
+ {
+ // Similar semantics to filter() above for shared libraries specified as
+ // post hoc prerequisites (e.g., plugins).
+ //
+ if (a.operation () != update_id)
+ {
+ for (posthoc_prerequisite_target& p: *me.posthoc_prerequisite_targets)
+ {
+ if (p.target != nullptr && p.target->is_a<libs> ())
+ {
+ if (t.is_a<exe> ())
+ p.match_options = lib::option_install_runtime;
+ else
+ {
+ if (me.cur_options == lib::option_install_runtime)
+ p.match_options = lib::option_install_runtime;
+ }
+ }
+ }
+ }
+ }
+
+ void install_rule::
reapply (action a, target& t, match_extra& me) const
{
tracer trace ("cc::install_rule::reapply");
@@ -410,6 +437,19 @@ namespace build2
}
}
+ // Also to post hoc.
+ //
+ if (me.posthoc_prerequisite_targets != nullptr)
+ {
+ for (posthoc_prerequisite_target& p: *me.posthoc_prerequisite_targets)
+ {
+ if (p.target != nullptr && p.target->is_a<libs> ())
+ {
+ p.match_options = match_extra::all_options;
+ }
+ }
+ }
+
// Also match any additional prerequisites (e.g., headers).
//
file_rule::reapply_impl (a, t, me);
@@ -685,6 +725,27 @@ namespace build2
}
void libux_install_rule::
+ apply_posthoc (action a, target& t, match_extra& me) const
+ {
+ if (a.operation () != update_id)
+ {
+ for (posthoc_prerequisite_target& p: *me.posthoc_prerequisite_targets)
+ {
+ if (p.target != nullptr && p.target->is_a<libs> ())
+ {
+ if (t.is_a<libue> ())
+ p.match_options = lib::option_install_runtime;
+ else
+ {
+ if (me.cur_options == lib::option_install_runtime)
+ p.match_options = lib::option_install_runtime;
+ }
+ }
+ }
+ }
+ }
+
+ void libux_install_rule::
reapply (action a, target& t, match_extra& me) const
{
tracer trace ("cc::linux_install_rule::reapply");
@@ -706,6 +767,17 @@ namespace build2
rematch_sync (a, *pt, match_extra::all_options);
}
+ if (me.posthoc_prerequisite_targets != nullptr)
+ {
+ for (posthoc_prerequisite_target& p: *me.posthoc_prerequisite_targets)
+ {
+ if (p.target != nullptr && p.target->is_a<libs> ())
+ {
+ p.match_options = match_extra::all_options;
+ }
+ }
+ }
+
alias_rule::reapply_impl (a, t, me);
}
}
diff --git a/libbuild2/cc/install-rule.hxx b/libbuild2/cc/install-rule.hxx
index 9d9211b..771c33b 100644
--- a/libbuild2/cc/install-rule.hxx
+++ b/libbuild2/cc/install-rule.hxx
@@ -55,6 +55,9 @@ namespace build2
apply (action, target&, match_extra&) const override;
virtual void
+ apply_posthoc (action, target&, match_extra&) const override;
+
+ virtual void
reapply (action, target&, match_extra&) const override;
virtual bool
@@ -97,6 +100,9 @@ namespace build2
apply (action, target&, match_extra&) const override;
virtual void
+ apply_posthoc (action, target&, match_extra&) const override;
+
+ virtual void
reapply (action, target&, match_extra&) const override;
private: