aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-08-17 14:40:59 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-08-17 14:40:59 +0200
commit46fdd9eb995af4f704b283f0e6ce2c54d2e43d5c (patch)
tree9fe403084c5862e4d751028f5e964dbd6dd99c47
parent112c57a03bb76413067e4856a6c6492c0a1bbfa5 (diff)
If bpkg has exe.suffix, use it for the default build2 name
So if bpkg is called bpkg-stage, then we by default look for b-stage.
-rw-r--r--bpkg/buildfile2
-rw-r--r--bpkg/common.cli11
-rw-r--r--bpkg/utility.cxx6
3 files changed, 14 insertions, 5 deletions
diff --git a/bpkg/buildfile b/bpkg/buildfile
index 748147c..9d4cc8f 100644
--- a/bpkg/buildfile
+++ b/bpkg/buildfile
@@ -59,6 +59,8 @@ $libs
if ($cxx.id == "msvc")
cxx.coptions += /wd4068
+obj{utility}: cxx.poptions += -DBPKG_EXE_SUFFIX='"'$bin.exe.suffix'"'
+
# Load the cli module but only if it's available. This way a distribution
# that includes pre-generated files can be built without installing cli.
# This is also the reason why above we explicitly spelled out individual
diff --git a/bpkg/common.cli b/bpkg/common.cli
index 587d32d..577b449 100644
--- a/bpkg/common.cli
+++ b/bpkg/common.cli
@@ -75,14 +75,17 @@ namespace bpkg
\li|Even more detailed information.||"
}
- path --build = "b"
+ path --build
{
"<path>",
"The build program to be used to build packages. This should be the path
to the build2 \cb{b} executable. You can also specify additional options
- that should be passed to the build program with \cb{--build-option}. If
- the build program is not explicitly specified, then \cb{bpkg} will use
- \cb{b} by default."
+ that should be passed to the build program with \cb{--build-option}.
+
+ If the build program is not explicitly specified, then \cb{bpkg} will
+ by default use \cb{b} plus an executable suffix if one was specified
+ when building \cb{bpkg}. So, for example, if \cb{bpkg} name was set
+ to \cb{bpkg-1.0}, then it will look for \cb{b-1.0}."
}
strings --build-option
diff --git a/bpkg/utility.cxx b/bpkg/utility.cxx
index 9bf1a5a..a26ab3c 100644
--- a/bpkg/utility.cxx
+++ b/bpkg/utility.cxx
@@ -199,7 +199,11 @@ namespace bpkg
const strings& pvars,
const strings& cvars)
{
- cstrings args {co.build ().string ().c_str ()};
+ const char* b (co.build_specified ()
+ ? co.build ().string ().c_str ()
+ : "b" BPKG_EXE_SUFFIX);
+
+ cstrings args {b};
// Map verbosity level. If we are running quiet or at level 1,
// then run build2 quiet. Otherwise, run it at the same level