Reviewers: Jakob, ulan,
Message:
Enable building V8 for Android on Mac.
Basically choose the functions working on both Linux and Mac. Verified on
Linux
Ubuntu 12.04 64 bits and Mac Lion 10.7.4.
1) Use make-android flavor for both Linux and Mac.
2) "readlink -f" does not work on Mac. Use ${PWD} directly.
3) "${MODE[@]^}" does not work on Mac. Use implementation in main Makefile.
4) It is strange that "echo -n "-m32"" on Mac generates "-n -m32" and on
Linux
generates "-m32". IA32 cross compiler fails because of the extra "-n". As
removing -n works for both Linux and Mac, I did not spend time to debug gyp
to
find the root cause.
5) Fix a typo in Makefile.
Jakob, please help to add exec permission to the android-build.sh.
Description:
Enable building V8 for Android on Mac
Please review this at http://codereview.chromium.org/10795045/
SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/
Affected files:
M Makefile
M build/common.gypi
M tools/android-build.sh
Index: Makefile
===================================================================
--- Makefile (revision 12162)
+++ Makefile (working copy)
@@ -175,7 +175,7 @@
CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \
builddir="$(shell pwd)/$(OUTDIR)/$@"
-$(ANDROID_ARCHES): $(addprefix $$@.,$(MODE))
+$(ANDROID_ARCHES): $(addprefix $$@.,$(MODES))
$(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \
must-set-ANDROID_NDK_ROOT
Index: build/common.gypi
===================================================================
--- build/common.gypi (revision 12162)
+++ build/common.gypi (working copy)
@@ -279,7 +279,7 @@
'target_conditions': [
['_toolset=="host"', {
'variables': {
- 'm32flag': '<!((echo | $(echo ${CXX_host:-$(which g++)})
-m32 -E - > /dev/null 2>&1) && echo -n "-m32" || true)',
+ 'm32flag': '<!((echo | $(echo ${CXX_host:-$(which g++)})
-m32 -E - > /dev/null 2>&1) && echo "-m32" || true)',
},
'cflags': [ '<(m32flag)' ],
'ldflags': [ '<(m32flag)' ],
@@ -289,7 +289,7 @@
}],
['_toolset=="target"', {
'variables': {
- 'm32flag': '<!((echo | $(echo ${CXX_target:-${CXX:-$(which
g++)}}) -m32 -E - > /dev/null 2>&1) && echo -n "-m32" || true)',
+ 'm32flag': '<!((echo | $(echo ${CXX_target:-${CXX:-$(which
g++)}}) -m32 -E - > /dev/null 2>&1) && echo "-m32" || true)',
},
'cflags': [ '<(m32flag)' ],
'ldflags': [ '<(m32flag)' ],
Index: tools/android-build.sh
===================================================================
--- tools/android-build.sh (revision 12162)
+++ tools/android-build.sh (working copy)
@@ -42,6 +42,9 @@
"linux")
toolchain_dir="linux-x86"
;;
+ "mac")
+ toolchain_dir="darwin-x86"
+ ;;
*)
echo "Host platform ${host_os} is not supported" >& 2
exit 1
@@ -71,10 +74,12 @@
exit 1
fi
+DEFINES+=" host_os=${host_os}"
+
# The set of GYP_DEFINES to pass to gyp.
export GYP_DEFINES="${DEFINES}"
-export GYP_GENERATORS=make
+export GYP_GENERATORS=make-android
export CC=${ANDROID_TOOLCHAIN}/*-gcc
export CXX=${ANDROID_TOOLCHAIN}/*-g++
build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \
@@ -85,6 +90,6 @@
export RANLIB=${ANDROID_TOOLCHAIN}/*-ranlib
export LD=${ANDROID_TOOLCHAIN}/*-ld
export LINK=${ANDROID_TOOLCHAIN}/*-g++
-export BUILDTYPE=${MODE[@]^}
-export builddir=$(readlink -f ${PWD})/${OUTDIR}/${ARCH}.${MODE}
+export BUILDTYPE=$(echo ${MODE} | python -c "print
raw_input().capitalize()")
+export builddir=${PWD}/${OUTDIR}/${ARCH}.${MODE}
make -C "${OUTDIR}" -f Makefile.${ARCH}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev