aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/b.cxx3
-rw-r--r--build2/context.cxx2
-rw-r--r--build2/utility6
-rw-r--r--build2/utility.cxx5
4 files changed, 13 insertions, 3 deletions
diff --git a/build2/b.cxx b/build2/b.cxx
index d800605..a652c97 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -161,7 +161,8 @@ main (int argc, char* argv[])
// Global initializations.
//
- init (ops.verbose_specified ()
+ init (argv[0],
+ ops.verbose_specified ()
? ops.verbose ()
: ops.V () ? 3 : ops.v () ? 2 : ops.q () ? 0 : 1);
diff --git a/build2/context.cxx b/build2/context.cxx
index c783832..6d39da2 100644
--- a/build2/context.cxx
+++ b/build2/context.cxx
@@ -238,6 +238,8 @@ namespace build2
v.insert<string> ("extension", variable_visibility::target);
}
+ gs.assign<path> ("build.driver") = argv0;
+
gs.assign<dir_path> ("build.work") = work;
gs.assign<dir_path> ("build.home") = home;
diff --git a/build2/utility b/build2/utility
index 56e0c47..7c30395 100644
--- a/build2/utility
+++ b/build2/utility
@@ -83,6 +83,10 @@ namespace build2
next_word (const string&, size_t n, size_t& b, size_t& e,
char d1 = ' ', char d2 = '\0');
+ // Build system driver recall path (argv[0]).
+ //
+ extern path argv0;
+
// Work/home directories (must be initialized in main()) and relative path
// calculation.
//
@@ -476,7 +480,7 @@ namespace build2
// Should be called early in main() once.
//
void
- init (uint16_t verbosity);
+ init (const char* argv0, uint16_t verbosity);
}
#include <build2/utility.ixx>
diff --git a/build2/utility.cxx b/build2/utility.cxx
index ca6b239..4b68edb 100644
--- a/build2/utility.cxx
+++ b/build2/utility.cxx
@@ -89,6 +89,7 @@ namespace build2
return l;
}
+ path argv0;
dir_path work;
dir_path home;
const dir_path* relative_base = &work;
@@ -505,8 +506,10 @@ namespace build2
bool exception_unwinding_dtor = false;
void
- init (uint16_t v)
+ init (const char* a0, uint16_t v)
{
+ argv0 = path (a0);
+
// Diagnostics verbosity.
//
verb = v;