From 46fdd9eb995af4f704b283f0e6ce2c54d2e43d5c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 17 Aug 2016 14:40:59 +0200 Subject: 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. --- bpkg/buildfile | 2 ++ bpkg/common.cli | 11 +++++++---- bpkg/utility.cxx | 6 +++++- 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 { "", "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 -- cgit v1.1