Skip to content

Commit 82bcbf8

Browse files
author
jkummerow@chromium.org
committed
Enable building V8 for Android on Mac
Review URL: https://chromiumcodereview.appspot.com/10795045 Patch from Haitao Feng <haitao.feng@intel.com>. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12172 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
1 parent 72e4a14 commit 82bcbf8

3 files changed

Lines changed: 20 additions & 13 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ native: $(OUTDIR)/Makefile.native
175175
CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \
176176
builddir="$(shell pwd)/$(OUTDIR)/$@"
177177

178-
$(ANDROID_ARCHES): $(addprefix $$@.,$(MODE))
178+
$(ANDROID_ARCHES): $(addprefix $$@.,$(MODES))
179179

180180
$(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \
181181
must-set-ANDROID_NDK_ROOT

build/common.gypi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@
279279
'target_conditions': [
280280
['_toolset=="host"', {
281281
'variables': {
282-
'm32flag': '<!((echo | $(echo ${CXX_host:-$(which g++)}) -m32 -E - > /dev/null 2>&1) && echo -n "-m32" || true)',
282+
'm32flag': '<!((echo | $(echo ${CXX_host:-$(which g++)}) -m32 -E - > /dev/null 2>&1) && echo "-m32" || true)',
283283
},
284284
'cflags': [ '<(m32flag)' ],
285285
'ldflags': [ '<(m32flag)' ],
@@ -289,7 +289,7 @@
289289
}],
290290
['_toolset=="target"', {
291291
'variables': {
292-
'm32flag': '<!((echo | $(echo ${CXX_target:-${CXX:-$(which g++)}}) -m32 -E - > /dev/null 2>&1) && echo -n "-m32" || true)',
292+
'm32flag': '<!((echo | $(echo ${CXX_target:-${CXX:-$(which g++)}}) -m32 -E - > /dev/null 2>&1) && echo "-m32" || true)',
293293
},
294294
'cflags': [ '<(m32flag)' ],
295295
'ldflags': [ '<(m32flag)' ],

tools/android-build.sh

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828

2929
if [ ${#@} -lt 4 ] ; then
30-
echo "Error: $0 needs 4 arguments."
30+
echo "$0: Error: needs 4 arguments."
3131
exit 1
3232
fi
3333

@@ -42,8 +42,11 @@ case "${host_os}" in
4242
"linux")
4343
toolchain_dir="linux-x86"
4444
;;
45+
"mac")
46+
toolchain_dir="darwin-x86"
47+
;;
4548
*)
46-
echo "Host platform ${host_os} is not supported" >& 2
49+
echo "$0: Host platform ${host_os} is not supported" >& 2
4750
exit 1
4851
esac
4952

@@ -58,23 +61,27 @@ case "${ARCH}" in
5861
toolchain_arch="x86-4.4.3"
5962
;;
6063
*)
61-
echo "Architecture: ${ARCH} is not supported." >& 2
62-
echo "Current supported architectures: arm|ia32." >& 2
64+
echo "$0: Target architecture ${ARCH} is not supported." >& 2
65+
echo "$0: Current supported architectures: android_arm|android_ia32." >& 2
6366
exit 1
6467
esac
6568

6669
toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}/prebuilt/"
6770
ANDROID_TOOLCHAIN="${toolchain_path}/${toolchain_dir}/bin"
6871
if [ ! -d "${ANDROID_TOOLCHAIN}" ]; then
69-
echo "Cannot find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2
70-
echo "The NDK version might be wrong." >& 2
72+
echo "$0: Cannot find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2
73+
echo "$0: The NDK version might be wrong." >& 2
7174
exit 1
7275
fi
7376

74-
# The set of GYP_DEFINES to pass to gyp.
77+
# For mksnapshot host generation.
78+
DEFINES+=" host_os=${host_os}"
79+
80+
# The set of GYP_DEFINES to pass to gyp.
7581
export GYP_DEFINES="${DEFINES}"
7682

77-
export GYP_GENERATORS=make
83+
# Use the "android" flavor of the Makefile generator for both Linux and OS X.
84+
export GYP_GENERATORS=make-android
7885
export CC=${ANDROID_TOOLCHAIN}/*-gcc
7986
export CXX=${ANDROID_TOOLCHAIN}/*-g++
8087
build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \
@@ -85,6 +92,6 @@ export AR=${ANDROID_TOOLCHAIN}/*-ar
8592
export RANLIB=${ANDROID_TOOLCHAIN}/*-ranlib
8693
export LD=${ANDROID_TOOLCHAIN}/*-ld
8794
export LINK=${ANDROID_TOOLCHAIN}/*-g++
88-
export BUILDTYPE=${MODE[@]^}
89-
export builddir=$(readlink -f ${PWD})/${OUTDIR}/${ARCH}.${MODE}
95+
export BUILDTYPE=$(echo ${MODE} | python -c "print raw_input().capitalize()")
96+
export builddir=${PWD}/${OUTDIR}/${ARCH}.${MODE}
9097
make -C "${OUTDIR}" -f Makefile.${ARCH}

0 commit comments

Comments
 (0)