Skip to content

Commit 17b71bb

Browse files
committed
wip
1 parent fa5245b commit 17b71bb

File tree

1 file changed

+129
-124
lines changed

1 file changed

+129
-124
lines changed

Dockerfile

Lines changed: 129 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,133 +1,138 @@
1-
# bump: alpine /ALPINE_VERSION=alpine:([\d.]+)/ docker:alpine|^3
2-
# bump: alpine link "Release notes" https://alpinelinux.org/posts/Alpine-$LATEST-released.html
3-
ARG ALPINE_VERSION=alpine:3.20.3
4-
FROM $ALPINE_VERSION AS builder
1+
FROM alpine:edge
52

6-
# Alpine Package Keeper options
7-
ARG APK_OPTS=""
3+
RUN apk add ffmpeg
4+
RUN ffmpeg -f lavfi -i testsrc -c:v libx265 -t 10000ms -f null -
85

9-
RUN apk add --no-cache $APK_OPTS \
10-
coreutils \
11-
pkgconfig \
12-
wget \
13-
rust cargo cargo-c \
14-
openssl-dev openssl-libs-static \
15-
ca-certificates \
16-
bash \
17-
tar \
18-
build-base \
19-
autoconf automake \
20-
libtool \
21-
diffutils \
22-
cmake meson ninja \
23-
git \
24-
yasm nasm \
25-
texinfo \
26-
jq \
27-
zlib-dev zlib-static \
28-
bzip2-dev bzip2-static \
29-
libxml2-dev libxml2-static \
30-
expat-dev expat-static \
31-
fontconfig-dev fontconfig-static \
32-
freetype freetype-dev freetype-static \
33-
graphite2-static \
34-
tiff tiff-dev \
35-
libjpeg-turbo libjpeg-turbo-dev \
36-
libpng-dev libpng-static \
37-
giflib giflib-dev \
38-
fribidi-dev fribidi-static \
39-
brotli-dev brotli-static \
40-
soxr-dev soxr-static \
41-
tcl \
42-
numactl-dev \
43-
cunit cunit-dev \
44-
fftw-dev \
45-
libsamplerate-dev libsamplerate-static \
46-
vo-amrwbenc-dev vo-amrwbenc-static \
47-
snappy snappy-dev snappy-static \
48-
xxd \
49-
xz-dev xz-static \
50-
python3 py3-packaging \
51-
linux-headers \
52-
curl \
53-
libdrm-dev
6+
# # bump: alpine /ALPINE_VERSION=alpine:([\d.]+)/ docker:alpine|^3
7+
# # bump: alpine link "Release notes" https://alpinelinux.org/posts/Alpine-$LATEST-released.html
8+
# ARG ALPINE_VERSION=alpine:3.20.3
9+
# FROM $ALPINE_VERSION AS builder
5410

55-
# linux-headers need by rtmpdump
56-
# python3 py3-packaging needed by glib
11+
# # Alpine Package Keeper options
12+
# ARG APK_OPTS=""
5713

58-
# -O3 makes sure we compile with optimization. setting CFLAGS/CXXFLAGS seems to override
59-
# default automake cflags.
60-
# -static-libgcc is needed to make gcc not include gcc_s as "as-needed" shared library which
61-
# cmake will include as a implicit library.
62-
# other options to get hardened build (same as ffmpeg hardened)
63-
ARG CFLAGS="-O3 -static-libgcc -fno-strict-overflow -fstack-protector-all -fPIC"
64-
ARG CXXFLAGS="-O3 -static-libgcc -fno-strict-overflow -fstack-protector-all -fPIC"
65-
ARG LDFLAGS="-Wl,-z,relro,-z,now"
14+
# RUN apk add --no-cache $APK_OPTS \
15+
# coreutils \
16+
# pkgconfig \
17+
# wget \
18+
# rust cargo cargo-c \
19+
# openssl-dev openssl-libs-static \
20+
# ca-certificates \
21+
# bash \
22+
# tar \
23+
# build-base \
24+
# autoconf automake \
25+
# libtool \
26+
# diffutils \
27+
# cmake meson ninja \
28+
# git \
29+
# yasm nasm \
30+
# texinfo \
31+
# jq \
32+
# zlib-dev zlib-static \
33+
# bzip2-dev bzip2-static \
34+
# libxml2-dev libxml2-static \
35+
# expat-dev expat-static \
36+
# fontconfig-dev fontconfig-static \
37+
# freetype freetype-dev freetype-static \
38+
# graphite2-static \
39+
# tiff tiff-dev \
40+
# libjpeg-turbo libjpeg-turbo-dev \
41+
# libpng-dev libpng-static \
42+
# giflib giflib-dev \
43+
# fribidi-dev fribidi-static \
44+
# brotli-dev brotli-static \
45+
# soxr-dev soxr-static \
46+
# tcl \
47+
# numactl-dev \
48+
# cunit cunit-dev \
49+
# fftw-dev \
50+
# libsamplerate-dev libsamplerate-static \
51+
# vo-amrwbenc-dev vo-amrwbenc-static \
52+
# snappy snappy-dev snappy-static \
53+
# xxd \
54+
# xz-dev xz-static \
55+
# python3 py3-packaging \
56+
# linux-headers \
57+
# curl \
58+
# libdrm-dev
6659

