Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added static build of ffmpeg #93

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions ffmpeg-android-maker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ export BUILD_DIR_EXTERNAL=$BUILD_DIR/external
function prepareOutput() {
OUTPUT_LIB=${OUTPUT_DIR}/lib/${ANDROID_ABI}
mkdir -p ${OUTPUT_LIB}
cp ${BUILD_DIR_FFMPEG}/${ANDROID_ABI}/lib/*.so ${OUTPUT_LIB}
if [ "$ENABLE_SHARED" -eq 1 ]; then
cp ${BUILD_DIR_FFMPEG}/${ANDROID_ABI}/lib/*.so ${OUTPUT_LIB}
fi
if [ "$ENABLE_STATIC" -eq 1 ]; then
cp ${BUILD_DIR_FFMPEG}/${ANDROID_ABI}/lib/*.a ${OUTPUT_LIB}
fi

OUTPUT_HEADERS=${OUTPUT_DIR}/include/${ANDROID_ABI}
mkdir -p ${OUTPUT_HEADERS}
Expand All @@ -46,7 +51,12 @@ function prepareOutput() {
# Otherwise the whole script is interrupted
function checkTextRelocations() {
TEXT_REL_STATS_FILE=${STATS_DIR}/text-relocations.txt
${FAM_READELF} --dynamic ${BUILD_DIR_FFMPEG}/${ANDROID_ABI}/lib/*.so | grep 'TEXTREL\|File' >> ${TEXT_REL_STATS_FILE}
if [ "$ENABLE_SHARED" -eq 1 ]; then
${FAM_READELF} --dynamic ${BUILD_DIR_FFMPEG}/${ANDROID_ABI}/lib/*.so | grep 'TEXTREL\|File' >> ${TEXT_REL_STATS_FILE}
fi
if [ "$ENABLE_STATIC" -eq 1 ]; then
${FAM_READELF} --dynamic ${BUILD_DIR_FFMPEG}/${ANDROID_ABI}/lib/*.a | grep 'TEXTREL\|File' >> ${TEXT_REL_STATS_FILE}
fi

if grep -q TEXTREL ${TEXT_REL_STATS_FILE}; then
echo "There are text relocations in output files:"
Expand Down
7 changes: 5 additions & 2 deletions scripts/ffmpeg/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ done
DEP_CFLAGS="-I${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}/include"
DEP_LD_FLAGS="-L${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}/lib $FFMPEG_EXTRA_LD_FLAGS"

PARAM_SHARED=$([ "$ENABLE_SHARED" -eq 1 ] && echo "--enable-shared" || echo "--disable-shared")
PARAM_STATIC=$([ "$ENABLE_STATIC" -eq 1 ] && echo "--enable-static" || echo "--disable-static")

./configure \
--prefix=${BUILD_DIR_FFMPEG}/${ANDROID_ABI} \
--enable-cross-compile \
Expand All @@ -41,8 +44,8 @@ DEP_LD_FLAGS="-L${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}/lib $FFMPEG_EXTRA_LD_FLAGS"
--strip=${FAM_STRIP} \
--extra-cflags="-O3 -fPIC $DEP_CFLAGS" \
--extra-ldflags="$DEP_LD_FLAGS" \
--enable-shared \
--disable-static \
${PARAM_SHARED} \
${PARAM_STATIC} \
--disable-vulkan \
--pkg-config=${PKG_CONFIG_EXECUTABLE} \
${EXTRA_BUILD_CONFIGURATION_FLAGS} \
Expand Down
14 changes: 14 additions & 0 deletions scripts/parse-arguments.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ SOURCE_TYPE=TAR
SOURCE_VALUE=7.0
EXTERNAL_LIBRARIES=()
FFMPEG_GPL_ENABLED=false
ENABLE_SHARED=1
ENABLE_STATIC=0

# All FREE libraries that are supported
SUPPORTED_LIBRARIES_FREE=(
Expand Down Expand Up @@ -135,6 +137,18 @@ for argument in "$@"; do
EXTERNAL_LIBRARIES+=" ${SUPPORTED_LIBRARIES_GPL[@]}"
FFMPEG_GPL_ENABLED=true
;;
--enable-shared)
ENABLE_SHARED=1
;;
--disable-shared)
ENABLE_SHARED=0
;;
--enable-static)
ENABLE_STATIC=1
;;
--disable-static)
ENABLE_STATIC=0
;;
*)
echo "Unknown argument $argument"
;;
Expand Down
Loading