aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/install/init.cxx4
-rw-r--r--build2/install/rule.cxx35
-rw-r--r--build2/install/rule.hxx13
3 files changed, 52 insertions, 0 deletions
diff --git a/build2/install/init.cxx b/build2/install/init.cxx
index 4ea438b..682f6b0 100644
--- a/build2/install/init.cxx
+++ b/build2/install/init.cxx
@@ -216,12 +216,16 @@ namespace build2
auto& r (bs.rules);
const auto& ar (alias_rule::instance);
+ const auto& dr (fsdir_rule::instance);
const auto& fr (file_rule::instance);
const auto& gr (group_rule_);
r.insert<alias> (perform_install_id, "install.alias", ar);
r.insert<alias> (perform_uninstall_id, "uninstall.alias", ar);
+ r.insert<fsdir> (perform_install_id, "install.fsdir", dr);
+ r.insert<fsdir> (perform_uninstall_id, "install.fsdir", dr);
+
r.insert<file> (perform_install_id, "install.file", fr);
r.insert<file> (perform_uninstall_id, "uninstall.file", fr);
diff --git a/build2/install/rule.cxx b/build2/install/rule.cxx
index df25021..1867134 100644
--- a/build2/install/rule.cxx
+++ b/build2/install/rule.cxx
@@ -125,6 +125,41 @@ namespace build2
return default_recipe;
}
+ // fsdir_rule
+ //
+ const fsdir_rule fsdir_rule::instance;
+
+ bool fsdir_rule::
+ match (action, target&, const string&) const
+ {
+ // We always match.
+ //
+ // Note that we are called both as the outer part during the update-for-
+ // un/install pre-operation and as the inner part during the un/install
+ // operation itself.
+ //
+ return true;
+ }
+
+ recipe fsdir_rule::
+ apply (action a, target& t) const
+ {
+ // If this is outer part of the update-for-un/install, delegate to the
+ // default fsdir rule. Otherwise, this is a noop (we don't install
+ // fsdir{}).
+ //
+ // For now we also assume we don't need to do anything for prerequisites
+ // (the only sensible prerequisite of fsdir{} is another fsdir{}).
+ //
+ if (a.operation () == update_id)
+ {
+ match_inner (a, t);
+ return &execute_inner;
+ }
+ else
+ return noop_recipe;
+ }
+
// group_rule
//
const group_rule group_rule::instance (false /* see_through_only */);
diff --git a/build2/install/rule.hxx b/build2/install/rule.hxx
index 32c6889..8bb2fa3 100644
--- a/build2/install/rule.hxx
+++ b/build2/install/rule.hxx
@@ -46,6 +46,19 @@ namespace build2
static const alias_rule instance;
};
+ class fsdir_rule: public rule
+ {
+ public:
+ virtual bool
+ match (action, target&, const string&) const override;
+
+ virtual recipe
+ apply (action, target&) const override;
+
+ fsdir_rule () {}
+ static const fsdir_rule instance;
+ };
+
// In addition to the alias rule's semantics, this rule sees through to
// the group's members.
//