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