mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 04:38:02 +00:00
Bug 1254115 - Move dependentlibs.py invocation to moz.build; r=ted
MozReview-Commit-ID: D8NF03tNuTX --HG-- extra : rebase_source : b8e4f9b672e5e9555cfc841c63e1aeb9130263d3
This commit is contained in:
parent
1112b7a522
commit
965ee10298
@ -13,13 +13,6 @@ endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifdef COMPILE_ENVIRONMENT
|
||||
target:: $(FINAL_TARGET)/dependentlibs.list
|
||||
endif
|
||||
|
||||
$(FINAL_TARGET)/dependentlibs.list: $(topsrcdir)/toolkit/library/dependentlibs.py $(SHARED_LIBRARY) $(wildcard $(if $(wildcard $(FINAL_TARGET)/dependentlibs.list),$(addprefix $(FINAL_TARGET)/,$(shell cat $(FINAL_TARGET)/dependentlibs.list))))
|
||||
$(PYTHON) $< $(SHARED_LIBRARY) -L $(FINAL_TARGET) $(if $(TOOLCHAIN_PREFIX),$(addprefix -p ,$(TOOLCHAIN_PREFIX))) > $@
|
||||
|
||||
.PHONY: gtestxul
|
||||
gtestxul:
|
||||
$(MAKE) -C $(DEPTH) toolkit/library/gtest/target LINK_GTEST=1
|
||||
|
@ -6,12 +6,11 @@
|
||||
upon that are in the same directory, followed by the library itself.
|
||||
'''
|
||||
|
||||
from optparse import OptionParser
|
||||
import os
|
||||
import re
|
||||
import fnmatch
|
||||
import subprocess
|
||||
import sys
|
||||
import mozpack.path as mozpath
|
||||
from mozpack.executables import (
|
||||
get_type,
|
||||
ELF,
|
||||
@ -19,8 +18,6 @@ from mozpack.executables import (
|
||||
)
|
||||
from buildconfig import substs
|
||||
|
||||
TOOLCHAIN_PREFIX = ''
|
||||
|
||||
def dependentlibs_dumpbin(lib):
|
||||
'''Returns the list of dependencies declared in the given DLL'''
|
||||
try:
|
||||
@ -54,7 +51,7 @@ def dependentlibs_mingw_objdump(lib):
|
||||
|
||||
def dependentlibs_readelf(lib):
|
||||
'''Returns the list of dependencies declared in the given ELF .so'''
|
||||
proc = subprocess.Popen([TOOLCHAIN_PREFIX + 'readelf', '-d', lib], stdout = subprocess.PIPE)
|
||||
proc = subprocess.Popen([substs.get('TOOLCHAIN_PREFIX', '') + 'readelf', '-d', lib], stdout = subprocess.PIPE)
|
||||
deps = []
|
||||
for line in proc.stdout:
|
||||
# Each line has the following format:
|
||||
@ -108,20 +105,13 @@ def dependentlibs(lib, libpaths, func):
|
||||
# leads to startup performance problems because of its excessive
|
||||
# size (around 10MB).
|
||||
if not dep.startswith("icu"):
|
||||
deps.append(dep)
|
||||
deps.append(deppath)
|
||||
break
|
||||
|
||||
return deps
|
||||
|
||||
def main():
|
||||
parser = OptionParser()
|
||||
parser.add_option("-L", dest="libpaths", action="append", metavar="PATH", help="Add the given path to the library search path")
|
||||
parser.add_option("-p", dest="toolchain_prefix", metavar="PREFIX", help="Use the given prefix to readelf")
|
||||
(options, args) = parser.parse_args()
|
||||
if options.toolchain_prefix:
|
||||
global TOOLCHAIN_PREFIX
|
||||
TOOLCHAIN_PREFIX = options.toolchain_prefix
|
||||
lib = args[0]
|
||||
def gen_list(output, lib):
|
||||
libpaths = [os.path.join(substs['DIST'], 'bin')]
|
||||
binary_type = get_type(lib)
|
||||
if binary_type == ELF:
|
||||
func = dependentlibs_readelf
|
||||
@ -131,10 +121,15 @@ def main():
|
||||
ext = os.path.splitext(lib)[1]
|
||||
assert(ext == '.dll')
|
||||
func = dependentlibs_dumpbin
|
||||
if not options.libpaths:
|
||||
options.libpaths = [os.path.dirname(lib)]
|
||||
|
||||
print '\n'.join(dependentlibs(lib, options.libpaths, func) + [lib])
|
||||
deps = dependentlibs(lib, libpaths, func)
|
||||
deps.append(mozpath.join(libpaths[0], lib))
|
||||
dependentlibs_output = [mozpath.basename(f) for f in deps]
|
||||
output.write('\n'.join(dependentlibs_output) + '\n')
|
||||
return set(deps)
|
||||
|
||||
def main():
|
||||
gen_list(sys.stdout, sys.argv[1])
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -363,5 +363,21 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
'oleaut32',
|
||||
]
|
||||
|
||||
if CONFIG['COMPILE_ENVIRONMENT']:
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit'):
|
||||
full_libname = SHARED_LIBRARY_NAME
|
||||
else:
|
||||
full_libname = '%s%s%s' % (
|
||||
CONFIG['DLL_PREFIX'],
|
||||
LIBRARY_NAME,
|
||||
CONFIG['DLL_SUFFIX']
|
||||
)
|
||||
GENERATED_FILES += ['dependentlibs.list']
|
||||
GENERATED_FILES['dependentlibs.list'].script = 'dependentlibs.py:gen_list'
|
||||
GENERATED_FILES['dependentlibs.list'].inputs = [
|
||||
'!%s' % full_libname,
|
||||
]
|
||||
FINAL_TARGET_FILES += ['!dependentlibs.list']
|
||||
|
||||
# This needs to be last
|
||||
USE_LIBS += ['StaticXULComponentsEnd']
|
||||
|
Loading…
x
Reference in New Issue
Block a user