Commit a50dbcea authored by ulan@chromium.org's avatar ulan@chromium.org

Fix android.gypi to provide correct include and library paths when using...

Fix android.gypi to provide correct include and library paths when using standalone Android toolchain.

R=jkummerow@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10910062

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12425 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 53dd910b
...@@ -59,7 +59,7 @@ else ...@@ -59,7 +59,7 @@ else
endif endif
TOOLCHAIN_PATH = ${ANDROID_NDK_ROOT}/toolchains/${TOOLCHAIN_ARCH}/prebuilt TOOLCHAIN_PATH = ${ANDROID_NDK_ROOT}/toolchains/${TOOLCHAIN_ARCH}/prebuilt
ANDROID_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR}/bin ANDROID_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR}
ifeq ($(wildcard $(ANDROID_TOOLCHAIN)),) ifeq ($(wildcard $(ANDROID_TOOLCHAIN)),)
$(error Cannot find Android toolchain in "${ANDROID_TOOLCHAIN}") $(error Cannot find Android toolchain in "${ANDROID_TOOLCHAIN}")
endif endif
...@@ -70,12 +70,12 @@ DEFINES += host_os=${HOST_OS} ...@@ -70,12 +70,12 @@ DEFINES += host_os=${HOST_OS}
.SECONDEXPANSION: .SECONDEXPANSION:
$(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$(basename $$@) $(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$(basename $$@)
@$(MAKE) -C "$(OUTDIR)" -f Makefile.$(basename $@) \ @$(MAKE) -C "$(OUTDIR)" -f Makefile.$(basename $@) \
CXX="$(ANDROID_TOOLCHAIN)/*-g++" \ CXX="$(ANDROID_TOOLCHAIN)/bin/*-g++" \
AR="$(ANDROID_TOOLCHAIN)/*-ar" \ AR="$(ANDROID_TOOLCHAIN)/bin/*-ar" \
RANLIB="$(ANDROID_TOOLCHAIN)/*-ranlib" \ RANLIB="$(ANDROID_TOOLCHAIN)/bin/*-ranlib" \
CC="$(ANDROID_TOOLCHAIN)/*-gcc" \ CC="$(ANDROID_TOOLCHAIN)/bin/*-gcc" \
LD="$(ANDROID_TOOLCHAIN)/*-ld" \ LD="$(ANDROID_TOOLCHAIN)/bin/*-ld" \
LINK="$(ANDROID_TOOLCHAIN)/*-g++" \ LINK="$(ANDROID_TOOLCHAIN)/bin/*-g++" \
BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \ BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
python -c "print raw_input().capitalize()") \ python -c "print raw_input().capitalize()") \
builddir="$(shell pwd)/$(OUTDIR)/$@" builddir="$(shell pwd)/$(OUTDIR)/$@"
...@@ -85,8 +85,8 @@ ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_ARCHES)) ...@@ -85,8 +85,8 @@ ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_ARCHES))
$(ANDROID_MAKEFILES): $(ANDROID_MAKEFILES):
@GYP_GENERATORS=make-android \ @GYP_GENERATORS=make-android \
GYP_DEFINES="${DEFINES}" \ GYP_DEFINES="${DEFINES}" \
CC="${ANDROID_TOOLCHAIN}/*-gcc" \ CC="${ANDROID_TOOLCHAIN}/bin/*-gcc" \
CXX="${ANDROID_TOOLCHAIN}/*-g++" \ CXX="${ANDROID_TOOLCHAIN}/bin/*-g++" \
build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \ build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \
-Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \ -Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \
-S.${ARCH} ${GYPFLAGS} -S.${ARCH} ${GYPFLAGS}
...@@ -33,28 +33,39 @@ ...@@ -33,28 +33,39 @@
'variables': { 'variables': {
# Location of Android NDK. # Location of Android NDK.
'variables': { 'variables': {
'variables': { 'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)',
'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)', 'android_toolchain%': '<!(/bin/echo -n $ANDROID_TOOLCHAIN)',
# Switch between different build types, currently only '0' is
# Switch between different build types, currently only '0' is # supported.
# supported. 'android_build_type%': 0,
'android_build_type%': 0,
},
'android_ndk_root%': '<(android_ndk_root)',
'android_ndk_sysroot': '<(android_ndk_root)/platforms/android-9/arch-<(android_target_arch)',
'android_build_type%': '<(android_build_type)',
}, },
'android_ndk_root%': '<(android_ndk_root)', 'conditions': [
'android_ndk_sysroot': '<(android_ndk_sysroot)', ['android_ndk_root==""', {
'android_ndk_include': '<(android_ndk_sysroot)/usr/include', 'variables': {
'android_ndk_lib': '<(android_ndk_sysroot)/usr/lib', 'android_sysroot': '<(android_toolchain)/sysroot/',
'android_stlport': '<(android_toolchain)/sources/cxx-stl/stlport/',
},
'android_include': '<(android_sysroot)/usr/include',
'android_lib': '<(android_sysroot)/usr/lib',
'android_stlport_include': '<(android_stlport)/stlport',
'android_stlport_libs': '<(android_stlport)/libs',
}, {
'variables': {
'android_sysroot': '<(android_ndk_root)/platforms/android-9/arch-<(android_target_arch)',
'android_stlport': '<(android_ndk_root)/sources/cxx-stl/stlport/',
},
'android_include': '<(android_sysroot)/usr/include',
'android_lib': '<(android_sysroot)/usr/lib',
'android_stlport_include': '<(android_stlport)/stlport',
'android_stlport_libs': '<(android_stlport)/libs',
}],
],
# Enable to use the system stlport, otherwise statically # Enable to use the system stlport, otherwise statically
# link the NDK one? # link the NDK one?
'use_system_stlport%': '<(android_build_type)', 'use_system_stlport%': '<(android_build_type)',
'android_stlport_library': 'stlport_static', 'android_stlport_library': 'stlport_static',
# Copy it out one scope. # Copy it out one scope.
'android_build_type%': '<(android_build_type)', 'android_build_type%': '<(android_build_type)',
'OS': 'android', 'OS': 'android',
}, # variables }, # variables
'target_defaults': { 'target_defaults': {
...@@ -94,7 +105,7 @@ ...@@ -94,7 +105,7 @@
'-Wno-error=non-virtual-dtor', # TODO(michaelbai): Fix warnings. '-Wno-error=non-virtual-dtor', # TODO(michaelbai): Fix warnings.
# Note: This include is in cflags to ensure that it comes after # Note: This include is in cflags to ensure that it comes after
# all of the includes. # all of the includes.
'-I<(android_ndk_include)', '-I<(android_include)',
], ],
'defines': [ 'defines': [
'ANDROID', 'ANDROID',
...@@ -134,8 +145,8 @@ ...@@ -134,8 +145,8 @@
'conditions': [ 'conditions': [
['android_build_type==0', { ['android_build_type==0', {
'ldflags': [ 'ldflags': [
'-Wl,-rpath-link=<(android_ndk_lib)', '-Wl,-rpath-link=<(android_lib)',
'-L<(android_ndk_lib)', '-L<(android_lib)',
], ],
}], }],
['target_arch == "arm"', { ['target_arch == "arm"', {
...@@ -159,22 +170,22 @@ ...@@ -159,22 +170,22 @@
# The include ordering here is important; change with caution. # The include ordering here is important; change with caution.
['use_system_stlport==0', { ['use_system_stlport==0', {
'cflags': [ 'cflags': [
'-I<(android_ndk_root)/sources/cxx-stl/stlport/stlport', '-I<(android_stlport_include)',
], ],
'conditions': [ 'conditions': [
['target_arch=="arm" and armv7==1', { ['target_arch=="arm" and armv7==1', {
'ldflags': [ 'ldflags': [
'-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi-v7a', '-L<(android_stlport_libs)/armeabi-v7a',
], ],
}], }],
['target_arch=="arm" and armv7==0', { ['target_arch=="arm" and armv7==0', {
'ldflags': [ 'ldflags': [
'-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi', '-L<(android_stlport_libs)/armeabi',
], ],
}], }],
['target_arch=="ia32"', { ['target_arch=="ia32"', {
'ldflags': [ 'ldflags': [
'-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/x86', '-L<(android_stlport_libs)/x86',
], ],
}], }],
], ],
...@@ -197,12 +208,12 @@ ...@@ -197,12 +208,12 @@
'-Wl,--gc-sections', '-Wl,--gc-sections',
'-Wl,-z,nocopyreloc', '-Wl,-z,nocopyreloc',
# crtbegin_dynamic.o should be the last item in ldflags. # crtbegin_dynamic.o should be the last item in ldflags.
'<(android_ndk_lib)/crtbegin_dynamic.o', '<(android_lib)/crtbegin_dynamic.o',
], ],
'libraries': [ 'libraries': [
# crtend_android.o needs to be the last item in libraries. # crtend_android.o needs to be the last item in libraries.
# Do not add any libraries after this! # Do not add any libraries after this!
'<(android_ndk_lib)/crtend_android.o', '<(android_lib)/crtend_android.o',
], ],
}], }],
['_type=="shared_library"', { ['_type=="shared_library"', {
...@@ -225,4 +236,4 @@ ...@@ -225,4 +236,4 @@
}], }],
], # target_conditions ], # target_conditions
}, # target_defaults }, # target_defaults
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment