summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2021-03-10 11:05:39 +0100
committerRémi Verschelde <rverschelde@gmail.com>2021-03-10 11:07:34 +0100
commitb7ebd22314f72c1021bd75efd14583089027558f (patch)
tree765f5ce16c13c6f90e2e1343731f6c2e630ca816 /SConstruct
parent469ac1e4152b75b2e3b88cf7bc3a9623f0d7da39 (diff)
SCons: Use default env["ENV"] and prepend PATH to it
See discussion in #46814. Now going with the safe option again (like in 3.2) as it turns out that we can't rely on user environments on Windows, since each shell has a different set of env variables (especially the ones necessary to use MSVC). SCons does its own magic when we don't pass it an `ENV` dictionary, so we should preserve it and only add things in a second step. Fixes this warning when compiling with MSVC using git-bash.exe: ``` Missing environment variable: WindowsSdkDir ``` Possibly fixes build issues when having both MinGW and MSVC installed and an older SCons version.
Diffstat (limited to 'SConstruct')
-rw-r--r--SConstruct10
1 files changed, 8 insertions, 2 deletions
diff --git a/SConstruct b/SConstruct
index 1fec033881..b006dddbe6 100644
--- a/SConstruct
+++ b/SConstruct
@@ -61,8 +61,14 @@ elif platform_arg == "javascript":
# Use generic POSIX build toolchain for Emscripten.
custom_tools = ["cc", "c++", "ar", "link", "textfile", "zip"]
-# Construct the environment using the user's host env variables.
-env_base = Environment(ENV=os.environ, tools=custom_tools)
+# We let SCons build its default ENV as it includes OS-specific things which we don't
+# want to have to pull in manually.
+# Then we prepend PATH to make it take precedence, while preserving SCons' own entries.
+env_base = Environment(tools=custom_tools)
+env_base.PrependENVPath("PATH", os.getenv("PATH"))
+env_base.PrependENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH"))
+if "TERM" in os.environ: # Used for colored output.
+ env_base["ENV"]["TERM"] = os.environ["TERM"]
env_base.disabled_modules = []
env_base.module_version_string = ""