aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/install-rule.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-01-20 13:46:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-02-03 14:35:45 +0200
commit934f2a9a90c5cad3cdc8a66b50c17827a3ddbcee (patch)
treef35f106e5369e98350327c79080c571195234c0b /build2/cc/install-rule.hxx
parent280f4a5bf787587227ca193cd59c6bd74091db70 (diff)
Get rid of action rule override semantics
Instead we now have two more or less separate match states for outer and inner parts of an action.
Diffstat (limited to 'build2/cc/install-rule.hxx')
-rw-r--r--build2/cc/install-rule.hxx77
1 files changed, 77 insertions, 0 deletions
diff --git a/build2/cc/install-rule.hxx b/build2/cc/install-rule.hxx
new file mode 100644
index 0000000..ac2f93a
--- /dev/null
+++ b/build2/cc/install-rule.hxx
@@ -0,0 +1,77 @@
+// file : build2/cc/install-rule.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef BUILD2_CC_INSTALL_RULE_HXX
+#define BUILD2_CC_INSTALL_RULE_HXX
+
+#include <build2/types.hxx>
+#include <build2/utility.hxx>
+
+#include <build2/install/rule.hxx>
+
+#include <build2/cc/types.hxx>
+#include <build2/cc/common.hxx>
+
+namespace build2
+{
+ namespace cc
+ {
+ class link_rule;
+
+ // Installation rule for exe{} and lib*{}. Here we do:
+ //
+ // 1. Signal to the link rule that this is update for install.
+ //
+ // 2. Additional filtering of prerequisites (e.g., headers of an exe{}).
+ //
+ // 3. Extra un/installation (e.g., libs{} symlinks).
+ //
+ class install_rule: public install::file_rule, virtual common
+ {
+ public:
+ install_rule (data&&, const link_rule&);
+
+ virtual const target*
+ filter (action, const target&, prerequisite_member) const override;
+
+ virtual bool
+ match (action, target&, const string&) const override;
+
+ virtual recipe
+ apply (action, target&) const override;
+
+ virtual bool
+ install_extra (const file&, const install_dir&) const override;
+
+ virtual bool
+ uninstall_extra (const file&, const install_dir&) const override;
+
+ private:
+ const link_rule& link_;
+ };
+
+ // Installation rule for libu*{}.
+ //
+ // While libu*{} themselves are not installable, we need to see through
+ // them in case they depend on stuff that we need to install (e.g.,
+ // headers). Note that we use the alias_rule as a base.
+ //
+ class libux_install_rule: public install::alias_rule, virtual common
+ {
+ public:
+ libux_install_rule (data&&, const link_rule&);
+
+ virtual const target*
+ filter (action, const target&, prerequisite_member) const override;
+
+ virtual bool
+ match (action, target&, const string&) const override;
+
+ private:
+ const link_rule& link_;
+ };
+ }
+}
+
+#endif // BUILD2_CC_INSTALL_RULE_HXX