win: Reduce length of command line for combine_libs.py
This fixes "command line is too long" error when running make_distrib.py.
This commit is contained in:
parent
52a9794659
commit
52cb08b973
|
@ -30,11 +30,11 @@ def Shell(*args):
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
||||||
def CollectRemovals(remove_re, inputs):
|
def CollectRemovals(remove_re, build_dir, inputs):
|
||||||
'''Returns a list of all object files in inputs that match remove_re.'''
|
'''Returns a list of all object files in inputs that match remove_re.'''
|
||||||
removals = []
|
removals = []
|
||||||
for input in inputs:
|
for input in inputs:
|
||||||
output = Shell('lib.exe', '/list', input)
|
output = Shell('lib.exe', '/list', os.path.join(build_dir, input))
|
||||||
|
|
||||||
for line in output:
|
for line in output:
|
||||||
line = line.rstrip()
|
line = line.rstrip()
|
||||||
|
@ -44,20 +44,20 @@ def CollectRemovals(remove_re, inputs):
|
||||||
return removals
|
return removals
|
||||||
|
|
||||||
|
|
||||||
def CombineLibraries(output, remove_re, inputs):
|
def CombineLibraries(build_dir, output, remove_re, inputs):
|
||||||
'''Combines all the libraries and objects in inputs, while removing any
|
'''Combines all the libraries and objects in inputs, while removing any
|
||||||
object files that match remove_re.
|
object files that match remove_re.
|
||||||
'''
|
'''
|
||||||
removals = []
|
removals = []
|
||||||
if remove_re:
|
if remove_re:
|
||||||
removals = CollectRemovals(remove_re, inputs)
|
removals = CollectRemovals(remove_re, build_dir, inputs)
|
||||||
|
|
||||||
if len(removals) > 0:
|
if len(removals) > 0:
|
||||||
print('Removals: ', removals)
|
print('Removals: ', removals)
|
||||||
|
|
||||||
args = ['lib.exe', '/out:%s' % output]
|
args = ['lib.exe', '/out:%s' % output]
|
||||||
args += ['/remove:%s' % obj for obj in removals]
|
args += ['/remove:%s' % obj for obj in removals]
|
||||||
args += inputs
|
args += [os.path.join(build_dir, input) for input in inputs]
|
||||||
Shell(*args)
|
Shell(*args)
|
||||||
|
|
||||||
|
|
||||||
|
@ -71,6 +71,8 @@ expression.
|
||||||
|
|
||||||
def GetOptionParser():
|
def GetOptionParser():
|
||||||
parser = optparse.OptionParser(USAGE)
|
parser = optparse.OptionParser(USAGE)
|
||||||
|
parser.add_option(
|
||||||
|
'-b', '--build-dir', dest='build_dir', help='build directory')
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
'-o', '--output', dest='output', help='write to this output library')
|
'-o', '--output', dest='output', help='write to this output library')
|
||||||
parser.add_option(
|
parser.add_option(
|
||||||
|
@ -86,6 +88,7 @@ def Main():
|
||||||
'''Main function for this script'''
|
'''Main function for this script'''
|
||||||
parser = GetOptionParser()
|
parser = GetOptionParser()
|
||||||
(opt, args) = parser.parse_args()
|
(opt, args) = parser.parse_args()
|
||||||
|
build_dir = opt.build_dir
|
||||||
output = opt.output
|
output = opt.output
|
||||||
remove = opt.remove
|
remove = opt.remove
|
||||||
if not output:
|
if not output:
|
||||||
|
@ -113,7 +116,7 @@ def Main():
|
||||||
if 'VS_UNICODE_OUTPUT' in os.environ:
|
if 'VS_UNICODE_OUTPUT' in os.environ:
|
||||||
del os.environ['VS_UNICODE_OUTPUT']
|
del os.environ['VS_UNICODE_OUTPUT']
|
||||||
|
|
||||||
CombineLibraries(output, remove_re, args)
|
CombineLibraries(build_dir, output, remove_re, args)
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -367,8 +367,8 @@ def combine_libs(platform, build_dir, libs, dest_lib):
|
||||||
""" Combine multiple static libraries into a single static library. """
|
""" Combine multiple static libraries into a single static library. """
|
||||||
intermediate_obj = None
|
intermediate_obj = None
|
||||||
if platform == 'windows':
|
if platform == 'windows':
|
||||||
cmdline = 'msvs_env.bat win%s "%s" combine_libs.py -o "%s"' % (
|
cmdline = 'msvs_env.bat win%s "%s" combine_libs.py -b "%s" -o "%s"' % (
|
||||||
platform_arch, sys.executable, dest_lib)
|
platform_arch, sys.executable, build_dir, dest_lib)
|
||||||
elif platform == 'mac':
|
elif platform == 'mac':
|
||||||
# Find CEF_EXPORT symbols from libcef_sandbox.a (include/cef_sandbox_mac.h)
|
# Find CEF_EXPORT symbols from libcef_sandbox.a (include/cef_sandbox_mac.h)
|
||||||
# Export only symbols that include these strings.
|
# Export only symbols that include these strings.
|
||||||
|
@ -400,6 +400,8 @@ def combine_libs(platform, build_dir, libs, dest_lib):
|
||||||
for path in get_files(lib_path): # Expand wildcards in |lib_path|.
|
for path in get_files(lib_path): # Expand wildcards in |lib_path|.
|
||||||
if not path_exists(path):
|
if not path_exists(path):
|
||||||
raise Exception('File not found: ' + path)
|
raise Exception('File not found: ' + path)
|
||||||
|
if platform == 'windows':
|
||||||
|
path = os.path.relpath(path, build_dir)
|
||||||
cmdline += ' "%s"' % path
|
cmdline += ' "%s"' % path
|
||||||
run(cmdline, os.path.join(cef_dir, 'tools'))
|
run(cmdline, os.path.join(cef_dir, 'tools'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue