86 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
if [ $# -eq 0 ]; then
echo "No command line parameters are provided. Please enter '$0 -h' to view usage instructions."
exit 1
fi
if test x"$1" = x"-h" -o x"$1" = x"--help"; then
cat <<EOF
Usage: ./configure [options]
Help:
-h, --help print this message
Standard options:
-x86_64 编译x86_64平台的库文件
-arm 编译arm32平台的库文件
-aarch64 编译aarch64平台的库文件
EOF
exit 1
fi
FFMPEG_BUILD_DIR=$(pwd)
PROJECT_ROOT_DIR="${FFMPEG_BUILD_DIR}/../.."
# configure
if [[ x"$1" = x"-x86_64" ]];then
if [ -d x86_64 ]; then
rm -rf x86_64
fi
mkdir -p x86_64/install
cd x86_64
# 导出 x264 pkg-config 查找文件的环境变量
export PKG_CONFIG_PATH=${PROJECT_ROOT_DIR}/thirdparty/x264_build/x86_64/install/lib/pkgconfig:$PKG_CONFIG_PATH
./../ffmpeg/configure \
--cc=gcc \
--cxx=g++ \
--prefix="${FFMPEG_BUILD_DIR}/x86_64/install" \
--disable-asm \
--enable-static \
--disable-shared \
--enable-libx264 \
--enable-encoder=libx264 \
--enable-ffmpeg \
--enable-gpl \
--enable-parsers \
--enable-muxers \
--extra-cflags="-I${PROJECT_ROOT_DIR}/thirdparty/x264_build/x86_64/install/include" \
--extra-ldflags="-L${PROJECT_ROOT_DIR}/thirdparty/x264_build/x86_64/install/lib -static" \
--extra-libs="-lx264" \
--pkg-config-flags="--static"
if [ $? -ne 0 ]; then
echo "ffmpeg configure failed!"
exit 1
fi
make -j8
if [ $? -ne 0 ]; then
echo "ffmpeg make failed!"
exit 1
fi
make install
if [ $? -ne 0 ]; then
echo "ffmpeg make install failed!"
exit 1
fi
elif [[ x"$1" = x"-arm" ]];then
echo "compile arm32"
elif [[ x"$1" = x"-aarch64" ]];then
echo "compile arm64"
else
echo "parameters error"
fi
if [ $? -ne 0 ];then
echo "Exec configure failed!"
exit 1
fi