aboutsummaryrefslogtreecommitdiffhomepage
path: root/compile.sh
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2018-01-30 06:59:49 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-01-30 07:01:52 -0800
commit4cb8cb806b7ea6351be0948c50675da8f17b09bd (patch)
treee927021abfdbb74c5e674f2005d89c030a46d795 /compile.sh
parentc13c91dc350c0061ef0fc401febc8459396264ef (diff)
Windows,bootstrapping: respect TMPDIR
Respect the user-defined TMPDIR, or use TMP or TEMP on Windows. Since MSYS sets TMP and TEMP to "/tmp" which is actually "<msysroot>/tmp" (e.g. "c:\tools\msys64\tmp"), it is shorter than the Windows-default TEMP directory. This buys us a bit of headroom to not hit path length limits while bootstrapping. Fixes https://github.com/bazelbuild/bazel/issues/4536 Change-Id: I2ab04e3c1c96bc306ef54348cc0c0c2f3fda13ee PiperOrigin-RevId: 183826475
Diffstat (limited to 'compile.sh')
-rwxr-xr-xcompile.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/compile.sh b/compile.sh
index 23412730ad..31bb9c4f1c 100755
--- a/compile.sh
+++ b/compile.sh
@@ -35,8 +35,9 @@ hash tr >&/dev/null || {
# Ensure Python is on the PATH on Windows,otherwise we would see
# "LAUNCHER ERROR" messages from py_binary exe launchers.
-case "$(uname -s | tr [:upper:] [:lower:])" in
+case "$(uname -s | tr "[:upper:]" "[:lower:]")" in
msys*|mingw*|cygwin*)
+ # Ensure Python is on the PATH, otherwise the bootstrapping fails later.
which python.exe >&/dev/null || {
echo >&2 "ERROR: cannot locate python.exe; check your PATH."
echo >&2 " You may need to run the following command, or something"
@@ -44,6 +45,10 @@ msys*|mingw*|cygwin*)
echo >&2 " export PATH=\"/c/Python27:\$PATH\""
exit 1
}
+ # Ensure TMPDIR uses the user-specified TMPDIR or TMP or TEMP.
+ # This is necessary to avoid overly longs paths during bootstrapping, see for
+ # example https://github.com/bazelbuild/bazel/issues/4536
+ export TMPDIR="${TMPDIR:-${TMP:-${TEMP:-}}}"
esac
cd "$(dirname "$0")"