tr2: add Linux builds

Resolves #1598.
This commit is contained in:
Marcin Kurczewski 2025-01-01 21:42:03 +01:00
parent b62af2d0c0
commit 2742002426
8 changed files with 165 additions and 1 deletions

View file

@ -16,6 +16,8 @@ jobs:
platform: linux
- game_version: tr2
platform: win
- game_version: tr2
platform: linux
steps:
- name: Login to Docker Hub
uses: docker/login-action@v1

View file

@ -15,6 +15,8 @@ jobs:
strategy:
matrix:
include:
- platform: linux
just_target: tr2-package-linux ${{ inputs.target }}
- platform: win
just_target: tr2-package-win-all ${{ inputs.target }}

View file

@ -1,4 +1,5 @@
## [Unreleased](https://github.com/LostArtefacts/TRX/compare/tr2-0.8...develop) - ××××-××-××
- added Linux builds and toolchain (#1598)
## [0.8](https://github.com/LostArtefacts/TRX/compare/tr2-0.8...tr2-0.8) - 2025-01-01
- completed decompilation efforts  TR2X.dll is gone, Tomb2.exe no longer needed (#1694)

View file

@ -7,7 +7,7 @@ TR2X is finished with the decompilation and is now able to run without the
original game .exe. The focus is now to clean up the code base and enrich the
game with new enhancements and features.
## Windows
## Windows / Linux
### Installing (manual)
@ -125,6 +125,7 @@ game with new enhancements and features.
- added ability to disable FMVs
#### Miscellaneous
- added Linux builds
- added .jpeg/.png screenshots
- added ability to skip FMVs with both the Action key
- added ability to skip end credits with the Action and Escape keys

View file

@ -62,14 +62,18 @@ tr1-package-win-installer target='release': (tr1-build-win target) (tr1-build-wi
cp tools/tr1/installer/out/TR1X_Installer.exe "${exe_name}"
echo "Created ${exe_name}"
tr2-image-linux force="1": (_docker_build "tools/tr2/docker/game-linux/Dockerfile" "rrdash/tr2x-linux" force)
tr2-image-win force="1": (_docker_build "tools/tr2/docker/game-win/Dockerfile" "rrdash/tr2x" force)
tr2-image-win-config force="1": (_docker_build "tools/tr2/docker/config/Dockerfile" "rrdash/tr2x-config" force)
tr2-push-image-linux: (tr2-image-linux "0") (_docker_push "rrdash/tr2x-linux")
tr2-push-image-win: (tr2-image-win "0") (_docker_push "rrdash/tr2x")
tr2-build-linux target='debug': (tr2-image-linux "0") (_docker_run "-e" "TARGET="+target "rrdash/tr2x-linux")
tr2-build-win target='debug': (tr2-image-win "0") (_docker_run "-e" "TARGET="+target "rrdash/tr2x")
tr2-build-win-config: (tr2-image-win-config "0") (_docker_run "rrdash/tr2x-config")
tr2-package-linux target='release': (tr2-build-linux target) (_docker_run "rrdash/tr2x-linux" "package")
tr2-package-win target='release': (tr2-build-win target) (_docker_run "rrdash/tr2x" "package")
tr2-package-win-all target='release': (tr2-build-win target) (tr2-build-win-config) (_docker_run "rrdash/tr2x" "package")

View file

@ -22,6 +22,7 @@ build_opts = [
'-Wno-unused',
'-Wno-address-of-packed-member',
'-DMESON_BUILD',
'-fms-extensions',
'-fno-omit-frame-pointer',
'-ffile-prefix-map=@0@/='.format(relative_dir),
] + trx.get_variable('defines')

View file

@ -0,0 +1,137 @@
# TR2X 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
# tools necessary to build TR2X.
FROM ubuntu:latest AS base
# don't prompt during potential installation/update of tzinfo
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Warsaw
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y \
git \
make
# 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
FROM base AS libav
RUN apt-get install -y \
nasm \
gcc \
zlib1g-dev
RUN git clone \
--depth 1 \
--branch "n4.4.1" \
https://github.com/FFmpeg/FFmpeg
COPY ./tools/ffmpeg_flags.txt /tmp/ffmpeg_flags.txt
RUN cd FFmpeg \
&& ./configure \
--arch=x86 \
--prefix=/ext/ \
--enable-static \
--disable-shared \
$(cat /tmp/ffmpeg_flags.txt) \
&& make -j 4 \
&& make install
# SDL
FROM base AS sdl
RUN git clone https://github.com/libsdl-org/SDL -b SDL2
RUN apt-get install -y \
libgl1-mesa-dev \
libglu1-mesa-dev \
libpulse-dev \
libxkbcommon-dev \
libwayland-client0 \
libwayland-cursor0 \
libwayland-dev \
libwayland-egl1 \
automake \
gcc \
libxext-dev
RUN cd SDL \
&& aclocal -I acinclude \
&& autoconf \
&& mkdir sdl_build \
&& cd sdl_build \
&& ../configure \
--prefix=/ext/ \
--enable-shared \
--enable-static \
&& make -j 4 \
&& make install
# TR2X
FROM base
# set the build dir - actual files are mounted with a Docker volume
RUN mkdir /app
WORKDIR /app
# package dependencies
RUN apt-get install -y \
zlib1g-dev \
libgl1-mesa-dev
# tooling dependencies
# 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/
RUN apt-get install -y \
pkg-config \
git \
python3-pip \
&& python3 -m pip install --break-system-packages \
pyjson5 \
meson \
ninja
# Regular dependencies
RUN apt-get install -y \
upx \
uthash-dev
# manually built dependencies
COPY --from=libav /ext/ /ext/
COPY --from=sdl /ext/ /ext/
COPY --from=backtrace /ext/ /ext/
COPY --from=pcre2 /ext/ /ext/
ENV PYTHONPATH=/app/tools/
ENTRYPOINT ["/app/tools/tr2/docker/game-linux/entrypoint.sh"]

View file

@ -0,0 +1,16 @@
#!/usr/bin/env python3
from pathlib import Path
from shared.cli.game_docker_entrypoint import run_script
run_script(
version=2,
platform="linux",
compile_args=[],
release_zip_files=[
(Path("/app/build/tr2/linux/TR2X"), "TR2X"),
],
compressable_exes=[
Path("/app/build/tr2/linux/TR2X"),
],
)