support newer android ndk versions

This commit is contained in:
Taner Sener 2022-09-01 23:24:40 +01:00
parent 004ae7187f
commit fd91644221
7 changed files with 55 additions and 57 deletions

View File

@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
ndk-version: [ 'r22b-linux-x86_64', 'r23b-linux' ]
ndk-version: [ 'r22b-linux-x86_64', 'r23b-linux', 'r24-linux', 'r25b-linux' ]
defaults:
run:
shell: bash
@ -39,7 +39,7 @@ jobs:
unzip -q -o ndk.zip -d .ndk
echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV
- name: run the build script
run: ./android.sh -d --enable-android-media-codec --enable-android-zlib
run: ./android.sh -d --enable-android-media-codec --enable-android-zlib --disable-arm-v7a
- name: print build logs
if: ${{ always() }}
run: cat build.log
@ -80,7 +80,7 @@ jobs:
runs-on: macos-10.15
strategy:
matrix:
ndk-version: [ 'r22b-darwin-x86_64', 'r23b-darwin' ]
ndk-version: [ 'r22b-darwin-x86_64', 'r23b-darwin', 'r24-darwin', 'r25b-darwin' ]
defaults:
run:
shell: bash
@ -97,7 +97,7 @@ jobs:
unzip -q -o ndk.zip -d .ndk
echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV
- name: run the build script
run: ./android.sh -d --enable-android-media-codec --enable-android-zlib
run: ./android.sh -d --enable-android-media-codec --enable-android-zlib --disable-arm-v7a
- name: print build logs
if: ${{ always() }}
run: cat build.log

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
ndk-version: [ 'r22b-linux-x86_64', 'r23b-linux' ]
ndk-version: [ 'r22b-linux-x86_64', 'r23b-linux', 'r24-linux', 'r25b-linux' ]
branches: [ 'main', 'development' ]
defaults:
run:
@ -34,7 +34,7 @@ jobs:
unzip -q -o ndk.zip -d .ndk
echo "ANDROID_NDK_ROOT=$PWD/.ndk/$(ls .ndk)" >> $GITHUB_ENV
- name: run the build script
run: ./android.sh --full --enable-gpl --disable-lib-srt
run: ./android.sh --full --enable-gpl --disable-lib-srt --disable-arm-v7a
- name: print build logs
if: ${{ always() }}
run: cat build.log

View File

@ -37,7 +37,11 @@ LOCAL_PATH := $(MY_LOCAL_PATH)/../ffmpeg-kit-android-lib/src/main/cpp
# DEFINE ARCH FLAGS
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
MY_ARCH_FLAGS := ARM_V7A
MY_ARM_NEON := false
ifeq ("$(shell test -e $(MY_LOCAL_PATH)/../build/.lts && echo lts)","lts")
MY_ARM_NEON := false
else
MY_ARM_NEON := true
endif
endif
ifeq ($(TARGET_ARCH_ABI), arm64-v8a)
MY_ARCH_FLAGS := ARM64_V8A
@ -45,9 +49,11 @@ ifeq ($(TARGET_ARCH_ABI), arm64-v8a)
endif
ifeq ($(TARGET_ARCH_ABI), x86)
MY_ARCH_FLAGS := X86
MY_ARM_NEON := true
endif
ifeq ($(TARGET_ARCH_ABI), x86_64)
MY_ARCH_FLAGS := X86_64
MY_ARM_NEON := true
endif
include $(CLEAR_VARS)

View File

@ -8,9 +8,10 @@ create_mason_cross_file "$CROSS_FILE" || return 1
# ALWAYS CLEAN THE PREVIOUS BUILD
rm -rf "${BUILD_DIR}" || return 1
# ENABLING LTO CAUSES SYMBOL NOT FOUND ERRORS ON NDKS >= 23b
meson "${BUILD_DIR}" \
--cross-file="$CROSS_FILE" \
-Db_lto=true \
-Db_lto=false \
-Db_ndebug=false \
-Denable_asm=false \
-Denable_tools=false \

View File

@ -31,6 +31,9 @@ if [[ ! -f "${BASEDIR}"/src/"${LIB_NAME}"/configure ]] || [[ ${RECONF_gnutls} -e
./bootstrap || return 1
fi
# MASKING THE -march=all OPTION WHICH BREAKS THE BUILD ON arm64-v8a
${SED_INLINE} "s|AM_CCASFLAGS =|#AM_CCASFLAGS=|g" "${BASEDIR}"/src/"${LIB_NAME}"/lib/accelerated/aarch64/Makefile.in
./configure \
--prefix="${LIB_INSTALL_PREFIX}" \
--with-pic \

View File

@ -13,17 +13,17 @@ arm-v7a)
# NEON disabled explicitly because
# --enable-runtime-cpu-detect enables NEON for armv7 cpu
ASM_OPTIONS="--disable-neon"
unset ASFLAGS
export ASFLAGS="-c"
;;
arm-v7a-neon)
# NEON IS ENABLED BY --enable-runtime-cpu-detect
TARGET_CPU="armv7"
unset ASFLAGS
export ASFLAGS="-c"
;;
arm64-v8a)
# NEON IS ENABLED BY --enable-runtime-cpu-detect
TARGET_CPU="arm64"
unset ASFLAGS
export ASFLAGS="-c"
;;
*)
# INTEL CPU EXTENSIONS ENABLED BY --enable-runtime-cpu-detect

