diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2023-03-23 06:18:26 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2023-03-23 06:18:26 +0200 |
commit | 5a763a5552184090602f0a9303b9266f5412f020 (patch) | |
tree | 0cf1fb0189157c4d02976156007fe4ee6ad7f1d1 /libbuild2/install/utility.hxx | |
parent | f62b8809d827a0474284e75ad5724cf201ed83b1 (diff) |
Add support for relocatable installation manifest
Diffstat (limited to 'libbuild2/install/utility.hxx')
-rw-r--r-- | libbuild2/install/utility.hxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libbuild2/install/utility.hxx b/libbuild2/install/utility.hxx index 530a9d7..7ab8114 100644 --- a/libbuild2/install/utility.hxx +++ b/libbuild2/install/utility.hxx @@ -86,6 +86,18 @@ namespace build2 // LIBBUILD2_SYMEXPORT path resolve_file (const file&); // rule.cxx + + // Given an abolute path return its chroot'ed version, if any, accoring to + // install.chroot. + // + template <typename P> + inline P + chroot_path (const scope& rs, const P& p) + { + assert (p.absolute ()); + const dir_path* d (cast_null<dir_path> (rs["install.chroot"])); + return d != nullptr ? *d / p.leaf (p.root_directory ()) : p; + } } } |