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

Side by Side Diff: build/android/envsetup.sh

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

Powered by Google App Engine
This is Rietveld 408576698