Chrome on Android: fix cross-compilation setup.
This patch removes the need of exporting / setting CROSS_C* variables when calling make for android. Instead, set them at Makefile generation time so that gyp will set the right compilers when calling android_gyp. This also allows goma builds. BUG= TEST=builds for android. Review URL: http://codereview.chromium.org/9693042 git-svn-id: http://src.chromium.org/svn/trunk/src/build@127667 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
This commit is contained in:
Родитель
0feb08867a
Коммит
f0219b05fd
|
@ -115,29 +115,6 @@ function bb_setup_goma_internal {
|
|||
export PATH=$GOMA_DIR:$PATH
|
||||
}
|
||||
|
||||
# Temporarily added back when goma disabled
|
||||
function old_make {
|
||||
# TODO(michaelbai): how to use ccache in NDK.
|
||||
if [ -n "${USE_CCACHE}" ]; then
|
||||
if [ -e "${PREBUILT_CCACHE_PATH}" ]; then
|
||||
use_ccache_var="$PREBUILT_CCACHE_PATH "
|
||||
else
|
||||
use_ccache_var=""
|
||||
fi
|
||||
fi
|
||||
# Only cross-compile if the build is being done either from Chromium's src/
|
||||
# directory, or through WebKit, in which case the WEBKIT_ANDROID_BUILD
|
||||
# environment variable will be defined. WebKit uses a different directory.
|
||||
if [ -f "$PWD/build/android/envsetup.sh" ] ||
|
||||
[ -n "${WEBKIT_ANDROID_BUILD}" ]; then
|
||||
CC="${use_ccache_var}${CROSS_CC}" CXX="${use_ccache_var}${CROSS_CXX}" \
|
||||
LINK="${CROSS_LINK}" AR="${CROSS_AR}" RANLIB="${CROSS_RANLIB}" \
|
||||
command make $*
|
||||
else
|
||||
command make $*
|
||||
fi
|
||||
}
|
||||
|
||||
# $@: make args.
|
||||
# Use goma if possible; degrades to non-Goma if needed.
|
||||
function bb_goma_make {
|
||||
|
@ -148,9 +125,12 @@ function bb_goma_make {
|
|||
# http://build.chromium.org/p/chromium/builders/Linux%20x64/builds/23995/steps/compile/logs/stdio
|
||||
# But not on Android trybots?
|
||||
# http://build.chromium.org/p/tryserver.chromium/builders/android/builds/2136/steps/Compile/logs/stdio
|
||||
old_make -j${JOBS} "$@"
|
||||
make -j${JOBS} "$@"
|
||||
return
|
||||
|
||||
# TODO(bulach): to use goma, we need to:
|
||||
# GOMA_DIR=... android_gyp
|
||||
# PATH=$GOMA_DIR:$PATH make -j${JOBS} "$@"
|
||||
bb_setup_goma_internal
|
||||
|
||||
if [ "${GOMA_DIR}" = "" ]; then
|
||||
|
|
|
@ -70,20 +70,21 @@ fi
|
|||
|
||||
# Performs a gyp_chromium run to convert gyp->Makefile for android code.
|
||||
android_gyp() {
|
||||
GOMA_WRAPPER=""
|
||||
if [[ -d $GOMA_DIR ]]; then
|
||||
GOMA_WRAPPER="$GOMA_DIR/gomacc"
|
||||
fi
|
||||
# Ninja requires "*_target" for target builds.
|
||||
GOMA_WRAPPER=${GOMA_WRAPPER} \
|
||||
CC_target=$(basename ${ANDROID_TOOLCHAIN}/*-gcc) \
|
||||
CXX_target=$(basename ${ANDROID_TOOLCHAIN}/*-g++) \
|
||||
LINK_target=$(basename ${ANDROID_TOOLCHAIN}/*-gcc) \
|
||||
AR_target=$(basename ${ANDROID_TOOLCHAIN}/*-ar) \
|
||||
"${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}"
|
||||
}
|
||||
|
||||
firstword() {
|
||||
echo "${1}"
|
||||
}
|
||||
|
||||
export CROSS_AR="$(firstword "${ANDROID_TOOLCHAIN}"/*-ar)"
|
||||
export CROSS_CC="$(firstword "${ANDROID_TOOLCHAIN}"/*-gcc)"
|
||||
export CROSS_CXX="$(firstword "${ANDROID_TOOLCHAIN}"/*-g++)"
|
||||
export CROSS_LINK="$(firstword "${ANDROID_TOOLCHAIN}"/*-gcc)"
|
||||
export CROSS_RANLIB="$(firstword "${ANDROID_TOOLCHAIN}"/*-ranlib)"
|
||||
export OBJCOPY="$(firstword "${ANDROID_TOOLCHAIN}"/*-objcopy)"
|
||||
export STRIP="$(firstword "${ANDROID_TOOLCHAIN}"/*-strip)"
|
||||
export OBJCOPY=$(echo ${ANDROID_TOOLCHAIN}/*-objcopy)
|
||||
export STRIP=$(echo ${ANDROID_TOOLCHAIN}/*-strip)
|
||||
|
||||
# The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories
|
||||
# to canonicalize them (remove double '/', remove trailing '/', etc).
|
||||
|
|
16
common.gypi
16
common.gypi
|
@ -2277,7 +2277,7 @@
|
|||
'libraries': [
|
||||
'-l<(android_stlport_library)',
|
||||
# Manually link the libgcc.a that the cross compiler uses.
|
||||
'<!($CROSS_CC -print-libgcc-file-name)',
|
||||
'<!(${ANDROID_TOOLCHAIN}/*-gcc -print-libgcc-file-name)',
|
||||
'-lc',
|
||||
'-ldl',
|
||||
'-lstdc++',
|
||||
|
@ -2883,7 +2883,7 @@
|
|||
],
|
||||
},
|
||||
}],
|
||||
['clang==1', {
|
||||
['clang==1 and OS!="android"', {
|
||||
'make_global_settings': [
|
||||
['CC', '<(make_clang_dir)/bin/clang'],
|
||||
['CXX', '<(make_clang_dir)/bin/clang++'],
|
||||
|
@ -2893,6 +2893,18 @@
|
|||
['LINK.host', '$(LINK)'],
|
||||
],
|
||||
}],
|
||||
['OS=="android" and "<(GENERATOR)"!="ninja"', {
|
||||
# Hardcode the compiler names in the Makefile so that
|
||||
# it won't depend on the environment at make time.
|
||||
'make_global_settings': [
|
||||
['CC', '<!(/bin/echo -n ${GOMA_WRAPPER} ${ANDROID_TOOLCHAIN}/*-gcc)'],
|
||||
['CXX', '<!(/bin/echo -n ${GOMA_WRAPPER} ${ANDROID_TOOLCHAIN}/*-g++)'],
|
||||
['LINK', '<!(/bin/echo -n ${GOMA_WRAPPER} ${ANDROID_TOOLCHAIN}/*-gcc)'],
|
||||
['CC.host', '<!(which gcc)'],
|
||||
['CXX.host', '<!(which g++)'],
|
||||
['LINK.host', '<!(which g++)'],
|
||||
],
|
||||
}],
|
||||
],
|
||||
'xcode_settings': {
|
||||
# DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT!
|
||||
|
|
Загрузка…
Ссылка в новой задаче