Build rav1e ourselves

This commit is contained in:
BtbN 2021-04-04 04:08:20 +02:00
parent c3b3e01674
commit 964573fa91
4 changed files with 20 additions and 22 deletions

View File

@ -4,7 +4,7 @@ FROM docker.pkg.github.com/$GH_REPO/base:latest
ENV DEBIAN_FRONTEND noninteractive
RUN \
apt-get -y install gcc-mingw-w64-i686 g++-mingw-w64-i686 gfortran-mingw-w64-i686 && \
apt-get -y install binutils-mingw-w64-x86-64 gcc-mingw-w64-i686 g++-mingw-w64-i686 gfortran-mingw-w64-i686 && \
apt-get -y clean && \
rm /usr/lib/gcc/*-w64-mingw32/*/libstdc++*.dll* && \
rm /usr/lib/gcc/*-w64-mingw32/*/libgcc_s* && \
@ -20,9 +20,11 @@ ADD cross.meson /cross.meson
ENV FFBUILD_TARGET_FLAGS="--pkg-config=pkg-config --cross-prefix=i686-w64-mingw32- --arch=i686 --target-os=mingw32" \
FFBUILD_TOOLCHAIN=i686-w64-mingw32 \
FFBUILD_CROSS_PREFIX=i686-w64-mingw32- \
FFBUILD_RUST_TARGET=i686-pc-windows-gnu \
FFBUILD_PREFIX=/opt/ffbuild \
FFBUILD_CMAKE_TOOLCHAIN=/toolchain.cmake \
PKG_CONFIG_LIBDIR=/opt/ffbuild/lib/pkgconfig \
CFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
CXXFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
LDFLAGS="-static-libgcc -static-libstdc++ -L/opt/ffbuild/lib -O2 -pipe -fstack-protector-strong"
LDFLAGS="-static-libgcc -static-libstdc++ -L/opt/ffbuild/lib -O2 -pipe -fstack-protector-strong" \
DLLTOOL="i686-w64-mingw32-dlltool"

View File

@ -4,7 +4,7 @@ FROM docker.pkg.github.com/$GH_REPO/base:latest
ENV DEBIAN_FRONTEND noninteractive
RUN \
apt-get -y install gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 gfortran-mingw-w64-x86-64 && \
apt-get -y install binutils-mingw-w64-i686 gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 gfortran-mingw-w64-x86-64 && \
apt-get -y clean && \
rm /usr/lib/gcc/*-w64-mingw32/*/libstdc++*.dll* && \
rm /usr/lib/gcc/*-w64-mingw32/*/libgcc_s* && \
@ -20,9 +20,11 @@ ADD cross.meson /cross.meson
ENV FFBUILD_TARGET_FLAGS="--pkg-config=pkg-config --cross-prefix=x86_64-w64-mingw32- --arch=x86_64 --target-os=mingw32" \
FFBUILD_TOOLCHAIN=x86_64-w64-mingw32 \
FFBUILD_CROSS_PREFIX=x86_64-w64-mingw32- \
FFBUILD_RUST_TARGET=x86_64-pc-windows-gnu \
FFBUILD_PREFIX=/opt/ffbuild \
FFBUILD_CMAKE_TOOLCHAIN=/toolchain.cmake \
PKG_CONFIG_LIBDIR=/opt/ffbuild/lib/pkgconfig \
CFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
CXXFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -D_FORTIFY_SOURCE=2 -fstack-protector-strong" \
LDFLAGS="-static-libgcc -static-libstdc++ -L/opt/ffbuild/lib -O2 -pipe -fstack-protector-strong"
LDFLAGS="-static-libgcc -static-libstdc++ -L/opt/ffbuild/lib -O2 -pipe -fstack-protector-strong" \
DLLTOOL="x86_64-w64-mingw32-dlltool"

View File

@ -5,11 +5,12 @@ ENV DEBIAN_FRONTEND noninteractive
RUN \
apt-get -y update && \
apt-get -y dist-upgrade && \
apt-get -y install build-essential yasm nasm pkgconf git curl wget cmake unzip subversion autoconf automake libtool autopoint cmake clang texinfo texi2html gperf gettext itstool ragel libc6-dev gtk-doc-tools gobject-introspection gawk meson ninja-build p7zip-full python3-distutils python3-apt python-is-python3 && \
apt-get -y install build-essential yasm nasm pkgconf git curl wget cmake unzip subversion autoconf automake libtool autopoint cmake clang texinfo texi2html gperf gettext itstool ragel libc6-dev libssl-dev gtk-doc-tools gobject-introspection gawk meson ninja-build p7zip-full python3-distutils python3-apt python-is-python3 && \
apt-get -y clean
ENV CARGO_HOME="/opt/cargo" RUSTUP_HOME="/opt/rustup" PATH="/opt/cargo/bin:${PATH}"
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --no-modify-path
RUN cargo install cargo-c && rm -rf "${CARGO_HOME}"/{registry,git}
ADD run_stage.sh /usr/bin/run_stage
ADD git-mini-clone.sh /usr/bin/git-mini-clone

View File

@ -1,6 +1,7 @@
#!/bin/bash
RAV1E_URL="https://github.com/xiph/rav1e/releases/download/v0.4.1/rav1e-0.4.1-windows-gnu.zip"
RAV1E_REPO="https://github.com/xiph/rav1e.git"
RAV1E_COMMIT="d6e4b5c714f107f9cc6991d44927fd029ba53a72"
ffbuild_enabled() {
[[ $TARGET == win32 ]] && return -1
@ -13,24 +14,16 @@ ffbuild_dockerstage() {
}
ffbuild_dockerbuild() {
mkdir rav1e && cd rav1e
git-mini-clone "$RAV1E_REPO" "$RAV1E_COMMIT" rav1e
cd rav1e
if [[ $TARGET == win64 ]]; then
wget -O rav1e.zip "${RAV1E_URL}"
else
echo "Unknown target"
return -1
fi
cargo cinstall \
--target="$FFBUILD_RUST_TARGET" \
--prefix="$FFBUILD_PREFIX" \
--crt-static \
--release
unzip rav1e.zip
cd rav1e-*
rm -r bin lib/*.dll.a
sed -i "s|^prefix=.*|prefix=${FFBUILD_PREFIX}|" lib/pkgconfig/rav1e.pc
mkdir -p "$FFBUILD_PREFIX"/{include,lib/pkgconfig}
cp -r include/. "$FFBUILD_PREFIX"/include/.
cp -r lib/. "$FFBUILD_PREFIX"/lib/.
rm "${FFBUILD_PREFIX}"/{lib/rav1e.dll.a,lib/rav1e.def,bin/rav1e.dll}
cd ..
rm -rf rav1e