Commit 625eb03a authored by thakis@chromium.org's avatar thakis@chromium.org

android envsetup: Remove --host-os flag.

Clients should set the host_os gyp variable instead. (As far as I can tell,
this flag was added for the webview build, and this CL updates gyp_webview
to use the gyp define instead. I haven't found other clients.)

Since several gyp targets check the value of host_os in a
target_conditions block and most of the build/common.gypi variables
aren't available during target_conditions processing time, use the same
trick that chromium_code uses to make host_os available at target_conditions
time.

BUG=330631
NOTRY=true

Review URL: https://codereview.chromium.org/153623011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@251138 0039d316-1c4b-4281-b951-d872f2087c98
parent b301e8f6
......@@ -21,26 +21,26 @@ FLAGS="-f android -Gdefault_target=All -Glimit_to_target_all=1 "\
"${CHROME_SRC}/android_webview/all_webview.gyp"
if [ "$PLATFORM" == "linux-arm" -o "$PLATFORM" == "all" ]; then
( . $CHROME_SRC/build/android/envsetup.sh --target-arch=arm --host-os=linux \
&& android_gyp --suffix .linux-arm ${FLAGS} )
( . $CHROME_SRC/build/android/envsetup.sh --target-arch=arm \
&& android_gyp --suffix .linux-arm ${FLAGS} -Dhost_os=linux )
fi
if [ "$PLATFORM" == "linux-x86" -o "$PLATFORM" == "all" ]; then
( . $CHROME_SRC/build/android/envsetup.sh --target-arch=x86 --host-os=linux \
&& android_gyp --suffix .linux-x86 ${FLAGS} )
( . $CHROME_SRC/build/android/envsetup.sh --target-arch=x86 \
&& android_gyp --suffix .linux-x86 ${FLAGS} -Dhost_os=linux )
fi
if [ "$PLATFORM" == "linux-mips" -o "$PLATFORM" == "all" ]; then
( . $CHROME_SRC/build/android/envsetup.sh --target-arch=mips --host-os=linux \
&& android_gyp --suffix .linux-mips ${FLAGS} )
( . $CHROME_SRC/build/android/envsetup.sh --target-arch=mips \
&& android_gyp --suffix .linux-mips ${FLAGS} -Dhost_os=linux )
fi
if [ "$PLATFORM" == "darwin-arm" -o "$PLATFORM" == "all" ]; then
( . $CHROME_SRC/build/android/envsetup.sh --target-arch=arm --host-os=mac \
&& android_gyp --suffix .darwin-arm ${FLAGS} )
( . $CHROME_SRC/build/android/envsetup.sh --target-arch=arm \
&& android_gyp --suffix .darwin-arm ${FLAGS} -Dhost_os=mac )
fi
if [ "$PLATFORM" == "darwin-x86" -o "$PLATFORM" == "all" ]; then
( . $CHROME_SRC/build/android/envsetup.sh --target-arch=x86 --host-os=mac \
&& android_gyp --suffix .darwin-x86 ${FLAGS} )
( . $CHROME_SRC/build/android/envsetup.sh --target-arch=x86 \
&& android_gyp --suffix .darwin-x86 ${FLAGS} -Dhost_os=mac )
fi
if [ "$PLATFORM" == "darwin-mips" -o "$PLATFORM" == "all" ]; then
( . $CHROME_SRC/build/android/envsetup.sh --target-arch=mips --host-os=mac \
&& android_gyp --suffix .darwin-mips ${FLAGS} )
( . $CHROME_SRC/build/android/envsetup.sh --target-arch=mips \
&& android_gyp --suffix .darwin-mips ${FLAGS} -Dhost_os=mac )
fi
......@@ -26,7 +26,6 @@ ${ANDROID_SDK_BUILD_TOOLS_VERSION}
# The set of GYP_DEFINES to pass to gyp.
DEFINES="OS=android"
DEFINES+=" host_os=${host_os}"
if [[ -n "$CHROME_ANDROID_OFFICIAL_BUILD" ]]; then
# These defines are used by various chrome build scripts to tag the binary's
......@@ -69,7 +68,6 @@ ${ANDROID_SDK_BUILD_TOOLS_VERSION}
print_usage() {
echo "usage: ${0##*/} [--target-arch=value] [--help]" >& 2
echo "--target-arch=value target CPU architecture (arm=default, x86)" >& 2
echo "--host-os=value override host OS detection (linux, mac)" >&2
echo "--help this help" >& 2
}
......@@ -77,15 +75,11 @@ print_usage() {
# Process command line options.
################################################################################
process_options() {
host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')
while [[ -n $1 ]]; do
case "$1" in
--target-arch=*)
target_arch="$(echo "$1" | sed 's/^[^=]*=//')"
;;
--host-os=*)
host_os="$(echo "$1" | sed 's/^[^=]*=//')"
;;
--help)
print_usage
return 1
......@@ -169,20 +163,11 @@ ${ANDROID_SDK_VERSION}
ANDROID_SDK=$(python -c \
"import os.path; print os.path.relpath('${ANDROID_SDK_ROOT}', \
'${ANDROID_BUILD_TOP}')")
case "${host_os}" in
"linux")
ANDROID_SDK_TOOLS=$(python -c \
"import os.path; \
print os.path.relpath('${ANDROID_SDK_ROOT}/../tools/linux', \
'${ANDROID_BUILD_TOP}')")
;;
"mac")
ANDROID_SDK_TOOLS=$(python -c \
"import os.path; \
print os.path.relpath('${ANDROID_SDK_ROOT}/../tools/darwin', \
'${ANDROID_BUILD_TOP}')")
;;
esac
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_sdk=\$(PWD)/${ANDROID_SDK}"
......
......@@ -1397,6 +1397,7 @@
'android_sdk_version%': '<!(/bin/echo -n ${ANDROID_SDK_VERSION})',
# Android SDK build tools (e.g. dx, aapt, aidl)
'android_sdk_tools%': '<!(/bin/echo -n ${ANDROID_SDK_TOOLS})',
'host_os%': "<!(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/')",
},
# Copy conditionally-set variables out one scope.
'android_ndk_root%': '<(android_ndk_root)',
......@@ -1404,6 +1405,7 @@
'android_sdk_version%': '<(android_sdk_version)',
'android_sdk_tools%': '<(android_sdk_tools)',
'android_stlport_root': '<(android_ndk_root)/sources/cxx-stl/stlport',
'host_os%': '<(host_os)',
'android_sdk%': '<(android_sdk_root)/platforms/android-<(android_sdk_version)',
......@@ -1455,6 +1457,7 @@
'android_stlport_root': '<(android_stlport_root)',
'android_stlport_include': '<(android_stlport_root)/stlport',
'android_stlport_libs_dir': '<(android_stlport_root)/libs/<(android_app_abi)',
'host_os%': '<(host_os)',
# Location of the "strip" binary, used by both gyp and scripts.
'android_strip%' : '<!(/bin/echo -n <(android_toolchain)/*-strip)',
......@@ -2104,6 +2107,9 @@
'mac_release_optimization%': '3', # Use -O3 unless overridden
'mac_debug_optimization%': '0', # Use -O0 unless overridden
}],
['OS=="android"', {
'host_os%': '<(host_os)', # See comment above chromium_code.
}],
],
},
'defines': [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment