Skip to content

Commit d5231ce

Browse files
committed
Fix segfault in libx264 and remove unused libraries and non-free options from the build
1 parent 8893173 commit d5231ce

2 files changed

Lines changed: 55 additions & 411 deletions

File tree

Earthfile

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,41 @@
11
VERSION 0.8
22

3+
build-base-alpine:
4+
FROM alpine:3.19
5+
ARG TARGETARCH # Built-in Earthly variable
6+
WORKDIR /app
7+
8+
# Install build dependencies for static builds with musl
9+
# Musl is required because static glibc has broken pthread/threading
10+
RUN --mount=type=cache,target=/var/cache/apk \
11+
apk add --no-cache \
12+
build-base \
13+
curl \
14+
ca-certificates \
15+
python3 \
16+
ninja \
17+
meson \
18+
git \
19+
bash \
20+
nasm \
21+
yasm \
22+
cmake \
23+
pkgconfig \
24+
linux-headers \
25+
coreutils \
26+
diffutils \
27+
perl \
28+
m4 \
29+
autoconf \
30+
automake \
31+
libtool \
32+
zlib-dev \
33+
zlib-static \
34+
libogg-dev \
35+
openssl-dev \
36+
openssl-libs-static \
37+
gettext-dev
38+
339
build-base:
440
FROM ubuntu:24.04
541
ARG TARGETARCH # Built-in Earthly variable
@@ -21,14 +57,14 @@ build-base:
2157
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
2258

2359
build:
24-
FROM +build-base
60+
FROM +build-base-alpine
2561
ARG TARGETARCH # Built-in Earthly variable
2662
ARG FFMPEG_VERSION=8.0
2763

2864
COPY ./build-ffmpeg ./build-ffmpeg
2965
ARG SKIPINSTALL=yes
30-
RUN --mount=type=cache,target=/app/packages,id=ffmpeg-packages-$TARGETARCH \
31-
./build-ffmpeg --build --enable-gpl-and-non-free --full-static
66+
RUN --mount=type=cache,target=/app/packages,id=ffmpeg-packages-musl-$TARGETARCH \
67+
./build-ffmpeg --build --enable-gpl --full-static
3268

3369
# Test the binary
3470
RUN ./workspace/bin/ffmpeg -version
@@ -54,8 +90,8 @@ build-vaapi:
5490

5591
COPY ./build-ffmpeg ./build-ffmpeg
5692
ARG SKIPINSTALL=yes
57-
RUN --mount=type=cache,target=/app/packages,id=ffmpeg-packages-vaapi-$TARGETARCH \
58-
./build-ffmpeg --build --enable-gpl-and-non-free
93+
RUN --mount=type=cache,target=/app/packages,id=ffmpeg-packages-glibc-vaapi-$TARGETARCH \
94+
./build-ffmpeg --build --enable-gpl
5995

6096
# Test the binary
6197
RUN ./workspace/bin/ffmpeg -version

0 commit comments

Comments
 (0)