2022-08-02 18:37:17 +00:00
|
|
|
ARG GH_REPO=ghcr.io/btbn/ffmpeg-builds
|
|
|
|
FROM $GH_REPO/base:latest
|
2021-05-12 17:50:12 +00:00
|
|
|
|
2021-05-13 23:52:34 +00:00
|
|
|
RUN --mount=src=ct-ng-config,dst=/.config \
|
2021-12-06 17:23:09 +00:00
|
|
|
git clone --filter=blob:none https://github.com/crosstool-ng/crosstool-ng.git /ct-ng && cd /ct-ng && \
|
2021-05-13 23:52:34 +00:00
|
|
|
./bootstrap && \
|
|
|
|
./configure --enable-local && \
|
|
|
|
make -j$(nproc) && \
|
|
|
|
cp /.config .config && \
|
|
|
|
./ct-ng build && \
|
|
|
|
cd / && \
|
|
|
|
rm -rf ct-ng
|
2021-05-13 13:47:08 +00:00
|
|
|
|
2021-05-13 23:52:34 +00:00
|
|
|
# Prepare "cross" environment to heavily favour static builds
|
|
|
|
RUN \
|
2021-05-14 17:10:57 +00:00
|
|
|
find /opt/ct-ng -type l \
|
|
|
|
-and -name '*.so' \
|
|
|
|
-and -not -ipath '*plugin*' \
|
|
|
|
-and -not -name 'libdl.*' \
|
|
|
|
-and -not -name 'libc.*' \
|
|
|
|
-and -not -name 'libm.*' \
|
2021-12-20 21:02:14 +00:00
|
|
|
-and -not -name 'libmvec.*' \
|
|
|
|
-and -not -name 'librt.*' \
|
|
|
|
-and -not -name 'libpthread.*' \
|
2021-05-14 17:10:57 +00:00
|
|
|
-delete && \
|
|
|
|
find /opt/ct-ng \
|
|
|
|
-name 'libdl.a' \
|
|
|
|
-or -name 'libc.a' \
|
|
|
|
-or -name 'libm.a' \
|
2021-12-20 21:02:14 +00:00
|
|
|
-or -name 'libmvec.a' \
|
|
|
|
-or -name 'librt.a' \
|
|
|
|
-or -name 'libpthread.a' \
|
2021-12-06 17:23:09 +00:00
|
|
|
-delete && \
|
|
|
|
mkdir /opt/ffbuild
|
2021-05-12 17:50:12 +00:00
|
|
|
|
|
|
|
ADD toolchain.cmake /toolchain.cmake
|
|
|
|
ADD cross.meson /cross.meson
|
2021-12-24 13:05:08 +00:00
|
|
|
|
2021-12-20 16:32:39 +00:00
|
|
|
ADD gen-implib.sh /usr/bin/gen-implib
|
2021-12-24 13:05:08 +00:00
|
|
|
RUN git clone --filter=blob:none --depth=1 https://github.com/yugr/Implib.so /opt/implib
|
2021-05-12 17:50:12 +00:00
|
|
|
|
2022-10-31 20:47:07 +00:00
|
|
|
ENV FFBUILD_TOOLCHAIN=x86_64-ffbuild-linux-gnu
|
2021-12-06 17:23:09 +00:00
|
|
|
ENV PATH="/opt/ct-ng/bin:${PATH}" \
|
2022-10-31 20:47:07 +00:00
|
|
|
FFBUILD_TARGET_FLAGS="--pkg-config=pkg-config --cross-prefix=${FFBUILD_TOOLCHAIN}- --arch=x86_64 --target-os=linux" \
|
|
|
|
FFBUILD_CROSS_PREFIX="${FFBUILD_TOOLCHAIN}-" \
|
2021-05-13 23:52:34 +00:00
|
|
|
FFBUILD_RUST_TARGET="x86_64-unknown-linux-gnu" \
|
2021-05-12 17:50:12 +00:00
|
|
|
FFBUILD_PREFIX=/opt/ffbuild \
|
|
|
|
FFBUILD_CMAKE_TOOLCHAIN=/toolchain.cmake \
|
2021-07-13 21:51:33 +00:00
|
|
|
PKG_CONFIG=pkg-config \
|
2021-07-14 19:37:48 +00:00
|
|
|
PKG_CONFIG_LIBDIR=/opt/ffbuild/lib/pkgconfig:/opt/ffbuild/share/pkgconfig \
|
2021-05-14 15:58:06 +00:00
|
|
|
CFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -fPIC -DPIC -D_FORTIFY_SOURCE=2 -fstack-protector-strong -pthread" \
|
|
|
|
CXXFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -fPIC -DPIC -D_FORTIFY_SOURCE=2 -fstack-protector-strong -pthread" \
|
2021-05-15 13:05:54 +00:00
|
|
|
LDFLAGS="-static-libgcc -static-libstdc++ -L/opt/ffbuild/lib -O2 -pipe -fstack-protector-strong -Wl,-z,relro,-z,now -pthread -lm" \
|
2021-07-15 00:05:21 +00:00
|
|
|
STAGE_CFLAGS="-fvisibility=hidden -fno-semantic-interposition" \
|
|
|
|
STAGE_CXXFLAGS="-fvisibility=hidden -fno-semantic-interposition"
|