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
parent 72e4a144
...@@ -175,7 +175,7 @@ native: $(OUTDIR)/Makefile.native ...@@ -175,7 +175,7 @@ native: $(OUTDIR)/Makefile.native
CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \ CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \
builddir="$(shell pwd)/$(OUTDIR)/$@" builddir="$(shell pwd)/$(OUTDIR)/$@"
$(ANDROID_ARCHES): $(addprefix $$@.,$(MODE)) $(ANDROID_ARCHES): $(addprefix $$@.,$(MODES))
$(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \ $(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \
must-set-ANDROID_NDK_ROOT must-set-ANDROID_NDK_ROOT
......
...@@ -279,7 +279,7 @@ ...@@ -279,7 +279,7 @@
'target_conditions': [ 'target_conditions': [
['_toolset=="host"', { ['_toolset=="host"', {
'variables': { '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)' ], 'cflags': [ '<(m32flag)' ],
'ldflags': [ '<(m32flag)' ], 'ldflags': [ '<(m32flag)' ],
...@@ -289,7 +289,7 @@ ...@@ -289,7 +289,7 @@
}], }],
['_toolset=="target"', { ['_toolset=="target"', {
'variables': { '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)' ], 'cflags': [ '<(m32flag)' ],
'ldflags': [ '<(m32flag)' ], 'ldflags': [ '<(m32flag)' ],
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if [ ${#@} -lt 4 ] ; then if [ ${#@} -lt 4 ] ; then
echo "Error: $0 needs 4 arguments." echo "$0: Error: needs 4 arguments."
exit 1 exit 1
fi fi
...@@ -42,8 +42,11 @@ case "${host_os}" in ...@@ -42,8 +42,11 @@ case "${host_os}" in
"linux") "linux")
toolchain_dir="linux-x86" toolchain_dir="linux-x86"
;; ;;
"mac")
toolchain_dir="darwin-x86"
;;
*) *)
echo "Host platform ${host_os} is not supported" >& 2 echo "$0: Host platform ${host_os} is not supported" >& 2
exit 1 exit 1
esac esac
...@@ -58,23 +61,27 @@ case "${ARCH}" in ...@@ -58,23 +61,27 @@ case "${ARCH}" in
toolchain_arch="x86-4.4.3" toolchain_arch="x86-4.4.3"
;; ;;
*) *)
echo "Architecture: ${ARCH} is not supported." >& 2 echo "$0: Target architecture ${ARCH} is not supported." >& 2
echo "Current supported architectures: arm|ia32." >& 2 echo "$0: Current supported architectures: android_arm|android_ia32." >& 2
exit 1 exit 1
esac esac
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}/bin"
if [ ! -d "${ANDROID_TOOLCHAIN}" ]; then if [ ! -d "${ANDROID_TOOLCHAIN}" ]; then
echo "Cannot find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2 echo "$0: Cannot find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2
echo "The NDK version might be wrong." >& 2 echo "$0: The NDK version might be wrong." >& 2
exit 1 exit 1
fi fi
# The set of GYP_DEFINES to pass to gyp. # For mksnapshot host generation.
DEFINES+=" host_os=${host_os}"
# The set of GYP_DEFINES to pass to gyp.
export GYP_DEFINES="${DEFINES}" export GYP_DEFINES="${DEFINES}"
export GYP_GENERATORS=make # Use the "android" flavor of the Makefile generator for both Linux and OS X.
export GYP_GENERATORS=make-android
export CC=${ANDROID_TOOLCHAIN}/*-gcc export CC=${ANDROID_TOOLCHAIN}/*-gcc
export CXX=${ANDROID_TOOLCHAIN}/*-g++ export CXX=${ANDROID_TOOLCHAIN}/*-g++
build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \ build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \
...@@ -85,6 +92,6 @@ export AR=${ANDROID_TOOLCHAIN}/*-ar ...@@ -85,6 +92,6 @@ export AR=${ANDROID_TOOLCHAIN}/*-ar
export RANLIB=${ANDROID_TOOLCHAIN}/*-ranlib export RANLIB=${ANDROID_TOOLCHAIN}/*-ranlib
export LD=${ANDROID_TOOLCHAIN}/*-ld export LD=${ANDROID_TOOLCHAIN}/*-ld
export LINK=${ANDROID_TOOLCHAIN}/*-g++ export LINK=${ANDROID_TOOLCHAIN}/*-g++
export BUILDTYPE=${MODE[@]^} export BUILDTYPE=$(echo ${MODE} | python -c "print raw_input().capitalize()")
export builddir=$(readlink -f ${PWD})/${OUTDIR}/${ARCH}.${MODE} export builddir=${PWD}/${OUTDIR}/${ARCH}.${MODE}
make -C "${OUTDIR}" -f Makefile.${ARCH} make -C "${OUTDIR}" -f Makefile.${ARCH}
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