diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-20 17:34:47 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-20 17:34:47 +0000 |
commit | 16bd0f1e656d440790d77ce6be61f81b0c542728 (patch) | |
tree | 60e7c40ce06aed7f3d7215800281b91d8a394e58 | |
parent | bffd8be7042b2f23d8fd3fce57c54950e343ebf9 (diff) | |
download | chromium_src-16bd0f1e656d440790d77ce6be61f81b0c542728.zip chromium_src-16bd0f1e656d440790d77ce6be61f81b0c542728.tar.gz chromium_src-16bd0f1e656d440790d77ce6be61f81b0c542728.tar.bz2 |
android webview build: Stop using envsetup.
By now, envsetup only sets OS=android and converts GOMA_DIR to the corresponding
gyp defines. It also sets GYP_CROSSCOMPILE. Nothing but the OS=android bit is
used by the webview build, so let android_webview/tools/gyp_webview set what
it needs directly instead of going through envsetup.
(envsetup also does a few envvar chanes to PATH etc, but gyp_webview calls
envsetup in a subshell, so it doesn't see these changes anyways.)
As a side effect, android_webview/tools/gyp_webview no longer ignores
GYP_DEFINES from the environment.
BUG=330631
R=torne@chromium.org
Review URL: https://codereview.chromium.org/170533004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@252293 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | android_webview/tools/gyp_webview | 62 | ||||
-rwxr-xr-x | build/android/envsetup.sh | 34 | ||||
-rwxr-xr-x | build/android/envsetup_functions.sh | 44 |
3 files changed, 50 insertions, 90 deletions
diff --git a/android_webview/tools/gyp_webview b/android_webview/tools/gyp_webview index e28a6e3..778fbe4 100755 --- a/android_webview/tools/gyp_webview +++ b/android_webview/tools/gyp_webview @@ -13,34 +13,66 @@ set -e PLATFORM=${1:-linux-arm} echo "Generating makefiles for $PLATFORM" -export CHROME_ANDROID_BUILD_WEBVIEW=1 -export CHROME_SRC="$(readlink -f "$(dirname "$0")/../..")" export PYTHONDONTWRITEBYTECODE=1 +CHROME_SRC="$(readlink -f "$(dirname "$0")/../..")" +GYP="${CHROME_SRC}/build/gyp_chromium" + +# Use the latest API in the AOSP prebuilts directory (change with AOSP roll). +android_sdk_version=18 + +# For the WebView build we always use the SDK in the Android tree. +export ANDROID_SDK_ROOT=${ANDROID_BUILD_TOP}/prebuilts/sdk/\ +${android_sdk_version} + +DEFINES="OS=android" +DEFINES+=" android_webview_build=1" + +# We need to supply SDK paths relative to the top of the Android tree to make +# sure the generated Android makefiles are portable, as they will be checked +# into the Android tree. +android_sdk=$(python -c \ + "import os.path; print os.path.relpath('${ANDROID_SDK_ROOT}', \ + '${ANDROID_BUILD_TOP}')") +android_sdk_tools=$(python -c \ + "import os.path, sys; \ + print os.path.relpath( \ + '${ANDROID_SDK_ROOT}/../tools/' + sys.platform.rstrip('23'), \ + '${ANDROID_BUILD_TOP}')") +DEFINES+=" android_src=\$(PWD)" +DEFINES+=" android_ndk_root=ndk_root_unused_in_webview_build" +DEFINES+=" android_sdk=\$(PWD)/${android_sdk}" +DEFINES+=" android_sdk_root=\$(PWD)/${android_sdk}" +DEFINES+=" android_sdk_tools=\$(PWD)/${android_sdk_tools}" +DEFINES+=" android_sdk_version=sdk_version_unused_in_webview_build" +DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" + +# TODO: Get rid of this block, crbug.com/334021 +if [[ -n "$CHROME_ANDROID_WEBVIEW_OFFICIAL_BUILD" ]]; then + DEFINES+=" logging_like_official_build=1" + DEFINES+=" tracing_like_official_build=1" +fi + +export GYP_DEFINES="${GYP_DEFINES} ${DEFINES}" + FLAGS="-f android -Gdefault_target=All -Glimit_to_target_all=1 "\ -"${CHROME_SRC}/android_webview/all_webview.gyp" +"--depth=${CHROME_SRC} ${CHROME_SRC}/android_webview/all_webview.gyp" if [ "$PLATFORM" == "linux-arm" -o "$PLATFORM" == "all" ]; then - ( . $CHROME_SRC/build/android/envsetup.sh \ - && android_gyp --suffix .linux-arm ${FLAGS} -Dtarget_arch=arm -Dhost_os=linux ) + ${GYP} --suffix .linux-arm ${FLAGS} -Dtarget_arch=arm -Dhost_os=linux fi if [ "$PLATFORM" == "linux-x86" -o "$PLATFORM" == "all" ]; then - ( . $CHROME_SRC/build/android/envsetup.sh \ - && android_gyp --suffix .linux-x86 ${FLAGS} -Dtarget_arch=ia32 -Dhost_os=linux ) + ${GYP} --suffix .linux-x86 ${FLAGS} -Dtarget_arch=ia32 -Dhost_os=linux fi if [ "$PLATFORM" == "linux-mips" -o "$PLATFORM" == "all" ]; then - ( . $CHROME_SRC/build/android/envsetup.sh \ - && android_gyp --suffix .linux-mips ${FLAGS} -Dtarget_arch=mipsel -Dhost_os=linux ) + ${GYP} --suffix .linux-mips ${FLAGS} -Dtarget_arch=mipsel -Dhost_os=linux fi if [ "$PLATFORM" == "darwin-arm" -o "$PLATFORM" == "all" ]; then - ( . $CHROME_SRC/build/android/envsetup.sh --target-arch=arm \ - && android_gyp --suffix .darwin-arm ${FLAGS} -Dtarget_arch=arm -Dhost_os=mac ) + ${GYP} --suffix .darwin-arm ${FLAGS} -Dtarget_arch=arm -Dhost_os=mac fi if [ "$PLATFORM" == "darwin-x86" -o "$PLATFORM" == "all" ]; then - ( . $CHROME_SRC/build/android/envsetup.sh \ - && android_gyp --suffix .darwin-x86 ${FLAGS} -Dtarget_arch=ia32 -Dhost_os=mac ) + ${GYP} --suffix .darwin-x86 ${FLAGS} -Dtarget_arch=ia32 -Dhost_os=mac fi if [ "$PLATFORM" == "darwin-mips" -o "$PLATFORM" == "all" ]; then - ( . $CHROME_SRC/build/android/envsetup.sh \ - && android_gyp --suffix .darwin-mips ${FLAGS} -Dtarget_arch=mipsel -Dhost_os=mac ) + ${GYP} --suffix .darwin-mips ${FLAGS} -Dtarget_arch=mipsel -Dhost_os=mac fi diff --git a/build/android/envsetup.sh b/build/android/envsetup.sh index e8a373c..9d4d3f5 100755 --- a/build/android/envsetup.sh +++ b/build/android/envsetup.sh @@ -3,11 +3,7 @@ # 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. It can either be -# compiled with the Android tree or using the Android SDK/NDK. To build with -# NDK/SDK: ". build/android/envsetup.sh". Environment variable -# ANDROID_SDK_BUILD=1 will then be defined and used in the rest of the setup to -# specifiy build type. +# Sets up environment for building Chromium on Android. # Make sure we're being sourced (possibly by another script). Check for bash # since zsh sets $0 when sourcing. @@ -26,16 +22,6 @@ if ! process_options "$@" ; then return 1 fi -# When building WebView as part of Android we can't use the SDK. Other builds -# default to using the SDK. -if [[ "${CHROME_ANDROID_BUILD_WEBVIEW}" -eq 1 ]]; then - export ANDROID_SDK_BUILD=0 -fi - -if [[ "${ANDROID_SDK_BUILD}" -ne 1 ]]; then - echo "Initializing for non-SDK build." -fi - # Get host architecture, and abort if it is 32-bit. host_arch=$(uname -m) case "${host_arch}" in @@ -67,23 +53,7 @@ the one you want." echo "${CHROME_SRC}" fi -if [[ "${ANDROID_SDK_BUILD}" -eq 1 ]]; then - sdk_build_init -# Sets up environment for building Chromium for Android with source. Expects -# android environment setup and lunch. -elif [[ -z "$ANDROID_BUILD_TOP" || \ - -z "$ANDROID_TOOLCHAIN" || \ - -z "$ANDROID_PRODUCT_OUT" ]]; then - echo "Android build environment variables must be set." - echo "Please cd to the root of your Android tree and do: " - echo " . build/envsetup.sh" - echo " lunch" - echo "Then try this again." - echo "Or did you mean NDK/SDK build. Run envsetup.sh without any arguments." - return 1 -elif [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then - webview_build_init -fi +sdk_build_init # Source a bunch of helper functions . ${CHROME_SRC}/build/android/adb_device_functions.sh diff --git a/build/android/envsetup_functions.sh b/build/android/envsetup_functions.sh index 5d47276..dbfdb91 100755 --- a/build/android/envsetup_functions.sh +++ b/build/android/envsetup_functions.sh @@ -5,9 +5,7 @@ # found in the LICENSE file. # Defines functions for envsetup.sh which sets up environment for building -# Chromium on Android. The build can be either use the Android NDK/SDK or -# android source tree. Each has a unique init function which calls functions -# prefixed with "common_" that is common for both environment setups. +# Chromium for Android using the Android NDK/SDK. ################################################################################ # Exports environment variables common to both sdk and non-sdk build (e.g. PATH) @@ -90,43 +88,3 @@ sdk_build_init() { return 1 fi } - -################################################################################ -# To build WebView, we use the Android build system and build inside an Android -# source tree. -############################################################################# -webview_build_init() { - # Use the latest API in the AOSP prebuilts directory (change with AOSP roll). - android_sdk_version=18 - - # For the WebView build we always use the SDK in the Android tree. - export ANDROID_SDK_ROOT=${ANDROID_BUILD_TOP}/prebuilts/sdk/\ -${android_sdk_version} - - common_vars_defines - - # We need to supply SDK paths relative to the top of the Android tree to make - # sure the generated Android makefiles are portable, as they will be checked - # into the Android tree. - ANDROID_SDK=$(python -c \ - "import os.path; print os.path.relpath('${ANDROID_SDK_ROOT}', \ - '${ANDROID_BUILD_TOP}')") - ANDROID_SDK_TOOLS=$(python -c \ - "import os.path, sys; \ - print os.path.relpath( \ - '${ANDROID_SDK_ROOT}/../tools/' + sys.platform.rstrip('23'), \ - '${ANDROID_BUILD_TOP}')") - DEFINES+=" android_webview_build=1" - DEFINES+=" android_src=\$(PWD)" - DEFINES+=" android_ndk_root=ndk_root_unused_in_webview_build" - DEFINES+=" android_sdk=\$(PWD)/${ANDROID_SDK}" - DEFINES+=" android_sdk_root=\$(PWD)/${ANDROID_SDK}" - DEFINES+=" android_sdk_tools=\$(PWD)/${ANDROID_SDK_TOOLS}" - DEFINES+=" android_sdk_version=sdk_version_unused_in_webview_build" - DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" - if [[ -n "$CHROME_ANDROID_WEBVIEW_OFFICIAL_BUILD" ]]; then - DEFINES+=" logging_like_official_build=1" - DEFINES+=" tracing_like_official_build=1" - fi - export GYP_DEFINES="${DEFINES}" -} |