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

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: Created 9 years, 3 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
« build/all_android.gyp ('K') | « 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 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
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 in Linux or Mac is offically supported.
John Grabowski 2011/09/23 19:40:31 in Linux --> on Linux
michaelbai 2011/09/26 17:15:13 Done.
8 #
9 # To run this script, the system environment ANDROID_NDK_ROOT must be set
10 # to Android NDK's root path.
John Grabowski 2011/09/23 19:40:31 Add TODO here to develop a standard for NDK/SDK in
michaelbai 2011/09/26 17:15:13 Done.
11 #
12 # If current path isn't the Chrome's src directory, CHROME_SRC must be set
John Grabowski 2011/09/23 19:40:31 Not sure I like this... is a bit non-standard for
Peter Beverloo 2011/09/23 21:55:28 Since this script will be stored in build/android/
michaelbai 2011/09/26 17:15:13 I am not sure how it work, most of time, this scri
13 # to the Chrome's src directory.
14
15 if [ ! -d "$ANDROID_NDK_ROOT" ]; then
16 echo "ANDROID_NDK_ROOT must be set to the path of Android NDK, Revision 6b."
John Grabowski 2011/09/23 19:40:31 Provide download link
michaelbai 2011/09/26 17:15:13 Done.
17 return 1
18 fi
19
20 host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
21
22 case "$host_os" in
John Grabowski 2011/09/23 19:40:31 Is there a standard or suggested way of doing this
michaelbai 2011/09/26 17:15:13 I didn't find it. On 2011/09/23 19:40:31, John Gr
23 "linux")
24 toolchain_dir="linux-x86"
25 ;;
26 "mac")
27 toolchain_dir="darwin-x86"
28 ;;
29 *)
30 echo "Host platform $host_os is not supported"
31 return 1
32 esac
33
34 export ANDROID_TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.4 .3/prebuilt/$toolchain_dir/bin/"
35
36 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then
37 echo "Can not find Android toolchain in $ANDROID_TOOLCHAIN."
Peter Beverloo 2011/09/23 21:55:28 Maybe emphasize that the person running the script
michaelbai 2011/09/26 17:15:13 Done.
38 return 1
39 fi
40
41 if [ -z "$CHROME_SRC" ]; then
42 # if $CHROME_SRC was not set, assume current directory is CHROME_SRC.
43 export CHROME_SRC=$(pwd)
44 fi
45
46 if [ ! -d "$CHROME_SRC" ]; then
47 echo "CHROME_SRC must be set to the path of Chrome source code."
48 return 1
49 fi
50
51 make() {
52 # TODO(michaelbai): how to use ccache in NDK.
53 if [ -n "$USE_CCACHE" ]
John Grabowski 2011/09/23 19:40:31 if/then on same line (like above) Several spots he
michaelbai 2011/09/26 17:15:13 Done.
54 then
55 if [ -e "$PREBUILT_CCACHE_PATH" ]
56 then
57 use_ccache_var="$PREBUILT_CCACHE_PATH "
58 else
59 use_ccache_var=""
60 fi
61 fi
62 if [ -f "$PWD/build/android/envsetup.sh" ]
63 then
64 CC="$use_ccache_var$CROSS_CC" CXX="$use_ccache_var$CROSS_CXX"
65 LINK="$CROSS_LINK" AR="$CROSS_AR" RANLIB="$CROSS_RANLIB" \
66 command make $*
67 else
68 command make $*
69 fi
70 }
71
72 # Performs a gyp_chromium run to convert gyp->Makefile for android code.
73 android_gyp() {
74 "$CHROME_SRC"/build/gyp_chromium --depth="$CHROME_SRC"
75 }
76
77 LS="/bin/ls" # Use directly to avoid any 'ls' alias that might be defined.
78 export CROSS_AR="$($LS ${ANDROID_TOOLCHAIN}/*-ar | head -n1)"
79 export CROSS_CC="$($LS ${ANDROID_TOOLCHAIN}/*-gcc | head -n1)"
80 export CROSS_CXX="$($LS ${ANDROID_TOOLCHAIN}/*-g++ | head -n1)"
81 export CROSS_LINK="$($LS ${ANDROID_TOOLCHAIN}/*-gcc | head -n1)"
82 export CROSS_RANLIB="$($LS ${ANDROID_TOOLCHAIN}/*-ranlib | head -n1)"
83 export OBJCOPY="$($LS ${ANDROID_TOOLCHAIN}/*-objcopy | head -n1)"
84 export STRIP="$($LS ${ANDROID_TOOLCHAIN}/*-strip | head -n1)"
85
86 # The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories
87 # to canonicalize them (remove double '/', remove trailing '/', etc).
88 DEFINES="OS=android"
89 DEFINES="${DEFINES} android_build_type=0" # Currently, Only '0' is supportted.
90 DEFINES="${DEFINES} host_os=${host_os}"
91 DEFINES="${DEFINES} linux_fpic=1"
92 DEFINES="${DEFINES} release_optimize=s"
93 DEFINES="${DEFINES} linux_use_tcmalloc=0"
94 DEFINES="${DEFINES} disable_nacl=1"
95 DEFINES="${DEFINES} remoting=0"
96 DEFINES="${DEFINES} p2p_apis=0"
97 DEFINES="${DEFINES} enable_touch_events=1"
98 # TODO(bulach): use "shared_libraries" once the transition from executable
99 # is over.
Peter Beverloo 2011/09/23 21:55:28 Please check up with bulach@ if this to-do should
michaelbai 2011/09/26 17:15:13 We will not wait if the shared_libraries version i
100 DEFINES="${DEFINES} gtest_target_type=executable"
101 if [ -z "$ANDROID_OFFICIAL_BUILD" ]; then
102 DEFINES="${DEFINES} branding=Chromium"
103 else
104 DEFINES="${DEFINES} branding=Chrome"
105 DEFINES="${DEFINES} buildtype=Official"
106 fi
107
108 # If the TARGET_PRODUCT wasn't set, use 'full' by default.
109 if [ -z "$TARGET_PRODUCT" ]; then
110 TARGET_PRODUCT="full"
111 fi
112
113 # The following defines will affect ARM code generation of both C/C++ compiler
114 # and V8 mksnapshot.
115 case "${TARGET_PRODUCT}" in
116 "full")
117 DEFINES="${DEFINES} target_arch=arm"
118 DEFINES="${DEFINES} arm_neon=0 armv7=0 arm_thumb=1 arm_fpu=vfp"
Peter Beverloo 2011/09/23 21:55:28 WebKit currently assumes arm_neon=1 and armv7=1, w
michaelbai 2011/09/26 17:15:13 Let's discuss off line, once we make the decision,
119 ;;
120 *x86*)
121 # TODO(tedbo): The ia32 build fails on ffmpeg, so we disable it here.
Peter Beverloo 2011/09/23 21:55:28 We completely disable ffmpeg, only defining use_li
michaelbai 2011/09/26 17:15:13 Done.
122 DEFINES="${DEFINES} target_arch=ia32 use_libffmpeg=0"
123 ;;
124 *)
125 echo "TARGET_PRODUCT:${TARGET_PRODUCT} is not supported."
126 return 1
127 esac
128
129 export GYP_DEFINES="$DEFINES"
130
131 # Use the "android" flavor of the Makefile generator for both Linux and OS X.
132 export GYP_GENERATORS="make-android"
133
134 # We want to use our version of "all" targets.
135 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp"
136
137
OLDNEW
« build/all_android.gyp ('K') | « build/all_android.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698