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

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

Issue 10823209: Add support for building the Dart VM for Android OS. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporate review feedback from cshapiro Created 8 years, 4 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
OLDNEW
(Empty)
1
cshapiro 2012/08/07 22:39:40 Any reason why #!/bin/bash isn't the first line?
jackpal 2012/08/08 00:26:19 This script is designed to be _sourced_ only, rath
2 #!/bin/bash
3
4 # Copyright (c) 2012 The Dart Authors. All rights reserved.
5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file.
7
8 # Sets up environment for building Dart on Android. Only Android NDK,
9 # Revision 8b on Linux or Mac is offically supported.
10 #
11 # To run this script, the system environment ANDROID_NDK_ROOT must be set
12 # to Android NDK's root path.
13 #
14 # If current path isn't Dart's root directory, DART_ROOT must be set
15 # to Dart's root directory.
16
17 if [ ! -d "${ANDROID_NDK_ROOT}" ]; then
18 echo "ANDROID_NDK_ROOT must be set to the path of Android NDK, Revision 6b." \
19 >& 2
20 echo "which could be installed by" >& 2
21 echo "<chromium_tree>/src/build/install-build-deps-android-sdk.sh" >& 2
22 return 1
23 fi
24
25 if [ ! -d "${ANDROID_SDK_ROOT}" ]; then
26 echo "ANDROID_SDK_ROOT must be set to the path of Android SDK, Android 3.2." \
27 >& 2
28 echo "which could be installed by" >& 2
29 echo "<chromium_tree>/src/build/install-build-deps-android-sdk.sh" >& 2
30 return 1
31 fi
32
33 host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
34
35 case "${host_os}" in
36 "linux")
37 toolchain_dir="linux-x86"
38 ;;
39 "mac")
40 toolchain_dir="darwin-x86"
41 ;;
42 *)
43 echo "Host platform ${host_os} is not supported" >& 2
44 return 1
45 esac
46
47 TARGET_PRODUCT="x86"
48
49 # The following defines will affect ARM code generation of both C/C++ compiler
50 # and V8 mksnapshot.
51 case "${TARGET_PRODUCT-full}" in
52 "full")
53 DEFINES=" target_arch=arm"
54 DEFINES+=" arm_neon=0 armv7=1 arm_thumb=1 arm_fpu=vfpv3-d16"
55 toolchain_arch="arm-linux-androideabi-4.4.3"
56 ;;
57 *x86*)
58 DEFINES=" target_arch=ia32 use_libffmpeg=0"
59 toolchain_arch="x86-4.4.3"
60 ;;
61 *)
62 echo "TARGET_PRODUCT: ${TARGET_PRODUCT} is not supported." >& 2
63 return 1
64 esac
65
66 # If we are building NDK/SDK, and in the upstream (open source) tree,
67 # define a special variable for bringup purposes.
68 case "${ANDROID_BUILD_TOP-undefined}" in
69 "undefined")
70 DEFINES+=" android_upstream_bringup=1"
71 ;;
72 esac
73
74 toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}/prebuilt/"
75 export ANDROID_TOOLCHAIN="${toolchain_path}/${toolchain_dir}/bin/"
76
77 if [ ! -d "${ANDROID_TOOLCHAIN}" ]; then
78 echo "Can not find Android toolchain in ${ANDROID_TOOLCHAIN}." >& 2
79 echo "The NDK version might be wrong." >& 2
80 return 1
81 fi
82
83 export ANDROID_SDK_VERSION="9"
84
85 # Needed by android antfiles when creating apks.
86 export ANDROID_SDK_HOME=${ANDROID_SDK_ROOT}
87
88 # Add Android SDK/NDK tools to system path.
89 export PATH=$PATH:${ANDROID_NDK_ROOT}
90 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools
91 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools
92 # Must have tools like arm-linux-androideabi-gcc on the path for ninja
93 export PATH=$PATH:${ANDROID_TOOLCHAIN}
94
95 CURRENT_DIR="$(readlink -f ${PWD})"
96 if [ -z "${DART_ROOT}" ]; then
97 # If $DART_ROOT was not set, assume current directory is DART_ROOT.
98 export DART_ROOT="${CURRENT_DIR}"
99 fi
100
101 if [ "${CURRENT_DIR/"${DART_ROOT}"/}" == "${CURRENT_DIR}" ]; then
102 # If current directory is not in $DART_ROOT, it might be set for other
103 # source tree. If $DART_ROOT was set correctly and we are in the correct
104 # directory, "${CURRENT_DIR/"${DART_ROOT}"/}" will be "".
105 # Otherwise, it will equal to "${CURRENT_DIR}"
106 echo "Warning: Current directory is out of DART_ROOT, it may not be \
107 the one you want."
108 echo "${DART_ROOT}"
109 fi
110
111 if [ ! -d "${DART_ROOT}" ]; then
112 echo "DART_ROOT must be set to the path of Chrome source code." >& 2
113 return 1
114 fi
115
116 # Add Dart Android development scripts to system path.
117 # Must be after DART_ROOT is set.
118 export PATH=$PATH:${DART_ROOT}/tools/android
119
120 ANDROID_GOMA_WRAPPER=""
121 if [[ -d $GOMA_DIR ]]; then
122 ANDROID_GOMA_WRAPPER="$GOMA_DIR/gomacc"
123 fi
124 export ANDROID_GOMA_WRAPPER
125
126 export CC_target=$(basename ${ANDROID_TOOLCHAIN}/*-gcc)
127 export CXX_target=$(basename ${ANDROID_TOOLCHAIN}/*-g++)
128 export LINK_target=$(basename ${ANDROID_TOOLCHAIN}/*-gcc)
129 export AR_target=$(basename ${ANDROID_TOOLCHAIN}/*-ar)
130
131 # Performs a gyp_chromium run to convert gyp->Makefile for android code.
132 # android_gyp() {
133 # echo "GYP_GENERATORS set to '$GYP_GENERATORS'"
134 # "${DART_ROOT}/tools/generate_projects.py" "$@"
135 # }
136
137 export OBJCOPY=$(echo ${ANDROID_TOOLCHAIN}/*-objcopy)
138 export STRIP=$(echo ${ANDROID_TOOLCHAIN}/*-strip)
139
140 # The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories
141 # to canonicalize them (remove double '/', remove trailing '/', etc).
142 DEFINES+=" OS=android"
143 DEFINES+=" android_build_type=0"
144 DEFINES+=" host_os=${host_os}"
145 DEFINES+=" linux_fpic=1"
146 DEFINES+=" release_optimize=s"
147 DEFINES+=" linux_use_tcmalloc=0"
148 DEFINES+=" disable_nacl=1"
149 DEFINES+=" remoting=0"
150 DEFINES+=" p2p_apis=0"
151 DEFINES+=" enable_touch_events=1"
152 DEFINES+=" build_ffmpegsumo=0"
153 DEFINES+=" gtest_target_type=shared_library"
154 DEFINES+=" branding=Chromium"
155 DEFINES+=\
156 " android_sdk=${ANDROID_SDK_ROOT}/platforms/android-${ANDROID_SDK_VERSION}"
157 DEFINES+=" android_sdk_tools=${ANDROID_SDK_ROOT}/platform-tools"
158
159 export GYP_DEFINES="${DEFINES}"
160
161 # Use the "android" flavor of the Makefile generator for both Linux and OS X.
162 export GYP_GENERATORS="make-android"
163
164 # Use our All target as the default
165 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All"
166
167 # We want to use our version of "all" targets.
168 # export CHROMIUM_GYP_FILE="${DART_ROOT}/build/all_android.gyp"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698