mirror of
https://github.com/BtbN/FFmpeg-Builds.git
synced 2025-04-29 22:24:28 +02:00
Pull rust-build-config into images
This commit is contained in:
parent
bca241b76e
commit
faca65b15a
@ -33,17 +33,24 @@ RUN \
|
||||
-delete && \
|
||||
mkdir /opt/ffbuild
|
||||
|
||||
ENV FFBUILD_TOOLCHAIN=x86_64-ffbuild-linux-gnu \
|
||||
FFBUILD_RUST_TARGET="x86_64-unknown-linux-gnu"
|
||||
|
||||
RUN \
|
||||
rustup default nightly && \
|
||||
echo "[unstable]\ntarget-applies-to-host = true\nhost-config = true\n" > "$CARGO_HOME"/config.toml && \
|
||||
echo "[target.$FFBUILD_RUST_TARGET]\nlinker = \"${FFBUILD_TOOLCHAIN}-gcc\"\nar = \"${FFBUILD_TOOLCHAIN}-gcc-ar\"\n" >> "$CARGO_HOME"/config.toml && \
|
||||
echo "[target.host]\nlinker = \"gcc\"\nar = \"ar\"\n" >> "$CARGO_HOME"/config.toml
|
||||
|
||||
ADD toolchain.cmake /toolchain.cmake
|
||||
ADD cross.meson /cross.meson
|
||||
|
||||
ADD gen-implib.sh /usr/bin/gen-implib
|
||||
RUN git clone --filter=blob:none --depth=1 https://github.com/yugr/Implib.so /opt/implib
|
||||
|
||||
ENV FFBUILD_TOOLCHAIN=x86_64-ffbuild-linux-gnu
|
||||
ENV PATH="/opt/ct-ng/bin:${PATH}" \
|
||||
FFBUILD_TARGET_FLAGS="--pkg-config=pkg-config --cross-prefix=${FFBUILD_TOOLCHAIN}- --arch=x86_64 --target-os=linux" \
|
||||
FFBUILD_CROSS_PREFIX="${FFBUILD_TOOLCHAIN}-" \
|
||||
FFBUILD_RUST_TARGET="x86_64-unknown-linux-gnu" \
|
||||
FFBUILD_PREFIX=/opt/ffbuild \
|
||||
FFBUILD_CMAKE_TOOLCHAIN=/toolchain.cmake \
|
||||
PKG_CONFIG=pkg-config \
|
||||
|
@ -33,7 +33,12 @@ RUN \
|
||||
-delete && \
|
||||
mkdir /opt/ffbuild
|
||||
|
||||
RUN rustup target add aarch64-unknown-linux-gnu
|
||||
ENV FFBUILD_TOOLCHAIN=aarch64-ffbuild-linux-gnu \
|
||||
FFBUILD_RUST_TARGET="aarch64-unknown-linux-gnu"
|
||||
|
||||
RUN \
|
||||
rustup target add "$FFBUILD_RUST_TARGET" && \
|
||||
echo "[target.$FFBUILD_RUST_TARGET]\nlinker = \"${FFBUILD_TOOLCHAIN}-gcc\"\nar = \"${FFBUILD_TOOLCHAIN}-gcc-ar\"\n" > "$CARGO_HOME"/config.toml
|
||||
|
||||
ADD toolchain.cmake /toolchain.cmake
|
||||
ADD cross.meson /cross.meson
|
||||
@ -41,11 +46,9 @@ ADD cross.meson /cross.meson
|
||||
ADD gen-implib.sh /usr/bin/gen-implib
|
||||
RUN git clone --filter=blob:none --depth=1 https://github.com/yugr/Implib.so /opt/implib
|
||||
|
||||
ENV FFBUILD_TOOLCHAIN=aarch64-ffbuild-linux-gnu
|
||||
ENV PATH="/opt/ct-ng/bin:${PATH}" \
|
||||
FFBUILD_TARGET_FLAGS="--pkg-config=pkg-config --cross-prefix=${FFBUILD_TOOLCHAIN}- --arch=aarch64 --target-os=linux" \
|
||||
FFBUILD_CROSS_PREFIX="${FFBUILD_TOOLCHAIN}-" \
|
||||
FFBUILD_RUST_TARGET="aarch64-unknown-linux-gnu" \
|
||||
FFBUILD_PREFIX=/opt/ffbuild \
|
||||
FFBUILD_CMAKE_TOOLCHAIN=/toolchain.cmake \
|
||||
PKG_CONFIG=pkg-config \
|
||||
|
@ -19,16 +19,19 @@ RUN \
|
||||
-delete && \
|
||||
mkdir /opt/ffbuild
|
||||
|
||||
RUN rustup target add i686-pc-windows-gnu
|
||||
ENV FFBUILD_TOOLCHAIN=i686-w64-mingw32 \
|
||||
FFBUILD_RUST_TARGET=i686-pc-windows-gnu
|
||||
|
||||
RUN \
|
||||
rustup target add "$FFBUILD_RUST_TARGET" && \
|
||||
echo "[target.$FFBUILD_RUST_TARGET]\nlinker = \"${FFBUILD_TOOLCHAIN}-gcc\"\nar = \"${FFBUILD_TOOLCHAIN}-gcc-ar\"\n" > "$CARGO_HOME"/config.toml
|
||||
|
||||
ADD toolchain.cmake /toolchain.cmake
|
||||
ADD cross.meson /cross.meson
|
||||
|
||||
ENV FFBUILD_TOOLCHAIN=i686-w64-mingw32
|
||||
ENV PATH="/opt/ct-ng/bin:${PATH}" \
|
||||
FFBUILD_TARGET_FLAGS="--pkg-config=pkg-config --cross-prefix=${FFBUILD_TOOLCHAIN}- --arch=i686 --target-os=mingw32" \
|
||||
FFBUILD_CROSS_PREFIX=${FFBUILD_TOOLCHAIN}- \
|
||||
FFBUILD_RUST_TARGET=i686-pc-windows-gnu \
|
||||
FFBUILD_PREFIX=/opt/ffbuild \
|
||||
FFBUILD_CMAKE_TOOLCHAIN=/toolchain.cmake \
|
||||
PKG_CONFIG=pkg-config \
|
||||
|
@ -19,16 +19,19 @@ RUN \
|
||||
-delete && \
|
||||
mkdir /opt/ffbuild
|
||||
|
||||
RUN rustup target add x86_64-pc-windows-gnu
|
||||
ENV FFBUILD_TOOLCHAIN=x86_64-w64-mingw32 \
|
||||
FFBUILD_RUST_TARGET=x86_64-pc-windows-gnu
|
||||
|
||||
RUN \
|
||||
rustup target add "$FFBUILD_RUST_TARGET" && \
|
||||
echo "[target.$FFBUILD_RUST_TARGET]\nlinker = \"${FFBUILD_TOOLCHAIN}-gcc\"\nar = \"${FFBUILD_TOOLCHAIN}-gcc-ar\"\n" > "$CARGO_HOME"/config.toml
|
||||
|
||||
ADD toolchain.cmake /toolchain.cmake
|
||||
ADD cross.meson /cross.meson
|
||||
|
||||
ENV FFBUILD_TOOLCHAIN=x86_64-w64-mingw32
|
||||
ENV PATH="/opt/ct-ng/bin:${PATH}" \
|
||||
FFBUILD_TARGET_FLAGS="--pkg-config=pkg-config --cross-prefix=${FFBUILD_TOOLCHAIN}- --arch=x86_64 --target-os=mingw32" \
|
||||
FFBUILD_CROSS_PREFIX=${FFBUILD_TOOLCHAIN}- \
|
||||
FFBUILD_RUST_TARGET=x86_64-pc-windows-gnu \
|
||||
FFBUILD_PREFIX=/opt/ffbuild \
|
||||
FFBUILD_CMAKE_TOOLCHAIN=/toolchain.cmake \
|
||||
PKG_CONFIG=pkg-config \
|
||||
|
@ -5,7 +5,7 @@ RUN \
|
||||
apt-get -y update && \
|
||||
apt-get -y dist-upgrade && \
|
||||
apt-get -y install build-essential yasm nasm \
|
||||
xxd pkgconf curl wget unzip zip git subversion mercurial rsync \
|
||||
xxd pkgconf curl wget unzip zip git subversion mercurial rsync jq \
|
||||
autoconf automake libtool libtool-bin autopoint gettext cmake clang meson ninja-build \
|
||||
texinfo texi2html help2man flex bison groff \
|
||||
gperf itstool ragel libc6-dev zlib1g-dev libssl-dev \
|
||||
@ -23,3 +23,8 @@ RUN curl https://sh.rustup.rs -sSf | bash -s -- -y --no-modify-path && \
|
||||
|
||||
RUN --mount=src=.,dst=/input \
|
||||
for s in /input/*.sh; do cp $s /usr/bin/$(echo $s | sed -e 's|.*/||' -e 's/\.sh$//'); done
|
||||
|
||||
ENV HOST_CC="gcc" \
|
||||
HOST_CXX="g++" \
|
||||
HOST_CFLAGS="-O2 -pipe" \
|
||||
HOST_CXXFLAGS="-O2 -pipe"
|
||||
|
@ -11,34 +11,15 @@ ffbuild_enabled() {
|
||||
ffbuild_dockerbuild() {
|
||||
local myconf=(
|
||||
--prefix="$FFBUILD_PREFIX"
|
||||
--target="${FFBUILD_RUST_TARGET}"
|
||||
--library-type=staticlib
|
||||
--crt-static
|
||||
--release
|
||||
)
|
||||
|
||||
if [[ -n "$FFBUILD_RUST_TARGET" ]]; then
|
||||
unset PKG_CONFIG_LIBDIR
|
||||
export CROSS_COMPILE=1
|
||||
|
||||
export TARGET_CC="$CC"
|
||||
export TARGET_CXX="$CXX"
|
||||
export TARGET_CFLAGS="$CFLAGS"
|
||||
export TARGET_CXXFLAGS="$CXXFLAGS"
|
||||
unset CFLAGS
|
||||
unset CXXFLAGS
|
||||
export CC="gcc"
|
||||
export CXX="g++"
|
||||
|
||||
myconf+=(
|
||||
--target="${FFBUILD_RUST_TARGET}"
|
||||
--config="target.${FFBUILD_RUST_TARGET}.linker=\"${TARGET_CC}\""
|
||||
--config="target.${FFBUILD_RUST_TARGET}.ar=\"${AR}\""
|
||||
# This is a horrible hack to work around cargo being too stupid for cross-builds to the same target.
|
||||
# When building for Linux, it will try to build a build-time tool with the target-linker, which fails horribly.
|
||||
# Since we are only creating a static lib, the linker is never actually used. So just always force it to host gcc.
|
||||
--config="target.x86_64-unknown-linux-gnu.linker=\"gcc\""
|
||||
)
|
||||
fi
|
||||
# Pulls in target-libs for host tool builds otherwise.
|
||||
# Luckily no target libraries are needed.
|
||||
unset PKG_CONFIG_LIBDIR
|
||||
|
||||
cargo cinstall -v "${myconf[@]}"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user