67-
# retry dns and some http codes that might be transient errors
68-
ARG WGET_OPTS="--retry-on-host-error --retry-on-http-error=429,500,502,503"
60+
# # linux-headers need by rtmpdump
61+
# # python3 py3-packaging needed by glib
6962

70-
# --no-same-owner as we don't care about uid/gid even if we run as root. fixes invalid gid/uid issue.
71-
ARG TAR_OPTS="--no-same-owner --extract --file"
63+
# # -O3 makes sure we compile with optimization. setting CFLAGS/CXXFLAGS seems to override
64+
# # default automake cflags.
65+
# # -static-libgcc is needed to make gcc not include gcc_s as "as-needed" shared library which
66+
# # cmake will include as a implicit library.
67+
# # other options to get hardened build (same as ffmpeg hardened)
68+
# ARG CFLAGS="-O3 -static-libgcc -fno-strict-overflow -fstack-protector-all -fPIC"
69+
# ARG CXXFLAGS="-O3 -static-libgcc -fno-strict-overflow -fstack-protector-all -fPIC"
70+
# ARG LDFLAGS="-Wl,-z,relro,-z,now"
7271

73-
# bump: x265 /X265_VERSION=([\d.]+)/ https://bitbucket.org/multicoreware/x265_git.git|*
74-
# bump: x265 after ./hashupdate Dockerfile X265 $LATEST
75-
# bump: x265 link "Source diff $CURRENT..$LATEST" https://bitbucket.org/multicoreware/x265_git/branches/compare/$LATEST..$CURRENT#diff
76-
ARG X265_VERSION=4.1
77-
ARG X265_SHA256=a31699c6a89806b74b0151e5e6a7df65de4b49050482fe5ebf8a4379d7af8f29
78-
ARG X265_URL="https://bitbucket.org/multicoreware/x265_git/downloads/x265_$X265_VERSION.tar.gz"
79-
# CMAKEFLAGS issue
80-
# https://bitbucket.org/multicoreware/x265_git/issues/620/support-passing-cmake-flags-to-multilibsh
81-
RUN \
82-
wget $WGET_OPTS -O x265_git.tar.bz2 "$X265_URL" && \
83-
echo "$X265_SHA256 x265_git.tar.bz2" | sha256sum -c - && \
84-
tar $TAR_OPTS x265_git.tar.bz2 && cd x265_*/build/linux && \
85-
sed -i '/^cmake / s/$/ -G "Unix Makefiles" ${CMAKEFLAGS}/' ./multilib.sh && \
86-
sed -i 's/ -DENABLE_SHARED=OFF//g' ./multilib.sh && \
87-
MAKEFLAGS="-j$(nproc)" \
88-
CMAKEFLAGS="-DENABLE_SHARED=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_AGGRESSIVE_CHECKS=ON -DENABLE_NASM=ON -DCMAKE_BUILD_TYPE=Release" \
89-
./multilib.sh && \
90-
make -C 8bit -j$(nproc) install
72+
# # retry dns and some http codes that might be transient errors
73+
# ARG WGET_OPTS="--retry-on-host-error --retry-on-http-error=429,500,502,503"
9174

