2020-09-02 16:07:59 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -xe
|
|
|
|
cd "$(dirname "$0")"
|
2020-09-02 23:03:23 +00:00
|
|
|
source util/vars.sh
|
2020-09-02 16:07:59 +00:00
|
|
|
|
|
|
|
get_output() {
|
|
|
|
(
|
|
|
|
SELF="$1"
|
|
|
|
source $1
|
2020-09-03 17:31:29 +00:00
|
|
|
if ffbuild_enabled; then
|
|
|
|
ffbuild_$2 || exit 0
|
|
|
|
else
|
|
|
|
ffbuild_un$2 || exit 0
|
|
|
|
fi
|
2020-09-02 16:07:59 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-09-02 23:03:23 +00:00
|
|
|
source "variants/${TARGET}-${VARIANT}.sh"
|
2020-09-02 16:07:59 +00:00
|
|
|
|
2020-09-05 14:25:25 +00:00
|
|
|
export FFBUILD_PREFIX="$(docker run --rm "$IMAGE" bash -c 'echo $FFBUILD_PREFIX')"
|
2020-09-04 15:05:12 +00:00
|
|
|
|
2020-09-02 16:07:59 +00:00
|
|
|
for script in scripts.d/*.sh; do
|
2020-09-03 20:49:43 +00:00
|
|
|
FF_CONFIGURE+=" $(get_output $script configure)"
|
|
|
|
FF_CFLAGS+=" $(get_output $script cflags)"
|
|
|
|
FF_CXXFLAGS+=" $(get_output $script cxxflags)"
|
|
|
|
FF_LDFLAGS+=" $(get_output $script ldflags)"
|
2020-09-06 19:55:59 +00:00
|
|
|
FF_LIBS+=" $(get_output $script libs)"
|
2020-09-02 16:07:59 +00:00
|
|
|
done
|
|
|
|
|
2020-09-03 20:49:43 +00:00
|
|
|
FF_CONFIGURE="$(xargs <<< "$FF_CONFIGURE")"
|
|
|
|
FF_CFLAGS="$(xargs <<< "$FF_CFLAGS")"
|
|
|
|
FF_CXXFLAGS="$(xargs <<< "$FF_CXXFLAGS")"
|
|
|
|
FF_LDFLAGS="$(xargs <<< "$FF_LDFLAGS")"
|
2020-09-06 19:55:59 +00:00
|
|
|
FF_LIBS="$(xargs <<< "$FF_LIBS")"
|
2020-09-03 18:08:50 +00:00
|
|
|
|
2020-09-02 23:03:23 +00:00
|
|
|
rm -rf ffbuild
|
|
|
|
mkdir ffbuild
|
2020-09-02 16:07:59 +00:00
|
|
|
|
2020-09-02 23:03:23 +00:00
|
|
|
docker run --rm -i -u "$(id -u):$(id -g)" -v $PWD/ffbuild:/ffbuild "$IMAGE" bash -s <<EOF
|
2020-09-02 16:07:59 +00:00
|
|
|
set -xe
|
2020-09-02 23:03:23 +00:00
|
|
|
cd /ffbuild
|
|
|
|
rm -rf ffmpeg prefix
|
2020-09-02 16:07:59 +00:00
|
|
|
|
|
|
|
git clone https://git.videolan.org/git/ffmpeg.git ffmpeg
|
|
|
|
cd ffmpeg
|
2020-09-03 15:02:15 +00:00
|
|
|
git checkout $GIT_BRANCH
|
2020-09-02 23:03:23 +00:00
|
|
|
|
2020-09-06 19:55:59 +00:00
|
|
|
./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"
|
2020-09-02 16:07:59 +00:00
|
|
|
make -j\$(nproc)
|
2020-09-02 23:03:23 +00:00
|
|
|
make install
|
2020-09-02 16:07:59 +00:00
|
|
|
EOF
|
2020-09-02 23:03:23 +00:00
|
|
|
|
|
|
|
mkdir -p artifacts
|
2020-09-03 15:42:23 +00:00
|
|
|
ARTIFACTS_PATH="$PWD/artifacts"
|
2020-09-03 16:03:26 +00:00
|
|
|
BUILD_NAME="ffmpeg-$(./ffbuild/ffmpeg/ffbuild/version.sh ffbuild/ffmpeg)-${TARGET}-${VARIANT}"
|
|
|
|
|
2020-09-03 16:15:02 +00:00
|
|
|
mkdir -p "ffbuild/pkgroot/$BUILD_NAME"
|
2020-09-03 16:03:26 +00:00
|
|
|
package_variant ffbuild/prefix "ffbuild/pkgroot/$BUILD_NAME"
|
2020-09-02 23:03:23 +00:00
|
|
|
|
2020-09-03 15:42:23 +00:00
|
|
|
cd ffbuild/pkgroot
|
2020-09-03 16:03:26 +00:00
|
|
|
zip -9 -r "${ARTIFACTS_PATH}/${BUILD_NAME}.zip" "$BUILD_NAME"
|
2020-09-03 15:42:23 +00:00
|
|
|
cd -
|
|
|
|
|
2020-09-02 23:05:56 +00:00
|
|
|
rm -rf ffbuild
|