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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 # Needed by android antfiles when creating apks. | 84 # Needed by android antfiles when creating apks. |
85 export ANDROID_SDK_HOME=${ANDROID_SDK_ROOT} | 85 export ANDROID_SDK_HOME=${ANDROID_SDK_ROOT} |
86 | 86 |
87 # Add Android SDK/NDK tools to system path. | 87 # Add Android SDK/NDK tools to system path. |
88 export PATH=$PATH:${ANDROID_NDK_ROOT} | 88 export PATH=$PATH:${ANDROID_NDK_ROOT} |
89 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools | 89 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools |
90 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools | 90 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools |
91 # Must have tools like arm-linux-androideabi-gcc on the path for ninja | 91 # Must have tools like arm-linux-androideabi-gcc on the path for ninja |
92 export PATH=$PATH:${ANDROID_TOOLCHAIN} | 92 export PATH=$PATH:${ANDROID_TOOLCHAIN} |
93 | 93 |
| 94 CURRENT_DIR="$(readlink -f ${PWD})" |
94 if [ -z "${CHROME_SRC}" ]; then | 95 if [ -z "${CHROME_SRC}" ]; then |
95 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. | 96 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. |
96 export CHROME_SRC="${PWD}" | 97 export CHROME_SRC="${CURRENT_DIR}" |
97 fi | 98 fi |
98 | 99 |
99 if [ "${PWD/"${CHROME_SRC}"/}" == "${PWD}" ]; then | 100 if [ "${CURRENT_DIR/"${CHROME_SRC}"/}" == "${CURRENT_DIR}" ]; then |
100 # If current directory is not in $CHROME_SRC, it might be set for other | 101 # If current directory is not in $CHROME_SRC, it might be set for other |
101 # source tree. If $CHROME_SRC was set correctly and we are in the correct | 102 # source tree. If $CHROME_SRC was set correctly and we are in the correct |
102 # directory, "${PWD/"${CHROME_SRC}"/}" will be "". | 103 # directory, "${CURRENT_DIR/"${CHROME_SRC}"/}" will be "". |
103 # Otherwise, it will equal to "${PWD}" | 104 # Otherwise, it will equal to "${CURRENT_DIR}" |
104 echo "Warning: Current directory is out of CHROME_SRC, it may not be \ | 105 echo "Warning: Current directory is out of CHROME_SRC, it may not be \ |
105 the one you want." | 106 the one you want." |
106 echo "${CHROME_SRC}" | 107 echo "${CHROME_SRC}" |
107 fi | 108 fi |
108 | 109 |
109 if [ ! -d "${CHROME_SRC}" ]; then | 110 if [ ! -d "${CHROME_SRC}" ]; then |
110 echo "CHROME_SRC must be set to the path of Chrome source code." >& 2 | 111 echo "CHROME_SRC must be set to the path of Chrome source code." >& 2 |
111 return 1 | 112 return 1 |
112 fi | 113 fi |
113 | 114 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 export GYP_DEFINES="${DEFINES}" | 158 export GYP_DEFINES="${DEFINES}" |
158 | 159 |
159 # Use the "android" flavor of the Makefile generator for both Linux and OS X. | 160 # Use the "android" flavor of the Makefile generator for both Linux and OS X. |
160 export GYP_GENERATORS="make-android" | 161 export GYP_GENERATORS="make-android" |
161 | 162 |
162 # Use our All target as the default | 163 # Use our All target as the default |
163 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" | 164 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" |
164 | 165 |
165 # We want to use our version of "all" targets. | 166 # We want to use our version of "all" targets. |
166 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp" | 167 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp" |
OLD | NEW |