Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
remove c++_shared dependency for ffmpeg on android, fixes #92
Browse files Browse the repository at this point in the history
  • Loading branch information
tanersener committed Mar 4, 2019
1 parent 2db0de4 commit 16c3359
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
18 changes: 9 additions & 9 deletions android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,22 @@ build_application_mk() {
local LTS_BUILD__FLAG="-DMOBILE_FFMPEG_LTS "
fi

if [[ ${ENABLED_LIBRARIES[$LIBRARY_TESSERACT]} -eq 1 ]]; then
local APP_STL="c++_shared"
else
local APP_STL="none"

${SED_INLINE} 's/c++_shared //g' ${BASEDIR}/android/jni/Android.mk 1>>${BASEDIR}/build.log 2>&1
fi

rm -f ${BASEDIR}/android/jni/Application.mk

cat > "${BASEDIR}/android/jni/Application.mk" << EOF
APP_OPTIM := release
APP_ABI := ${ANDROID_ARCHITECTURES}
APP_STL := c++_shared
APP_STL := ${APP_STL}
APP_PLATFORM := android-${API}
Expand Down Expand Up @@ -613,21 +621,13 @@ do
fi
done

# CLEANING PREVIOUSLY COPIED c++_shared.so FILES
rm -rf ${BASEDIR}/prebuilt/android-cpp-shared 1>>${BASEDIR}/build.log 2>&1

for run_arch in {0..4}
do
if [[ ${ENABLED_ARCHITECTURES[$run_arch]} -eq 1 ]]; then
export ARCH=$(get_arch_name $run_arch)
export TOOLCHAIN=$(get_toolchain)
export TOOLCHAIN_ARCH=$(get_toolchain_arch)

# COPY libc++_shared.so FROM EACH TOOLCHAIN ARCH
mkdir -p ${BASEDIR}/prebuilt/android-cpp-shared/${TOOLCHAIN_ARCH}

cp ${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/lib/$(get_target_host)/libc++_shared.so ${BASEDIR}/prebuilt/android-cpp-shared/${TOOLCHAIN_ARCH} 1>>${BASEDIR}/build.log 2>&1

. ${BASEDIR}/build/main-android.sh "${ENABLED_LIBRARIES[@]}" || exit 1

# CLEAR FLAGS
Expand Down
1 change: 1 addition & 0 deletions android/jni/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/Application.mk
/Android.mk.tmp
8 changes: 4 additions & 4 deletions build/android-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -347,14 +347,14 @@ get_cxxflags() {
}

get_common_linked_libraries() {
local COMMON_LIBRARY_PATHS="-L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/${TARGET_HOST}/lib -L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/lib -L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/lib"
local COMMON_LIBRARY_PATHS="-L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/${TARGET_HOST}/lib -L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/sysroot/usr/lib/${TARGET_HOST}/${API} -L${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/${TOOLCHAIN}/lib"

case $1 in
ffmpeg)
if [[ -z ${MOBILE_FFMPEG_LTS_BUILD} ]]; then
echo "-lc -lm -ldl -llog -lcamera2ndk -lmediandk -lc++_shared ${COMMON_LIBRARY_PATHS}"
echo "-lc -lm -ldl -llog -lcamera2ndk -lmediandk ${COMMON_LIBRARY_PATHS}"
else
echo "-lc -lm -ldl -llog -lc++_shared ${COMMON_LIBRARY_PATHS}"
echo "-lc -lm -ldl -llog ${COMMON_LIBRARY_PATHS}"
fi
;;
tesseract)
Expand Down Expand Up @@ -751,7 +751,7 @@ URL: https://github.com/tesseract-ocr/tesseract
Version: ${TESSERACT_VERSION}
Requires: lept, libjpeg, libpng, giflib, zlib, libwebp, libtiff-4
Libs: -L\${libdir} -ltesseract
Libs: -L\${libdir} -ltesseract -lc++_shared
Cflags: -I\${includedir}
EOF
}
Expand Down

0 comments on commit 16c3359

Please sign in to comment.