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
5 # found in the LICENSE file.
7 # This script runs gyp with the configuration required to build WebView in the
8 # Android build system. It is not necessary to source build/android/envsetup.sh
9 # before running this script.
13 PLATFORM
=${1:-linux-arm}
14 echo "Generating makefiles for $PLATFORM"
16 export PYTHONDONTWRITEBYTECODE
=1
18 CHROME_SRC
="$(readlink -f "$
(dirname "$0")/..
/..
")"
19 GYP
="${CHROME_SRC}/build/gyp_chromium"
21 # Use the latest API in the AOSP prebuilts directory (change with AOSP roll).
22 android_sdk_version
=18
24 # For the WebView build we always use the SDK in the Android tree.
25 export ANDROID_SDK_ROOT
=${ANDROID_BUILD_TOP}/prebuilts
/sdk
/\
26 ${android_sdk_version}
29 DEFINES
+=" android_webview_build=1"
31 # We need to supply SDK paths relative to the top of the Android tree to make
32 # sure the generated Android makefiles are portable, as they will be checked
33 # into the Android tree.
34 android_sdk
=$
(python
-c \
35 "import os.path; print os.path.relpath('${ANDROID_SDK_ROOT}', \
36 '${ANDROID_BUILD_TOP}')")
37 DEFINES
+=" android_src=\$(PWD)"
38 DEFINES
+=" android_ndk_root=ndk_root_unused_in_webview_build"
39 DEFINES
+=" android_sdk=\$(PWD)/${android_sdk}"
40 DEFINES
+=" android_sdk_root=\$(PWD)/${android_sdk}"
41 DEFINES
+=" android_sdk_version=sdk_version_unused_in_webview_build"
42 DEFINES
+=" android_toolchain=${ANDROID_TOOLCHAIN}"
44 # TODO: Get rid of this block, crbug.com/334021
45 if [[ -n "$CHROME_ANDROID_WEBVIEW_OFFICIAL_BUILD" ]]; then
46 DEFINES
+=" logging_like_official_build=1"
47 DEFINES
+=" tracing_like_official_build=1"
50 export GYP_DEFINES
="${GYP_DEFINES} ${DEFINES}"
52 FLAGS
="-f android -Gdefault_target=libwebviewchromium -Glimit_to_target_all=1 "\
53 "--depth=${CHROME_SRC} ${CHROME_SRC}/android_webview/android_webview.gyp"
55 for host_os
in linux mac
; do
56 host_platform
=$
(echo $host_os |
sed -e 's/mac/darwin/')
57 android_sdk_tools
=$
(python
-c \
58 "import os.path, sys; \
59 print os.path.relpath( \
60 '${ANDROID_SDK_ROOT}/../tools/${host_platform}', \
61 '${ANDROID_BUILD_TOP}')")
63 "${FLAGS} -Dhost_os=${host_os} -Dandroid_sdk_tools=\$(PWD)/${android_sdk_tools}"
65 if [ "$PLATFORM" == "${host_platform}-arm" -o "$PLATFORM" == "all" ]; then
66 ${GYP} --suffix .${host_platform}-arm ${EFLAGS} -Dtarget_arch=arm
68 if [ "$PLATFORM" == "${host_platform}-arm64" -o "$PLATFORM" == "all" ]; then
69 ${GYP} --suffix .${host_platform}-arm64 ${EFLAGS} -Dtarget_arch=arm64
71 if [ "$PLATFORM" == "${host_platform}-x86" -o "$PLATFORM" == "all" ]; then
72 ${GYP} --suffix .${host_platform}-x86 ${EFLAGS} -Dtarget_arch=ia32
74 if [ "$PLATFORM" == "${host_platform}-x86_64" -o "$PLATFORM" == "all" ]; then
75 ${GYP} --suffix .${host_platform}-x86_64 ${EFLAGS} -Dtarget_arch=x64
77 if [ "$PLATFORM" == "${host_platform}-mips" -o "$PLATFORM" == "all" ]; then
78 ${GYP} --suffix .${host_platform}-mips ${EFLAGS} -Dtarget_arch=mipsel