FFmpeg-Builds/build.sh

53 lines
1.2 KiB
Bash
Raw Normal View History

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
ffbuild_enabled || exit 0
2020-09-02 23:03:23 +00:00
ffbuild_$2 || exit 0
2020-09-02 16:07:59 +00:00
)
}
2020-09-02 23:03:23 +00:00
source "variants/${VARIANT}.sh"
source "variants/${TARGET}-${VARIANT}.sh"
2020-09-02 16:07:59 +00:00
for script in scripts.d/*.sh; do
2020-09-02 23:03:23 +00:00
CONFIGURE+=" $(get_output $script configure)"
CFLAGS+=" $(get_output $script cflags)"
LDFLAGS+=" $(get_output $script ldflags)"
2020-09-02 16:07:59 +00:00
done
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-03 15:28:01 +00:00
./configure --prefix=/ffbuild/prefix --pkg-config-flags="--static" \$FFBUILD_TARGET_FLAGS $CONFIGURE --extra-cflags="$CFLAGS" --extra-ldflags="$LDFLAGS"
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}"
mkdir "ffbuild/pkgroot/$BUILD_NAME"
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