Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(872)

Side by Side Diff: platform_tools/android/bin/android_setup.sh

Issue 25275006: make vanilla android_ninja work, and add quiet options (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: sync Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | platform_tools/android/gyp/skia_android.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 # 2 #
3 # android_setup.sh: Sets environment variables used by other Android scripts. 3 # android_setup.sh: Sets environment variables used by other Android scripts.
4 4
5 # Parse the arguments for a DEVICE_ID. 5 # Parse the arguments for a DEVICE_ID.
6 DEVICE_ID="" 6 DEVICE_ID=""
7 DEVICE_SERIAL="" 7 DEVICE_SERIAL=""
8 while (( "$#" )); do 8 while (( "$#" )); do
9 if [[ $(echo "$1" | grep "^-d$") != "" ]]; 9 if [[ $(echo "$1" | grep "^-d$") != "" ]];
10 then 10 then
11 DEVICE_ID=$2 11 DEVICE_ID=$2
12 shift 12 shift
13 elif [[ "$1" == "-s" ]]; 13 elif [[ "$1" == "-s" ]];
14 then 14 then
15 if [[ $# -lt 2 ]]; 15 if [[ $# -lt 2 ]];
16 then 16 then
17 echo "ERROR: missing serial number" 17 echo "ERROR: missing serial number"
18 exit 1; 18 exit 1;
19 fi 19 fi
20 DEVICE_SERIAL="-s $2" 20 DEVICE_SERIAL="-s $2"
21 shift 21 shift
22 else 22 else
23 APP_ARGS=("${APP_ARGS[@]}" "${1}") 23 APP_ARGS=("${APP_ARGS[@]}" "${1}")
24 fi 24 fi
25 25
26 shift 26 shift
27 done 27 done
28 28
29 function verbose {
30 if [[ -n $VERBOSE ]]; then
borenet 2013/09/30 20:42:10 Could we rename this variable so that it's clear w
31 echo $@
32 fi
33 }
34
29 function exportVar { 35 function exportVar {
30 NAME=$1 36 NAME=$1
31 VALUE=$2 37 VALUE=$2
32 echo export $NAME=\"$VALUE\" 38 verbose export $NAME=\"$VALUE\"
33 export $NAME="$VALUE" 39 export $NAME="$VALUE"
34 } 40 }
35 41
36 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 42 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
37 43
38 # A valid Android SDK installation is required to build the sample app. 44 # A valid Android SDK installation is required to build the sample app.
39 if [ -z "$ANDROID_SDK_ROOT" ]; then 45 if [ -z "$ANDROID_SDK_ROOT" ]; then
40 ANDROID_TOOL=$(which android 2>/dev/null) 46 ANDROID_TOOL=$(which android 2>/dev/null)
41 if [ -z "$ANDROID_TOOL" ]; then 47 if [ -z "$ANDROID_TOOL" ]; then
42 echo "ERROR: Please define ANDROID_SDK_ROOT in your environment to point" 48 echo "ERROR: Please define ANDROID_SDK_ROOT in your environment to point"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 NDK_REV="8e" 80 NDK_REV="8e"
75 fi 81 fi
76 82
77 if [[ -z "$ANDROID_ARCH" ]]; 83 if [[ -z "$ANDROID_ARCH" ]];
78 then 84 then
79 ANDROID_ARCH="arm" 85 ANDROID_ARCH="arm"
80 fi 86 fi
81 87
82 TOOLCHAIN_DIR=${SCRIPT_DIR}/../toolchains 88 TOOLCHAIN_DIR=${SCRIPT_DIR}/../toolchains
83 if [ $(uname) == "Linux" ]; then 89 if [ $(uname) == "Linux" ]; then
84 echo "Using Linux toolchain." 90 verbose "Using Linux toolchain."
85 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-linux_v$API_LEVEL 91 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-linux_v$API_LEVEL
86 elif [ $(uname) == "Darwin" ]; then 92 elif [ $(uname) == "Darwin" ]; then
87 echo "Using Mac toolchain." 93 verbose "Using Mac toolchain."
88 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-mac_v$API_LEVEL 94 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-mac_v$API_LEVEL
89 else 95 else
90 echo "Could not automatically determine toolchain! Defaulting to Linux." 96 verbose "Could not automatically determine toolchain! Defaulting to Linux."
91 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-linux_v$API_LEVEL 97 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-linux_v$API_LEVEL
92 fi 98 fi
93 exportVar ANDROID_TOOLCHAIN ${TOOLCHAIN_DIR}/${TOOLCHAIN_TYPE}/bin 99 exportVar ANDROID_TOOLCHAIN ${TOOLCHAIN_DIR}/${TOOLCHAIN_TYPE}/bin
94 100
95 # if the toolchain doesn't exist on your machine then we need to fetch it 101 # if the toolchain doesn't exist on your machine then we need to fetch it
96 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then 102 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then
97 # create the toolchain directory if needed 103 # create the toolchain directory if needed
98 if [ ! -d "$TOOLCHAIN_DIR" ]; then 104 if [ ! -d "$TOOLCHAIN_DIR" ]; then
99 mkdir $TOOLCHAIN_DIR 105 mkdir $TOOLCHAIN_DIR
100 fi 106 fi
(...skipping 13 matching lines...) Expand all
114 echo "Removing $TARBALL" 120 echo "Removing $TARBALL"
115 rm $TARBALL 121 rm $TARBALL
116 popd 122 popd
117 fi 123 fi
118 124
119 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then 125 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then
120 echo "ERROR: unable to download/setup the required toolchain (${TOOLCHAIN_TY PE})" 126 echo "ERROR: unable to download/setup the required toolchain (${TOOLCHAIN_TY PE})"
121 return 1; 127 return 1;
122 fi 128 fi
123 129
124 echo "The build is targeting NDK API level $API_LEVEL for use on Android 4.0 ( NDK Revision $NDK_REV) and above" 130 verbose "The build is targeting NDK API level $API_LEVEL for use on Android 4. 0 (NDK Revision $NDK_REV) and above"
125 131
126 LS="/bin/ls" # Use directly to avoid any 'ls' alias that might be defined. 132 LS="/bin/ls" # Use directly to avoid any 'ls' alias that might be defined.
127 GCC=$($LS $ANDROID_TOOLCHAIN/*-gcc | head -n1) 133 GCC=$($LS $ANDROID_TOOLCHAIN/*-gcc | head -n1)
128 if [ -z "$GCC" ]; then 134 if [ -z "$GCC" ]; then
129 echo "ERROR: Could not find Android cross-compiler in: $ANDROID_TOOLCHAIN" 135 echo "ERROR: Could not find Android cross-compiler in: $ANDROID_TOOLCHAIN"
130 return 1 136 return 1
131 fi 137 fi
132 138
133 # Remove the '-gcc' at the end to get the full toolchain prefix 139 # Remove the '-gcc' at the end to get the full toolchain prefix
134 ANDROID_TOOLCHAIN_PREFIX=${GCC%%-gcc} 140 ANDROID_TOOLCHAIN_PREFIX=${GCC%%-gcc}
(...skipping 21 matching lines...) Expand all
156 DEFINES="${DEFINES} skia_os=android" 162 DEFINES="${DEFINES} skia_os=android"
157 DEFINES="${DEFINES} android_base=${SCRIPT_DIR}/.." 163 DEFINES="${DEFINES} android_base=${SCRIPT_DIR}/.."
158 DEFINES="${DEFINES} skia_shared_lib=1" 164 DEFINES="${DEFINES} skia_shared_lib=1"
159 165
160 # Setup the build variation depending on the target device 166 # Setup the build variation depending on the target device
161 TARGET_DEVICE="$1" 167 TARGET_DEVICE="$1"
162 168
163 if [ -z "$TARGET_DEVICE" ]; then 169 if [ -z "$TARGET_DEVICE" ]; then
164 if [ -f .android_config ]; then 170 if [ -f .android_config ]; then
165 TARGET_DEVICE=$(cat .android_config) 171 TARGET_DEVICE=$(cat .android_config)
166 echo "INFO: no target device was specified so using the device (${TARGET_D EVICE}) from the most recent build" 172 verbose "INFO: no target device was specified so using the device (${TARGE T_DEVICE}) from the most recent build"
167 else 173 else
168 TARGET_DEVICE="arm_v7_thumb" 174 TARGET_DEVICE="arm_v7_thumb"
169 echo "INFO: no target device type was specified so using the default '${TA RGET_DEVICE}'" 175 verbose "INFO: no target device type was specified so using the default '$ {TARGET_DEVICE}'"
170 fi 176 fi
171 fi 177 fi
172 178
173 case $TARGET_DEVICE in 179 case $TARGET_DEVICE in
174 nexus_s) 180 nexus_s)
175 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thumb= 1" 181 DEFINES="${DEFINES} skia_arch_type=arm arm_neon=1 arm_version=7 arm_thumb= 1"
176 DEFINES="${DEFINES} skia_texture_cache_mb_limit=24" 182 DEFINES="${DEFINES} skia_texture_cache_mb_limit=24"
177 ANDROID_ARCH="arm" 183 ANDROID_ARCH="arm"
178 ;; 184 ;;
179 nexus_4 | nexus_7 | nexus_10) 185 nexus_4 | nexus_7 | nexus_10)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 DEFINES="${DEFINES} skia_texture_cache_mb_limit=32" 226 DEFINES="${DEFINES} skia_texture_cache_mb_limit=32"
221 ANDROID_ARCH="x86" 227 ANDROID_ARCH="x86"
222 ;; 228 ;;
223 *) 229 *)
224 echo -n "ERROR: unknown device specified ($TARGET_DEVICE), valid values: " 230 echo -n "ERROR: unknown device specified ($TARGET_DEVICE), valid values: "
225 echo "nexus_[s,4,7,10] xoom galaxy_nexus razr_i arm arm_thumb arm_v7 arm_v 7_thumb x86" 231 echo "nexus_[s,4,7,10] xoom galaxy_nexus razr_i arm arm_thumb arm_v7 arm_v 7_thumb x86"
226 return 1; 232 return 1;
227 ;; 233 ;;
228 esac 234 esac
229 235
230 echo "The build is targeting the device: $TARGET_DEVICE" 236 verbose "The build is targeting the device: $TARGET_DEVICE"
231 export DEVICE_ID="$TARGET_DEVICE" 237 export DEVICE_ID="$TARGET_DEVICE"
232 238
233 # Set up the toolchain. 239 # Set up the toolchain.
234 setup_toolchain 240 setup_toolchain
235 if [[ "$?" != "0" ]]; then 241 if [[ "$?" != "0" ]]; then
236 return 1 242 return 1
237 fi 243 fi
238 DEFINES="${DEFINES} android_toolchain=${TOOLCHAIN_TYPE}" 244 DEFINES="${DEFINES} android_toolchain=${TOOLCHAIN_TYPE}"
239 245
240 exportVar GYP_DEFINES "$DEFINES" 246 exportVar GYP_DEFINES "$DEFINES"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 else 323 else
318 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST 324 $ADB $DEVICE_SERIAL push $HOST_SRC $ANDROID_DST
319 fi 325 fi
320 } 326 }
321 327
322 # Set up the device. 328 # Set up the device.
323 setup_device "${DEVICE_ID}" 329 setup_device "${DEVICE_ID}"
324 if [[ "$?" != "0" ]]; then 330 if [[ "$?" != "0" ]]; then
325 exit 1 331 exit 1
326 fi 332 fi
OLDNEW
« no previous file with comments | « no previous file | platform_tools/android/gyp/skia_android.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698