Merge pull request #180 from tanersener/android-darwin-arm64

use x86-64 ndk toolchain on arm64 darwin hosts, fixes #175
This commit is contained in:
Taner Şener 2021-10-10 08:36:49 +01:00 committed by GitHub
commit 39911c0e79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -296,7 +296,11 @@ if [[ -n ${ANDROID_ARCHITECTURES} ]]; then
# BUILD NATIVE LIBRARY # BUILD NATIVE LIBRARY
if [[ ${SKIP_ffmpeg_kit} -ne 1 ]]; then if [[ ${SKIP_ffmpeg_kit} -ne 1 ]]; then
if [ "$(is_darwin_arm64)" == "1" ]; then
arch -x86_64 "${ANDROID_NDK_ROOT}"/ndk-build -B 1>>"${BASEDIR}"/build.log 2>&1
else
"${ANDROID_NDK_ROOT}"/ndk-build -B 1>>"${BASEDIR}"/build.log 2>&1 "${ANDROID_NDK_ROOT}"/ndk-build -B 1>>"${BASEDIR}"/build.log 2>&1
fi
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "ok" echo "ok"

View File

@ -109,6 +109,17 @@ get_clang_host() {
esac esac
} }
is_darwin_arm64() {
HOST_OS=$(uname -s)
HOST_ARCH=$(uname -m)
if [ "${HOST_OS}" == "Darwin" ] && [ "${HOST_ARCH}" == "arm64" ]; then
echo "1"
else
echo "0"
fi
}
get_toolchain() { get_toolchain() {
HOST_OS=$(uname -s) HOST_OS=$(uname -s)
case ${HOST_OS} in case ${HOST_OS} in
@ -124,6 +135,12 @@ get_toolchain() {
x86_64 | amd64) HOST_ARCH=x86_64 ;; x86_64 | amd64) HOST_ARCH=x86_64 ;;
esac esac
if [ "$(is_darwin_arm64)" == "1" ]; then
# NDK DOESNT HAVE AN ARM64 TOOLCHAIN ON DARWIN
# WE USE x86-64 WITH ROSETTA INSTEAD
HOST_ARCH=x86_64
fi
echo "${HOST_OS}-${HOST_ARCH}" echo "${HOST_OS}-${HOST_ARCH}"
} }