aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-04-21 10:35:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-04-22 09:02:03 +0200
commit1ac5458eede2b4b2d3bc98cde787348f70328361 (patch)
tree031115d69cc8db08ada7735966bb88d09e3716df
parent35c1c44bc5f75a327f5d879373a9683af2072a1a (diff)
Add another hash/save_environment() overload
-rw-r--r--libbuild2/cc/guess.cxx4
-rw-r--r--libbuild2/config/utility.hxx10
-rw-r--r--libbuild2/utility.hxx6
-rw-r--r--libbuild2/utility.ixx15
4 files changed, 33 insertions, 2 deletions
diff --git a/libbuild2/cc/guess.cxx b/libbuild2/cc/guess.cxx
index 82be591..839bf20 100644
--- a/libbuild2/cc/guess.cxx
+++ b/libbuild2/cc/guess.cxx
@@ -1812,7 +1812,7 @@ namespace build2
// See "Environment Variables Affecting GCC".
//
- // @@ TODO: Yt feels like we should unset the following variables:
+ // @@ TODO: It feels like we should unset the following variables:
//
// DEPENDENCIES_OUTPUT
// SUNPRO_DEPENDENCIES
@@ -1835,7 +1835,7 @@ namespace build2
nullptr};
// Note that Clang recognizes a whole family of *_DEPLOYMENT_TARGET
- // variables.
+ // variables (as does ld64).
//
static const char* macos_env[] = {
"SDKROOT", "MACOSX_DEPLOYMENT_TARGET", nullptr};
diff --git a/libbuild2/config/utility.hxx b/libbuild2/config/utility.hxx
index 8dc0650..4673d0c 100644
--- a/libbuild2/config/utility.hxx
+++ b/libbuild2/config/utility.hxx
@@ -139,6 +139,16 @@ namespace build2
}
inline void
+ save_environment (scope& rs, const cstrings& vars)
+ {
+ if (config_save_environment != nullptr)
+ {
+ for (const char* var: vars)
+ config_save_environment (rs, var);
+ }
+ }
+
+ inline void
save_environment (scope& rs, const strings& vars)
{
if (config_save_environment != nullptr)
diff --git a/libbuild2/utility.hxx b/libbuild2/utility.hxx
index b4a8ce4..c3e1921 100644
--- a/libbuild2/utility.hxx
+++ b/libbuild2/utility.hxx
@@ -818,6 +818,12 @@ namespace build2
hash_environment (initializer_list<const char*> names);
void
+ hash_environment (sha256&, const cstrings& names);
+
+ string
+ hash_environment (const cstrings& names);
+
+ void
hash_environment (sha256&, const strings& names);
string
diff --git a/libbuild2/utility.ixx b/libbuild2/utility.ixx
index 3f9d34b..aedfc94 100644
--- a/libbuild2/utility.ixx
+++ b/libbuild2/utility.ixx
@@ -274,6 +274,21 @@ namespace build2
}
inline void
+ hash_environment (sha256& cs, const cstrings& ns)
+ {
+ for (const char* n: ns)
+ hash_environment (cs, n);
+ }
+
+ inline string
+ hash_environment (const cstrings& ns)
+ {
+ sha256 cs;
+ hash_environment (cs, ns);
+ return cs.string ();
+ }
+
+ inline void
hash_environment (sha256& cs, const strings& ns)
{
for (const string& n: ns)