mirror of
https://github.com/UltraCoderRU/libwebrtc.git
synced 2026-01-28 11:15:13 +00:00
Remove merge_libs_wrapper.py script
This commit is contained in:
parent
2d1dd68e00
commit
377c684fc6
1 changed files with 0 additions and 110 deletions
|
|
@ -1,110 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
# Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
|
||||||
#
|
|
||||||
# Use of this source code is governed by a BSD-style license
|
|
||||||
# that can be found in the LICENSE file in the root of the source
|
|
||||||
# tree. An additional intellectual property rights grant can be found
|
|
||||||
# in the file PATENTS. All contributing project authors may
|
|
||||||
# be found in the AUTHORS file in the root of the source tree.
|
|
||||||
|
|
||||||
# Searches for libraries or object files on the specified path and merges them
|
|
||||||
# them into a single library. Assumes ninja is used on all platforms.
|
|
||||||
|
|
||||||
import fnmatch
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import vs_toolchain
|
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
|
||||||
vs_toolchain.GetToolchainDir()
|
|
||||||
os.environ['PATH'] += os.pathsep + os.environ['GYP_MSVS_OVERRIDE_PATH'] + '\\VC\\bin'
|
|
||||||
|
|
||||||
IGNORE_PATTERNS = ['do_not_use', 'protoc', 'genperf']
|
|
||||||
|
|
||||||
def FindFiles(path, pattern):
|
|
||||||
"""Finds files matching |pattern| under |path|.
|
|
||||||
|
|
||||||
Returns a list of file paths matching |pattern|, by walking the directory tree
|
|
||||||
under |path|. Filenames containing the string 'do_not_use' or 'protoc' are
|
|
||||||
excluded.
|
|
||||||
|
|
||||||
Args:
|
|
||||||
path: The root path for the search.
|
|
||||||
pattern: A shell-style wildcard pattern to match filenames against.
|
|
||||||
(e.g. '*.a')
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
A list of file paths, relative to the current working directory.
|
|
||||||
"""
|
|
||||||
files = []
|
|
||||||
for root, _, filenames in os.walk(path):
|
|
||||||
for filename in fnmatch.filter(filenames, pattern):
|
|
||||||
if all(pattern not in filename for pattern in IGNORE_PATTERNS):
|
|
||||||
# We use the relative path here to avoid "argument list too
|
|
||||||
# long" errors on Linux. Note: This doesn't always work, so
|
|
||||||
# we use the find command on Linux.
|
|
||||||
files.append(os.path.relpath(os.path.join(root, filename)))
|
|
||||||
return files
|
|
||||||
|
|
||||||
def chunks(l, n):
|
|
||||||
"""Yield successive n-sized chunks from l."""
|
|
||||||
for i in range(0, len(l), n):
|
|
||||||
yield l[i:i + n]
|
|
||||||
|
|
||||||
|
|
||||||
def main(argv):
|
|
||||||
if len(argv) != 3:
|
|
||||||
sys.stderr.write('Usage: ' + argv[0] + ' <search_path> <output_lib>\n')
|
|
||||||
return 1
|
|
||||||
|
|
||||||
search_path = os.path.normpath(argv[1])
|
|
||||||
output_lib = os.path.normpath(argv[2])
|
|
||||||
|
|
||||||
if not os.path.exists(search_path):
|
|
||||||
sys.stderr.write('search_path does not exist: %s\n' % search_path)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
if os.path.isfile(output_lib):
|
|
||||||
os.remove(output_lib)
|
|
||||||
|
|
||||||
if sys.platform.startswith('linux'):
|
|
||||||
pattern = '*.o'
|
|
||||||
cmd = 'ar crs'
|
|
||||||
elif sys.platform == 'darwin':
|
|
||||||
pattern = '*.a'
|
|
||||||
cmd = 'libtool -static -v -o '
|
|
||||||
elif sys.platform == 'win32':
|
|
||||||
pattern = '*.lib'
|
|
||||||
cmd = 'lib /OUT:'
|
|
||||||
else:
|
|
||||||
sys.stderr.write('Platform not supported: %r\n\n' % sys.platform)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
if sys.platform.startswith('linux'):
|
|
||||||
cmd = ' '.join(['find', search_path, '-name "' + pattern + '"' +
|
|
||||||
' -and -not -name ' +
|
|
||||||
' -and -not -name '.join(IGNORE_PATTERNS) +
|
|
||||||
' -exec', cmd, output_lib, '{} +'])
|
|
||||||
else:
|
|
||||||
cmd = ' '.join([cmd + output_lib] + FindFiles(search_path, pattern))
|
|
||||||
print cmd
|
|
||||||
subprocess.check_call(cmd, shell=True)
|
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
|
||||||
filesList = list(chunks(FindFiles(search_path + '\\third_party\\libvpx', '*.obj'), 100))
|
|
||||||
for files in filesList:
|
|
||||||
cmd = ' '.join(['lib /OUT:' + output_lib] + [output_lib] + files)
|
|
||||||
print cmd
|
|
||||||
subprocess.check_call(cmd, shell=True)
|
|
||||||
filesList = list(chunks(FindFiles(search_path + '\\third_party\\jsoncpp', '*.obj'), 100))
|
|
||||||
for files in filesList:
|
|
||||||
cmd = ' '.join(['lib /OUT:' + output_lib] + [output_lib] + files)
|
|
||||||
print cmd
|
|
||||||
subprocess.check_call(cmd, shell=True)
|
|
||||||
return 0
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.exit(main(sys.argv))
|
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue