0

Removed CXX_target for Android

Don't rely on compiler_version.py, we pass in the gcc_version for Android

Also revert the previous compiler_version.py change.

BUG=143889


Review URL: https://chromiumcodereview.appspot.com/11185059

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162808 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
michaelbai@chromium.org
2012-10-18 22:08:06 +00:00
parent 25320604c1
commit d0245a13c4
3 changed files with 20 additions and 49 deletions

@ -107,24 +107,12 @@ export ANDROID_GOMA_WRAPPER
# Declare Android are cross compile.
export GYP_CROSSCOMPILE=1
export CXX_target="${ANDROID_GOMA_WRAPPER} \
$(echo -n ${ANDROID_TOOLCHAIN}/*-g++)"
# Performs a gyp_chromium run to convert gyp->Makefile for android code.
android_gyp() {
# This is just a simple wrapper of gyp_chromium, please don't add anything
# in this function.
echo "GYP_GENERATORS set to '$GYP_GENERATORS'"
# http://crbug.com/143889.
# In case we are doing a Clang build, we have to unset CC_target and
# CXX_target. Otherwise GYP ends up generating a gcc build (although we set
# 'clang' to 1). This behavior was introduced by
# 54d2f6fe6d8a7b9d9786bd1f8540df6b4f46b83f in GYP.
(
# Fork to avoid side effects on the user's environment variables.
if echo "$GYP_DEFINES" | grep -qE '(clang|asan)'; then
if echo "$CXX_target" | grep -q g++; then
unset CXX_target
fi
fi
"${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@"
)
}

@ -33,6 +33,9 @@ common_vars_defines() {
fi
toolchain_version="4.6"
# We directly set the gcc_version since we know what we use, and it should
# be set to xx instead of x.x. Refer the output of compiler_version.py.
gcc_version="46"
toolchain_target=$(basename \
${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}-${toolchain_version})
toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_target}"\
@ -70,6 +73,7 @@ common_vars_defines() {
# to canonicalize them (remove double '/', remove trailing '/', etc).
DEFINES="OS=android"
DEFINES+=" host_os=${host_os}"
DEFINES+=" gcc_version=${gcc_version}"
if [[ -n "$CHROME_ANDROID_OFFICIAL_BUILD" ]]; then
DEFINES+=" branding=Chrome"

@ -33,42 +33,21 @@ def GetVersion(compiler):
print >> sys.stderr, e
return ""
def GetVersionFromEnvironment(compiler_env):
""" Returns the version of compiler
If the compiler was set by the given environment variable and exists,
return its version, otherwise None is returned.
"""
cxx = os.getenv(compiler_env, None)
if cxx:
cxx_version = GetVersion(cxx)
if cxx_version != "":
return cxx_version
return None
def main():
# Check if CXX_target or CXX environment variable exists an if it does use
# that compiler.
# TODO: Fix ninja (see http://crbug.com/140900) instead and remove this code
# In ninja's cross compile mode, the CXX_target is target compiler, while
# the CXX is host. The CXX_target needs be checked first, though the target
# and host compiler have different version, there seems no issue to use the
# target compiler's version number as gcc_version in Android.
cxx_version = GetVersionFromEnvironment("CXX_target")
if cxx_version:
print cxx_version
return 0
cxx_version = GetVersionFromEnvironment("CXX")
if cxx_version:
print cxx_version
return 0
# Otherwise we check the g++ version.
gccversion = GetVersion("g++")
if gccversion != "":
print gccversion
return 0
# Check if CXX environment variable exists and
# if it does use that compiler.
cxx = os.getenv("CXX", None)
if cxx:
cxxversion = GetVersion(cxx)
if cxxversion != "":
print cxxversion
return 0
else:
# Otherwise we check the g++ version.
gccversion = GetVersion("g++")
if gccversion != "":
print gccversion
return 0
return 1