Improve build script a bit

This commit is contained in:
BtbN 2020-09-03 16:56:24 +02:00
parent 75d2e07732
commit b87c78bae4
3 changed files with 21 additions and 13 deletions

View file

@ -11,12 +11,8 @@ to_df() {
}
to_df "FROM $REPO:base-$TARGET"
to_df "ENV TARGET $TARGET"
to_df "ENV VARIANT $VARIANT"
to_df "ENV REPO $REPO"
to_df "ENV FFPREFIX /opt/ffbuild"
to_df "ENV PKG_CONFIG_LIBDIR /opt/ffbuild/lib/pkgconfig"
to_df "ENV TARGET=$TARGET VARIANT=$VARIANT REPO=$REPO"
to_df "ENV FFBUILD_PREFIX=/opt/ffbuild PKG_CONFIG_LIBDIR=/opt/ffbuild/lib/pkgconfig"
for script in scripts.d/*.sh; do
(

View file

@ -7,3 +7,5 @@ RUN \
apt-get -y clean
ENV FFBUILD_TARGET_FLAGS "--pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=win32"
ENV FFBUILD_TOOLCHAIN x86_64-w64-mingw32
ENV FFBUILD_CROSS_PREFIX x86_64-w64-mingw32-

View file

@ -10,24 +10,34 @@ ffbuild_enabled() {
ffbuild_dockerstage() {
to_df "ADD $SELF /root/x264.sh"
to_df "RUN bash -c 'source /root/x264.sh && ffbuild_dockerbuild'"
to_df "RUN bash -c 'source /root/x264.sh && ffbuild_dockerbuild && rm /root/x264.sh'"
}
ffbuild_dockerbuild() {
git clone "$X264_REPO" x264 || return -1
pushd x264
git checkout "$X264_COMMIT" || return -1
git switch "$X264_COMMIT" || return -1
if [[ $TARGET == win64 ]]; then
./configure --disable-cli --enable-static --enable-pic \
--disable-lavf --disable-swscale \
--host=x86_64-w64-mingw32 --cross-prefix=x86_64-w64-mingw32- \
--prefix="$FFPREFIX" || return -1
local myconf=(
--disable-cli
--enable-static
--enable-pic
--disable-lavf
--disable-swscale
--prefix="$FFBUILD_PREFIX"
)
if [[ $TARGET == win* ]]; then
myconf+=(
--host="$FFBUILD_TOOLCHAIN"
--cross-prefix="$FFBUILD_CROSS_PREFIX"
)
else
echo "Unknown target"
return -1
fi
./configure "${myconf[@]}" || return -1
make -j$(nproc) || return -1
make install || return -1