|
|
@ -12,8 +12,10 @@ SOURCE_TYPE=TAR |
|
|
|
SOURCE_VALUE=4.3.1 |
|
|
|
SOURCE_VALUE=4.3.1 |
|
|
|
BINUTILS=gnu |
|
|
|
BINUTILS=gnu |
|
|
|
EXTERNAL_LIBRARIES=() |
|
|
|
EXTERNAL_LIBRARIES=() |
|
|
|
|
|
|
|
FFMPEG_GPL_ENABLED=false |
|
|
|
|
|
|
|
|
|
|
|
ALL_SUPPORTED_LIBRARIES=( |
|
|
|
# All FREE libraries that are supported |
|
|
|
|
|
|
|
SUPPORTED_LIBRARIES_FREE=( |
|
|
|
"libaom" |
|
|
|
"libaom" |
|
|
|
"libdav1d" |
|
|
|
"libdav1d" |
|
|
|
"libmp3lame" |
|
|
|
"libmp3lame" |
|
|
@ -26,95 +28,108 @@ ALL_SUPPORTED_LIBRARIES=( |
|
|
|
"libfribidi" |
|
|
|
"libfribidi" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# All GPL libraries that are supported |
|
|
|
|
|
|
|
SUPPORTED_LIBRARIES_GPL=( |
|
|
|
|
|
|
|
"libx264" |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
for argument in "$@"; do |
|
|
|
for argument in "$@"; do |
|
|
|
case $argument in |
|
|
|
case $argument in |
|
|
|
# Build for only specified ABIs (separated by comma) |
|
|
|
# Build for only specified ABIs (separated by comma) |
|
|
|
--target-abis=*|-abis=*) |
|
|
|
--target-abis=* | -abis=*) |
|
|
|
IFS=',' read -ra ABIS <<< "${argument#*=}" |
|
|
|
IFS=',' read -ra ABIS <<<"${argument#*=}" |
|
|
|
for abi in "${ABIS[@]}"; do |
|
|
|
for abi in "${ABIS[@]}"; do |
|
|
|
case $abi in |
|
|
|
case $abi in |
|
|
|
x86|x86_64|armeabi-v7a|arm64-v8a) |
|
|
|
x86 | x86_64 | armeabi-v7a | arm64-v8a) |
|
|
|
ABIS_TO_BUILD+=( "$abi" ) |
|
|
|
ABIS_TO_BUILD+=("$abi") |
|
|
|
;; |
|
|
|
;; |
|
|
|
arm) |
|
|
|
arm) |
|
|
|
ABIS_TO_BUILD+=( "armeabi-v7a" ) |
|
|
|
ABIS_TO_BUILD+=("armeabi-v7a") |
|
|
|
;; |
|
|
|
;; |
|
|
|
arm64) |
|
|
|
arm64) |
|
|
|
ABIS_TO_BUILD+=( "arm64-v8a" ) |
|
|
|
ABIS_TO_BUILD+=("arm64-v8a") |
|
|
|
;; |
|
|
|
|
|
|
|
*) |
|
|
|
|
|
|
|
echo "Unknown ABI: $abi" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
esac |
|
|
|
|
|
|
|
done |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
# Use this value as Android platform version during compilation. |
|
|
|
|
|
|
|
--android-api-level=*|-android=*) |
|
|
|
|
|
|
|
API_LEVEL="${argument#*=}" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
# Checkout the particular tag in the FFmpeg's git repository |
|
|
|
|
|
|
|
--source-git-tag=*) |
|
|
|
|
|
|
|
SOURCE_TYPE=GIT_TAG |
|
|
|
|
|
|
|
SOURCE_VALUE="${argument#*=}" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
# Checkout the particular branch in the FFmpeg's git repository |
|
|
|
|
|
|
|
--source-git-branch=*) |
|
|
|
|
|
|
|
SOURCE_TYPE=GIT_BRANCH |
|
|
|
|
|
|
|
SOURCE_VALUE="${argument#*=}" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
# Download the particular tar archive by its version |
|
|
|
|
|
|
|
--source-tar=*) |
|
|
|
|
|
|
|
SOURCE_TYPE=TAR |
|
|
|
|
|
|
|
SOURCE_VALUE="${argument#*=}" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
# Which binutils to use (gnu or llvm) |
|
|
|
|
|
|
|
--binutils=*|-binutils=*) |
|
|
|
|
|
|
|
binutils_value="${argument#*=}" |
|
|
|
|
|
|
|
case $binutils_value in |
|
|
|
|
|
|
|
gnu|llvm) |
|
|
|
|
|
|
|
BINUTILS=$binutils_value |
|
|
|
|
|
|
|
;; |
|
|
|
;; |
|
|
|
*) |
|
|
|
*) |
|
|
|
echo "Unknown binutils: $binutils_value" |
|
|
|
echo "Unknown ABI: $abi" |
|
|
|
;; |
|
|
|
;; |
|
|
|
esac |
|
|
|
esac |
|
|
|
|
|
|
|
done |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
# Use this value as Android platform version during compilation. |
|
|
|
|
|
|
|
--android-api-level=* | -android=*) |
|
|
|
|
|
|
|
API_LEVEL="${argument#*=}" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
# Checkout the particular tag in the FFmpeg's git repository |
|
|
|
|
|
|
|
--source-git-tag=*) |
|
|
|
|
|
|
|
SOURCE_TYPE=GIT_TAG |
|
|
|
|
|
|
|
SOURCE_VALUE="${argument#*=}" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
# Checkout the particular branch in the FFmpeg's git repository |
|
|
|
|
|
|
|
--source-git-branch=*) |
|
|
|
|
|
|
|
SOURCE_TYPE=GIT_BRANCH |
|
|
|
|
|
|
|
SOURCE_VALUE="${argument#*=}" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
# Download the particular tar archive by its version |
|
|
|
|
|
|
|
--source-tar=*) |
|
|
|
|
|
|
|
SOURCE_TYPE=TAR |
|
|
|
|
|
|
|
SOURCE_VALUE="${argument#*=}" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
# Which binutils to use (gnu or llvm) |
|
|
|
|
|
|
|
--binutils=* | -binutils=*) |
|
|
|
|
|
|
|
binutils_value="${argument#*=}" |
|
|
|
|
|
|
|
case $binutils_value in |
|
|
|
|
|
|
|
gnu | llvm) |
|
|
|
|
|
|
|
BINUTILS=$binutils_value |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
*) |
|
|
|
|
|
|
|
echo "Unknown binutils: $binutils_value" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
esac |
|
|
|
;; |
|
|
|
;; |
|
|
|
# Arguments below enable certain external libraries to build into FFmpeg |
|
|
|
# Arguments below enable certain external libraries to build into FFmpeg |
|
|
|
--enable-libaom|-aom) |
|
|
|
--enable-libaom | -aom) |
|
|
|
EXTERNAL_LIBRARIES+=( "libaom" ) |
|
|
|
EXTERNAL_LIBRARIES+=("libaom") |
|
|
|
;; |
|
|
|
;; |
|
|
|
--enable-libdav1d|-dav1d) |
|
|
|
--enable-libdav1d | -dav1d) |
|
|
|
EXTERNAL_LIBRARIES+=( "libdav1d" ) |
|
|
|
EXTERNAL_LIBRARIES+=("libdav1d") |
|
|
|
;; |
|
|
|
;; |
|
|
|
--enable-libmp3lame|-mp3lame|-lame) |
|
|
|
--enable-libmp3lame | -mp3lame | -lame) |
|
|
|
EXTERNAL_LIBRARIES+=( "libmp3lame" ) |
|
|
|
EXTERNAL_LIBRARIES+=("libmp3lame") |
|
|
|
;; |
|
|
|
;; |
|
|
|
--enable-libopus|-opus) |
|
|
|
--enable-libopus | -opus) |
|
|
|
EXTERNAL_LIBRARIES+=( "libopus" ) |
|
|
|
EXTERNAL_LIBRARIES+=("libopus") |
|
|
|
;; |
|
|
|
;; |
|
|
|
--enable-libwavpack|-wavpack) |
|
|
|
--enable-libwavpack | -wavpack) |
|
|
|
EXTERNAL_LIBRARIES+=( "libwavpack" ) |
|
|
|
EXTERNAL_LIBRARIES+=("libwavpack") |
|
|
|
;; |
|
|
|
;; |
|
|
|
--enable-libtwolame|-twolame) |
|
|
|
--enable-libtwolame | -twolame) |
|
|
|
EXTERNAL_LIBRARIES+=( "libtwolame" ) |
|
|
|
EXTERNAL_LIBRARIES+=("libtwolame") |
|
|
|
;; |
|
|
|
;; |
|
|
|
--enable-libspeex|-speex) |
|
|
|
--enable-libspeex | -speex) |
|
|
|
EXTERNAL_LIBRARIES+=( "libspeex" ) |
|
|
|
EXTERNAL_LIBRARIES+=("libspeex") |
|
|
|
;; |
|
|
|
;; |
|
|
|
--enable-libvpx|-vpx) |
|
|
|
--enable-libvpx | -vpx) |
|
|
|
EXTERNAL_LIBRARIES+=( "libvpx" ) |
|
|
|
EXTERNAL_LIBRARIES+=("libvpx") |
|
|
|
;; |
|
|
|
;; |
|
|
|
--enable-libfreetype|-freetype) |
|
|
|
--enable-libfreetype | -freetype) |
|
|
|
EXTERNAL_LIBRARIES+=( "libfreetype" ) |
|
|
|
EXTERNAL_LIBRARIES+=("libfreetype") |
|
|
|
;; |
|
|
|
;; |
|
|
|
--enable-libfribidi|-fribidi) |
|
|
|
--enable-libfribidi | -fribidi) |
|
|
|
EXTERNAL_LIBRARIES+=( "libfribidi" ) |
|
|
|
EXTERNAL_LIBRARIES+=("libfribidi") |
|
|
|
;; |
|
|
|
;; |
|
|
|
--enable-all-external|-all) |
|
|
|
--enable-libx264 | -x264) |
|
|
|
EXTERNAL_LIBRARIES=${ALL_SUPPORTED_LIBRARIES[@]} |
|
|
|
EXTERNAL_LIBRARIES+=("libx264") |
|
|
|
|
|
|
|
FFMPEG_GPL_ENABLED=true |
|
|
|
;; |
|
|
|
;; |
|
|
|
*) |
|
|
|
--enable-all-free | -all-free) |
|
|
|
echo "Unknown argument $argument" |
|
|
|
EXTERNAL_LIBRARIES+=" ${SUPPORTED_LIBRARIES_FREE[@]}" |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
--enable-all-gpl | -all-gpl) |
|
|
|
|
|
|
|
EXTERNAL_LIBRARIES+=" ${SUPPORTED_LIBRARIES_GPL[@]}" |
|
|
|
|
|
|
|
FFMPEG_GPL_ENABLED=true |
|
|
|
|
|
|
|
;; |
|
|
|
|
|
|
|
*) |
|
|
|
|
|
|
|
echo "Unknown argument $argument" |
|
|
|
;; |
|
|
|
;; |
|
|
|
esac |
|
|
|
esac |
|
|
|
shift |
|
|
|
shift |
|
|
@ -124,7 +139,7 @@ done |
|
|
|
# The x86 is the first, because it is more likely to have Text Relocations. |
|
|
|
# The x86 is the first, because it is more likely to have Text Relocations. |
|
|
|
# In this case the rest ABIs will not be assembled at all. |
|
|
|
# In this case the rest ABIs will not be assembled at all. |
|
|
|
if [ ${#ABIS_TO_BUILD[@]} -eq 0 ]; then |
|
|
|
if [ ${#ABIS_TO_BUILD[@]} -eq 0 ]; then |
|
|
|
ABIS_TO_BUILD=( "x86" "x86_64" "armeabi-v7a" "arm64-v8a" ) |
|
|
|
ABIS_TO_BUILD=("x86" "x86_64" "armeabi-v7a" "arm64-v8a") |
|
|
|
fi |
|
|
|
fi |
|
|
|
# The FFmpeg will be build for ABIs in this list |
|
|
|
# The FFmpeg will be build for ABIs in this list |
|
|
|
export FFMPEG_ABIS_TO_BUILD=${ABIS_TO_BUILD[@]} |
|
|
|
export FFMPEG_ABIS_TO_BUILD=${ABIS_TO_BUILD[@]} |
|
|
|