Commit 586ad5da authored by Ghislain MARY's avatar Ghislain MARY

Fix Android toolchain configuration.

parent 06fde6d6
......@@ -819,6 +819,67 @@ process_common_toolchain() {
;;
esac
# Configure Android toolchain
case ${tgt_os} in
android*)
case ${tgt_isa} in
armv7)
ANDROID_TOOLCHAIN_PREFIX=arm-linux-androideabi
ANDROID_TOOLCHAIN_ARCH=arm
;;
x86)
ANDROID_TOOLCHAIN_PREFIX=x86-linux-android
ANDROID_TOOLCHAIN_ALT_PREFIX=x86_64-linux-android
ANDROID_TOOLCHAIN_ARCH=x86
;;
esac
SDK_PATH=${sdk_path}
COMPILER_LOCATION=`find "${SDK_PATH}" \
-name "${ANDROID_TOOLCHAIN_PREFIX}-gcc*" -print -quit`
if [ -z "${COMPILER_LOCATION}" ]; then
COMPILER_LOCATION=`find "${SDK_PATH}" \
-name "${ANDROID_TOOLCHAIN_ALT_PREFIX}-gcc*" -print -quit`
ANDROID_TOOLCHAIN_PREFIX=${ANDROID_TOOLCHAIN_ALT_PREFIX}
fi
TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/${ANDROID_TOOLCHAIN_PREFIX}-
CC=${TOOLCHAIN_PATH}gcc
CXX=${TOOLCHAIN_PATH}g++
AR=${TOOLCHAIN_PATH}ar
LD=${TOOLCHAIN_PATH}gcc
AS=${TOOLCHAIN_PATH}as
STRIP=${TOOLCHAIN_PATH}strip
NM=${TOOLCHAIN_PATH}nm
if [ -z "${alt_libc}" ]; then
alt_libc=`find "${SDK_PATH}" -name arch-${ANDROID_TOOLCHAIN_ARCH} -print | \
awk '{n = split($0,a,"/"); \
split(a[n-1],b,"-"); \
print $0 " " b[2]}' | \
sort -g -k 2 | \
awk '{ print $1 }' | tail -1`
fi
add_cflags "--sysroot=${alt_libc}"
add_ldflags "--sysroot=${alt_libc}"
if [ ${tgt_isa} = "armv7" ]; then
# linker flag that routes around a CPU bug in some
# Cortex-A8 implementations (NDK Dev Guide)
add_ldflags "-Wl,--fix-cortex-a8"
fi
enable_feature pic
soft_enable realtime_only
if [ ${tgt_isa} = "armv7" ]; then
soft_enable runtime_cpu_detect
fi
if enabled runtime_cpu_detect; then
add_cflags "-I${SDK_PATH}/sources/android/cpufeatures"
fi
;;
esac
# Process ARM architecture variants
case ${toolchain} in
arm*)
......@@ -964,45 +1025,6 @@ EOF
disable_feature multithread
;;
android*)
SDK_PATH=${sdk_path}
COMPILER_LOCATION=`find "${SDK_PATH}" \
-name "arm-linux-androideabi-gcc*" -print -quit`
TOOLCHAIN_PATH=${COMPILER_LOCATION%/*}/arm-linux-androideabi-
CC=${TOOLCHAIN_PATH}gcc
CXX=${TOOLCHAIN_PATH}g++
AR=${TOOLCHAIN_PATH}ar
LD=${TOOLCHAIN_PATH}gcc
AS=${TOOLCHAIN_PATH}as
STRIP=${TOOLCHAIN_PATH}strip
NM=${TOOLCHAIN_PATH}nm
if [ -z "${alt_libc}" ]; then
alt_libc=`find "${SDK_PATH}" -name arch-arm -print | \
awk '{n = split($0,a,"/"); \
split(a[n-1],b,"-"); \
print $0 " " b[2]}' | \
sort -g -k 2 | \
awk '{ print $1 }' | tail -1`
fi
add_cflags "--sysroot=${alt_libc}"
add_ldflags "--sysroot=${alt_libc}"
# linker flag that routes around a CPU bug in some
# Cortex-A8 implementations (NDK Dev Guide)
add_ldflags "-Wl,--fix-cortex-a8"
enable_feature pic
soft_enable realtime_only
if [ ${tgt_isa} = "armv7" ]; then
soft_enable runtime_cpu_detect
fi
if enabled runtime_cpu_detect; then
add_cflags "-I${SDK_PATH}/sources/android/cpufeatures"
fi
;;
darwin*)
XCRUN_FIND="xcrun --sdk iphoneos --find"
CXX="$(${XCRUN_FIND} clang++)"
......
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