1 Star 0 Fork 2

fanyangchu/FFmpeg-Builds

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.sh 2.26 KB
一键复制 编辑 原始数据 按行查看 历史
#!/bin/bash
set -xe
cd "$(dirname "$0")"
source util/vars.sh
get_output() {
(
SELF="$1"
source $1
if ffbuild_enabled; then
ffbuild_$2 || exit 0
else
ffbuild_un$2 || exit 0
fi
)
}
source "variants/${TARGET}-${VARIANT}.sh"
for addin in ${ADDINS[*]}; do
source "addins/${addin}.sh"
done
export FFBUILD_PREFIX="$(docker run --rm "$IMAGE" bash -c 'echo $FFBUILD_PREFIX')"
for script in scripts.d/*.sh; do
FF_CONFIGURE+=" $(get_output $script configure)"
FF_CFLAGS+=" $(get_output $script cflags)"
FF_CXXFLAGS+=" $(get_output $script cxxflags)"
FF_LDFLAGS+=" $(get_output $script ldflags)"
FF_LIBS+=" $(get_output $script libs)"
done
FF_CONFIGURE="$(xargs <<< "$FF_CONFIGURE")"
FF_CFLAGS="$(xargs <<< "$FF_CFLAGS")"
FF_CXXFLAGS="$(xargs <<< "$FF_CXXFLAGS")"
FF_LDFLAGS="$(xargs <<< "$FF_LDFLAGS")"
FF_LIBS="$(xargs <<< "$FF_LIBS")"
TESTFILE="uidtestfile"
rm -f "$TESTFILE"
docker run --rm -v "$PWD:/uidtestdir" "$IMAGE" /usr/bin/touch "/uidtestdir/$TESTFILE"
DOCKERUID="$(stat -c "%u" "$TESTFILE")"
rm -f "$TESTFILE"
[[ "$DOCKERUID" != "$(id -u)" ]] && UIDARGS=( -u "$(id -u):$(id -g)" ) || UIDARGS=()
rm -rf ffbuild
mkdir ffbuild
docker run --rm -i "${UIDARGS[@]}" -v $PWD/ffbuild:/ffbuild "$IMAGE" bash -s <<EOF
set -xe
cd /ffbuild
rm -rf ffmpeg prefix
git clone https://github.com/FFmpeg/FFmpeg.git ffmpeg
cd ffmpeg
git checkout $GIT_BRANCH
./configure --prefix=/ffbuild/prefix --pkg-config-flags="--static" \$FFBUILD_TARGET_FLAGS $FF_CONFIGURE --extra-cflags="$FF_CFLAGS" --extra-cxxflags="$FF_CXXFLAGS" --extra-ldflags="$FF_LDFLAGS" --extra-libs="$FF_LIBS"
make -j\$(nproc)
make install
EOF
mkdir -p artifacts
ARTIFACTS_PATH="$PWD/artifacts"
BUILD_NAME="ffmpeg-$(./ffbuild/ffmpeg/ffbuild/version.sh ffbuild/ffmpeg)-${TARGET}-${VARIANT}${ADDINS_STR:+-}${ADDINS_STR}"
mkdir -p "ffbuild/pkgroot/$BUILD_NAME"
package_variant ffbuild/prefix "ffbuild/pkgroot/$BUILD_NAME"
cd ffbuild/pkgroot
zip -9 -r "${ARTIFACTS_PATH}/${BUILD_NAME}.zip" "$BUILD_NAME"
cd -
rm -rf ffbuild
if [[ -n "$GITHUB_ACTIONS" ]]; then
echo "::set-output name=build_name::${BUILD_NAME}"
echo "${BUILD_NAME}.zip" > "${ARTIFACTS_PATH}/${TARGET}-${VARIANT}${ADDINS_STR:+-}${ADDINS_STR}.txt"
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fanych/FFmpeg-Builds.git
git@gitee.com:fanych/FFmpeg-Builds.git
fanych
FFmpeg-Builds
FFmpeg-Builds
master

搜索帮助