aboutsummaryrefslogtreecommitdiff
path: root/build2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-08-23 09:46:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-08-23 09:46:11 +0200
commit421d0a4d1a7786e90407072b378cc060d325907d (patch)
tree881b02405e74c11c74979bc6cd5df4f313c209cf /build2
parent6cc8301e4fb819393c1245cea0fbfb89e69b90b4 (diff)
Variables
Diffstat (limited to 'build2')
-rw-r--r--build2/b.cxx10
-rw-r--r--build2/cc/pkgconfig.cxx13
2 files changed, 14 insertions, 9 deletions
diff --git a/build2/b.cxx b/build2/b.cxx
index cb9c2c0..af51a31 100644
--- a/build2/b.cxx
+++ b/build2/b.cxx
@@ -794,7 +794,7 @@ main (int argc, char* argv[])
// limitations as for pre-processing).
//
scope& gs (ctx->global_scope.rw ());
- gs.assign (var_build_meta_operation) = mname;
+ gs.assign (ctx->var_build_meta_operation) = mname;
for (auto oit (opspecs.begin ()); oit != opspecs.end (); ++oit)
{
@@ -1041,7 +1041,7 @@ main (int argc, char* argv[])
// See if the bootstrap process set/changed src_root.
//
- value& v (rs.assign (var_src_root));
+ value& v (rs.assign (ctx->var_src_root));
if (v)
{
@@ -1103,7 +1103,7 @@ main (int argc, char* argv[])
// command line and import).
//
if (forwarded)
- rs.assign (var_forwarded) = true;
+ rs.assign (ctx->var_forwarded) = true;
// Sync local variable that are used below with actual values.
//
@@ -1140,7 +1140,7 @@ main (int argc, char* argv[])
// Note that the subprojects variable has already been processed
// and converted to a map by the bootstrap_src() call above.
//
- if (auto l = rs.vars[var_subprojects])
+ if (auto l = rs.vars[ctx->var_subprojects])
{
for (const auto& p: cast<subprojects> (l))
{
@@ -1413,7 +1413,7 @@ main (int argc, char* argv[])
trace << " out_root: " << out_root;
trace << " src_root: " << src_root;
trace << " forwarded: " << (forwarded ? "true" : "false");
- if (auto l = rs.vars[var_amalgamation])
+ if (auto l = rs.vars[ctx->var_amalgamation])
{
trace << " amalgamation: " << cast<dir_path> (l);
trace << " strong scope: " << *rs.strong_scope ();
diff --git a/build2/cc/pkgconfig.cxx b/build2/cc/pkgconfig.cxx
index 13cc752..038ecc6 100644
--- a/build2/cc/pkgconfig.cxx
+++ b/build2/cc/pkgconfig.cxx
@@ -1228,6 +1228,8 @@ namespace build2
{
tracer trace (x, "pkgconfig_save");
+ context& ctx (l.ctx);
+
const scope& bs (l.base_scope ());
const scope& rs (*bs.root_scope ());
@@ -1256,9 +1258,12 @@ namespace build2
ofdstream os (p);
{
- const project_name& n (cast<project_name> (rs.vars[var_project]));
+ const project_name& n (project (rs));
+
+ if (n.empty ())
+ fail << "no project name in " << rs;
- lookup vl (rs.vars[var_version]);
+ lookup vl (rs.vars[ctx.var_version]);
if (!vl)
fail << "no version variable in project " << n <<
info << "while generating " << p;
@@ -1271,12 +1276,12 @@ namespace build2
// This one is required so make something up if unspecified.
//
os << "Description: ";
- if (const string* s = cast_null<string> (rs[var_project_summary]))
+ if (const string* s = cast_null<string> (rs[ctx.var_project_summary]))
os << *s << endl;
else
os << n << ' ' << v << endl;
- if (const string* u = cast_null<string> (rs[var_project_url]))
+ if (const string* u = cast_null<string> (rs[ctx.var_project_url]))
os << "URL: " << *u << endl;
}