Skip to content
This repository has been archived by the owner on Oct 7, 2021. It is now read-only.

cleanup openh264 build for Android #369

Merged
merged 4 commits into from
Apr 1, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/android-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ get_android_arch() {
}

get_common_includes() {
echo "-I${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/include -I${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/local/include"
echo "-isystem ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/include -isystem ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/include/${BUILD_HOST} -isystem ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/local/include"
tanersener marked this conversation as resolved.
Show resolved Hide resolved
}

get_common_cflags() {
Expand Down
20 changes: 7 additions & 13 deletions build/android-openh264.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,32 +35,22 @@ LDFLAGS=$(get_ldflags ${LIB_NAME})

case ${ARCH} in
arm-v7a-neon)
ASM_ARCH=arm
# Enabling NEON causes undefined symbol error for WelsCopy8x8_neon
# CFLAGS+=" -DHAVE_NEON"
;;
arm64-v8a)
ASM_ARCH=arm64
CFLAGS+=" -DHAVE_NEON_AARCH64"
;;
x86*)
ASM_ARCH=x86
CFLAGS+=" -DHAVE_AVX2"
;;
esac

cd ${BASEDIR}/src/${LIB_NAME} || exit 1

# MAKE SURE THAT ASM IS ENABLED FOR ALL IOS ARCHITECTURES
${SED_INLINE} 's/arm64 aarch64/arm64% aarch64/g' ${BASEDIR}/src/${LIB_NAME}/build/arch.mk
${SED_INLINE} 's/%86 x86_64,/%86 x86_64 x86-64,/g' ${BASEDIR}/src/${LIB_NAME}/build/arch.mk
${SED_INLINE} 's/filter-out arm64,/filter-out arm64%,/g' ${BASEDIR}/src/${LIB_NAME}/build/arch.mk
${SED_INLINE} 's/CFLAGS += -DHAVE_NEON/#CFLAGS += -DHAVE_NEON/g' ${BASEDIR}/src/${LIB_NAME}/build/arch.mk
${SED_INLINE} 's/ifeq (\$(ASM_ARCH), arm64)/ifneq (\$(filter arm64%, \$(ASM_ARCH)),)/g' ${BASEDIR}/src/${LIB_NAME}/codec/common/targets.mk
${SED_INLINE} 's/ifeq (\$(ASM_ARCH), x86)/ifneq (\$(filter %86 x86-64, \$(ASM_ARCH)),)/g' ${BASEDIR}/src/${LIB_NAME}/codec/common/targets.mk
${SED_INLINE} 's/ifeq (\$(ASM_ARCH), arm)/ifneq (\$(filter armv%, \$(ASM_ARCH)),)/g' ${BASEDIR}/src/${LIB_NAME}/codec/common/targets.mk

# DO NOT USE DEFAULT ANDROID ARCH FLAGS
${SED_INLINE} 's/ CFLAGS +=/ #CFLAGS +=/g' ${BASEDIR}/src/${LIB_NAME}/build/platform-android.mk
${SED_INLINE} 's/ LDFLAGS +=/ #LDFLAGS +=/g' ${BASEDIR}/src/${LIB_NAME}/build/platform-android.mk

make clean 2>/dev/null 1>/dev/null

make -j$(get_cpu_count) \
Expand All @@ -75,6 +65,10 @@ PREFIX="${BASEDIR}/prebuilt/android-$(get_target_build)/${LIB_NAME}" \
NDKLEVEL="${API}" \
NDKROOT="${ANDROID_NDK_ROOT}" \
NDK_TOOLCHAIN_VERSION=clang \
TOOLCHAINPREFIX=dummy_prefix \
tanersener marked this conversation as resolved.
Show resolved Hide resolved
TOOLCHAIN_NAME=dummy_name \
AR="${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/bin/${AR}" \
ASM_ARCH=${ASM_ARCH} \
TARGET="android-${API}" \
install-static || exit 1

Expand Down