Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / android_webview / tools / gyp_webview
1 #!/bin/bash
2
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.
6
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.
10
11 set -e
12
13 PLATFORM=${1:-linux-arm}
14 echo "Generating makefiles for $PLATFORM"
15
16 export PYTHONDONTWRITEBYTECODE=1
17
18 # Override the calling user's locale sort order as this affects the generated
19 # makefiles.
20 export LC_COLLATE=C
21
22 CHROME_SRC="$(readlink -f "$(dirname "$0")/../..")"
23 GYP="${CHROME_SRC}/build/gyp_chromium"
24
25 # Use the latest API in the AOSP prebuilts directory (change with AOSP roll).
26 android_sdk_version=18
27
28 # For the WebView build we always use the SDK in the Android tree.
29 export ANDROID_SDK_ROOT=${ANDROID_BUILD_TOP}/prebuilts/sdk/\
30 ${android_sdk_version}
31
32 DEFINES="OS=android"
33 DEFINES+=" android_webview_build=1"
34
35 # We need to supply SDK paths relative to the top of the Android tree to make
36 # sure the generated Android makefiles are portable, as they will be checked
37 # into the Android tree.
38 android_sdk=$(python -c \
39     "import os.path; print os.path.relpath('${ANDROID_SDK_ROOT}', \
40     '${ANDROID_BUILD_TOP}')")
41 DEFINES+=" android_ndk_root=ndk_root_unused_in_webview_build"
42 DEFINES+=" android_sdk=\$(PWD)/${android_sdk}"
43 DEFINES+=" android_sdk_root=\$(PWD)/${android_sdk}"
44 DEFINES+=" android_sdk_version=sdk_version_unused_in_webview_build"
45 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}"
46
47 # TODO: Get rid of this block, crbug.com/334021
48 if [[ -n "$CHROME_ANDROID_WEBVIEW_OFFICIAL_BUILD" ]]; then
49   DEFINES+=" tracing_like_official_build=1"
50 fi
51
52 export GYP_DEFINES="${GYP_DEFINES} ${DEFINES}"
53
54 FLAGS="-f android -Gdefault_target=libwebviewchromium -Glimit_to_target_all=1 "\
55 "-Gaosp_sdk_version=21 "\
56 "--depth=${CHROME_SRC} ${CHROME_SRC}/android_webview/android_webview.gyp"
57
58 for host_os in linux mac; do
59   host_platform=$(echo $host_os | sed -e 's/mac/darwin/')
60   android_sdk_tools=$(python -c \
61       "import os.path, sys; \
62       print os.path.relpath( \
63       '${ANDROID_SDK_ROOT}/../tools/${host_platform}', \
64       '${ANDROID_BUILD_TOP}')")
65   EFLAGS=\
66 "${FLAGS} -Dhost_os=${host_os} -Dandroid_sdk_tools=\$(PWD)/${android_sdk_tools}"
67
68   if [ "$PLATFORM" == "${host_platform}-arm" -o "$PLATFORM" == "all" ]; then
69     ${GYP} --suffix .${host_platform}-arm ${EFLAGS} -Dtarget_arch=arm
70   fi
71   if [ "$PLATFORM" == "${host_platform}-arm64" -o "$PLATFORM" == "all" ]; then
72     ${GYP} --suffix .${host_platform}-arm64 ${EFLAGS} -Dtarget_arch=arm64
73   fi
74   if [ "$PLATFORM" == "${host_platform}-x86" -o "$PLATFORM" == "all" ]; then
75     ${GYP} --suffix .${host_platform}-x86 ${EFLAGS} -Dtarget_arch=ia32
76   fi
77   if [ "$PLATFORM" == "${host_platform}-x86_64" -o "$PLATFORM" == "all" ]; then
78     ${GYP} --suffix .${host_platform}-x86_64 ${EFLAGS} -Dtarget_arch=x64
79   fi
80   if [ "$PLATFORM" == "${host_platform}-mips" -o "$PLATFORM" == "all" ]; then
81     ${GYP} --suffix .${host_platform}-mips ${EFLAGS} -Dtarget_arch=mipsel
82   fi
83   if [ "$PLATFORM" == "${host_platform}-mips64" -o "$PLATFORM" == "all" ]; then
84     ${GYP} --suffix .${host_platform}-mips64 ${EFLAGS} -Dtarget_arch=mips64el
85   fi
86 done