Actually build

This commit is contained in:
BtbN 2020-09-02 18:07:59 +02:00
parent cbb86a4d0e
commit 57ca78ac1d
6 changed files with 95 additions and 7 deletions

View file

@ -5,3 +5,5 @@ ENV DEBIAN_FRONTEND noninteractive
RUN \ RUN \
apt-get -y install mingw-w64 && \ apt-get -y install mingw-w64 && \
apt-get -y clean apt-get -y clean
ENV FFBUILD_TARGET_FLAGS "--pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=win32"

View file

@ -7,6 +7,3 @@ RUN \
apt-get -y dist-upgrade && \ apt-get -y dist-upgrade && \
apt-get -y install build-essential yasm nasm pkg-config git curl wget cmake unzip subversion autoconf automake libtool clang && \ apt-get -y install build-essential yasm nasm pkg-config git curl wget cmake unzip subversion autoconf automake libtool clang && \
apt-get -y clean apt-get -y clean
RUN mkdir -p /opt/ffbuild/{lib,bin,include}
ENV FFBUILD_PREFIX /opt/ffbuild

58
build.sh Executable file
View file

@ -0,0 +1,58 @@
#!/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"
get_output() {
(
SELF="$1"
source $1
ffbuild_enabled || exit 0
ffbuild_$2 || exit -1
)
}
CONFIGURE=""
CFLAGS=""
LDFLAGS=""
for script in scripts.d/*.sh; do
CONFIGURE+="$(get_output $script configure)"
CFLAGS+="$(get_output $script cflags)"
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
BUILD_CONTAINER="ffbuild"
docker rm "$BUILD_CONTAINER" 2>/dev/null || true
docker run -i --name "$BUILD_CONTAINER" "$IMAGE" bash -s <<EOF
set -xe
git clone https://git.videolan.org/git/ffmpeg.git ffmpeg
cd ffmpeg
./configure \$FFBUILD_TARGET_FLAGS $VARIANT_FLAGS $CONFIGURE --extra-cflags="$CFLAGS" --extra-ldflags="$LDFLAGS"
make -j\$(nproc)
EOF

View file

@ -12,25 +12,26 @@ fi
TARGET="$1" TARGET="$1"
VARIANT="${2:-gpl}" VARIANT="${2:-gpl}"
REPO="${GITHUB_REPOSITORY:-btbn/ffmpeg-builds}" REPO="${GITHUB_REPOSITORY:-btbn/ffmpeg-builds}"
REPO="${REPO,,}"
to_df() { to_df() {
printf "$@" >> Dockerfile printf "$@" >> Dockerfile
echo >> Dockerfile echo >> Dockerfile
} }
REPO="${REPO,,}"
to_df "FROM $REPO/base-$TARGET:latest" to_df "FROM $REPO/base-$TARGET:latest"
to_df "ENV TARGET $TARGET" to_df "ENV TARGET $TARGET"
to_df "ENV VARIANT $VARIANT" to_df "ENV VARIANT $VARIANT"
to_df "ENV REPO $REPO" to_df "ENV REPO $REPO"
to_df "ENV FFPREFIX /opt/ffbuild" to_df "ENV FFPREFIX /opt/ffbuild"
to_df "ENV PKG_CONFIG_LIBDIR /opt/ffbuild/lib/pkgconfig"
for script in scripts.d/*.sh; do for script in scripts.d/*.sh; do
( (
SELF="$script" SELF="$script"
source $script source $script
ffbuild_relevant || exit 0 ffbuild_enabled || exit 0
ffbuild_dockerstage || exit $? ffbuild_dockerstage || exit $?
) )
done done

18
makeimage.sh Executable file
View file

@ -0,0 +1,18 @@
#!/bin/bash
set -e
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,,}"
./generate.sh "$TARGET" "$VARIANT"
exec docker build -t "$REPO/$TARGET-$VARIANT:latest" .

View file

@ -3,7 +3,7 @@
X264_REPO="https://code.videolan.org/videolan/x264.git" X264_REPO="https://code.videolan.org/videolan/x264.git"
X264_COMMIT="db0d417728460c647ed4a847222a535b00d3dbcb" X264_COMMIT="db0d417728460c647ed4a847222a535b00d3dbcb"
ffbuild_relevant() { ffbuild_enabled() {
[[ $VARIANT == gpl ]] || return -1 [[ $VARIANT == gpl ]] || return -1
return 0 return 0
} }
@ -34,3 +34,15 @@ ffbuild_dockerbuild() {
popd popd
rm -rf x264 rm -rf x264
} }
ffbuild_configure() {
echo --enable-libx264
}
ffbuild_cflags() {
return 0
}
ffbuild_ldflags() {
return 0
}