From 7595381c1a6aa75eedae3c982d923ba4154c8e32 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 6 Sep 2022 17:09:06 +0200 Subject: 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 ./ 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. --- libbuild2/dist/init.cxx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'libbuild2/dist/init.cxx') 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 ("dist.archives"); vp.insert ("dist.checksums"); - vp.insert ("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 ./ 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 ("dist", variable_visibility::target); // Project's package name. Note: if set, must be in bootstrap.build. // -- cgit v1.1