From 063b1a3c038ace6e1d9f8c49c04bf82dd9034828 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 21 Jul 2018 16:33:07 +0200 Subject: Install bash module prerequisites for amalgamation rather than project This is similar to what we do for shared libraries in cc::install_rule. --- build2/bash/rule.cxx | 15 +++++++++++++++ build2/bash/rule.hxx | 11 +++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'build2/bash') diff --git a/build2/bash/rule.cxx b/build2/bash/rule.cxx index 4266c89..d12e743 100644 --- a/build2/bash/rule.cxx +++ b/build2/bash/rule.cxx @@ -422,5 +422,20 @@ namespace build2 return r; } + + const target* install_rule:: + filter (action a, const target& t, const prerequisite& p) const + { + // If this is a module prerequisite, install it as long as it is in the + // same amalgamation as we are. + // + if (p.is_a ()) + { + const target& pt (search (t, p)); + return pt.in (t.weak_scope ()) ? &pt : nullptr; + } + else + return file_rule::filter (a, t, p); + } } } diff --git a/build2/bash/rule.hxx b/build2/bash/rule.hxx index 9957970..5110f97 100644 --- a/build2/bash/rule.hxx +++ b/build2/bash/rule.hxx @@ -58,8 +58,12 @@ namespace build2 const string&) const; }; - // Installation rule for bash scripts (exe{}) and modules (bash{}) that - // signals to in_rule that this is update for install. + // Installation rule for bash scripts (exe{}) and modules (bash{}). Here + // we do: + // + // 1. Signal to in_rule that this is update for install. + // + // 2. Custom filtering of prerequisites. // class install_rule: public install::file_rule { @@ -72,6 +76,9 @@ namespace build2 virtual recipe apply (action, target&) const override; + virtual const target* + filter (action, const target&, const prerequisite&) const override; + private: const in_rule& in_; }; -- cgit v1.1