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

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

Issue 10821066: Revert 148377 - [Android] Upstream additional changes from envsetup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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/android/adb_device_functions.sh ('k') | build/android/envsetup_functions.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Sets up environment for building Chromium on Android. It can either be 7 # Sets up environment for building Chromium on Android. Only Android NDK,
8 # compiled with the Android tree or using the Android SDK/NDK. To build with 8 # Revision 6b on Linux or Mac is offically supported.
9 # NDK/SDK: ". build/android/envsetup.sh --sdk". Environment variable 9 #
10 # ANDROID_SDK_BUILD=1 will then be defined and used in the rest of the setup to 10 # To run this script, the system environment ANDROID_NDK_ROOT must be set
11 # specifiy build type. 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.
12 17
13 # NOTE(yfriedman): This looks unnecessary but downstream the default value 18 if [ ! -d "${ANDROID_NDK_ROOT}" ]; then
14 # should be 0 until all builds switch to SDK/NDK. 19 echo "ANDROID_NDK_ROOT must be set to the path of Android NDK, Revision 6b." \
15 export ANDROID_SDK_BUILD=1 20 >& 2
16 # Loop over args in case we add more arguments in the future. 21 echo "which could be installed by" >& 2
17 while [ "$1" != "" ]; do 22 echo "<chromium_tree>/src/build/install-build-deps-android-sdk.sh" >& 2
18 case $1 in 23 return 1
19 -s | --sdk ) export ANDROID_SDK_BUILD=1 ; shift ;; 24 fi
20 * ) shift ; break ;;
21 esac
22 done
23 25
24 if [[ "${ANDROID_SDK_BUILD}" -eq 1 ]]; then 26 if [ ! -d "${ANDROID_SDK_ROOT}" ]; then
25 echo "Using SDK build" 27 echo "ANDROID_SDK_ROOT must be set to the path of Android SDK, Android 3.2." \
28 >& 2
29 echo "which could be installed by" >& 2
30 echo "<chromium_tree>/src/build/install-build-deps-android-sdk.sh" >& 2
31 return 1
26 fi 32 fi
27 33
28 host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') 34 host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
29 35
30 case "${host_os}" in 36 case "${host_os}" in
31 "linux") 37 "linux")
32 toolchain_dir="linux-x86" 38 toolchain_dir="linux-x86"
33 ;; 39 ;;
34 "mac") 40 "mac")
35 toolchain_dir="darwin-x86" 41 toolchain_dir="darwin-x86"
36 ;; 42 ;;
37 *) 43 *)
38 echo "Host platform ${host_os} is not supported" >& 2 44 echo "Host platform ${host_os} is not supported" >& 2
39 return 1 45 return 1
40 esac 46 esac
41 47
42 CURRENT_DIR="$(readlink -f "$(dirname $BASH_SOURCE)/../../")" 48 # The following defines will affect ARM code generation of both C/C++ compiler
49 # and V8 mksnapshot.
50 case "${TARGET_PRODUCT-full}" in
51 "full")
52 DEFINES=" target_arch=arm"
53 DEFINES+=" arm_neon=0 armv7=1 arm_thumb=1 arm_fpu=vfpv3-d16"
54 toolchain_arch="arm-linux-androideabi-4.4.3"
55 ;;
56 *x86*)
57 DEFINES=" target_arch=ia32 use_libffmpeg=0"
58 toolchain_arch="x86-4.4.3"
59 ;;
60 *)
61 echo "TARGET_PRODUCT: ${TARGET_PRODUCT} is not supported." >& 2
62 return 1
63 esac
64
65 # If we are building NDK/SDK, and in the upstream (open source) tree,
66 # define a special variable for bringup purposes.
67 case "${ANDROID_BUILD_TOP-undefined}" in
68 "undefined")
69 DEFINES+=" android_upstream_bringup=1"
70 ;;
71 esac
72
73 toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}/prebuilt/"
74 export ANDROID_TOOLCHAIN="${toolchain_path}/${toolchain_dir}/bin/"
75
76 if [ ! -d "${ANDROID_TOOLCHAIN}" ]; then
77 echo "Can not find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2
78 echo "The NDK version might be wrong." >& 2
79 return 1
80 fi
81
82 export ANDROID_SDK_VERSION="15"
83
84 # Needed by android antfiles when creating apks.
85 export ANDROID_SDK_HOME=${ANDROID_SDK_ROOT}
86
87 # Add Android SDK/NDK tools to system path.
88 export PATH=$PATH:${ANDROID_NDK_ROOT}
89 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools
90 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools
91 # Must have tools like arm-linux-androideabi-gcc on the path for ninja
92 export PATH=$PATH:${ANDROID_TOOLCHAIN}
93
94 CURRENT_DIR="$(readlink -f ${PWD})"
43 if [ -z "${CHROME_SRC}" ]; then 95 if [ -z "${CHROME_SRC}" ]; then
44 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. 96 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC.
45 export CHROME_SRC="${CURRENT_DIR}" 97 export CHROME_SRC="${CURRENT_DIR}"
46 fi 98 fi
47 99
48 if [ "${CURRENT_DIR/"${CHROME_SRC}"/}" == "${CURRENT_DIR}" ]; then 100 if [ "${CURRENT_DIR/"${CHROME_SRC}"/}" == "${CURRENT_DIR}" ]; then
49 # If current directory is not in $CHROME_SRC, it might be set for other 101 # If current directory is not in $CHROME_SRC, it might be set for other
50 # source tree. If $CHROME_SRC was set correctly and we are in the correct 102 # source tree. If $CHROME_SRC was set correctly and we are in the correct
51 # directory, "${CURRENT_DIR/"${CHROME_SRC}"/}" will be "". 103 # directory, "${CURRENT_DIR/"${CHROME_SRC}"/}" will be "".
52 # Otherwise, it will equal to "${CURRENT_DIR}" 104 # Otherwise, it will equal to "${CURRENT_DIR}"
53 echo "Warning: Current directory is out of CHROME_SRC, it may not be \ 105 echo "Warning: Current directory is out of CHROME_SRC, it may not be \
54 the one you want." 106 the one you want."
55 echo "${CHROME_SRC}" 107 echo "${CHROME_SRC}"
56 fi 108 fi
57 109
58 # Source functions script. The file is in the same directory as this script. 110 if [ ! -d "${CHROME_SRC}" ]; then
59 . "$(dirname $BASH_SOURCE)"/envsetup_functions.sh 111 echo "CHROME_SRC must be set to the path of Chrome source code." >& 2
60
61 if [ "${ANDROID_SDK_BUILD}" -eq 1 ]; then
62 sdk_build_init
63 # Sets up environment for building Chromium for Android with source. Expects
64 # android environment setup and lunch.
65 elif [ -z "$ANDROID_BUILD_TOP" -o -z "$ANDROID_TOOLCHAIN" -o \
66 -z "$ANDROID_PRODUCT_OUT" ]; then
67 echo "Android build environment variables must be set."
68 echo "Please cd to the root of your Android tree and do: "
69 echo " . build/envsetup.sh"
70 echo " lunch"
71 echo "Then try this again."
72 echo "Or did you mean NDK/SDK build. Run envsetup.sh with --sdk argument."
73 return 1 112 return 1
74 else
75 non_sdk_build_init
76 fi 113 fi
77 114
78 # Workaround for valgrind build 115 # Add Chromium Android development scripts to system path.
79 if [ -n "$CHROME_ANDROID_VALGRIND_BUILD" ]; then 116 # Must be after CHROME_SRC is set.
80 # arm_thumb=0 is a workaround for https://bugs.kde.org/show_bug.cgi?id=270709 117 export PATH=$PATH:${CHROME_SRC}/build/android
81 DEFINES+=" arm_thumb=0 release_extra_cflags='-fno-inline\
82 -fno-omit-frame-pointer -fno-builtin' release_valgrind_build=1\
83 release_optimize=1"
84 fi
85
86 # Source a bunch of helper functions
87 . ${CHROME_SRC}/build/android/adb_device_functions.sh
88 118
89 ANDROID_GOMA_WRAPPER="" 119 ANDROID_GOMA_WRAPPER=""
90 if [[ -d $GOMA_DIR ]]; then 120 if [[ -d $GOMA_DIR ]]; then
91 ANDROID_GOMA_WRAPPER="$GOMA_DIR/gomacc" 121 ANDROID_GOMA_WRAPPER="$GOMA_DIR/gomacc"
92 fi 122 fi
93 export ANDROID_GOMA_WRAPPER 123 export ANDROID_GOMA_WRAPPER
94 124
95 export CC_target=$(basename ${ANDROID_TOOLCHAIN}/*-gcc) 125 export CC_target=$(basename ${ANDROID_TOOLCHAIN}/*-gcc)
96 export CXX_target=$(basename ${ANDROID_TOOLCHAIN}/*-g++) 126 export CXX_target=$(basename ${ANDROID_TOOLCHAIN}/*-g++)
97 export LINK_target=$(basename ${ANDROID_TOOLCHAIN}/*-gcc) 127 export LINK_target=$(basename ${ANDROID_TOOLCHAIN}/*-gcc)
98 export AR_target=$(basename ${ANDROID_TOOLCHAIN}/*-ar) 128 export AR_target=$(basename ${ANDROID_TOOLCHAIN}/*-ar)
99 129
100 # Performs a gyp_chromium run to convert gyp->Makefile for android code. 130 # Performs a gyp_chromium run to convert gyp->Makefile for android code.
101 android_gyp() { 131 android_gyp() {
102 echo "GYP_GENERATORS set to '$GYP_GENERATORS'" 132 echo "GYP_GENERATORS set to '$GYP_GENERATORS'"
103 if [[ $GYP_DEFINES =~ "clang=1" ]]; then 133 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" "$@"
104 echo -n "NOTE: You have \`clang=1' in \$GYP_DEFINES; "
105 echo "did you mean to run \`android_clang_gyp'?"
106 fi
107
108 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@"
109 } 134 }
110 135
111 # FLOCK needs to be null on system that has no flock 136 export OBJCOPY=$(echo ${ANDROID_TOOLCHAIN}/*-objcopy)
112 which flock > /dev/null || export FLOCK= 137 export STRIP=$(echo ${ANDROID_TOOLCHAIN}/*-strip)
138
139 # The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories
140 # to canonicalize them (remove double '/', remove trailing '/', etc).
141 DEFINES+=" OS=android"
142 DEFINES+=" android_build_type=0"
143 DEFINES+=" host_os=${host_os}"
144 DEFINES+=" linux_fpic=1"
145 DEFINES+=" release_optimize=s"
146 DEFINES+=" linux_use_tcmalloc=0"
147 DEFINES+=" disable_nacl=1"
148 DEFINES+=" remoting=0"
149 DEFINES+=" p2p_apis=0"
150 DEFINES+=" enable_touch_events=1"
151 DEFINES+=" build_ffmpegsumo=0"
152 DEFINES+=" gtest_target_type=shared_library"
153 DEFINES+=" branding=Chromium"
154 DEFINES+=\
155 " android_sdk=${ANDROID_SDK_ROOT}/platforms/android-${ANDROID_SDK_VERSION}"
156 DEFINES+=" android_sdk_tools=${ANDROID_SDK_ROOT}/platform-tools"
157
158 export GYP_DEFINES="${DEFINES}"
159
160 # Use the "android" flavor of the Makefile generator for both Linux and OS X.
161 export GYP_GENERATORS="make-android"
162
163 # Use our All target as the default
164 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All"
165
166 # We want to use our version of "all" targets.
167 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp"
OLDNEW
« no previous file with comments | « build/android/adb_device_functions.sh ('k') | build/android/envsetup_functions.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698