mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 15:15:44 +00:00
wscript: remove long_gcc for windows command line
waf now builds in support to detect the long command line problems for windows. Closes #5138.
This commit is contained in:
45
long_gcc.py
45
long_gcc.py
@@ -1,45 +0,0 @@
|
|||||||
#! /usr/bin/env python3
|
|
||||||
# encoding: utf-8
|
|
||||||
|
|
||||||
"""
|
|
||||||
def build(bld):
|
|
||||||
bld.load('long_gcc')
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os, tempfile
|
|
||||||
from waflib import Task
|
|
||||||
|
|
||||||
def exec_command(self, cmd, **kw):
|
|
||||||
# workaround for command line length limit:
|
|
||||||
# http://support.microsoft.com/kb/830473
|
|
||||||
tmp = None
|
|
||||||
try:
|
|
||||||
if not isinstance(cmd, str) and len(str(cmd)) > 8192:
|
|
||||||
(fd, tmp) = tempfile.mkstemp(dir=self.generator.bld.bldnode.abspath())
|
|
||||||
flat = ['"%s"' % x.replace('\\', '\\\\').replace('"', '\\"') for x in cmd[1:]]
|
|
||||||
try:
|
|
||||||
os.write(fd, ' '.join(flat).encode())
|
|
||||||
finally:
|
|
||||||
if tmp:
|
|
||||||
os.close(fd)
|
|
||||||
# Line may be very long:
|
|
||||||
# Logs.debug('runner:' + ' '.join(flat))
|
|
||||||
cmd = [cmd[0], '@' + tmp]
|
|
||||||
ret = super(self.__class__, self).exec_command(cmd, **kw)
|
|
||||||
finally:
|
|
||||||
if tmp:
|
|
||||||
os.remove(tmp)
|
|
||||||
return ret
|
|
||||||
|
|
||||||
def wrap_class(class_name):
|
|
||||||
cls = Task.classes.get(class_name)
|
|
||||||
if not cls:
|
|
||||||
return None
|
|
||||||
derived_class = type(class_name, (cls,), {})
|
|
||||||
derived_class.exec_command = exec_command
|
|
||||||
if hasattr(cls, 'hcode'):
|
|
||||||
derived_class.hcode = cls.hcode
|
|
||||||
return derived_class
|
|
||||||
|
|
||||||
for k in 'c cxx cprogram cxxprogram cshlib cxxshlib cstlib cxxstlib'.split():
|
|
||||||
wrap_class(k)
|
|
||||||
6
wscript
6
wscript
@@ -1582,11 +1582,6 @@ def append_variant_builds(bld):
|
|||||||
waflib.Options.commands.append(bld.cmd + "_" + var)
|
waflib.Options.commands.append(bld.cmd + "_" + var)
|
||||||
|
|
||||||
|
|
||||||
def long_command_line_workaround(bld):
|
|
||||||
if is_windows_host:
|
|
||||||
bld.load("long_gcc")
|
|
||||||
|
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
if not bld.variant:
|
if not bld.variant:
|
||||||
check_forbidden_options(
|
check_forbidden_options(
|
||||||
@@ -1596,7 +1591,6 @@ def build(bld):
|
|||||||
load_items(bld, bld.env.SPECS)
|
load_items(bld, bld.env.SPECS)
|
||||||
append_variant_builds(bld)
|
append_variant_builds(bld)
|
||||||
return
|
return
|
||||||
long_command_line_workaround(bld)
|
|
||||||
bic = BuildItemContext(bld.env.ARCH_INCLUDES.split(), [], [], [], [], [],
|
bic = BuildItemContext(bld.env.ARCH_INCLUDES.split(), [], [], [], [], [],
|
||||||
[])
|
[])
|
||||||
bsps[bld.env.ARCH][bld.env.BSP_BASE].build(bld, bic)
|
bsps[bld.env.ARCH][bld.env.BSP_BASE].build(bld, bic)
|
||||||
|
|||||||
Reference in New Issue
Block a user