OLD | NEW |
---|---|
(Empty) | |
1 #!/bin/bash | |
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
Mark Mentovai
2011/09/26 19:02:35
Blank line (no #) before this one.
michaelbai
2011/09/26 21:08:32
Done.
| |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 # Sets up environment for building Chromium on Android. Only Android NDK, | |
7 # Revision 6b on Linux or Mac is offically supported. | |
8 # | |
9 # To run this script, the system environment ANDROID_NDK_ROOT must be set | |
10 # to Android NDK's root path. | |
11 # | |
12 # TODO(michaelbai): Develop a standard for NDK/SDK integration. | |
13 # | |
14 # If current path isn't the Chrome's src directory, CHROME_SRC must be set | |
15 # to the Chrome's src directory. | |
16 | |
17 if [ ! -d "$ANDROID_NDK_ROOT" ]; then | |
Mark Mentovai
2011/09/26 19:02:35
Please revise this file to use ${ANDROID_NDK_ROOT}
michaelbai
2011/09/26 21:08:32
Done.
| |
18 echo "ANDROID_NDK_ROOT must be set to the path of Android NDK, Revision 6b." | |
19 echo "which could be downloaded from" | |
20 echo "http://developer.android.com/sdk/ndk/index.html" | |
21 return 1 | |
22 fi | |
23 | |
24 host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') | |
25 | |
26 case "$host_os" in | |
27 "linux") | |
28 toolchain_dir="linux-x86" | |
29 ;; | |
30 "mac") | |
31 toolchain_dir="darwin-x86" | |
32 ;; | |
33 *) | |
34 echo "Host platform $host_os is not supported" | |
35 return 1 | |
36 esac | |
37 | |
38 export ANDROID_TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.4 .3/prebuilt/$toolchain_dir/bin/" | |
39 | |
40 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then | |
41 echo "Can not find Android toolchain in $ANDROID_TOOLCHAIN." | |
42 echo "The NDK version might be wrong." | |
43 return 1 | |
44 fi | |
45 | |
46 if [ -z "$CHROME_SRC" ]; then | |
47 # if $CHROME_SRC was not set, assume current directory is CHROME_SRC. | |
48 export CHROME_SRC=$(pwd) | |
49 fi | |
50 | |
51 if [ ! -d "$CHROME_SRC" ]; then | |
52 echo "CHROME_SRC must be set to the path of Chrome source code." | |
53 return 1 | |
54 fi | |
55 | |
56 make() { | |
57 # TODO(michaelbai): how to use ccache in NDK. | |
58 if [ -n "$USE_CCACHE" ]; then | |
59 if [ -e "$PREBUILT_CCACHE_PATH" ]; then | |
60 use_ccache_var="$PREBUILT_CCACHE_PATH " | |
61 else | |
62 use_ccache_var="" | |
63 fi | |
64 fi | |
65 if [ -f "$PWD/build/android/envsetup.sh" ]; then | |
66 CC="$use_ccache_var$CROSS_CC" CXX="$use_ccache_var$CROSS_CXX" \ | |
67 LINK="$CROSS_LINK" AR="$CROSS_AR" RANLIB="$CROSS_RANLIB" \ | |
68 command make $* | |
69 else | |
70 command make $* | |
71 fi | |
72 } | |
73 | |
74 # Performs a gyp_chromium run to convert gyp->Makefile for android code. | |
75 android_gyp() { | |
76 "$CHROME_SRC"/build/gyp_chromium --depth="$CHROME_SRC" | |
77 } | |
78 | |
79 LS="/bin/ls" # Use directly to avoid any 'ls' alias that might be defined. | |
80 export CROSS_AR="$($LS ${ANDROID_TOOLCHAIN}/*-ar | head -n1)" | |
Mark Mentovai
2011/09/26 19:02:35
${LS} should be quoted.
${ANDROID_TOOLCHAIN} shou
michaelbai
2011/09/26 21:08:32
Done.
| |
81 export CROSS_CC="$($LS ${ANDROID_TOOLCHAIN}/*-gcc | head -n1)" | |
82 export CROSS_CXX="$($LS ${ANDROID_TOOLCHAIN}/*-g++ | head -n1)" | |
83 export CROSS_LINK="$($LS ${ANDROID_TOOLCHAIN}/*-gcc | head -n1)" | |
84 export CROSS_RANLIB="$($LS ${ANDROID_TOOLCHAIN}/*-ranlib | head -n1)" | |
85 export OBJCOPY="$($LS ${ANDROID_TOOLCHAIN}/*-objcopy | head -n1)" | |
86 export STRIP="$($LS ${ANDROID_TOOLCHAIN}/*-strip | head -n1)" | |
87 | |
88 # The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories | |
89 # to canonicalize them (remove double '/', remove trailing '/', etc). | |
90 DEFINES="OS=android" | |
91 DEFINES="${DEFINES} android_build_type=0" # Currently, Only '0' is supportted. | |
Mark Mentovai
2011/09/26 19:02:35
Instead of doing
DEFINES="${DEFINES} whatever"
y
michaelbai
2011/09/26 21:08:32
Done.
| |
92 DEFINES="${DEFINES} host_os=${host_os}" | |
93 DEFINES="${DEFINES} linux_fpic=1" | |
94 DEFINES="${DEFINES} release_optimize=s" | |
95 DEFINES="${DEFINES} linux_use_tcmalloc=0" | |
96 DEFINES="${DEFINES} disable_nacl=1" | |
97 DEFINES="${DEFINES} remoting=0" | |
98 DEFINES="${DEFINES} p2p_apis=0" | |
99 DEFINES="${DEFINES} enable_touch_events=1" | |
100 # TODO(bulach): use "shared_libraries" once the transition from executable | |
101 # is over. | |
102 DEFINES="${DEFINES} gtest_target_type=executable" | |
103 DEFINES="${DEFINES} branding=Chromium" | |
104 | |
105 # If the TARGET_PRODUCT wasn't set, use 'full' by default. | |
106 if [ -z "$TARGET_PRODUCT" ]; then | |
107 TARGET_PRODUCT="full" | |
108 fi | |
109 | |
110 # The following defines will affect ARM code generation of both C/C++ compiler | |
111 # and V8 mksnapshot. | |
112 case "${TARGET_PRODUCT}" in | |
113 "full") | |
114 DEFINES="${DEFINES} target_arch=arm" | |
115 DEFINES="${DEFINES} arm_neon=0 armv7=0 arm_thumb=1 arm_fpu=vfp" | |
116 ;; | |
117 *x86*) | |
Mark Mentovai
2011/09/26 19:02:35
Things are starting to get a little weird on the i
michaelbai
2011/09/26 21:08:32
Fixed the indentation.
| |
118 DEFINES="${DEFINES} target_arch=ia32 use_libffmpeg=0" | |
119 ;; | |
120 *) | |
121 echo "TARGET_PRODUCT:${TARGET_PRODUCT} is not supported." | |
122 return 1 | |
123 esac | |
124 | |
125 export GYP_DEFINES="$DEFINES" | |
126 | |
127 # Use the "android" flavor of the Makefile generator for both Linux and OS X. | |
128 export GYP_GENERATORS="make-android" | |
129 | |
130 # We want to use our version of "all" targets. | |
131 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp" | |
132 | |
Mark Mentovai
2011/09/26 19:02:35
Get rid of these two blank lines at EOF.
michaelbai
2011/09/26 21:08:32
Done.
| |
133 | |
OLD | NEW |