[build] Remove more unused files
This commit is contained in:
47
gyp/link.py
47
gyp/link.py
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
from merge_static_libs import MergeLibs
|
||||
|
||||
args = sys.argv[1:]
|
||||
|
||||
out_lib = ''
|
||||
in_libs = []
|
||||
flags = []
|
||||
|
||||
i = 0
|
||||
l = len(args)
|
||||
while i < l:
|
||||
arg = args[i]
|
||||
|
||||
if arg[0:2] == '-l':
|
||||
flags.append(arg)
|
||||
elif arg[0:2] == '-L':
|
||||
flags.append(arg)
|
||||
elif arg == '-arch':
|
||||
i += 1
|
||||
elif arg == '-framework':
|
||||
i += 1
|
||||
flags.append(arg + ' ' + args[i])
|
||||
elif arg == '-o':
|
||||
i += 1
|
||||
out_lib = args[i]
|
||||
elif arg[0] != '-':
|
||||
in_libs.append(arg)
|
||||
else:
|
||||
print 'Ignored linker directive: ' + arg
|
||||
|
||||
i += 1
|
||||
|
||||
flags.reverse()
|
||||
unique_flags = []
|
||||
for flag in flags:
|
||||
if flag not in unique_flags:
|
||||
unique_flags.append(flag)
|
||||
unique_flags.reverse()
|
||||
|
||||
with open(out_lib + '.ldflags', 'w+') as f:
|
||||
f.write(' '.join(unique_flags));
|
||||
|
||||
MergeLibs(in_libs, out_lib)
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
'conditions': [
|
||||
['platform_library == "mbglosx"', {
|
||||
}],
|
||||
],
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
def _Usage():
|
||||
print 'Usage: merge_static_libs OUTPUT_LIB INPUT_LIB [INPUT_LIB]*'
|
||||
sys.exit(1)
|
||||
|
||||
def MergeLibs(in_libs, out_lib):
|
||||
""" Merges multiple static libraries into one.
|
||||
|
||||
in_libs: list of paths to static libraries to be merged
|
||||
out_lib: path to the static library which will be created from in_libs
|
||||
"""
|
||||
if os.name == 'posix':
|
||||
tempdir = tempfile.mkdtemp()
|
||||
abs_in_libs = []
|
||||
for in_lib in in_libs:
|
||||
abs_in_libs.append(os.path.abspath(in_lib))
|
||||
curdir = os.getcwd()
|
||||
os.chdir(tempdir)
|
||||
objects = []
|
||||
ar = os.environ.get('AR', 'ar')
|
||||
for in_lib in abs_in_libs:
|
||||
proc = subprocess.Popen([ar, '-t', in_lib], stdout=subprocess.PIPE)
|
||||
proc.wait()
|
||||
obj_str = proc.communicate()[0]
|
||||
current_objects = obj_str.rstrip().split('\n')
|
||||
proc = subprocess.Popen([ar, '-x', in_lib], stdout=subprocess.PIPE,
|
||||
stderr=subprocess.STDOUT)
|
||||
proc.wait()
|
||||
if proc.poll() == 0:
|
||||
# The static library is non-thin, and we extracted objects
|
||||
for object in current_objects:
|
||||
objects.append(os.path.abspath(object))
|
||||
elif 'thin archive' in proc.communicate()[0]:
|
||||
# The static library is thin, so it contains the paths to its objects
|
||||
for object in current_objects:
|
||||
objects.append(object)
|
||||
else:
|
||||
raise Exception('Failed to extract objects from %s.' % in_lib)
|
||||
os.chdir(curdir)
|
||||
if not subprocess.call([ar, '-crs', out_lib] + objects) == 0:
|
||||
raise Exception('Failed to add object files to %s' % out_lib)
|
||||
shutil.rmtree(tempdir)
|
||||
elif os.name == 'nt':
|
||||
subprocess.call(['lib', '/OUT:%s' % out_lib] + in_libs)
|
||||
else:
|
||||
raise Exception('Error: Your platform is not supported')
|
||||
|
||||
def Main():
|
||||
if len(sys.argv) < 3:
|
||||
_Usage()
|
||||
out_lib = sys.argv[1]
|
||||
in_libs = sys.argv[2:]
|
||||
MergeLibs(in_libs, out_lib)
|
||||
|
||||
if '__main__' == __name__:
|
||||
sys.exit(Main())
|
||||
Reference in New Issue
Block a user