Implement build logic
This commit is contained in:
parent
57ca78ac1d
commit
c024aa01d6
10 changed files with 65 additions and 60 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
/Dockerfile
|
||||
/ffbuild/
|
||||
/artifacts/
|
||||
|
|
52
build.sh
52
build.sh
|
@ -1,32 +1,19 @@
|
|||
#!/bin/bash
|
||||
set -xe
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
if [[ $# -lt 1 || $# -gt 2 ]]; then
|
||||
echo "Invalid Arguments"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
TARGET="$1"
|
||||
VARIANT="${2:-gpl}"
|
||||
REPO="${GITHUB_REPOSITORY:-btbn/ffmpeg-builds}"
|
||||
REPO="${REPO,,}"
|
||||
|
||||
IMAGE="$REPO/$TARGET-$VARIANT:latest"
|
||||
source util/vars.sh
|
||||
|
||||
get_output() {
|
||||
(
|
||||
SELF="$1"
|
||||
source $1
|
||||
ffbuild_enabled || exit 0
|
||||
ffbuild_$2 || exit -1
|
||||
ffbuild_$2 || exit 0
|
||||
)
|
||||
}
|
||||
|
||||
CONFIGURE=""
|
||||
CFLAGS=""
|
||||
LDFLAGS=""
|
||||
source "variants/${VARIANT}.sh"
|
||||
source "variants/${TARGET}-${VARIANT}.sh"
|
||||
|
||||
for script in scripts.d/*.sh; do
|
||||
CONFIGURE+=" $(get_output $script configure)"
|
||||
|
@ -34,25 +21,28 @@ for script in scripts.d/*.sh; do
|
|||
LDFLAGS+=" $(get_output $script ldflags)"
|
||||
done
|
||||
|
||||
if [[ $VARIANT == gpl ]]; then
|
||||
VARIANT_FLAGS="--enable-gpl --enable-version3"
|
||||
elif [[ $VARIANT == lgpl ]]; then
|
||||
VARIANT_FLAGS="--enable-version3"
|
||||
else
|
||||
echo "Unknown variant"
|
||||
exit -1
|
||||
fi
|
||||
rm -rf ffbuild
|
||||
mkdir ffbuild
|
||||
|
||||
BUILD_CONTAINER="ffbuild"
|
||||
|
||||
docker rm "$BUILD_CONTAINER" 2>/dev/null || true
|
||||
docker run -i --name "$BUILD_CONTAINER" "$IMAGE" bash -s <<EOF
|
||||
docker run --rm -i -u "$(id -u):$(id -g)" -v $PWD/ffbuild:/ffbuild "$IMAGE" bash -s <<EOF
|
||||
set -xe
|
||||
cd /ffbuild
|
||||
rm -rf ffmpeg prefix
|
||||
|
||||
git clone https://git.videolan.org/git/ffmpeg.git ffmpeg
|
||||
cd ffmpeg
|
||||
git switch $GIT_BRANCH
|
||||
|
||||
./configure \$FFBUILD_TARGET_FLAGS $VARIANT_FLAGS $CONFIGURE --extra-cflags="$CFLAGS" --extra-ldflags="$LDFLAGS"
|
||||
|
||||
./configure --prefix=/ffbuild/prefix \$FFBUILD_TARGET_FLAGS $CONFIGURE --extra-cflags="$CFLAGS" --extra-ldflags="$LDFLAGS"
|
||||
make -j\$(nproc)
|
||||
make install
|
||||
EOF
|
||||
|
||||
mkdir ffbuild/pkgroot
|
||||
package_variant ffbuild/prefix ffbuild/pkgroot
|
||||
|
||||
mkdir -p artifacts
|
||||
|
||||
BUILD_NAME="ffmpeg-$(git --git-dir=ffbuild/ffmpeg/.git describe)-${TARGET}-${VARIANT}"
|
||||
|
||||
tar cJf artifacts/"${BUILD_NAME}.tar.xz" -C ffbuild/pkgroot .
|
||||
|
|
15
generate.sh
15
generate.sh
|
@ -1,19 +1,10 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
set -xe
|
||||
cd "$(dirname "$0")"
|
||||
source util/vars.sh
|
||||
|
||||
rm -f Dockerfile
|
||||
|
||||
if [[ $# -lt 1 || $# -gt 2 ]]; then
|
||||
echo "Invalid Arguments"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
TARGET="$1"
|
||||
VARIANT="${2:-gpl}"
|
||||
REPO="${GITHUB_REPOSITORY:-btbn/ffmpeg-builds}"
|
||||
REPO="${REPO,,}"
|
||||
|
||||
to_df() {
|
||||
printf "$@" >> Dockerfile
|
||||
echo >> Dockerfile
|
||||
|
|
14
makeimage.sh
14
makeimage.sh
|
@ -1,17 +1,7 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
set -xe
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
if [[ $# -lt 1 || $# -gt 2 ]]; then
|
||||
echo "Invalid Arguments"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
TARGET="$1"
|
||||
VARIANT="${2:-gpl}"
|
||||
REPO="${GITHUB_REPOSITORY:-btbn/ffmpeg-builds}"
|
||||
REPO="${REPO,,}"
|
||||
source util/vars.sh
|
||||
|
||||
./generate.sh "$TARGET" "$VARIANT"
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ X264_REPO="https://code.videolan.org/videolan/x264.git"
|
|||
X264_COMMIT="db0d417728460c647ed4a847222a535b00d3dbcb"
|
||||
|
||||
ffbuild_enabled() {
|
||||
[[ $VARIANT == gpl ]] || return -1
|
||||
[[ $VARIANT == gpl* ]] || return -1
|
||||
return 0
|
||||
}
|
||||
|
||||
|
|
13
util/vars.sh
Normal file
13
util/vars.sh
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [[ $# -lt 1 || $# -gt 2 ]]; then
|
||||
echo "Invalid Arguments"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
TARGET="$1"
|
||||
VARIANT="${2:-gpl}"
|
||||
REPO="${GITHUB_REPOSITORY:-btbn/ffmpeg-builds}"
|
||||
REPO="${REPO,,}"
|
||||
|
||||
IMAGE="$REPO/$TARGET-$VARIANT:latest"
|
4
variants/gpl.sh
Normal file
4
variants/gpl.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
CONFIGURE="--enable-gpl --enable-version3"
|
||||
CFLAGS=""
|
||||
LDFLAGS=""
|
||||
GIT_BRANCH="master"
|
4
variants/lgpl.sh
Normal file
4
variants/lgpl.sh
Normal file
|
@ -0,0 +1,4 @@
|
|||
CONFIGURE="--enable-version3"
|
||||
CFLAGS=""
|
||||
LDFLAGS=""
|
||||
GIT_BRANCH="master"
|
9
variants/win64-gpl.sh
Normal file
9
variants/win64-gpl.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
package_variant() {
|
||||
IN="$1"
|
||||
OUT="$2"
|
||||
|
||||
mkdir -p "$OUT/bin"
|
||||
cp "$IN"/bin/* "$OUT"/bin
|
||||
}
|
2
variants/win64-lgpl.sh
Normal file
2
variants/win64-lgpl.sh
Normal file
|
@ -0,0 +1,2 @@
|
|||
#!/bin/bash
|
||||
source "$(dirname "$BASH_SOURCE")/win64-gpl.sh"
|
Loading…
Reference in a new issue