Bug 767024 - Allow dependentlibs.py to work when cross-compiling for Android on OSX. r=khuey

This commit is contained in:
Mike Hommey 2012-06-22 18:33:17 +02:00
Родитель d3dff6ae2d
Коммит 14c1a3b0ed
6 изменённых файлов: 13 добавлений и 2 удалений

Просмотреть файл

@ -98,6 +98,7 @@ case "$target" in
fi
dnl set up compilers
TOOLCHAIN_PREFIX="$android_toolchain/bin/$android_tool_prefix-"
AS="$android_toolchain"/bin/"$android_tool_prefix"-as
CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++

Просмотреть файл

@ -357,6 +357,7 @@ HAVE_64BIT_OS = @HAVE_64BIT_OS@
CC = @CC@
CXX = @CXX@
CPP = @CPP@
TOOLCHAIN_PREFIX = @TOOLCHAIN_PREFIX@
CC_VERSION = @CC_VERSION@
CXX_VERSION = @CXX_VERSION@

Просмотреть файл

@ -171,6 +171,7 @@ if test -n "$gonkdir" ; then
ANDROID_NDK="${ANDROID_SOURCE}/ndk"
dnl set up compilers
TOOLCHAIN_PREFIX="$gonk_toolchain_prefix"
AS="$gonk_toolchain_prefix"as
CC="$gonk_toolchain_prefix"gcc
CXX="$gonk_toolchain_prefix"g++
@ -8320,6 +8321,7 @@ AC_SUBST(MOZ_FEEDS)
AC_SUBST(NS_PRINTING)
AC_SUBST(MOZ_WEBGL)
AC_SUBST(MOZ_HELP_VIEWER)
AC_SUBST(TOOLCHAIN_PREFIX)
AC_SUBST(JAVA)
AC_SUBST(JAVAC)

Просмотреть файл

@ -98,6 +98,7 @@ case "$target" in
fi
dnl set up compilers
TOOLCHAIN_PREFIX="$android_toolchain/bin/$android_tool_prefix-"
AS="$android_toolchain"/bin/"$android_tool_prefix"-as
CC="$android_toolchain"/bin/"$android_tool_prefix"-gcc
CXX="$android_toolchain"/bin/"$android_tool_prefix"-g++

Просмотреть файл

@ -57,4 +57,4 @@ include $(topsrcdir)/config/rules.mk
libs:: $(FINAL_TARGET)/dependentlibs.list
$(FINAL_TARGET)/dependentlibs.list: 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) > $@
$(PYTHON) $< $(SHARED_LIBRARY) -L $(FINAL_TARGET) $(if $(TOOLCHAIN_PREFIX),$(addprefix -p ,$(TOOLCHAIN_PREFIX))) > $@

Просмотреть файл

@ -12,6 +12,8 @@ import re
import subprocess
import sys
TOOLCHAIN_PREFIX = ''
def dependentlibs_dumpbin(lib):
'''Returns the list of dependencies declared in the given DLL'''
proc = subprocess.Popen(['dumpbin', '-imports', lib], stdout = subprocess.PIPE)
@ -26,7 +28,7 @@ def dependentlibs_dumpbin(lib):
def dependentlibs_readelf(lib):
'''Returns the list of dependencies declared in the given ELF .so'''
proc = subprocess.Popen(['readelf', '-d', lib], stdout = subprocess.PIPE)
proc = subprocess.Popen([TOOLCHAIN_PREFIX + 'readelf', '-d', lib], stdout = subprocess.PIPE)
deps = []
for line in proc.stdout:
# Each line has the following format:
@ -84,7 +86,11 @@ def dependentlibs(lib, libpaths, func):
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]
ext = os.path.splitext(lib)[1]
if ext == '.dll':