scons: Capture TMPDIR envvar

During gem5 build, the compiler may produce some large intermediate
files. The default path is /tmp, but in some usecase, it's under a small
file system, and we may want to change the storage path to a sufficient
large file system. This CL captures TMPDIR environment variables, to
allow users change the default temporary directory.

Change-Id: Ib3fad301f36df9f3f08eb9b6cfeb4df1b7df5d1a
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/64873
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/site_scons/gem5_scons/defaults.py b/site_scons/gem5_scons/defaults.py
index 2a4e020..a07b7ff 100644
--- a/site_scons/gem5_scons/defaults.py
+++ b/site_scons/gem5_scons/defaults.py
@@ -77,6 +77,7 @@
         "INCLUDE_SERVER_",  # distcc pump server settings
         "M5",  # M5 configuration (e.g., path to kernels)
         "NIX_",  # wrapped binaries if using nix package manager
+        "TMPDIR",  # default temporary directory
     ]
 
     for key, val in sorted(os.environ.items()):