Build V8 for Android IA
Review URL: https://chromiumcodereview.appspot.com/10778033 Patch from Haitao Feng <haitao.feng@intel.com>. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12122 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
610b705e80
commit
6a60899022
44
Makefile
44
Makefile
@ -34,7 +34,6 @@ TESTJOBS ?= -j16
|
||||
GYPFLAGS ?=
|
||||
TESTFLAGS ?=
|
||||
ANDROID_NDK_ROOT ?=
|
||||
ANDROID_TOOL_PREFIX = $(ANDROID_NDK_ROOT)/toolchain/bin/arm-linux-androideabi
|
||||
ANDROID_V8 ?= /data/local/v8
|
||||
|
||||
# Special build flags. Use them like this: "make library=shared"
|
||||
@ -121,7 +120,7 @@ endif
|
||||
ARCHES = ia32 x64 arm mipsel
|
||||
DEFAULT_ARCHES = ia32 x64 arm
|
||||
MODES = release debug
|
||||
ANDROID_MODES = android.release android.debug
|
||||
ANDROID_ARCHES = android_ia32 android_arm
|
||||
|
||||
# List of files that trigger Makefile regeneration:
|
||||
GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \
|
||||
@ -130,14 +129,18 @@ GYPFILES = build/all.gyp build/common.gypi build/standalone.gypi \
|
||||
|
||||
# Generates all combinations of ARCHES and MODES, e.g. "ia32.release".
|
||||
BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES)))
|
||||
ANDROID_BUILDS = $(foreach mode,$(MODES), \
|
||||
$(addsuffix .$(mode),$(ANDROID_ARCHES)))
|
||||
# Generates corresponding test targets, e.g. "ia32.release.check".
|
||||
CHECKS = $(addsuffix .check,$(BUILDS))
|
||||
ANDROID_CHECKS = $(addsuffix .check,$(ANDROID_BUILDS))
|
||||
# File where previously used GYPFLAGS are stored.
|
||||
ENVFILE = $(OUTDIR)/environment
|
||||
|
||||
.PHONY: all check clean dependencies $(ENVFILE).new native \
|
||||
$(ARCHES) $(MODES) $(BUILDS) $(CHECKS) $(addsuffix .clean,$(ARCHES)) \
|
||||
$(addsuffix .check,$(MODES)) $(addsuffix .check,$(ARCHES)) \
|
||||
$(ANDROID_ARCHES) $(ANDROID_BUILDS) $(ANDROID_CHECKS) \
|
||||
must-set-ANDROID_NDK_ROOT
|
||||
|
||||
# Target definitions. "all" is the default.
|
||||
@ -172,19 +175,12 @@ native: $(OUTDIR)/Makefile.native
|
||||
CXX="$(CXX)" LINK="$(LINK)" BUILDTYPE=Release \
|
||||
builddir="$(shell pwd)/$(OUTDIR)/$@"
|
||||
|
||||
android: $(ANDROID_MODES)
|
||||
$(ANDROID_ARCHES): $(addprefix $$@.,$(MODE))
|
||||
|
||||
$(ANDROID_MODES): $(OUTDIR)/Makefile.android
|
||||
@$(MAKE) -C "$(OUTDIR)" -f Makefile.android \
|
||||
CXX="$(ANDROID_TOOL_PREFIX)-g++" \
|
||||
AR="$(ANDROID_TOOL_PREFIX)-ar" \
|
||||
RANLIB="$(ANDROID_TOOL_PREFIX)-ranlib" \
|
||||
CC="$(ANDROID_TOOL_PREFIX)-gcc" \
|
||||
LD="$(ANDROID_TOOL_PREFIX)-ld" \
|
||||
LINK="$(ANDROID_TOOL_PREFIX)-g++" \
|
||||
BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
|
||||
python -c "print raw_input().capitalize()") \
|
||||
builddir="$(shell pwd)/$(OUTDIR)/$@"
|
||||
$(ANDROID_BUILDS): $(GYPFILES) $(ENVFILE) build/android.gypi \
|
||||
must-set-ANDROID_NDK_ROOT
|
||||
@tools/android-build.sh $(basename $@) $(subst .,,$(suffix $@)) \
|
||||
$(OUTDIR) $(GYPFLAGS)
|
||||
|
||||
# Test targets.
|
||||
check: all
|
||||
@ -204,23 +200,24 @@ $(CHECKS): $$(basename $$@)
|
||||
@tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \
|
||||
--arch-and-mode=$(basename $@) $(TESTFLAGS)
|
||||
|
||||
$(addsuffix .sync, $(ANDROID_MODES)): $$(basename $$@)
|
||||
$(addsuffix .sync, $(ANDROID_BUILDS)): $$(basename $$@)
|
||||
@tools/android-sync.sh $(basename $@) $(OUTDIR) \
|
||||
$(shell pwd) $(ANDROID_V8)
|
||||
|
||||
$(addsuffix .check, $(ANDROID_MODES)): $$(basename $$@).sync
|
||||
$(addsuffix .check, $(ANDROID_BUILDS)): $$(basename $$@).sync
|
||||
@tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR) \
|
||||
--arch-and-mode=$(basename $@) \
|
||||
--special-command="tools/android-run.py @"
|
||||
|
||||
android.check: android.release.check android.debug.check
|
||||
$(addsuffix .check, $(ANDROID_ARCHES)): \
|
||||
$(addprefix $$(basename $$@).,$(MODES)).check
|
||||
|
||||
native.check: native
|
||||
@tools/test-wrapper-gypbuild.py $(TESTJOBS) --outdir=$(OUTDIR)/native \
|
||||
--arch-and-mode=. $(TESTFLAGS)
|
||||
|
||||
# Clean targets. You can clean each architecture individually, or everything.
|
||||
$(addsuffix .clean,$(ARCHES)) android.clean:
|
||||
$(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)):
|
||||
rm -f $(OUTDIR)/Makefile.$(basename $@)
|
||||
rm -rf $(OUTDIR)/$(basename $@).release
|
||||
rm -rf $(OUTDIR)/$(basename $@).debug
|
||||
@ -231,7 +228,7 @@ native.clean:
|
||||
rm -rf $(OUTDIR)/native
|
||||
find $(OUTDIR) -regex '.*\(host\|target\).native\.mk' -delete
|
||||
|
||||
clean: $(addsuffix .clean,$(ARCHES)) native.clean android.clean
|
||||
clean: $(addsuffix .clean, $(ARCHES) $(ANDROID_ARCHES)) native.clean
|
||||
|
||||
# GYP file generation targets.
|
||||
MAKEFILES = $(addprefix $(OUTDIR)/Makefile.,$(ARCHES))
|
||||
@ -247,15 +244,6 @@ $(OUTDIR)/Makefile.native: $(GYPFILES) $(ENVFILE)
|
||||
build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
|
||||
-Ibuild/standalone.gypi --depth=. -S.native $(GYPFLAGS)
|
||||
|
||||
$(OUTDIR)/Makefile.android: $(GYPFILES) $(ENVFILE) build/android.gypi \
|
||||
must-set-ANDROID_NDK_ROOT
|
||||
GYP_GENERATORS=make \
|
||||
CC="${ANDROID_TOOL_PREFIX}-gcc" \
|
||||
CXX="${ANDROID_TOOL_PREFIX}-g++" \
|
||||
build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
|
||||
-Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \
|
||||
-S.android $(GYPFLAGS)
|
||||
|
||||
must-set-ANDROID_NDK_ROOT:
|
||||
ifndef ANDROID_NDK_ROOT
|
||||
$(error ANDROID_NDK_ROOT is not set)
|
||||
|
@ -35,7 +35,6 @@
|
||||
'variables': {
|
||||
'variables': {
|
||||
'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)',
|
||||
'android_target_arch%': 'arm', # target_arch in android terms.
|
||||
|
||||
# Switch between different build types, currently only '0' is
|
||||
# supported.
|
||||
@ -57,11 +56,6 @@
|
||||
'android_build_type%': '<(android_build_type)',
|
||||
|
||||
'OS': 'android',
|
||||
'target_arch': 'arm',
|
||||
'v8_target_arch': 'arm',
|
||||
'armv7': 1,
|
||||
'arm_neon': 0,
|
||||
'arm_fpu': 'vfpv3',
|
||||
}, # variables
|
||||
'target_defaults': {
|
||||
'defines': [
|
||||
@ -101,9 +95,6 @@
|
||||
# Note: This include is in cflags to ensure that it comes after
|
||||
# all of the includes.
|
||||
'-I<(android_ndk_include)',
|
||||
'-march=armv7-a',
|
||||
'-mtune=cortex-a8',
|
||||
'-mfpu=vfp3',
|
||||
],
|
||||
'defines': [
|
||||
'ANDROID',
|
||||
@ -120,7 +111,6 @@
|
||||
'ldflags': [
|
||||
'-nostdlib',
|
||||
'-Wl,--no-undefined',
|
||||
'-Wl,--icf=safe', # Enable identical code folding to reduce size
|
||||
# Don't export symbols from statically linked libraries.
|
||||
'-Wl,--exclude-libs=ALL',
|
||||
],
|
||||
@ -148,6 +138,19 @@
|
||||
'-L<(android_ndk_lib)',
|
||||
],
|
||||
}],
|
||||
['target_arch == "arm"', {
|
||||
'ldflags': [
|
||||
# Enable identical code folding to reduce size.
|
||||
'-Wl,--icf=safe',
|
||||
],
|
||||
}],
|
||||
['target_arch=="arm" and armv7==1', {
|
||||
'cflags': [
|
||||
'-march=armv7-a',
|
||||
'-mtune=cortex-a8',
|
||||
'-mfpu=vfp3',
|
||||
],
|
||||
}],
|
||||
# NOTE: The stlport header include paths below are specified in
|
||||
# cflags rather than include_dirs because they need to come
|
||||
# after include_dirs. Think of them like system headers, but
|
||||
|
@ -68,7 +68,8 @@
|
||||
'conditions': [
|
||||
['(v8_target_arch=="arm" and host_arch!="arm") or \
|
||||
(v8_target_arch=="mipsel" and host_arch!="mipsel") or \
|
||||
(v8_target_arch=="x64" and host_arch!="x64")', {
|
||||
(v8_target_arch=="x64" and host_arch!="x64") or \
|
||||
(OS=="android")', {
|
||||
'want_separate_host_toolset': 1,
|
||||
}, {
|
||||
'want_separate_host_toolset': 0,
|
||||
|
@ -54,7 +54,7 @@ test-profile-generator/RecordStackTraceAtStartProfiling: PASS || FAIL
|
||||
test-weakmaps/Shrinking: FAIL
|
||||
|
||||
##############################################################################
|
||||
[ $arch == arm || $arch == android ]
|
||||
[ $arch == arm || $arch == android_arm ]
|
||||
|
||||
# We cannot assume that we can throw OutOfMemory exceptions in all situations.
|
||||
# Apparently our ARM box is in such a state. Skip the test as it also runs for
|
||||
|
@ -49,7 +49,7 @@ regress/regress-create-exception: PASS, SKIP if $mode == debug
|
||||
##############################################################################
|
||||
# This one uses a built-in that's only present in debug mode. It takes
|
||||
# too long to run in debug mode on ARM and MIPS.
|
||||
fuzz-natives: PASS, SKIP if ($mode == release || $arch == arm || $arch == android || $arch == mipsel)
|
||||
fuzz-natives: PASS, SKIP if ($mode == release || $arch == arm || $arch == android_arm || $arch == mipsel)
|
||||
|
||||
big-object-literal: PASS, SKIP if ($arch == arm || $arch == android)
|
||||
|
||||
|
90
tools/android-build.sh
Normal file
90
tools/android-build.sh
Normal file
@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
# Copyright 2012 the V8 project authors. All rights reserved.
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are
|
||||
# met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the following
|
||||
# disclaimer in the documentation and/or other materials provided
|
||||
# with the distribution.
|
||||
# * Neither the name of Google Inc. nor the names of its
|
||||
# contributors may be used to endorse or promote products derived
|
||||
# from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
if [ ${#@} -lt 4 ] ; then
|
||||
echo "Error: $0 needs 4 arguments."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ARCH=$1
|
||||
MODE=$2
|
||||
OUTDIR=$3
|
||||
GYPFLAGS=$4
|
||||
|
||||
host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
|
||||
|
||||
case "${host_os}" in
|
||||
"linux")
|
||||
toolchain_dir="linux-x86"
|
||||
;;
|
||||
*)
|
||||
echo "Host platform ${host_os} is not supported" >& 2
|
||||
exit 1
|
||||
esac
|
||||
|
||||
case "${ARCH}" in
|
||||
"android_arm")
|
||||
DEFINES=" target_arch=arm v8_target_arch=arm android_target_arch=arm"
|
||||
DEFINES+=" arm_neon=0 armv7=1"
|
||||
toolchain_arch="arm-linux-androideabi-4.4.3"
|
||||
;;
|
||||
"android_ia32")
|
||||
DEFINES=" target_arch=ia32 v8_target_arch=ia32 android_target_arch=x86"
|
||||
toolchain_arch="x86-4.4.3"
|
||||
;;
|
||||
*)
|
||||
echo "Architecture: ${ARCH} is not supported." >& 2
|
||||
echo "Current supported architectures: arm|ia32." >& 2
|
||||
exit 1
|
||||
esac
|
||||
|
||||
toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}/prebuilt/"
|
||||
ANDROID_TOOLCHAIN="${toolchain_path}/${toolchain_dir}/bin"
|
||||
if [ ! -d "${ANDROID_TOOLCHAIN}" ]; then
|
||||
echo "Cannot find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2
|
||||
echo "The NDK version might be wrong." >& 2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The set of GYP_DEFINES to pass to gyp.
|
||||
export GYP_DEFINES="${DEFINES}"
|
||||
|
||||
export GYP_GENERATORS=make
|
||||
export CC=${ANDROID_TOOLCHAIN}/*-gcc
|
||||
export CXX=${ANDROID_TOOLCHAIN}/*-g++
|
||||
build/gyp/gyp --generator-output="${OUTDIR}" build/all.gyp \
|
||||
-Ibuild/standalone.gypi --depth=. -Ibuild/android.gypi \
|
||||
-S.${ARCH} ${GYPFLAGS}
|
||||
|
||||
export AR=${ANDROID_TOOLCHAIN}/*-ar
|
||||
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}
|
||||
make -C "${OUTDIR}" -f Makefile.${ARCH}
|
@ -95,11 +95,14 @@ def BuildOptions():
|
||||
default=1, type="int")
|
||||
result.add_option("--time", help="Print timing information after running",
|
||||
default=False, action="store_true")
|
||||
result.add_option("--suppress-dialogs", help="Suppress Windows dialogs for crashing tests",
|
||||
dest="suppress_dialogs", default=True, action="store_true")
|
||||
result.add_option("--no-suppress-dialogs", help="Display Windows dialogs for crashing tests",
|
||||
dest="suppress_dialogs", action="store_false")
|
||||
result.add_option("--isolates", help="Whether to test isolates", default=False, action="store_true")
|
||||
result.add_option("--suppress-dialogs",
|
||||
help="Suppress Windows dialogs for crashing tests",
|
||||
dest="suppress_dialogs", default=True, action="store_true")
|
||||
result.add_option("--no-suppress-dialogs",
|
||||
help="Display Windows dialogs for crashing tests",
|
||||
dest="suppress_dialogs", action="store_false")
|
||||
result.add_option("--isolates", help="Whether to test isolates",
|
||||
default=False, action="store_true")
|
||||
result.add_option("--store-unexpected-output",
|
||||
help="Store the temporary JS files from tests that fails",
|
||||
dest="store_unexpected_output", default=True, action="store_true")
|
||||
@ -148,7 +151,8 @@ def ProcessOptions(options):
|
||||
print "Unknown mode %s" % mode
|
||||
return False
|
||||
for arch in options.arch:
|
||||
if not arch in ['ia32', 'x64', 'arm', 'mipsel', 'android']:
|
||||
if not arch in ['ia32', 'x64', 'arm', 'mipsel', 'android_arm',
|
||||
'android_ia32']:
|
||||
print "Unknown architecture %s" % arch
|
||||
return False
|
||||
if options.buildbot:
|
||||
|
Loading…
Reference in New Issue
Block a user