Hi @vkuznet - This isn't the right way to do this. SCons, as part of its design, intentionally does not allow environment variables into the build by default. This is intended to ensure reproducible builds, and this is actually a feature that we support.
However, we do recognize that sometimes, as in your case, you need to do this. So, we have provided a mechanism to allow users to externally script injections into the SCons environment.
This is accomplished by configuring SCons 'Variables'. Among those variables is `ENV`, which contains a dictionary of shell environment variables that should be propagated into the environment of processes started by SCons.
While Variables are typically configured on the command line (e.g. `scons VAR=value`), it is clear that the `ENV` variable cannot be configured in this manner (how would you specify the dictionary?). Instead, we have provided the ability to load Variables from a file, with the SCons flag `--variables-files`.
The `--variables-files` option takes a delimiter separated list of files and loads Variable definitions from them. In particular, we have provided a pre-canned Variables file that explicitly imports the calling shell environment to handle situations like the one you have described:
https://github.com/mongodb/mongo/blob/master/etc/scons/propagate_shell_environment.vars
Invoking SCons as:
scons --variables-files=etc/scons/propagate_shell_environment.vars ...
|
will achieve the same effect as the change you have made in this pull request, without unconditionally forcing it on all users of the MongoDB build system.