Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Sets up environment for building Chromium on Android. Only Android NDK, | 7 # Sets up environment for building Chromium on Android. Only Android NDK, |
| 8 # Revision 6b on Linux or Mac is offically supported. | 8 # Revision 6b on Linux or Mac is offically supported. |
| 9 # | 9 # |
| 10 # To run this script, the system environment ANDROID_NDK_ROOT must be set | 10 # To run this script, the system environment ANDROID_NDK_ROOT must be set |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 toolchain_dir="linux-x86" | 38 toolchain_dir="linux-x86" |
| 39 ;; | 39 ;; |
| 40 "mac") | 40 "mac") |
| 41 toolchain_dir="darwin-x86" | 41 toolchain_dir="darwin-x86" |
| 42 ;; | 42 ;; |
| 43 *) | 43 *) |
| 44 echo "Host platform ${host_os} is not supported" >& 2 | 44 echo "Host platform ${host_os} is not supported" >& 2 |
| 45 return 1 | 45 return 1 |
| 46 esac | 46 esac |
| 47 | 47 |
| 48 export ANDROID_TOOLCHAIN="${ANDROID_NDK_ROOT}/toolchains/arm-linux-androideabi-4 .4.3/prebuilt/${toolchain_dir}/bin/" | 48 # If the TARGET_PRODUCT wasn't set, use 'full' by default. |
|
Nico
2012/04/27 05:29:22
s/the //
Wei James
2012/04/27 08:59:05
fixed. thanks.
| |
| 49 if [ -z "${TARGET_PRODUCT}" ]; then | |
| 50 TARGET_PRODUCT="full" | |
| 51 fi | |
|
Nico
2012/04/27 05:29:22
You can remove this...
| |
| 52 | |
| 53 # The following defines will affect ARM code generation of both C/C++ compiler | |
| 54 # and V8 mksnapshot. | |
| 55 case "${TARGET_PRODUCT}" in | |
|
Nico
2012/04/27 05:29:22
...and say "${TARGET_PRODUCT-full}" here, that wil
Wei James
2012/04/27 08:59:05
fixed. thanks
| |
| 56 "full") | |
| 57 DEFINES=" target_arch=arm" | |
| 58 DEFINES+=" arm_neon=0 armv7=1 arm_thumb=1 arm_fpu=vfpv3-d16" | |
| 59 toolchain_arch="arm-linux-androideabi-4.4.3" | |
| 60 ;; | |
| 61 *x86*) | |
| 62 DEFINES=" target_arch=ia32 use_libffmpeg=0" | |
| 63 toolchain_arch="x86-4.4.3" | |
| 64 ;; | |
| 65 *) | |
| 66 echo "TARGET_PRODUCT: ${TARGET_PRODUCT} is not supported." >& 2 | |
| 67 return 1 | |
| 68 esac | |
| 69 | |
| 70 toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}/prebuilt/" | |
| 71 export ANDROID_TOOLCHAIN="${toolchain_path}/${toolchain_dir}/bin/" | |
| 49 | 72 |
| 50 export ANDROID_SDK_VERSION="15" | 73 export ANDROID_SDK_VERSION="15" |
| 51 | 74 |
| 52 # Needed by android antfiles when creating apks. | 75 # Needed by android antfiles when creating apks. |
| 53 export ANDROID_SDK_HOME=${ANDROID_SDK_ROOT} | 76 export ANDROID_SDK_HOME=${ANDROID_SDK_ROOT} |
| 54 | 77 |
| 55 # Add Android SDK/NDK tools to system path. | 78 # Add Android SDK/NDK tools to system path. |
| 56 export PATH=$PATH:${ANDROID_NDK_ROOT} | 79 export PATH=$PATH:${ANDROID_NDK_ROOT} |
| 57 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools | 80 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools |
| 58 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools | 81 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 86 LINK_target=$(basename ${ANDROID_TOOLCHAIN}/*-gcc) \ | 109 LINK_target=$(basename ${ANDROID_TOOLCHAIN}/*-gcc) \ |
| 87 AR_target=$(basename ${ANDROID_TOOLCHAIN}/*-ar) \ | 110 AR_target=$(basename ${ANDROID_TOOLCHAIN}/*-ar) \ |
| 88 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" | 111 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" |
| 89 } | 112 } |
| 90 | 113 |
| 91 export OBJCOPY=$(echo ${ANDROID_TOOLCHAIN}/*-objcopy) | 114 export OBJCOPY=$(echo ${ANDROID_TOOLCHAIN}/*-objcopy) |
| 92 export STRIP=$(echo ${ANDROID_TOOLCHAIN}/*-strip) | 115 export STRIP=$(echo ${ANDROID_TOOLCHAIN}/*-strip) |
| 93 | 116 |
| 94 # The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories | 117 # The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories |
| 95 # to canonicalize them (remove double '/', remove trailing '/', etc). | 118 # to canonicalize them (remove double '/', remove trailing '/', etc). |
| 96 DEFINES="OS=android" | 119 DEFINES+=" OS=android" |
| 97 DEFINES+=" android_build_type=0" # Currently, Only '0' is supportted. | 120 DEFINES+=" android_build_type=0" # Currently, Only '0' is supportted. |
| 98 DEFINES+=" host_os=${host_os}" | 121 DEFINES+=" host_os=${host_os}" |
| 99 DEFINES+=" linux_fpic=1" | 122 DEFINES+=" linux_fpic=1" |
| 100 DEFINES+=" release_optimize=s" | 123 DEFINES+=" release_optimize=s" |
| 101 DEFINES+=" linux_use_tcmalloc=0" | 124 DEFINES+=" linux_use_tcmalloc=0" |
| 102 DEFINES+=" disable_nacl=1" | 125 DEFINES+=" disable_nacl=1" |
| 103 DEFINES+=" remoting=0" | 126 DEFINES+=" remoting=0" |
| 104 DEFINES+=" p2p_apis=0" | 127 DEFINES+=" p2p_apis=0" |
| 105 DEFINES+=" enable_touch_events=1" | 128 DEFINES+=" enable_touch_events=1" |
| 106 DEFINES+=" build_ffmpegsumo=0" | 129 DEFINES+=" build_ffmpegsumo=0" |
| 107 # TODO(bulach): use "shared_libraries" once the transition from executable | 130 # TODO(bulach): use "shared_libraries" once the transition from executable |
| 108 # is over. | 131 # is over. |
| 109 DEFINES+=" gtest_target_type=executable" | 132 DEFINES+=" gtest_target_type=executable" |
| 110 DEFINES+=" branding=Chromium" | 133 DEFINES+=" branding=Chromium" |
| 111 | 134 |
| 112 # If the TARGET_PRODUCT wasn't set, use 'full' by default. | |
| 113 if [ -z "${TARGET_PRODUCT}" ]; then | |
| 114 TARGET_PRODUCT="full" | |
| 115 fi | |
| 116 | |
| 117 # The following defines will affect ARM code generation of both C/C++ compiler | |
| 118 # and V8 mksnapshot. | |
| 119 case "${TARGET_PRODUCT}" in | |
| 120 "full") | |
| 121 DEFINES+=" target_arch=arm" | |
| 122 DEFINES+=" arm_neon=0 armv7=1 arm_thumb=1 arm_fpu=vfpv3-d16" | |
| 123 ;; | |
| 124 *x86*) | |
| 125 DEFINES+=" target_arch=ia32 use_libffmpeg=0" | |
| 126 ;; | |
| 127 *) | |
| 128 echo "TARGET_PRODUCT: ${TARGET_PRODUCT} is not supported." >& 2 | |
| 129 return 1 | |
| 130 esac | |
| 131 | |
| 132 export GYP_DEFINES="${DEFINES}" | 135 export GYP_DEFINES="${DEFINES}" |
| 133 | 136 |
| 134 # Use the "android" flavor of the Makefile generator for both Linux and OS X. | 137 # Use the "android" flavor of the Makefile generator for both Linux and OS X. |
| 135 export GYP_GENERATORS="make-android" | 138 export GYP_GENERATORS="make-android" |
| 136 | 139 |
| 137 # Use our All target as the default | 140 # Use our All target as the default |
| 138 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" | 141 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" |
| 139 | 142 |
| 140 # We want to use our version of "all" targets. | 143 # We want to use our version of "all" targets. |
| 141 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp" | 144 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp" |
| OLD | NEW |