From 018f063b64ca66be044985a6cfee4d04f46c62df Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Tue, 28 Dec 2021 21:21:47 +0000 Subject: [PATCH] put libc++ inside aar package when custom library uses c++ --- scripts/function-android.sh | 2 +- scripts/function.sh | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/scripts/function-android.sh b/scripts/function-android.sh index 88a555a..41cd5a1 100755 --- a/scripts/function-android.sh +++ b/scripts/function-android.sh @@ -70,7 +70,7 @@ build_application_mk() { local LTS_BUILD_FLAG="-DFFMPEG_KIT_LTS " fi - if [[ ${ENABLED_LIBRARIES[$LIBRARY_X265]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_TESSERACT]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_OPENH264]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_SNAPPY]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_RUBBERBAND]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_ZIMG]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_SRT]} -eq 1 ]]; then + if [[ ${ENABLED_LIBRARIES[$LIBRARY_X265]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_TESSERACT]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_OPENH264]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_SNAPPY]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_RUBBERBAND]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_ZIMG]} -eq 1 ]] || [[ ${ENABLED_LIBRARIES[$LIBRARY_SRT]} -eq 1 ]] || [[ -n ${CUSTOM_LIBRARY_USES_CPP} ]]; then local APP_STL="c++_shared" else local APP_STL="none" diff --git a/scripts/function.sh b/scripts/function.sh index e644ac4..b38503f 100755 --- a/scripts/function.sh +++ b/scripts/function.sh @@ -813,12 +813,17 @@ display_help_gpl_libraries() { display_help_custom_libraries() { echo -e "Custom libraries:" echo -e " --enable-custom-library-[n]-name=value\t\t\tname of the custom library []" - echo -e " --enable-custom-library-[n]-repo=value\t\t\tgit repository url []" - echo -e " --enable-custom-library-[n]-repo-commit=value\t\t\tgit commit []" - echo -e " --enable-custom-library-[n]-repo-tag=value\t\t\tgit tag []" + echo -e " --enable-custom-library-[n]-repo=value\t\t\tgit repository of the source code []" + echo -e " --enable-custom-library-[n]-repo-commit=value\t\t\tgit commit to download the source code from []" + echo -e " --enable-custom-library-[n]-repo-tag=value\t\t\tgit tag to download the source code from []" echo -e " --enable-custom-library-[n]-package-config-file-name=value\tpackage config file installed by the build script []" echo -e " --enable-custom-library-[n]-ffmpeg-enable-flag=value\tlibrary name used in ffmpeg configure script to enable the library []" - echo -e " --enable-custom-library-[n]-license-file=value\t\tlicence file path relative to the library source folder []\n" + echo -e " --enable-custom-library-[n]-license-file=value\t\tlicence file path relative to the library source folder []" + if [ ${FFMPEG_KIT_BUILD_TYPE} == "android" ]; then + echo -e " --enable-custom-library-[n]-uses-cpp\t\t\t\tflag to specify that the library uses libc++ []\n" + else + echo "" + fi } display_help_advanced_options() { @@ -1511,6 +1516,7 @@ print_custom_libraries() { LIBRARY_PACKAGE_CONFIG_FILE_NAME="CUSTOM_LIBRARY_${index}_PACKAGE_CONFIG_FILE_NAME" LIBRARY_FFMPEG_ENABLE_FLAG="CUSTOM_LIBRARY_${index}_FFMPEG_ENABLE_FLAG" LIBRARY_LICENSE_FILE="CUSTOM_LIBRARY_${index}_LICENSE_FILE" + LIBRARY_USES_CPP="CUSTOM_LIBRARY_${index}_USES_CPP" if [[ -z "${!LIBRARY_NAME}" ]]; then echo -e "INFO: Custom library ${index} not detected\n" 1>>"${BASEDIR}"/build.log 2>&1 @@ -1542,6 +1548,11 @@ print_custom_libraries() { continue fi + if [[ -n "${!LIBRARY_USES_CPP}" ]] && [[ ${FFMPEG_KIT_BUILD_TYPE} == "android" ]]; then + echo -e "INFO: Custom library ${index} is marked as uses libc++ \n" 1>>"${BASEDIR}"/build.log 2>&1 + export CUSTOM_LIBRARY_USES_CPP=1 + fi + CUSTOM_LIBRARIES+=("${index}") if [[ ${counter} -eq 0 ]]; then