aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/install
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-03-21 13:39:51 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-03-21 13:39:51 +0200
commit27db5f97c0f7460c2c0d2e28660c69cbc6d1207e (patch)
treeb8eaf7d7e31ca5b95ec89911c83fc5df0a621fe1 /libbuild2/install
parent5a4efaa7ce675c0f68a94aeb822d82896bd29a2d (diff)
Filter out exe{} prerequisites in install group rule similar to file rule
Diffstat (limited to 'libbuild2/install')
-rw-r--r--libbuild2/install/rule.cxx19
-rw-r--r--libbuild2/install/rule.hxx10
2 files changed, 29 insertions, 0 deletions
diff --git a/libbuild2/install/rule.cxx b/libbuild2/install/rule.cxx
index 3ed61f3..468fcc3 100644
--- a/libbuild2/install/rule.cxx
+++ b/libbuild2/install/rule.cxx
@@ -215,6 +215,23 @@ namespace build2
return &m;
}
+ const target* group_rule::
+ filter (const scope* is,
+ action, const target& t, const prerequisite& p) const
+ {
+ // The same logic as in file_rule::filter() below.
+ //
+ if (p.is_a<exe> ())
+ {
+ if (p.vars.empty () ||
+ cast_empty<path> (p.vars[var_install (t.ctx)]).string () != "true")
+ return nullptr;
+ }
+
+ const target& pt (search (t, p));
+ return is == nullptr || pt.in (*is) ? &pt : nullptr;
+ }
+
recipe group_rule::
apply (action a, target& t) const
{
@@ -303,6 +320,8 @@ namespace build2
filter (const scope* is,
action, const target& t, const prerequisite& p) const
{
+ // See also group_rule::filter() with identical semantics.
+ //
if (p.is_a<exe> ())
{
// Note that while include() checks for install=false, here we need to
diff --git a/libbuild2/install/rule.hxx b/libbuild2/install/rule.hxx
index 53d97d2..79cef85 100644
--- a/libbuild2/install/rule.hxx
+++ b/libbuild2/install/rule.hxx
@@ -88,8 +88,18 @@ namespace build2
virtual const target*
filter (action, const target&, const target& group_member) const;
+ // Return NULL if this prerequisite should be ignored and pointer to its
+ // target otherwise.
+ //
+ // The same semantics as in file_rule below.
+ //
using alias_rule::filter; // "Unhide" to make Clang happy.
+ virtual const target*
+ filter (const scope*,
+ action, const target&,
+ const prerequisite&) const override;
+
virtual recipe
apply (action, target&) const override;