Documentation improvement

ffmpeg_4.4.2
Javernaut 5 years ago
parent 8227b3257a
commit c97c2683b8
  1. 44
      ffmpeg-android-maker.sh

@ -2,7 +2,8 @@
FFMPEG_FALLBACK_VERSION=4.2 FFMPEG_FALLBACK_VERSION=4.2
# Assuming the script is used on macOS or Linux machine # Defining a toolchan directory's name according to the current OS.
# Assume that proper version of NDK is installed.
case "$OSTYPE" in case "$OSTYPE" in
darwin*) HOST_TAG="darwin-x86_64" ;; darwin*) HOST_TAG="darwin-x86_64" ;;
linux*) HOST_TAG="linux-x86_64" ;; linux*) HOST_TAG="linux-x86_64" ;;
@ -30,6 +31,7 @@ mkdir -p ${OUTPUT_DIR}
# Note: the 'source' folder wasn't actually deleted, just ensure it exists # Note: the 'source' folder wasn't actually deleted, just ensure it exists
mkdir -p ${SOURCES_DIR} mkdir -p ${SOURCES_DIR}
# Utility function
# Getting sources of a particular ffmpeg release. # Getting sources of a particular ffmpeg release.
# Same argument (ffmpeg version) produces the same source set. # Same argument (ffmpeg version) produces the same source set.
function ensureSourcesTag() { function ensureSourcesTag() {
@ -47,6 +49,7 @@ function ensureSourcesTag() {
fi fi
} }
# Utility function
# Getting sources of a particular branch of ffmpeg's git repository. # Getting sources of a particular branch of ffmpeg's git repository.
# Same argument (branch name) may produce different source set, # Same argument (branch name) may produce different source set,
# as the branch in origin repository may be updated in future. # as the branch in origin repository may be updated in future.
@ -75,6 +78,7 @@ function ensureSourcesBranch() {
cd ${BASE_DIR} cd ${BASE_DIR}
} }
# Utility function
# Test if sources of the FFmpeg exist. If not - download them # Test if sources of the FFmpeg exist. If not - download them
function ensureSources() { function ensureSources() {
TYPE=$1 TYPE=$1
@ -107,9 +111,6 @@ function assemble() {
TOOLCHAIN_PATH=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/${HOST_TAG} TOOLCHAIN_PATH=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/${HOST_TAG}
SYSROOT=${TOOLCHAIN_PATH}/sysroot SYSROOT=${TOOLCHAIN_PATH}/sysroot
EXTRA_CFLAGS=
EXTRA_CONFIGURE_FLAGS=
TARGET_TRIPLE_MACHINE_BINUTILS= TARGET_TRIPLE_MACHINE_BINUTILS=
TARGET_TRIPLE_MACHINE_CC= TARGET_TRIPLE_MACHINE_CC=
TARGET_TRIPLE_OS="android" TARGET_TRIPLE_OS="android"
@ -132,55 +133,60 @@ function assemble() {
#binutils i686-linux-android -ld #binutils i686-linux-android -ld
TARGET_TRIPLE_MACHINE_BINUTILS=i686 TARGET_TRIPLE_MACHINE_BINUTILS=i686
EXTRA_CFLAGS=-mno-stackrealign # Disabling assembler optimizations, because they have text relocations
EXTRA_CONFIGURE_FLAGS=--disable-asm EXTRA_BUILD_CONFIGURATION_FLAGS=--disable-asm
;; ;;
x86_64) x86_64)
#cc x86_64-linux-android21-clang #cc x86_64-linux-android21-clang
#binutils x86_64-linux-android -ld #binutils x86_64-linux-android -ld
TARGET_TRIPLE_MACHINE_BINUTILS=x86_64 TARGET_TRIPLE_MACHINE_BINUTILS=x86_64
EXTRA_CONFIGURE_FLAGS=--x86asmexe=${TOOLCHAIN_PATH}/bin/yasm EXTRA_BUILD_CONFIGURATION_FLAGS=--x86asmexe=${TOOLCHAIN_PATH}/bin/yasm
;; ;;
esac esac
# If the cc-specific variable isn't set, we fallback to binutils version # If the cc-specific variable isn't set, we fallback to binutils version
[ -z "${TARGET_TRIPLE_MACHINE_CC}" ] && TARGET_TRIPLE_MACHINE_CC=${TARGET_TRIPLE_MACHINE_BINUTILS} [ -z "${TARGET_TRIPLE_MACHINE_CC}" ] && TARGET_TRIPLE_MACHINE_CC=${TARGET_TRIPLE_MACHINE_BINUTILS}
# Common prefix for ld, as, etc.
CROSS_PREFIX=${TOOLCHAIN_PATH}/bin/${TARGET_TRIPLE_MACHINE_BINUTILS}-linux-${TARGET_TRIPLE_OS}- CROSS_PREFIX=${TOOLCHAIN_PATH}/bin/${TARGET_TRIPLE_MACHINE_BINUTILS}-linux-${TARGET_TRIPLE_OS}-
# The name for compiler is slightly different, so it is defined separatly.
CC=${TOOLCHAIN_PATH}/bin/${TARGET_TRIPLE_MACHINE_CC}-linux-${TARGET_TRIPLE_OS}${API_LEVEL}-clang CC=${TOOLCHAIN_PATH}/bin/${TARGET_TRIPLE_MACHINE_CC}-linux-${TARGET_TRIPLE_OS}${API_LEVEL}-clang
# Reading a list of video codecs to enable
DECODERS_TO_ENABLE= DECODERS_TO_ENABLE=
while IFS= read -r line; do DECODERS_TO_ENABLE="${DECODERS_TO_ENABLE} --enable-decoder=$line"; done < ${BASE_DIR}/video_decoders_list.txt while IFS= read -r line; do DECODERS_TO_ENABLE="${DECODERS_TO_ENABLE} --enable-decoder=$line"; done < ${BASE_DIR}/video_decoders_list.txt
# Everything that goes below ${EXTRA_BUILD_CONFIGURATION_FLAGS} is my project-specific.
# You are free to enable/disable whatever you actually need.
./configure \ ./configure \
--prefix=${BUILD_DIR}/${ABI} \ --prefix=${BUILD_DIR}/${ABI} \
--enable-cross-compile \ --enable-cross-compile \
--cross-prefix=${CROSS_PREFIX} \
--arch=${TARGET_TRIPLE_MACHINE_BINUTILS} \
--target-os=android \ --target-os=android \
--cc=${CC} \ --arch=${TARGET_TRIPLE_MACHINE_BINUTILS} \
--extra-cflags="-O3 -fPIC $EXTRA_CFLAGS" \
--sysroot=${SYSROOT} \ --sysroot=${SYSROOT} \
--cross-prefix=${CROSS_PREFIX} \
--cc=${CC} \
--extra-cflags="-O3 -fPIC" \
--enable-shared \ --enable-shared \
--disable-static \ --disable-static \
--disable-doc \ ${EXTRA_BUILD_CONFIGURATION_FLAGS} \
--disable-runtime-cpudetect \ --disable-runtime-cpudetect \
--disable-debug \
--disable-programs \ --disable-programs \
--disable-muxers \ --disable-muxers \
--disable-encoders \ --disable-encoders \
--disable-decoders \
${DECODERS_TO_ENABLE} \
--disable-bsfs \
--disable-pthreads \
--disable-avdevice \ --disable-avdevice \
--disable-network \
--disable-postproc \ --disable-postproc \
--disable-swresample \ --disable-swresample \
--disable-avfilter \ --disable-avfilter \
${EXTRA_CONFIGURE_FLAGS} --disable-doc \
--disable-debug \
--disable-pthreads \
--disable-network \
--disable-bsfs \
--disable-decoders \
${DECODERS_TO_ENABLE}
make clean make clean
make -j8 make -j8

Loading…
Cancel
Save