1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Remove ARFLAGS hack for Windows, replace with TEMPFILE

TEMPFILE is the built-in way of SCons to use a response file for command
lines that are too long.
This commit is contained in:
Alvin Wong
2024-09-01 04:03:00 +08:00
parent 61598c5c88
commit 28b95ff550
2 changed files with 11 additions and 18 deletions

View File

@@ -467,16 +467,6 @@ def use_windows_spawn_fix(self, platform=None):
if os.name != "nt":
return # not needed, only for windows
# On Windows, due to the limited command line length, when creating a static library
# from a very high number of objects SCons will invoke "ar" once per object file;
# that makes object files with same names to be overwritten so the last wins and
# the library loses symbols defined by overwritten objects.
# By enabling quick append instead of the default mode (replacing), libraries will
# got built correctly regardless the invocation strategy.
# Furthermore, since SCons will rebuild the library from scratch when an object file
# changes, no multiple versions of the same object file will be present.
self.Replace(ARFLAGS="q")
def mySubProcess(cmdline, env):
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
@@ -500,19 +490,17 @@ def use_windows_spawn_fix(self, platform=None):
return rv
def mySpawn(sh, escape, cmd, args, env):
# Used by TEMPFILE.
if cmd == "del":
os.remove(args[1])
return 0
newargs = " ".join(args[1:])
cmdline = cmd + " " + newargs
rv = 0
env = {str(key): str(value) for key, value in iter(env.items())}
if len(cmdline) > 32000 and cmd.endswith("ar"):
cmdline = cmd + " " + args[1] + " " + args[2] + " "
for i in range(3, len(args)):
rv = mySubProcess(cmdline + args[i], env)
if rv:
break
else:
rv = mySubProcess(cmdline, env)
rv = mySubProcess(cmdline, env)
return rv