2022-08-02 18:37:17 +00:00
|
|
|
ARG GH_REPO=ghcr.io/btbn/ffmpeg-builds
|
|
|
|
FROM $GH_REPO/base:latest
|
2022-05-09 22:15:31 +00:00
|
|
|
|
|
|
|
RUN --mount=src=ct-ng-config,dst=/.config \
|
|
|
|
git clone --filter=blob:none https://github.com/crosstool-ng/crosstool-ng.git /ct-ng && cd /ct-ng && \
|
|
|
|
./bootstrap && \
|
|
|
|
./configure --enable-local && \
|
|
|
|
make -j$(nproc) && \
|
|
|
|
cp /.config .config && \
|
|
|
|
./ct-ng build && \
|
|
|
|
cd / && \
|
|
|
|
rm -rf ct-ng
|
|
|
|
|
|
|
|
# Prepare cross environment to heavily favour static builds
|
|
|
|
RUN \
|
|
|
|
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.*' \
|
|
|
|
-and -not -name 'libmvec.*' \
|
|
|
|
-and -not -name 'librt.*' \
|
|
|
|
-and -not -name 'libpthread.*' \
|
|
|
|
-delete && \
|
|
|
|
find /opt/ct-ng \
|
|
|
|
-name 'libdl.a' \
|
|
|
|
-or -name 'libc.a' \
|
|
|
|
-or -name 'libm.a' \
|
|
|
|
-or -name 'libmvec.a' \
|
|
|
|
-or -name 'librt.a' \
|
|
|
|
-or -name 'libpthread.a' \
|
|
|
|
-delete && \
|
|
|
|
mkdir /opt/ffbuild
|
|
|
|
|
|
|
|
RUN rustup target add aarch64-unknown-linux-gnu
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2022-10-31 20:47:07 +00:00
|
|
|
ENV FFBUILD_TOOLCHAIN=aarch64-ffbuild-linux-gnu
|
2022-05-09 22:15:31 +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=aarch64 --target-os=linux" \
|
|
|
|
FFBUILD_CROSS_PREFIX="${FFBUILD_TOOLCHAIN}-" \
|
2022-05-09 22:15:31 +00:00
|
|
|
FFBUILD_RUST_TARGET="aarch64-unknown-linux-gnu" \
|
|
|
|
FFBUILD_PREFIX=/opt/ffbuild \
|
|
|
|
FFBUILD_CMAKE_TOOLCHAIN=/toolchain.cmake \
|
|
|
|
PKG_CONFIG=pkg-config \
|
|
|
|
PKG_CONFIG_LIBDIR=/opt/ffbuild/lib/pkgconfig:/opt/ffbuild/share/pkgconfig \
|
2022-11-02 21:02:09 +00:00
|
|
|
CC="${FFBUILD_TOOLCHAIN}-gcc" \
|
|
|
|
CXX="${FFBUILD_TOOLCHAIN}-g++" \
|
|
|
|
LD="${FFBUILD_TOOLCHAIN}-ld" \
|
|
|
|
AR="${FFBUILD_TOOLCHAIN}-gcc-ar" \
|
|
|
|
RANLIB="${FFBUILD_TOOLCHAIN}-gcc-ranlib" \
|
|
|
|
NM="${FFBUILD_TOOLCHAIN}-gcc-nm" \
|
2022-12-05 17:57:54 +00:00
|
|
|
CFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -fPIC -DPIC -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -pthread" \
|
|
|
|
CXXFLAGS="-static-libgcc -static-libstdc++ -I/opt/ffbuild/include -O2 -pipe -fPIC -DPIC -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fstack-clash-protection -pthread" \
|
|
|
|
LDFLAGS="-static-libgcc -static-libstdc++ -L/opt/ffbuild/lib -O2 -pipe -fstack-protector-strong -fstack-clash-protection -Wl,-z,relro,-z,now -pthread -lm" \
|
2022-05-09 22:15:31 +00:00
|
|
|
STAGE_CFLAGS="-fvisibility=hidden -fno-semantic-interposition" \
|
|
|
|
STAGE_CXXFLAGS="-fvisibility=hidden -fno-semantic-interposition"
|