TRX/tools/docker/game-linux/Dockerfile

143 lines
3 KiB
Text
Raw Normal View History

2023-09-26 16:22:29 +02:00
# TR1X building toolchain for Linux.
#
# This is a multi-stage Docker image. It is designed to keep the final image
# size low. Each stage builds an external dependency. The final stage takes the
# artifacts (binaries, includes etc.) from previous stages and installs all the
2023-09-26 16:22:29 +02:00
# tools necessary to build TR1X.
2023-09-20 14:00:42 +02:00
FROM ubuntu:latest as base
2021-11-17 12:08:20 +01:00
# don't prompt during potential installation/update of tzinfo
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Warsaw
2021-11-17 12:08:20 +01:00
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y \
git \
make
2021-11-20 22:40:57 +01:00
# pcre2
FROM base AS pcre2
RUN apt-get install -y git gcc autoconf libtool
RUN git clone https://github.com/PCRE2Project/pcre2
RUN cd pcre2 \
&& autoreconf -fi \
&& ./configure \
--prefix=/ext/ \
&& make -j 4 \
&& make install
# libbacktrace
FROM base AS backtrace
RUN apt-get install -y git gcc autoconf libtool
RUN git clone https://github.com/LostArtefacts/libbacktrace/
RUN cd libbacktrace && \
autoreconf -fi && \
./configure \
--prefix=/ext/ \
&& make -j 4 \
&& make install
# libav
2023-09-21 17:38:17 +02:00
FROM base AS libav
RUN apt-get install -y \
2023-09-20 14:00:42 +02:00
nasm \
gcc \
zlib1g-dev
2021-12-04 18:45:39 +01:00
RUN git clone \
--depth 1 \
--branch "n4.4.1" \
https://github.com/FFmpeg/FFmpeg
COPY ./tools/ffmpeg_flags.txt /tmp/ffmpeg_flags.txt
2021-11-20 22:40:57 +01:00
RUN cd FFmpeg \
&& ./configure \
--arch=x86 \
--prefix=/ext/ \
2021-11-20 22:40:57 +01:00
--enable-static \
--disable-shared \
$(cat /tmp/ffmpeg_flags.txt) \
2021-11-20 22:40:57 +01:00
&& make -j 4 \
&& make install
2023-09-20 14:00:42 +02:00
# SDL
2023-09-21 17:38:17 +02:00
FROM base AS sdl
RUN git clone https://github.com/libsdl-org/SDL -b SDL2
2023-09-20 14:00:42 +02:00
RUN apt-get install -y \
libgl1-mesa-dev \
libglu1-mesa-dev \
libpulse-dev \
automake \
gcc \
libxext-dev
RUN cd SDL \
&& aclocal -I acinclude \
&& autoconf \
2023-09-20 14:00:42 +02:00
&& mkdir sdl_build \
&& cd sdl_build \
&& ../configure \
--prefix=/ext/ \
--enable-shared \
2021-12-07 12:54:44 +01:00
--enable-static \
&& make -j 4 \
&& make install
2023-09-21 19:31:11 +02:00
# UPX
FROM base AS upx
RUN mkdir /ext/
WORKDIR /ext/
RUN apt-get install -y wget xz-utils
RUN wget https://github.com/upx/upx/releases/download/v4.1.0/upx-4.1.0-amd64_linux.tar.xz
RUN tar -xvf upx-*.tar.xz
RUN ln -s upx-*/upx
2023-09-26 16:22:29 +02:00
# TR1X
2023-09-20 14:00:42 +02:00
FROM base
2021-11-17 12:08:20 +01:00
# set the build dir - actual files are mounted with a Docker volume
RUN mkdir /app
WORKDIR /app
2023-09-20 14:00:42 +02:00
# package dependencies
RUN apt-get install -y \
zlib1g-dev \
libgl1-mesa-dev
2023-09-20 14:00:42 +02:00
# tooling dependencies
2021-12-07 12:54:26 +01:00
# configure pkgconfig manually
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=967969
ENV PKG_CONFIG_LIBDIR=/ext/lib/
ENV PKG_CONFIG_PATH=/ext/lib/pkgconfig/
2022-12-15 12:10:51 +01:00
RUN apt-get install -y \
2021-12-07 12:54:26 +01:00
pkg-config \
2023-09-20 14:00:42 +02:00
git \
python3-pip \
&& python3 -m pip install \
pyjson5 \
meson \
ninja
2023-09-20 14:00:42 +02:00
# manually built dependencies
2023-09-21 19:31:11 +02:00
COPY --from=upx /ext/upx /usr/local/bin/upx
2023-09-20 14:00:42 +02:00
COPY --from=libav /ext/ /ext/
COPY --from=sdl /ext/ /ext/
COPY --from=backtrace /ext/ /ext/
COPY --from=pcre2 /ext/ /ext/
2023-09-20 14:00:42 +02:00
2024-03-25 11:09:05 +01:00
ENV PYTHONPATH=/app/tools/
2024-03-23 13:34:59 +01:00
ENTRYPOINT ["/app/tools/docker/game-linux/entrypoint.sh"]