Index: build/android/envsetup_functions.sh |
diff --git a/build/android/envsetup_functions.sh b/build/android/envsetup_functions.sh |
index 051f4ee266ebda317c33f1100aa83d4e205ec9d5..57ecd31e6b58c7bdca80455f00dbed546219c1a2 100755 |
--- a/build/android/envsetup_functions.sh |
+++ b/build/android/envsetup_functions.sh |
@@ -25,12 +25,20 @@ common_check_toolchain() { |
# based on CHROME_SRC and ANDROID_TOOLCHAIN, along with DEFINES for GYP_DEFINES. |
################################################################################ |
common_vars_defines() { |
- |
# Set toolchain path according to product architecture. |
- toolchain_arch="arm-linux-androideabi" |
- if [[ "${TARGET_PRODUCT}" =~ .*x86.* ]]; then |
- toolchain_arch="x86" |
- fi |
+ case "${TARGET_ARCH}" in |
+ "arm") |
+ toolchain_arch="arm-linux-androideabi" |
+ ;; |
+ "x86") |
+ toolchain_arch="x86" |
+ ;; |
+ *) |
+ echo "TARGET_ARCH: ${TARGET_ARCH} is not supported." >& 2 |
+ usage |
+ return 1 |
+ ;; |
+ esac |
toolchain_version="4.6" |
# We directly set the gcc_version since we know what we use, and it should |
@@ -100,44 +108,24 @@ common_vars_defines() { |
# The following defines will affect ARM code generation of both C/C++ compiler |
# and V8 mksnapshot. |
- case "${TARGET_PRODUCT}" in |
- "passion"|"soju"|"sojua"|"sojus"|"yakju"|"mysid"|"nakasi") |
- DEFINES+=" arm_neon=1 armv7=1 arm_thumb=1" |
- DEFINES+=" ${ORDER_DEFINES}" |
- TARGET_ARCH="arm" |
- ;; |
- "trygon"|"tervigon") |
+ case "${TARGET_ARCH}" in |
+ "arm") |
DEFINES+=" arm_neon=0 armv7=1 arm_thumb=1 arm_fpu=vfpv3-d16" |
DEFINES+=" ${ORDER_DEFINES}" |
- TARGET_ARCH="arm" |
- ;; |
- "full") |
- DEFINES+=" arm_neon=0 armv7=0 arm_thumb=1 arm_fpu=vfp" |
- TARGET_ARCH="arm" |
+ DEFINES+=" target_arch=arm" |
;; |
- *x86*) |
+ "x86") |
# TODO(tedbo): The ia32 build fails on ffmpeg, so we disable it here. |
DEFINES+=" use_libffmpeg=0" |
host_arch=$(uname -m | sed -e \ |
's/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/') |
DEFINES+=" host_arch=${host_arch}" |
- TARGET_ARCH="x86" |
- ;; |
- *) |
- echo "TARGET_PRODUCT: ${TARGET_PRODUCT} is not supported." >& 2 |
- return 1 |
- esac |
- |
- case "${TARGET_ARCH}" in |
- "arm") |
- DEFINES+=" target_arch=arm" |
- ;; |
- "x86") |
DEFINES+=" target_arch=ia32" |
;; |
*) |
echo "TARGET_ARCH: ${TARGET_ARCH} is not supported." >& 2 |
+ usage |
return 1 |
esac |
@@ -164,6 +152,49 @@ common_gyp_vars() { |
################################################################################ |
+# Prints out help message on usage. |
+################################################################################ |
+usage() { |
Isaac (away)
2012/10/24 20:54:48
rename print_usage
Jinsuk Kim (do not use this)
2012/10/25 01:03:59
Done.
|
+ echo "usage: ${0##*/} [-t target_arch] [-h]" >& 2 |
+ echo "-t target_arch target CPU architecture (arm=default, x86)" >& 2 |
+ echo "-h this help" >& 2 |
+} |
+ |
+################################################################################ |
+# Process command line options. |
+# -t target_arch Specifices target CPU architecture. Currently supported |
+# architectures are "arm" (default), and "x86". |
+# -h Prints out help message. |
+################################################################################ |
+process_options() { |
+ while getopts “ht:” OPTION; do |
+ case $OPTION in |
+ h) |
+ usage |
+ return 1 |
+ ;; |
+ t) |
+ target_arch=$OPTARG |
+ ;; |
+ *) |
+ echo "invalid command line option: $OPTARG" >& 2 |
+ usage |
+ return 1 |
+ ;; |
+ esac |
+ done |
+ |
+ if [ $# -ge ${OPTIND} ]; then |
Isaac (away)
2012/10/24 20:54:48
I don't see where $OPTIND is defined.
Jinsuk Kim (do not use this)
2012/10/25 01:03:59
OPTIND (together with OPTERR, OPTARG) is defined (
|
+ eval echo "Unexpected command line argument: \${${OPTIND}}" >& 2 |
+ usage |
+ return 1 |
+ fi |
+ |
+ # Sets TARGET_ARCH. Defaults to arm if not specified. |
+ TARGET_ARCH=${target_arch:-arm} |
+} |
+ |
+################################################################################ |
# Initializes environment variables for NDK/SDK build. Only Android NDK Revision |
# 7 on Linux or Mac is offically supported. To run this script, the system |
# environment ANDROID_NDK_ROOT must be set to Android NDK's root path. The |
@@ -193,9 +224,6 @@ sdk_build_init() { |
unset ANDROID_BUILD_TOP |
- # Set default target. |
- export TARGET_PRODUCT="${TARGET_PRODUCT:-trygon}" |
Yaron
2012/10/24 20:50:17
build/android/emulator.py refers to this environme
Jinsuk Kim (do not use this)
2012/10/25 01:03:59
Thanks for catching it. I reverted the change to h
|
- |
# Unset toolchain so that it can be set based on TARGET_PRODUCT. |
# This makes it easy to switch between architectures. |
unset ANDROID_TOOLCHAIN |