aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-09-16 08:39:05 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-09-16 08:39:05 +0200
commit65ce598d17a662b4c8b9a8df02b619549c5824c3 (patch)
treebd0e3dd010120b154cf4490e458f0c4e34ece93d
parent505021d9297fcbc9232f7d5c2de432d5316dad08 (diff)
Register fallback dist meta-operation rule for out of project targets
The problematic scenario this fixes is an ad hoc pattern rule (which we register for dist in order to inject any additional sources; see parser.cxx for details) that pulls a tool imported from the system (say /usr/bin/xxd).
-rw-r--r--libbuild2/config/init.cxx6
-rw-r--r--libbuild2/dist/init.cxx12
-rw-r--r--libbuild2/parser.cxx4
3 files changed, 18 insertions, 4 deletions
diff --git a/libbuild2/config/init.cxx b/libbuild2/config/init.cxx
index e921657..72ded05 100644
--- a/libbuild2/config/init.cxx
+++ b/libbuild2/config/init.cxx
@@ -702,10 +702,12 @@ namespace build2
// Register alias and fallback rule for the configure meta-operation.
//
- // We need this rule for out-of-any-project dependencies (e.g.,
- // libraries imported from /usr/lib). We are registring it on the
+ // We need this rule for out-of-any-project dependencies (for example,
+ // libraries imported from /usr/lib). We are registering it on the
// global scope similar to builtin rules.
//
+ // See a similar rule in the dist module.
+ //
rs.global_scope ().insert_rule<mtime_target> (
configure_id, 0, "config.file", file_rule::instance);
diff --git a/libbuild2/dist/init.cxx b/libbuild2/dist/init.cxx
index dd8e25b..5e371bf 100644
--- a/libbuild2/dist/init.cxx
+++ b/libbuild2/dist/init.cxx
@@ -3,8 +3,9 @@
#include <libbuild2/dist/init.hxx>
-#include <libbuild2/scope.hxx>
#include <libbuild2/file.hxx>
+#include <libbuild2/rule.hxx>
+#include <libbuild2/scope.hxx>
#include <libbuild2/diagnostics.hxx>
#include <libbuild2/config/utility.hxx>
@@ -209,6 +210,15 @@ namespace build2
rs.insert_rule<target> (dist_id, 0, "dist", rule_);
rs.insert_rule<alias> (dist_id, 0, "dist.alias", rule_);
+ // We need this rule for out-of-any-project dependencies (for example,
+ // executables imported from /usr/bin, etc). We are registering it on
+ // the global scope similar to builtin rules.
+ //
+ // See a similar rule in the config module.
+ //
+ rs.global_scope ().insert_rule<mtime_target> (
+ dist_id, 0, "dist.file", file_rule::instance);
+
// Configuration.
//
// Adjust module priority so that the config.dist.* values are saved at
diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx
index 03b912d..e21fc8d 100644
--- a/libbuild2/parser.cxx
+++ b/libbuild2/parser.cxx
@@ -1307,7 +1307,9 @@ namespace build2
// recipe for dist.
//
// And the same for the configure meta-operation to, for
- // example, make sure a hinted ad hoc rule matches.
+ // example, make sure a hinted ad hoc rule matches. @@ Hm,
+ // maybe we fixed this with action-specific hints? But the
+ // injection part above may still apply.
//
if (a.meta_operation () == perform_id)
{