Skip to content

Commit a50dbce

Browse files
author
ulan@chromium.org
committed
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
1 parent 53dd910 commit a50dbce

2 files changed

Lines changed: 45 additions & 34 deletions

File tree

Makefile.android

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ else
5959
endif
6060

6161
TOOLCHAIN_PATH = ${ANDROID_NDK_ROOT}/toolchains/${TOOLCHAIN_ARCH}/prebuilt
62-
ANDROID_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR}/bin
62+
ANDROID_TOOLCHAIN ?= ${TOOLCHAIN_PATH}/${TOOLCHAIN_DIR}
6363
ifeq ($(wildcard $(ANDROID_TOOLCHAIN)),)
6464
$(error Cannot find Android toolchain in "${ANDROID_TOOLCHAIN}")
6565
endif
@@ -70,12 +70,12 @@ DEFINES += host_os=${HOST_OS}
7070
.SECONDEXPANSION:
7171
$(ANDROID_BUILDS): $(OUTDIR)/Makefile.$$(basename $$@)
7272
@$(MAKE) -C "$(OUTDIR)" -f Makefile.$(basename $@) \
73-
CXX="$(ANDROID_TOOLCHAIN)/*-g++" \
74-
AR="$(ANDROID_TOOLCHAIN)/*-ar" \
75-
RANLIB="$(ANDROID_TOOLCHAIN)/*-ranlib" \
76-
CC="$(ANDROID_TOOLCHAIN)/*-gcc" \
77-
LD="$(ANDROID_TOOLCHAIN)/*-ld" \
78-
LINK="$(ANDROID_TOOLCHAIN)/*-g++" \
73+
CXX="$(ANDROID_TOOLCHAIN)/bin/*-g++" \
74+
AR="$(ANDROID_TOOLCHAIN)/bin/*-ar" \
75+
RANLIB="$(ANDROID_TOOLCHAIN)/bin/*-ranlib" \
76+
CC="$(ANDROID_TOOLCHAIN)/bin/*-gcc" \
77+
LD="$(ANDROID_TOOLCHAIN)/bin/*-ld" \
78+
LINK="$(ANDROID_TOOLCHAIN)/bin/*-g++" \
7979
BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
8080
python -c "print raw_input().capitalize()") \
8181
builddir="$(shell pwd)/$(OUTDIR)/$@"
@@ -85,8 +85,8 @@ ANDROID_MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ANDROID_ARCHES))
8585
$(ANDROID_MAKEFILES):
8686
@GYP_GENERATORS=make-android \
8787
GYP_DEFINES="${DEFINES}" \
88-
CC="${ANDROID_TOOLCHAIN}/*-gcc" \
89-
CXX="${ANDROID_TOOLCHAIN}/*-g++" \
88+
CC="${ANDROID_TOOLCHAIN}/bin/*-gcc" \
89+
CXX="${ANDROID_TOOLCHAIN}/bin/*-g++" \
9090
build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \
9191
-Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \
9292
-S.${ARCH} ${GYPFLAGS}

