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..575ac04b2f22e77a626bbc18de47fa6147a01e4c |
| --- /dev/null |
| +++ b/build/android/envsetup.sh |
| @@ -0,0 +1,133 @@ |
| +#!/bin/bash |
| +# 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.
|
| +# 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 on Linux or Mac is offically supported. |
| +# |
| +# To run this script, the system environment ANDROID_NDK_ROOT must be set |
| +# to Android NDK's root path. |
| +# |
| +# TODO(michaelbai): Develop a standard for NDK/SDK integration. |
| +# |
| +# If current path isn't the Chrome's src directory, CHROME_SRC must be set |
| +# to the Chrome's src directory. |
| + |
| +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.
|
| + echo "ANDROID_NDK_ROOT must be set to the path of Android NDK, Revision 6b." |
| + echo "which could be downloaded from" |
| + echo "http://developer.android.com/sdk/ndk/index.html" |
| + return 1 |
| +fi |
| + |
| +host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') |
| + |
| +case "$host_os" in |
| + "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." |
| + echo "The NDK version might be wrong." |
| + 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" ]; 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)" |
|
Mark Mentovai
2011/09/26 19:02:35
${LS} should be quoted.
${ANDROID_TOOLCHAIN} shou
michaelbai
2011/09/26 21:08:32
Done.
|
| +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. |
|
Mark Mentovai
2011/09/26 19:02:35
Instead of doing
DEFINES="${DEFINES} whatever"
y
michaelbai
2011/09/26 21:08:32
Done.
|
| +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. |
| +DEFINES="${DEFINES} gtest_target_type=executable" |
| +DEFINES="${DEFINES} branding=Chromium" |
| + |
| +# 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" |
| + ;; |
| + *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.
|
| + 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" |
| + |
|
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.
|
| + |