aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/dist/init.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-09-06 17:09:06 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-09-06 17:09:06 +0200
commit7595381c1a6aa75eedae3c982d923ba4154c8e32 (patch)
treeb94b4e290dc974308706282e1702fffe55160f89 /libbuild2/dist/init.cxx
parent52296a1e3e57bdfa80003f37b63f4f263734e2c0 (diff)
Add ability to remap paths in distribution
Specifically, the dist target-specific variable now can specify a path besides true or false. This path is the "imaginary" source location which is used to derive the corresponding distribution local. This location can be either a directory path (to remap with the same file name) or a file path (to remap with a different name). If the path is relative, then it's treated relative to the target directory. Note that to make things less error prone, simple paths without any directory separators are not allowed (use ./<name> instead). Note that if multiple targets end up with the same source location, the behavior is undefined and no diagnostics is issued. Note also that such remapping has no effect in the bootstrap distribution mode.
Diffstat (limited to 'libbuild2/dist/init.cxx')
-rw-r--r--libbuild2/dist/init.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/libbuild2/dist/init.cxx b/libbuild2/dist/init.cxx
index 2b2aaa4..dd8e25b 100644
--- a/libbuild2/dist/init.cxx
+++ b/libbuild2/dist/init.cxx
@@ -71,7 +71,26 @@ namespace build2
vp.insert<paths> ("dist.archives");
vp.insert<paths> ("dist.checksums");
- vp.insert<bool> ("dist", variable_visibility::target); // Flag.
+ // The dist flag or path. Normally it is a flag (true or false) but can
+ // also be used to remap the distribution location.
+ //
+ // In the latter case it specifies the "imaginary" source location which
+ // is used to derive the corresponding distribution local. This location
+ // can be specified as either a directory path (to remap with the same
+ // file name) or a file path (to remap with a different name). And the
+ // way we distinguish between the two is via the presence/absence of the
+ // trailing directory separator. If the path is relative, then it's
+ // treated relative to the target directory. Note that to make things
+ // less error prone, simple paths without any directory separators are
+ // not allowed (use ./<name> instead).
+ //
+ // Note that if multiple targets end up with the same source location,
+ // the behavior is undefined and no diagnostics is issued.
+ //
+ // Note also that such remapping has no effect in the bootstrap
+ // distribution mode.
+ //
+ vp.insert<path> ("dist", variable_visibility::target);
// Project's package name. Note: if set, must be in bootstrap.build.
//