summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlvin Wong <alvinhochun@gmail.com>2024-09-19 22:04:55 +0800
committerAlvin Wong <alvinhochun@gmail.com>2024-09-19 22:19:15 +0800
commit454251660c4c227121be6a6bab67b2998ffbf81a (patch)
tree7f4395ae559a7b6ab0d600306ef75750c5431124
parent694d3c2930bdfb43fd93e1e6641f66c4f19a5c77 (diff)
downloadredot-engine-454251660c4c227121be6a6bab67b2998ffbf81a.tar.gz
Fix using Binutils AR with TEMPFILE on Windows
Set `TEMPFILEARGESCFUNC`[1] to replace backslashes with forward slashes in paths. [1]: https://scons.org/doc/production/HTML/scons-user/apa.html#cv-TEMPFILEARGESCFUNC
-rw-r--r--platform/windows/detect.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 2db58172bf..db4c743595 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -704,6 +704,17 @@ def get_is_ar_thin_supported(env):
return False
+WINPATHSEP_RE = re.compile(r"\\([^\"'\\]|$)")
+
+
+def tempfile_arg_esc_func(arg):
+ from SCons.Subst import quote_spaces
+
+ arg = quote_spaces(arg)
+ # GCC requires double Windows slashes, let's use UNIX separator
+ return WINPATHSEP_RE.sub(r"/\1", arg)
+
+
def configure_mingw(env: "SConsEnvironment"):
# Workaround for MinGW. See:
# https://www.scons.org/wiki/LongCmdLinesOnWin32
@@ -713,6 +724,8 @@ def configure_mingw(env: "SConsEnvironment"):
env["ARCOM_ORIG"] = env["ARCOM"]
env["ARCOM"] = "${TEMPFILE('$ARCOM_ORIG', '$ARCOMSTR')}"
env["TEMPFILESUFFIX"] = ".rsp"
+ if os.name == "nt":
+ env["TEMPFILEARGESCFUNC"] = tempfile_arg_esc_func
## Build type