Fix #1059: Linking for mingw/x86_64 on MSYS2 fails, w/ ar execution speed up
parent
61c3f8a440
commit
8d3dc7551d
|
@ -11,34 +11,39 @@ def configure(env):
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
def mySubProcess(cmdline, env):
|
def mySubProcess(cmdline, env):
|
||||||
# print("SPAWNED: " + cmdline)
|
# print(cmdline)
|
||||||
proc = subprocess.run(
|
proc = subprocess.run(args=cmdline, shell=True, env=env)
|
||||||
args=cmdline,
|
|
||||||
shell=True,
|
|
||||||
env=env,
|
|
||||||
)
|
|
||||||
rv = proc.returncode
|
rv = proc.returncode
|
||||||
if rv:
|
if rv:
|
||||||
print("=====")
|
print("=====")
|
||||||
print(rv, "(", hex(rv), ")")
|
print("subprocess.run().returncode=", rv, "(", hex(rv), ")")
|
||||||
|
print("len(cmdline)=", len(cmdline))
|
||||||
print("=====")
|
print("=====")
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
def mySpawn(sh, escape, cmd, args, env):
|
def mySpawn(sh, escape, cmd, args, env):
|
||||||
|
if len(args) > 3 and cmd.endswith("ar"):
|
||||||
newargs = " ".join(args[1:])
|
# print("Long ar command is split.\nargc=", len(args))
|
||||||
cmdline = cmd + " " + newargs
|
lead = len(" ".join(args[0:3]))
|
||||||
|
begin = 3
|
||||||
|
length = lead + 1 + len(args[begin])
|
||||||
rv = 0
|
rv = 0
|
||||||
if len(cmdline) > 32000 and cmd.endswith("ar"):
|
for i in range(4, len(args)):
|
||||||
cmdline = cmd + " " + args[1] + " " + args[2] + " "
|
length += 1 + len(args[i])
|
||||||
for i in range(3, len(args)):
|
if length >= 8 * 1024 - 32:
|
||||||
rv = mySubProcess(cmdline + args[i], env)
|
cmdline = " ".join(args[0:3] + args[begin:i])
|
||||||
|
# print("objs=", i - begin, ", length=", len(cmdline))
|
||||||
|
rv = mySubProcess(cmdline, env)
|
||||||
if rv:
|
if rv:
|
||||||
break
|
break
|
||||||
else:
|
begin = i
|
||||||
|
length = lead + 1 + len(args[i])
|
||||||
|
if not rv:
|
||||||
|
cmdline = " ".join(args[0:3] + args[begin:])
|
||||||
|
# print("objs=", len(args) - begin, ", length=", len(cmdline))
|
||||||
rv = mySubProcess(cmdline, env)
|
rv = mySubProcess(cmdline, env)
|
||||||
|
else:
|
||||||
|
rv = mySubProcess(args, env)
|
||||||
return rv
|
return rv
|
||||||
|
|
||||||
env["SPAWN"] = mySpawn
|
env["SPAWN"] = mySpawn
|
||||||
|
|
Loading…
Reference in New Issue