92-
# bump: ffmpeg /FFMPEG_VERSION=([\d.]+)/ https://github.com/FFmpeg/FFmpeg.git|*
93-
# bump: ffmpeg after ./hashupdate Dockerfile FFMPEG $LATEST
94-
# bump: ffmpeg link "Changelog" https://github.com/FFmpeg/FFmpeg/blob/n$LATEST/Changelog
95-
# bump: ffmpeg link "Source diff $CURRENT..$LATEST" https://github.com/FFmpeg/FFmpeg/compare/n$CURRENT..n$LATEST
96-
ARG FFMPEG_VERSION=8.0
97-
ARG FFMPEG_URL="https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2"
98-
ARG FFMPEG_SHA256=3e74acc48ddb9f5f70b6747d3f439d51e7cc5497f097d58e5975c84488f4d186
99-
ARG ENABLE_FDKAAC=
100-
# sed changes --toolchain=hardened -pie to -static-pie
101-
#
102-
# ldflags stack-size=2097152 is to increase default stack size from 128KB (musl default) to something
103-
# more similar to glibc (2MB). This fixing segfault with libaom-av1 and libsvtav1 as they seems to pass
104-
# large things on the stack.
105-
#
106-
# ldfalgs -Wl,--allow-multiple-definition is a workaround for linking with multiple rust staticlib to
107-
# not cause collision in toolchain symbols, see comment in checkdupsym script for details.
108-
RUN \
109-
wget $WGET_OPTS -O ffmpeg.tar.bz2 "$FFMPEG_URL" && \
110-
echo "$FFMPEG_SHA256 ffmpeg.tar.bz2" | sha256sum -c - && \
111-
tar $TAR_OPTS ffmpeg.tar.bz2 && cd ffmpeg* && \
112-
# workaround for https://gitlab.com/AOMediaCodec/SVT-AV1/-/merge_requests/2387
113-
sed -i 's/svt_av1_enc_init_handle(&svt_enc->svt_handle, svt_enc, &svt_enc->enc_params)/svt_av1_enc_init_handle(\&svt_enc->svt_handle, \&svt_enc->enc_params)/g' libavcodec/libsvtav1.c && \
114-
FDKAAC_FLAGS=$(if [[ -n "$ENABLE_FDKAAC" ]] ;then echo " --enable-libfdk-aac --enable-nonfree " ;else echo ""; fi) && \
115-
sed -i 's/add_ldexeflags -fPIE -pie/add_ldexeflags -fPIE -static-pie/' configure && \
116-
./configure \
117-
--pkg-config-flags="--static" \
118-
--extra-cflags="-fopenmp" \
119-
--extra-ldflags="-fopenmp -Wl,--allow-multiple-definition -Wl,-z,stack-size=2097152" \
120-
--toolchain=hardened \
121-
--disable-shared \
122-
--disable-ffplay \
123-
--enable-static \
124-
--enable-gpl \
125-
--enable-version3 \
126-
--enable-libx265 \
127-
|| (cat ffbuild/config.log ; false) \
128-
&& make -j$(nproc) install
75+
# # --no-same-owner as we don't care about uid/gid even if we run as root. fixes invalid gid/uid issue.
76+
# ARG TAR_OPTS="--no-same-owner --extract --file"
12977

