From dc46fa754baa446d5428ba38db0d637a17b91c57 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 17 Aug 2016 12:53:37 +0200 Subject: Add support for config.bin.{lib,exe}.{prefix,suffix} This replaces the bin.libprefix functionality. --- build2/bin/init.cxx | 46 +++++++++++++++++++++++++++++++++------------- 1 file changed, 33 insertions(+), 13 deletions(-) (limited to 'build2/bin') diff --git a/build2/bin/init.cxx b/build2/bin/init.cxx index 102c060..0db4400 100644 --- a/build2/bin/init.cxx +++ b/build2/bin/init.cxx @@ -45,7 +45,7 @@ namespace build2 tracer trace ("bin::config_init"); l5 ([&]{trace << "for " << b.out_path ();}); - // Enter configuration variables. + // Enter variables. // if (first) { @@ -62,17 +62,28 @@ namespace build2 v.insert ("config.bin.libs.lib", true); v.insert ("config.bin.rpath", true); + v.insert ("config.bin.lib.prefix", true); + v.insert ("config.bin.lib.suffix", true); + v.insert ("config.bin.exe.prefix", true); + v.insert ("config.bin.exe.suffix", true); + v.insert ("bin.lib"); v.insert ("bin.exe.lib"); v.insert ("bin.liba.lib"); v.insert ("bin.libs.lib"); v.insert ("bin.rpath"); + + v.insert ("bin.lib.prefix"); + v.insert ("bin.lib.suffix"); + v.insert ("bin.exe.prefix"); + v.insert ("bin.exe.suffix"); } // Configure. // using config::required; using config::optional; + using config::omitted; // Adjust module priority (binutils). // @@ -128,6 +139,24 @@ namespace build2 b.assign ("bin.rpath") += cast_null ( optional (r, "config.bin.rpath")); + // config.bin.{lib,exe}.{prefix,suffix} + // + // These ones are not used very often so we will omit them from the + // config.build if not specified. We also override any existing value + // that might have been specified before loading the module. + // + if (const value* v = omitted (r, "config.bin.lib.prefix").first) + b.assign ("bin.lib.prefix") = *v; + + if (const value* v = omitted (r, "config.bin.lib.suffix").first) + b.assign ("bin.lib.suffix") = *v; + + if (const value* v = omitted (r, "config.bin.exe.prefix").first) + b.assign ("bin.exe.prefix") = *v; + + if (const value* v = omitted (r, "config.bin.exe.suffix").first) + b.assign ("bin.exe.suffix") = *v; + if (first) { bool new_val (false); // Set any new values? @@ -140,7 +169,7 @@ namespace build2 // We first see if the value was specified via the configuration // mechanism. // - auto p (required (r, var)); + auto p (omitted (r, var)); const value* v (p.first); // Then see if there is a config hint (e.g., from the C++ module). @@ -216,7 +245,7 @@ namespace build2 // We first see if the value was specified via the configuration // mechanism. // - auto p (required (r, var)); + auto p (omitted (r, var)); const value* v (p.first); // Then see if there is a config hint (e.g., from the C++ module). @@ -266,22 +295,13 @@ namespace build2 scope& b, const location& loc, unique_ptr&, - bool first, + bool, bool, const variable_map& hints) { tracer trace ("bin::init"); l5 ([&]{trace << "for " << b.out_path ();}); - // Enter the rest of the variables. - // - if (first) - { - auto& v (var_pool); - - v.insert ("bin.libprefix", true); - } - // Load bin.config. // if (!cast_false (b["bin.config.loaded"])) -- cgit v1.1