diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2022-01-26 13:00:34 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2022-01-26 13:00:34 +0200 |
commit | 9b238b9b81a04554edbd6bc35d12aac0433cd511 (patch) | |
tree | 4873066ede5b9c1efcdc970603a4695bbcfb7e2b /libbuild2/bash/utility.hxx | |
parent | 614ac547aabbf9c6168e3ad42dad6ee022de2080 (diff) |
Make bash module install into bin/<project>.bash/ to avoid clashes
Also, expect the first component in the import path to be full project
name even in case it has the .bash extension.
Diffstat (limited to 'libbuild2/bash/utility.hxx')
-rw-r--r-- | libbuild2/bash/utility.hxx | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/libbuild2/bash/utility.hxx b/libbuild2/bash/utility.hxx index 087fc38..e5e4377 100644 --- a/libbuild2/bash/utility.hxx +++ b/libbuild2/bash/utility.hxx @@ -11,14 +11,26 @@ namespace build2 { namespace bash { - // Strip the .bash extension from the project name. + // Return the bash{} modules installation directory under bin/. // - // Note that the result may not be a valid project name. + // Note that we used to install into bin/<project>/ but that has a good + // chance of clashing with the project's executable. Adding the .bash + // extension feels like a good idea since in our model the executables + // should not use the .bash extension (only modules) and therefore are + // unlikely to clash with this name. + // + // One drawback of this approach is that in case of a project like + // libbutl.bash we now have different module directories inside the + // project (libbutl/) and when installed (libbutl.bash/). Also, the + // installation directory will be shared with the libbutl project but + // that's probably ok (and we had the same issue before). // inline string - project_base (const project_name& pn) + modules_install_dir (const project_name& pn) { - return pn.base ("bash"); + // Strip the .bash extension if present not to duplicate it. + // + return pn.base ("bash") + ".bash"; } } } |