Chromium Code Reviews| Index: build/android/envsetup.sh |
| diff --git a/build/android/envsetup.sh b/build/android/envsetup.sh |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..280e695cbb473c58d3cd3e1f53bf61600c431b2a |
| --- /dev/null |
| +++ b/build/android/envsetup.sh |
| @@ -0,0 +1,137 @@ |
| +#!/bin/bash |
| +# Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +# Sets up environment for building Chromium on Android. Only Android NDK, |
| +# 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.
|
| +# |
| +# To run this script, the system environment ANDROID_NDK_ROOT must be set |
| +# 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.
|
| +# |
| +# 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
|
| +# to the Chrome's src directory. |
| + |
| +if [ ! -d "$ANDROID_NDK_ROOT" ]; then |
| + 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.
|
| + return 1 |
| +fi |
| + |
| +host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') |
| + |
| +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
|
| + "linux") |
| + toolchain_dir="linux-x86" |
| + ;; |
| + "mac") |
| + toolchain_dir="darwin-x86" |
| + ;; |
| + *) |
| + echo "Host platform $host_os is not supported" |
| + return 1 |
| +esac |
| + |
| +export ANDROID_TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/$toolchain_dir/bin/" |
| + |
| +if [ ! -d "$ANDROID_TOOLCHAIN" ]; then |
| + 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.
|
| + return 1 |
| +fi |
| + |
| +if [ -z "$CHROME_SRC" ]; then |
| + # if $CHROME_SRC was not set, assume current directory is CHROME_SRC. |
| + export CHROME_SRC=$(pwd) |
| +fi |
| + |
| +if [ ! -d "$CHROME_SRC" ]; then |
| + echo "CHROME_SRC must be set to the path of Chrome source code." |
| + return 1 |
| +fi |
| + |
| +make() { |
| + # TODO(michaelbai): how to use ccache in NDK. |
| + 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.
|
| + then |
| + if [ -e "$PREBUILT_CCACHE_PATH" ] |
| + then |
| + use_ccache_var="$PREBUILT_CCACHE_PATH " |
| + else |
| + use_ccache_var="" |
| + fi |
| + fi |
| + if [ -f "$PWD/build/android/envsetup.sh" ] |
| + then |
| + CC="$use_ccache_var$CROSS_CC" CXX="$use_ccache_var$CROSS_CXX" |
| + LINK="$CROSS_LINK" AR="$CROSS_AR" RANLIB="$CROSS_RANLIB" \ |
| + command make $* |
| + else |
| + command make $* |
| + fi |
| +} |
| + |
| +# Performs a gyp_chromium run to convert gyp->Makefile for android code. |
| +android_gyp() { |
| + "$CHROME_SRC"/build/gyp_chromium --depth="$CHROME_SRC" |
| +} |
| + |
| +LS="/bin/ls" # Use directly to avoid any 'ls' alias that might be defined. |
| +export CROSS_AR="$($LS ${ANDROID_TOOLCHAIN}/*-ar | head -n1)" |
| +export CROSS_CC="$($LS ${ANDROID_TOOLCHAIN}/*-gcc | head -n1)" |
| +export CROSS_CXX="$($LS ${ANDROID_TOOLCHAIN}/*-g++ | head -n1)" |
| +export CROSS_LINK="$($LS ${ANDROID_TOOLCHAIN}/*-gcc | head -n1)" |
| +export CROSS_RANLIB="$($LS ${ANDROID_TOOLCHAIN}/*-ranlib | head -n1)" |
| +export OBJCOPY="$($LS ${ANDROID_TOOLCHAIN}/*-objcopy | head -n1)" |
| +export STRIP="$($LS ${ANDROID_TOOLCHAIN}/*-strip | head -n1)" |
| + |
| +# The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories |
| +# to canonicalize them (remove double '/', remove trailing '/', etc). |
| +DEFINES="OS=android" |
| +DEFINES="${DEFINES} android_build_type=0" # Currently, Only '0' is supportted. |
| +DEFINES="${DEFINES} host_os=${host_os}" |
| +DEFINES="${DEFINES} linux_fpic=1" |
| +DEFINES="${DEFINES} release_optimize=s" |
| +DEFINES="${DEFINES} linux_use_tcmalloc=0" |
| +DEFINES="${DEFINES} disable_nacl=1" |
| +DEFINES="${DEFINES} remoting=0" |
| +DEFINES="${DEFINES} p2p_apis=0" |
| +DEFINES="${DEFINES} enable_touch_events=1" |
| +# TODO(bulach): use "shared_libraries" once the transition from executable |
| +# 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
|
| +DEFINES="${DEFINES} gtest_target_type=executable" |
| +if [ -z "$ANDROID_OFFICIAL_BUILD" ]; then |
| + DEFINES="${DEFINES} branding=Chromium" |
| +else |
| + DEFINES="${DEFINES} branding=Chrome" |
| + DEFINES="${DEFINES} buildtype=Official" |
| +fi |
| + |
| +# If the TARGET_PRODUCT wasn't set, use 'full' by default. |
| +if [ -z "$TARGET_PRODUCT" ]; then |
| + TARGET_PRODUCT="full" |
| +fi |
| + |
| +# The following defines will affect ARM code generation of both C/C++ compiler |
| +# and V8 mksnapshot. |
| +case "${TARGET_PRODUCT}" in |
| + "full") |
| + DEFINES="${DEFINES} target_arch=arm" |
| + 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,
|
| + ;; |
| + *x86*) |
| + # 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.
|
| + DEFINES="${DEFINES} target_arch=ia32 use_libffmpeg=0" |
| + ;; |
| + *) |
| + echo "TARGET_PRODUCT:${TARGET_PRODUCT} is not supported." |
| + return 1 |
| +esac |
| + |
| +export GYP_DEFINES="$DEFINES" |
| + |
| +# Use the "android" flavor of the Makefile generator for both Linux and OS X. |
| +export GYP_GENERATORS="make-android" |
| + |
| +# We want to use our version of "all" targets. |
| +export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp" |
| + |
| + |