copy license files into android archives, fixes #12

This commit is contained in:
Taner Sener 2021-08-16 00:18:40 +03:00
parent 470f70282b
commit 5295129a7c
4 changed files with 58 additions and 16 deletions

View File

@ -265,6 +265,35 @@ if [[ -n ${ANDROID_ARCHITECTURES} ]]; then
cd "${BASEDIR}"/android 1>>"${BASEDIR}"/build.log 2>&1 || exit 1
# COPY LICENSES
LICENSE_BASEDIR="${BASEDIR}"/android/ffmpeg-kit-android-lib/src/main/res/raw
rm -f "${LICENSE_BASEDIR}"/*.txt 1>>"${BASEDIR}"/build.log 2>&1 || exit 1
for library in {0..46}; do
if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then
ENABLED_LIBRARY=$(get_library_name ${library} | sed 's/-/_/g')
LICENSE_FILE="${LICENSE_BASEDIR}/license_${ENABLED_LIBRARY}.txt"
RC=$(copy_external_library_license_file ${library} "${LICENSE_FILE}")
if [[ ${RC} -ne 0 ]]; then
echo -e "DEBUG: Failed to copy the license file of ${ENABLED_LIBRARY}\n" 1>>"${BASEDIR}"/build.log 2>&1
echo -e "failed\n\nSee build.log for details\n"
exit 1
fi
echo -e "DEBUG: Copied the license file of ${ENABLED_LIBRARY} successfully\n" 1>>"${BASEDIR}"/build.log 2>&1
fi
done
# COPY LIBRARY LICENSES
if [[ ${GPL_ENABLED} == "yes" ]]; then
cp "${BASEDIR}"/LICENSE.GPLv3 "${LICENSE_BASEDIR}"/license.txt 1>>"${BASEDIR}"/build.log 2>&1
else
cp "${BASEDIR}"/LICENSE.LGPLv3 "${LICENSE_BASEDIR}"/license.txt 1>>"${BASEDIR}"/build.log 2>&1
fi
echo -e "DEBUG: Copied the ffmpeg-kit license successfully\n" 1>>"${BASEDIR}"/build.log 2>&1
# BUILD NATIVE LIBRARY
if [[ ${SKIP_ffmpeg_kit} -ne 1 ]]; then
"${ANDROID_NDK_ROOT}"/ndk-build -B 1>>"${BASEDIR}"/build.log 2>&1
@ -287,6 +316,7 @@ if [[ -n ${ANDROID_ARCHITECTURES} ]]; then
echo -e -n "\nCreating Android archive under prebuilt: "
# BUILD ANDROID ARCHIVE
rm -f "${BASEDIR}"/android/ffmpeg-kit-android-lib/build/outputs/aar/ffmpeg-kit-release.aar 1>>"${BASEDIR}"/build.log 2>&1
./gradlew ffmpeg-kit-android-lib:clean ffmpeg-kit-android-lib:assembleRelease ffmpeg-kit-android-lib:testReleaseUnitTest 1>>"${BASEDIR}"/build.log 2>&1
if [ $? -ne 0 ]; then
echo -e "failed\n"

View File

@ -0,0 +1 @@
*.txt

View File

@ -14,20 +14,6 @@ get_ffmpeg_kit_version() {
fi
}
# 1 - library index
# 2 - output path
copy_external_library_license() {
output_path_array=("$2")
for output_path in "${output_path_array[@]}"; do
$(cp $(get_external_library_license_path "$1") "${output_path}/LICENSE" 1>>"${BASEDIR}"/build.log 2>&1)
if [[ $? -ne 0 ]]; then
echo 1
return
fi
done
echo 0
}
get_external_library_version() {
local library_version=$(grep Version "${BASEDIR}"/prebuilt/"$(get_build_directory)"/pkgconfig/"$1".pc 2>>"${BASEDIR}"/build.log | sed 's/Version://g;s/\ //g')

View File

@ -1306,13 +1306,38 @@ get_external_library_license_path() {
26) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYING.LGPL" ;;
28 | 35) echo "${BASEDIR}/src/$(get_library_name "$1")/LICENSE.md " ;;
30) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYING.txt" ;;
38 | 40) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYRIGHT" ;;
40) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYRIGHT" ;;
43) echo "${BASEDIR}/src/$(get_library_name "$1")/leptonica-license.txt" ;;
4 | 10 | 13 | 21 | 27 | 31 | 32 | 37) echo "${BASEDIR}/src/$(get_library_name "$1")/LICENSE" ;;
4 | 10 | 13 | 21 | 27 | 31 | 32 | 37 | 46) echo "${BASEDIR}/src/$(get_library_name "$1")/LICENSE" ;;
*) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYING" ;;
esac
}
# 1 - library index
# 2 - output directory
copy_external_library_license() {
output_path_array=("$2")
for output_path in "${output_path_array[@]}"; do
$(copy_external_library_license_file "$1" "${output_path}/LICENSE")
if [[ $? -ne 0 ]]; then
echo 1
return
fi
done
echo 0
}
# 1 - library index
# 2 - output path
copy_external_library_license_file() {
$(cp $(get_external_library_license_path "$1") "$2" 1>>"${BASEDIR}"/build.log 2>&1)
if [[ $? -ne 0 ]]; then
echo 1
return
fi
echo 0
}
get_cmake_build_directory() {
echo "${FFMPEG_KIT_TMPDIR}/cmake/build/$(get_build_directory)/${LIB_NAME}"
}