130-
RUN apk add gdb
131-
RUN \
132-
cd ffmpeg* && \
133-
gdb -ex="set confirm off" -ex r -ex bt -ex q --args ./ffmpeg_g -f lavfi -i testsrc -c:v libx265 -t 100ms -f null -
78+
# # bump: x265 /X265_VERSION=([\d.]+)/ https://bitbucket.org/multicoreware/x265_git.git|*
79+
# # bump: x265 after ./hashupdate Dockerfile X265 $LATEST
80+
# # bump: x265 link "Source diff $CURRENT..$LATEST" https://bitbucket.org/multicoreware/x265_git/branches/compare/$LATEST..$CURRENT#diff
81+
# ARG X265_VERSION=4.1
82+
# ARG X265_SHA256=a31699c6a89806b74b0151e5e6a7df65de4b49050482fe5ebf8a4379d7af8f29
83+
# ARG X265_URL="https://bitbucket.org/multicoreware/x265_git/downloads/x265_$X265_VERSION.tar.gz"
84+
# # CMAKEFLAGS issue
85+
# # https://bitbucket.org/multicoreware/x265_git/issues/620/support-passing-cmake-flags-to-multilibsh
86+
# RUN \
87+
# wget $WGET_OPTS -O x265_git.tar.bz2 "$X265_URL" && \
88+
# echo "$X265_SHA256 x265_git.tar.bz2" | sha256sum -c - && \
89+
# tar $TAR_OPTS x265_git.tar.bz2 && cd x265_*/build/linux && \
90+
# sed -i '/^cmake / s/$/ -G "Unix Makefiles" ${CMAKEFLAGS}/' ./multilib.sh && \
91+
# sed -i 's/ -DENABLE_SHARED=OFF//g' ./multilib.sh && \
92+
# MAKEFLAGS="-j$(nproc)" \
93+
# CMAKEFLAGS="-DENABLE_SHARED=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_AGGRESSIVE_CHECKS=ON -DENABLE_NASM=ON -DCMAKE_BUILD_TYPE=Release" \
94+
# ./multilib.sh && \
95+
# make -C 8bit -j$(nproc) install
96+
97+
# # bump: ffmpeg /FFMPEG_VERSION=([\d.]+)/ https://github.com/FFmpeg/FFmpeg.git|*
98+
# # bump: ffmpeg after ./hashupdate Dockerfile FFMPEG $LATEST
99+
# # bump: ffmpeg link "Changelog" https://github.com/FFmpeg/FFmpeg/blob/n$LATEST/Changelog
100+
# # bump: ffmpeg link "Source diff $CURRENT..$LATEST" https://github.com/FFmpeg/FFmpeg/compare/n$CURRENT..n$LATEST
101+
# ARG FFMPEG_VERSION=8.0
102+
# ARG FFMPEG_URL="https://ffmpeg.org/releases/ffmpeg-$FFMPEG_VERSION.tar.bz2"
103+
# ARG FFMPEG_SHA256=3e74acc48ddb9f5f70b6747d3f439d51e7cc5497f097d58e5975c84488f4d186
104+
# ARG ENABLE_FDKAAC=
105+
# # sed changes --toolchain=hardened -pie to -static-pie
106+
# #
107+
# # ldflags stack-size=2097152 is to increase default stack size from 128KB (musl default) to something
108+
# # more similar to glibc (2MB). This fixing segfault with libaom-av1 and libsvtav1 as they seems to pass
109+
# # large things on the stack.
110+
# #
111+
# # ldfalgs -Wl,--allow-multiple-definition is a workaround for linking with multiple rust staticlib to
112+
# # not cause collision in toolchain symbols, see comment in checkdupsym script for details.
113+
# RUN \
114+
# wget $WGET_OPTS -O ffmpeg.tar.bz2 "$FFMPEG_URL" && \
115+
# echo "$FFMPEG_SHA256 ffmpeg.tar.bz2" | sha256sum -c - && \
116+
# tar $TAR_OPTS ffmpeg.tar.bz2 && cd ffmpeg* && \
117+
# # workaround for https://gitlab.com/AOMediaCodec/SVT-AV1/-/merge_requests/2387
118+
# sed -i 's/svt_av1_enc_init_handle(&svt_enc->svt_handle, svt_enc, &svt_enc->enc_params)/svt_av1_enc_init_handle(\&svt_enc->svt_handle, \&svt_enc->enc_params)/g' libavcodec/libsvtav1.c && \
119+
# FDKAAC_FLAGS=$(if [[ -n "$ENABLE_FDKAAC" ]] ;then echo " --enable-libfdk-aac --enable-nonfree " ;else echo ""; fi) && \
120+
# sed -i 's/add_ldexeflags -fPIE -pie/add_ldexeflags -fPIE -static-pie/' configure && \
121+
# ./configure \
122+
# --pkg-config-flags="--static" \
123+
# --extra-cflags="-fopenmp" \
124+
# --extra-ldflags="-fopenmp -Wl,--allow-multiple-definition -Wl,-z,stack-size=2097152" \
125+
# --toolchain=hardened \
126+
# --disable-shared \
127+
# --disable-ffplay \
128+
# --enable-static \
129+
# --enable-gpl \
130+
# --enable-version3 \
131+
# --enable-libx265 \
132+
# || (cat ffbuild/config.log ; false) \
133+
# && make -j$(nproc) install
134+
135+
# RUN apk add gdb
136+
# RUN \
137+
# cd ffmpeg* && \
138+
# gdb -ex="set confirm off" -ex r -ex bt -ex q --args ./ffmpeg_g -f lavfi -i testsrc -c:v libx265 -t 100ms -f null -

0 commit comments

Comments
 (0)