Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

Commit

Permalink
This patch is to enable x86 android build.
Browse files Browse the repository at this point in the history
patch includes two parts:
1. gyp files modification to include x86 android build.
2. add android config files for yasm which is copied from linux ones. enable android x86 build

This patch is cloned from the issue #10198027 for ownership issue. 
https://chromiumcodereview.appspot.com/10198027/

BUG=125160
TEST=


Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=135087

Review URL: http://codereview.chromium.org/10271039

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135110 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
james.wei@intel.com committed May 3, 2012
1 parent 5752d8f commit c369bfb
Show file tree
Hide file tree
Showing 8 changed files with 4,060 additions and 28 deletions.
7 changes: 7 additions & 0 deletions base/base.gypi
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -686,6 +686,13 @@
], ],
}], }],
[ 'OS == "android" and _toolset == "target"', { [ 'OS == "android" and _toolset == "target"', {
'conditions': [
['target_arch == "ia32"', {
'sources/': [
['include', '^atomicops_internals_x86_gcc\\.cc$'],
],
}],
],
'dependencies': [ 'dependencies': [
'symbolize', 'symbolize',
'../third_party/ashmem/ashmem.gyp:ashmem', '../third_party/ashmem/ashmem.gyp:ashmem',
Expand Down
42 changes: 20 additions & 22 deletions build/android/envsetup.sh
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -45,7 +45,25 @@ case "${host_os}" in
return 1 return 1
esac esac


export ANDROID_TOOLCHAIN="${ANDROID_NDK_ROOT}/toolchains/arm-linux-androideabi-4.4.3/prebuilt/${toolchain_dir}/bin/" # The following defines will affect ARM code generation of both C/C++ compiler
# and V8 mksnapshot.
case "${TARGET_PRODUCT-full}" in
"full")
DEFINES=" target_arch=arm"
DEFINES+=" arm_neon=0 armv7=1 arm_thumb=1 arm_fpu=vfpv3-d16"
toolchain_arch="arm-linux-androideabi-4.4.3"
;;
*x86*)
DEFINES=" target_arch=ia32 use_libffmpeg=0"
toolchain_arch="x86-4.4.3"
;;
*)
echo "TARGET_PRODUCT: ${TARGET_PRODUCT} is not supported." >& 2
return 1
esac

toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}/prebuilt/"
export ANDROID_TOOLCHAIN="${toolchain_path}/${toolchain_dir}/bin/"


export ANDROID_SDK_VERSION="15" export ANDROID_SDK_VERSION="15"


Expand Down Expand Up @@ -97,7 +115,7 @@ export STRIP=$(echo ${ANDROID_TOOLCHAIN}/*-strip)


# The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories # The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories
# to canonicalize them (remove double '/', remove trailing '/', etc). # to canonicalize them (remove double '/', remove trailing '/', etc).
DEFINES="OS=android" DEFINES+=" OS=android"
DEFINES+=" android_build_type=0" # Currently, Only '0' is supportted. DEFINES+=" android_build_type=0" # Currently, Only '0' is supportted.
DEFINES+=" host_os=${host_os}" DEFINES+=" host_os=${host_os}"
DEFINES+=" linux_fpic=1" DEFINES+=" linux_fpic=1"
Expand All @@ -113,26 +131,6 @@ DEFINES+=" build_ffmpegsumo=0"
DEFINES+=" gtest_target_type=executable" DEFINES+=" gtest_target_type=executable"
DEFINES+=" branding=Chromium" DEFINES+=" branding=Chromium"


# If the TARGET_PRODUCT wasn't set, use 'full' by default.
if [ -z "${TARGET_PRODUCT}" ]; then
TARGET_PRODUCT="full"
fi

# The following defines will affect ARM code generation of both C/C++ compiler
# and V8 mksnapshot.
case "${TARGET_PRODUCT}" in
"full")
DEFINES+=" target_arch=arm"
DEFINES+=" arm_neon=0 armv7=1 arm_thumb=1 arm_fpu=vfpv3-d16"
;;
*x86*)
DEFINES+=" target_arch=ia32 use_libffmpeg=0"
;;
*)
echo "TARGET_PRODUCT: ${TARGET_PRODUCT} is not supported." >& 2
return 1
esac

export GYP_DEFINES="${DEFINES}" export GYP_DEFINES="${DEFINES}"


# Use the "android" flavor of the Makefile generator for both Linux and OS X. # Use the "android" flavor of the Makefile generator for both Linux and OS X.
Expand Down
20 changes: 17 additions & 3 deletions build/common.gypi
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -823,7 +823,16 @@
'variables': { 'variables': {
'variables': { 'variables': {
'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)', 'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)',
'target_arch%': 'arm', # target_arch in android terms. # Android uses x86 instead of ia32 for their target_arch
# designation.
# TODO(wistoch): Adjust the target_arch naming scheme to avoid
# confusion.
# http://crbug.com/125329
'conditions': [
['target_arch == "ia32"', {
'target_arch': 'x86',
}],
],


# Switch between different build types, currently only '0' is # Switch between different build types, currently only '0' is
# supported. # supported.
Expand Down Expand Up @@ -978,7 +987,7 @@
], ],
}], }],


['os_posix==1 and chromeos==0 and target_arch!="arm"', { ['os_posix==1 and chromeos==0 and OS!="android"', {
'use_cups%': 1, 'use_cups%': 1,
}, { }, {
'use_cups%': 0, 'use_cups%': 0,
Expand Down Expand Up @@ -2381,7 +2390,6 @@
'ldflags': [ 'ldflags': [
'-nostdlib', '-nostdlib',
'-Wl,--no-undefined', '-Wl,--no-undefined',
'-Wl,--icf=safe', # Enable identical code folding to reduce size
# Don't export symbols from statically linked libraries. # Don't export symbols from statically linked libraries.
'-Wl,--exclude-libs=ALL', '-Wl,--exclude-libs=ALL',
], ],
Expand All @@ -2400,6 +2408,12 @@
'--sysroot=<(android_ndk_sysroot)', '--sysroot=<(android_ndk_sysroot)',
], ],
}], }],
['target_arch == "arm"', {
'ldflags': [
# Enable identical code folding to reduce size.
'-Wl,--icf=safe',
],
}],
# NOTE: The stlport header include paths below are specified in # NOTE: The stlport header include paths below are specified in
# cflags rather than include_dirs because they need to come # cflags rather than include_dirs because they need to come
# after include_dirs. Think of them like system headers, but # after include_dirs. Think of them like system headers, but
Expand Down
9 changes: 7 additions & 2 deletions skia/skia.gyp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1099,8 +1099,13 @@
'../third_party/skia/src/opts/SkBlitRow_opts_SSE2.cpp', '../third_party/skia/src/opts/SkBlitRow_opts_SSE2.cpp',
'../third_party/skia/src/opts/SkUtils_opts_SSE2.cpp', '../third_party/skia/src/opts/SkUtils_opts_SSE2.cpp',
], ],
'dependencies': [ 'conditions': [
'skia_opts_ssse3', # x86 Android doesn't support SSSE3 instructions.
[ 'OS != "android"', {
'dependencies': [
'skia_opts_ssse3',
],
}],
], ],
}, },
{ # arm { # arm
Expand Down
3 changes: 2 additions & 1 deletion third_party/yasm/README.chromium
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ Instructions for recreating the yasm.gyp file.
compiler warnings. compiler warnings.


5) Grab the generated Makefile, libyasm-stdint.h, config.h, and put into 5) Grab the generated Makefile, libyasm-stdint.h, config.h, and put into
the correct platform location. the correct platform location. For android platform, copy the files
generated for linux.


src/third_party/yasm/source/config/[platform] src/third_party/yasm/source/config/[platform]


Expand Down
Loading

0 comments on commit c369bfb

Please sign in to comment.