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

Commit

Permalink
copy license files into android archives, fixes arthenica#12
Browse files Browse the repository at this point in the history
  • Loading branch information
tanersener committed Aug 15, 2021
1 parent 470f702 commit 5295129
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 16 deletions.
30 changes: 30 additions & 0 deletions android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
1 change: 1 addition & 0 deletions android/ffmpeg-kit-android-lib/src/main/res/raw/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.txt
14 changes: 0 additions & 14 deletions scripts/function-apple.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
29 changes: 27 additions & 2 deletions scripts/function.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
}
Expand Down

0 comments on commit 5295129

Please sign in to comment.