build/android.gypi

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,39 @@
3333
'variables': {
3434
# Location of Android NDK.
3535
'variables': {
36-
'variables': {
37-
'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)',
38-
39-
# Switch between different build types, currently only '0' is
40-
# supported.
41-
'android_build_type%': 0,
42-
},
43-
'android_ndk_root%': '<(android_ndk_root)',
44-
'android_ndk_sysroot': '<(android_ndk_root)/platforms/android-9/arch-<(android_target_arch)',
45-
'android_build_type%': '<(android_build_type)',
36+
'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)',
37+
'android_toolchain%': '<!(/bin/echo -n $ANDROID_TOOLCHAIN)',
38+
# Switch between different build types, currently only '0' is
39+
# supported.
40+
'android_build_type%': 0,
4641
},
47-
'android_ndk_root%': '<(android_ndk_root)',
48-
'android_ndk_sysroot': '<(android_ndk_sysroot)',
49-
'android_ndk_include': '<(android_ndk_sysroot)/usr/include',
50-
'android_ndk_lib': '<(android_ndk_sysroot)/usr/lib',
42+
'conditions': [
43+
['android_ndk_root==""', {
44+
'variables': {
45+
'android_sysroot': '<(android_toolchain)/sysroot/',
46+
'android_stlport': '<(android_toolchain)/sources/cxx-stl/stlport/',
47+
},
48+
'android_include': '<(android_sysroot)/usr/include',
49+
'android_lib': '<(android_sysroot)/usr/lib',
50+
'android_stlport_include': '<(android_stlport)/stlport',
51+
'android_stlport_libs': '<(android_stlport)/libs',
52+
}, {
53+
'variables': {
54+
'android_sysroot': '<(android_ndk_root)/platforms/android-9/arch-<(android_target_arch)',
55+
'android_stlport': '<(android_ndk_root)/sources/cxx-stl/stlport/',
56+
},
57+
'android_include': '<(android_sysroot)/usr/include',
58+
'android_lib': '<(android_sysroot)/usr/lib',
59+
'android_stlport_include': '<(android_stlport)/stlport',
60+
'android_stlport_libs': '<(android_stlport)/libs',
61+
}],
62+
],
5163
# Enable to use the system stlport, otherwise statically
5264
# link the NDK one?
5365
'use_system_stlport%': '<(android_build_type)',
5466
'android_stlport_library': 'stlport_static',
5567
# Copy it out one scope.
5668
'android_build_type%': '<(android_build_type)',
57-
5869
'OS': 'android',
5970
}, # variables
6071
'target_defaults': {
@@ -94,7 +105,7 @@
94105
'-Wno-error=non-virtual-dtor', # TODO(michaelbai): Fix warnings.
95106
# Note: This include is in cflags to ensure that it comes after
96107
# all of the includes.
97-
'-I<(android_ndk_include)',
108+
'-I<(android_include)',
98109
],
99110
'defines': [
100111
'ANDROID',
@@ -134,8 +145,8 @@
134145
'conditions': [
135146
['android_build_type==0', {
136147
'ldflags': [
137-
'-Wl,-rpath-link=<(android_ndk_lib)',
138-
'-L<(android_ndk_lib)',
148+
'-Wl,-rpath-link=<(android_lib)',
149+
'-L<(android_lib)',
139150
],
140151
}],
141152
['target_arch == "arm"', {
@@ -159,22 +170,22 @@
159170
# The include ordering here is important; change with caution.
160171
['use_system_stlport==0', {
161172
'cflags': [
162-
'-I<(android_ndk_root)/sources/cxx-stl/stlport/stlport',
173+
'-I<(android_stlport_include)',
163174
],
164175
'conditions': [
165176
['target_arch=="arm" and armv7==1', {
166177
'ldflags': [
167-
'-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi-v7a',
178+
'-L<(android_stlport_libs)/armeabi-v7a',
168179
],
169180
}],
170181
['target_arch=="arm" and armv7==0', {
171182
'ldflags': [
172-
'-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/armeabi',
183+
'-L<(android_stlport_libs)/armeabi',
173184
],
174185
}],
175186
['target_arch=="ia32"', {
176187
'ldflags': [
177-
'-L<(android_ndk_root)/sources/cxx-stl/stlport/libs/x86',
188+
'-L<(android_stlport_libs)/x86',
178189
],
179190
}],
180191
],
@@ -197,12 +208,12 @@
197208
'-Wl,--gc-sections',
198209
'-Wl,-z,nocopyreloc',
199210
# crtbegin_dynamic.o should be the last item in ldflags.
200-
'<(android_ndk_lib)/crtbegin_dynamic.o',
211+
'<(android_lib)/crtbegin_dynamic.o',
201212
],
202213
'libraries': [
203214
# crtend_android.o needs to be the last item in libraries.
204215
# Do not add any libraries after this!
205-
'<(android_ndk_lib)/crtend_android.o',
216+
'<(android_lib)/crtend_android.o',
206217
],
207218
}],
208219
['_type=="shared_library"', {
@@ -225,4 +236,4 @@
225236
}],
226237
], # target_conditions
227238
}, # target_defaults
228-
}
239+
}

0 commit comments

Comments
 (0)