| 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 # The following defines will affect ARM code generation of both C/C++ compiler | 48 export ANDROID_TOOLCHAIN="${ANDROID_NDK_ROOT}/toolchains/arm-linux-androideabi-4
.4.3/prebuilt/${toolchain_dir}/bin/" |
| 49 # and V8 mksnapshot. | |
| 50 case "${TARGET_PRODUCT-full}" in | |
| 51 "full") | |
| 52 DEFINES=" target_arch=arm" | |
| 53 DEFINES+=" arm_neon=0 armv7=1 arm_thumb=1 arm_fpu=vfpv3-d16" | |
| 54 toolchain_arch="arm-linux-androideabi-4.4.3" | |
| 55 ;; | |
| 56 *x86*) | |
| 57 DEFINES=" target_arch=ia32 use_libffmpeg=0" | |
| 58 toolchain_arch="x86-4.4.3" | |
| 59 ;; | |
| 60 *) | |
| 61 echo "TARGET_PRODUCT: ${TARGET_PRODUCT} is not supported." >& 2 | |
| 62 return 1 | |
| 63 esac | |
| 64 | |
| 65 toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}/prebuilt/" | |
| 66 export ANDROID_TOOLCHAIN="${toolchain_path}/${toolchain_dir}/bin/" | |
| 67 | 49 |
| 68 export ANDROID_SDK_VERSION="15" | 50 export ANDROID_SDK_VERSION="15" |
| 69 | 51 |
| 70 # Needed by android antfiles when creating apks. | 52 # Needed by android antfiles when creating apks. |
| 71 export ANDROID_SDK_HOME=${ANDROID_SDK_ROOT} | 53 export ANDROID_SDK_HOME=${ANDROID_SDK_ROOT} |
| 72 | 54 |
| 73 # Add Android SDK/NDK tools to system path. | 55 # Add Android SDK/NDK tools to system path. |
| 74 export PATH=$PATH:${ANDROID_NDK_ROOT} | 56 export PATH=$PATH:${ANDROID_NDK_ROOT} |
| 75 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools | 57 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools |
| 76 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools | 58 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 LINK_target=$(basename ${ANDROID_TOOLCHAIN}/*-gcc) \ | 90 LINK_target=$(basename ${ANDROID_TOOLCHAIN}/*-gcc) \ |
| 109 AR_target=$(basename ${ANDROID_TOOLCHAIN}/*-ar) \ | 91 AR_target=$(basename ${ANDROID_TOOLCHAIN}/*-ar) \ |
| 110 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" | 92 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" |
| 111 } | 93 } |
| 112 | 94 |
| 113 export OBJCOPY=$(echo ${ANDROID_TOOLCHAIN}/*-objcopy) | 95 export OBJCOPY=$(echo ${ANDROID_TOOLCHAIN}/*-objcopy) |
| 114 export STRIP=$(echo ${ANDROID_TOOLCHAIN}/*-strip) | 96 export STRIP=$(echo ${ANDROID_TOOLCHAIN}/*-strip) |
| 115 | 97 |
| 116 # The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories | 98 # The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories |
| 117 # to canonicalize them (remove double '/', remove trailing '/', etc). | 99 # to canonicalize them (remove double '/', remove trailing '/', etc). |
| 118 DEFINES+=" OS=android" | 100 DEFINES="OS=android" |
| 119 DEFINES+=" android_build_type=0" # Currently, Only '0' is supportted. | 101 DEFINES+=" android_build_type=0" # Currently, Only '0' is supportted. |
| 120 DEFINES+=" host_os=${host_os}" | 102 DEFINES+=" host_os=${host_os}" |
| 121 DEFINES+=" linux_fpic=1" | 103 DEFINES+=" linux_fpic=1" |
| 122 DEFINES+=" release_optimize=s" | 104 DEFINES+=" release_optimize=s" |
| 123 DEFINES+=" linux_use_tcmalloc=0" | 105 DEFINES+=" linux_use_tcmalloc=0" |
| 124 DEFINES+=" disable_nacl=1" | 106 DEFINES+=" disable_nacl=1" |
| 125 DEFINES+=" remoting=0" | 107 DEFINES+=" remoting=0" |
| 126 DEFINES+=" p2p_apis=0" | 108 DEFINES+=" p2p_apis=0" |
| 127 DEFINES+=" enable_touch_events=1" | 109 DEFINES+=" enable_touch_events=1" |
| 128 DEFINES+=" build_ffmpegsumo=0" | 110 DEFINES+=" build_ffmpegsumo=0" |
| 129 # TODO(bulach): use "shared_libraries" once the transition from executable | 111 # TODO(bulach): use "shared_libraries" once the transition from executable |
| 130 # is over. | 112 # is over. |
| 131 DEFINES+=" gtest_target_type=executable" | 113 DEFINES+=" gtest_target_type=executable" |
| 132 DEFINES+=" branding=Chromium" | 114 DEFINES+=" branding=Chromium" |
| 133 | 115 |
| 116 # If the TARGET_PRODUCT wasn't set, use 'full' by default. |
| 117 if [ -z "${TARGET_PRODUCT}" ]; then |
| 118 TARGET_PRODUCT="full" |
| 119 fi |
| 120 |
| 121 # The following defines will affect ARM code generation of both C/C++ compiler |
| 122 # and V8 mksnapshot. |
| 123 case "${TARGET_PRODUCT}" in |
| 124 "full") |
| 125 DEFINES+=" target_arch=arm" |
| 126 DEFINES+=" arm_neon=0 armv7=1 arm_thumb=1 arm_fpu=vfpv3-d16" |
| 127 ;; |
| 128 *x86*) |
| 129 DEFINES+=" target_arch=ia32 use_libffmpeg=0" |
| 130 ;; |
| 131 *) |
| 132 echo "TARGET_PRODUCT: ${TARGET_PRODUCT} is not supported." >& 2 |
| 133 return 1 |
| 134 esac |
| 135 |
| 134 export GYP_DEFINES="${DEFINES}" | 136 export GYP_DEFINES="${DEFINES}" |
| 135 | 137 |
| 136 # Use the "android" flavor of the Makefile generator for both Linux and OS X. | 138 # Use the "android" flavor of the Makefile generator for both Linux and OS X. |
| 137 export GYP_GENERATORS="make-android" | 139 export GYP_GENERATORS="make-android" |
| 138 | 140 |
| 139 # Use our All target as the default | 141 # Use our All target as the default |
| 140 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" | 142 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" |
| 141 | 143 |
| 142 # We want to use our version of "all" targets. | 144 # We want to use our version of "all" targets. |
| 143 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp" | 145 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp" |
| OLD | NEW |