Skip to content

Commit

Permalink
Bug 767024 - Allow dependentlibs.py to work when cross-compiling for …
Browse files Browse the repository at this point in the history
…Android on OSX. r=khuey
  • Loading branch information
glandium committed Jun 22, 2012
1 parent d107f62 commit 4f54c3b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions build/autoconf/android.m4
Expand Up @@ -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++
Expand Down
1 change: 1 addition & 0 deletions config/autoconf.mk.in
Expand Up @@ -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@
Expand Down
2 changes: 2 additions & 0 deletions configure.in
Expand Up @@ -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++
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions js/src/build/autoconf/android.m4
Expand Up @@ -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++
Expand Down
2 changes: 1 addition & 1 deletion xpcom/stub/Makefile.in
Expand Up @@ -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))) > $@
8 changes: 7 additions & 1 deletion xpcom/stub/dependentlibs.py
Expand Up @@ -12,6 +12,8 @@
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)
Expand All @@ -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:
Expand Down Expand Up @@ -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':
Expand Down

0 comments on commit 4f54c3b

Please sign in to comment.