View File

@ -227,14 +227,11 @@ get_common_cflags() {
local LTS_BUILD_FLAG="-DFFMPEG_KIT_LTS "
fi
case ${DETECTED_NDK_VERSION} in
23*)
echo "-fstrict-aliasing -DANDROID_NDK -fPIC -DANDROID ${LTS_BUILD_FLAG}-D__ANDROID__ -D__ANDROID_MIN_SDK_VERSION__=${API}"
;;
*)
echo "-fno-integrated-as -fstrict-aliasing -DANDROID_NDK -fPIC -DANDROID ${LTS_BUILD_FLAG}-D__ANDROID__ -D__ANDROID_API__=${API}"
;;
esac
if [[ $(compare_versions "$DETECTED_NDK_VERSION" "23") -ge 0 ]]; then
echo "-fstrict-aliasing -DANDROID_NDK -fPIC -DANDROID ${LTS_BUILD_FLAG}-D__ANDROID__ -D__ANDROID_MIN_SDK_VERSION__=${API}"
else
echo "-fno-integrated-as -fstrict-aliasing -DANDROID_NDK -fPIC -DANDROID ${LTS_BUILD_FLAG}-D__ANDROID__ -D__ANDROID_API__=${API}"
fi
}
get_arch_specific_cflags() {
@ -249,24 +246,18 @@ get_arch_specific_cflags() {
echo "-march=armv8-a -DFFMPEG_KIT_ARM64_V8A"
;;
x86)
case ${DETECTED_NDK_VERSION} in
23*)
echo "-march=i686 -mtune=generic -mssse3 -mfpmath=sse -m32 -DFFMPEG_KIT_X86"
;;
*)
echo "-march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -DFFMPEG_KIT_X86"
;;
esac
if [[ $(compare_versions "$DETECTED_NDK_VERSION" "23") -ge 0 ]]; then
echo "-march=i686 -mtune=generic -mssse3 -mfpmath=sse -m32 -DFFMPEG_KIT_X86"
else
echo "-march=i686 -mtune=intel -mssse3 -mfpmath=sse -m32 -DFFMPEG_KIT_X86"
fi
;;
x86-64)
case ${DETECTED_NDK_VERSION} in
23*)
echo "-march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=generic -DFFMPEG_KIT_X86_64"
;;
*)
echo "-march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64"
;;
esac
if [[ $(compare_versions "$DETECTED_NDK_VERSION" "23") -ge 0 ]]; then
echo "-march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=generic -DFFMPEG_KIT_X86_64"
else
echo "-march=x86-64 -msse4.2 -mpopcnt -m64 -mtune=intel -DFFMPEG_KIT_X86_64"
fi
;;
esac
}
@ -1037,33 +1028,30 @@ set_toolchain_paths() {
export CC=$(get_clang_host)-clang
export CXX=$(get_clang_host)-clang++
if [ "$1" == "x264" ]; then
export AS=${CC}
else
export AS=${HOST}-as
fi
case ${ARCH} in
arm64-v8a)
export ac_cv_c_bigendian=no
;;
esac
case ${DETECTED_NDK_VERSION} in
23*)
export AR=llvm-ar
export LD=lld
export RANLIB=llvm-ranlib
export STRIP=llvm-strip
export NM=llvm-nm
;;
*)
export AR=${HOST}-ar
export LD=${HOST}-ld
export RANLIB=${HOST}-ranlib
export STRIP=${HOST}-strip
export NM=${HOST}-nm
;;
esac
if [[ $(compare_versions "$DETECTED_NDK_VERSION" "23") -ge 0 ]]; then
export AR=llvm-ar
export LD=lld
export RANLIB=llvm-ranlib
export STRIP=llvm-strip
export NM=llvm-nm
export AS=$CC
else
export AR=${HOST}-ar
export LD=${HOST}-ld
export RANLIB=${HOST}-ranlib
export STRIP=${HOST}-strip
export NM=${HOST}-nm
if [ "$1" == "x264" ]; then
export AS=${CC}
else
export AS=${HOST}-as
fi
fi
export INSTALL_PKG_CONFIG_DIR="${BASEDIR}"/prebuilt/$(get_build_directory)/pkgconfig
export ZLIB_PACKAGE_CONFIG_PATH="${INSTALL_PKG_CONFIG_DIR}/zlib.pc"