2023-06-20 16:43:12 +00:00
|
|
|
name: Release (Linux)
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
survey_key:
|
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: ""
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
linux:
|
|
|
|
name: Linux (Generic)
|
|
|
|
|
2023-12-30 16:55:31 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-06-20 16:43:12 +00:00
|
|
|
container:
|
2024-01-15 21:30:52 +00:00
|
|
|
# manylinux_2_28 is based on AlmaLinux 8, and already has a lot of things
|
2023-06-20 16:43:12 +00:00
|
|
|
# installed and preconfigured. It makes it easier to build OpenTTD.
|
2024-01-15 21:30:52 +00:00
|
|
|
# This distro is based on glibc 2.28, released in 2018.
|
|
|
|
image: quay.io/pypa/manylinux_2_28_x86_64
|
2023-06-20 16:43:12 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Download source
|
2024-01-25 21:22:33 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2023-06-20 16:43:12 +00:00
|
|
|
with:
|
|
|
|
name: internal-source
|
|
|
|
|
|
|
|
- name: Unpack source
|
|
|
|
run: |
|
|
|
|
tar -xf source.tar.gz --strip-components=1
|
|
|
|
|
2023-08-30 18:27:15 +00:00
|
|
|
- name: Install Rust toolchain
|
|
|
|
uses: dtolnay/rust-toolchain@stable
|
2023-11-29 16:39:39 +00:00
|
|
|
|
2023-08-30 18:27:15 +00:00
|
|
|
- name: Enable Rust cache
|
2024-01-15 21:30:52 +00:00
|
|
|
uses: Swatinem/rust-cache@v2
|
2023-08-30 18:27:15 +00:00
|
|
|
|
2023-12-30 16:58:18 +00:00
|
|
|
- name: Setup vcpkg caching
|
2024-01-25 21:22:33 +00:00
|
|
|
uses: actions/github-script@v7
|
2023-06-20 16:43:12 +00:00
|
|
|
with:
|
2023-12-30 16:58:18 +00:00
|
|
|
script: |
|
|
|
|
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
|
|
|
|
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
|
|
|
|
core.exportVariable('VCPKG_BINARY_SOURCES', 'clear;x-gha,readwrite')
|
2023-06-20 16:43:12 +00:00
|
|
|
|
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
|
|
|
echo "::group::Install system dependencies"
|
|
|
|
# perl-IPC-Cmd, wget, and zip are needed to run vcpkg.
|
|
|
|
# autoconf-archive is needed to build ICU.
|
|
|
|
yum install -y \
|
|
|
|
autoconf-archive \
|
|
|
|
perl-IPC-Cmd \
|
|
|
|
wget \
|
|
|
|
zip \
|
|
|
|
# EOF
|
|
|
|
|
|
|
|
# aclocal looks first in /usr/local/share/aclocal, and if that doesn't
|
|
|
|
# exist only looks in /usr/share/aclocal. We have files in both that
|
|
|
|
# are important. So copy the latter to the first, and we are good to
|
|
|
|
# go.
|
|
|
|
cp /usr/share/aclocal/* /usr/local/share/aclocal/
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
2023-06-21 11:37:13 +00:00
|
|
|
# The yum variant of fluidsynth depends on all possible audio drivers,
|
|
|
|
# like jack, ALSA, pulseaudio, etc. This is not really useful for us,
|
|
|
|
# as we route the output of fluidsynth back via our sound driver, and
|
|
|
|
# as such do not use these audio driver outputs at all.
|
|
|
|
# The vcpkg variant of fluidsynth depends on ALSA. Similar issue here.
|
|
|
|
# So instead, we compile fluidsynth ourselves, with as few
|
|
|
|
# dependencies as possible. We do it before anything else is installed,
|
|
|
|
# to make sure it doesn't pick up on any of the drivers.
|
|
|
|
echo "::group::Install fluidsynth"
|
|
|
|
wget https://github.com/FluidSynth/fluidsynth/archive/v2.3.3.tar.gz
|
|
|
|
tar xf v2.3.3.tar.gz
|
|
|
|
(
|
|
|
|
cd fluidsynth-2.3.3
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr
|
|
|
|
cmake --build . -j $(nproc)
|
|
|
|
cmake --install .
|
|
|
|
)
|
2023-12-30 13:40:09 +00:00
|
|
|
|
2023-06-21 11:37:13 +00:00
|
|
|
echo "::group::Install audio drivers"
|
|
|
|
# These audio libs are to make sure the SDL version of vcpkg adds
|
|
|
|
# sound-support; these libraries are not added to the resulting
|
|
|
|
# binary, but the headers are used to enable them in SDL.
|
|
|
|
yum install -y \
|
|
|
|
alsa-lib-devel \
|
|
|
|
pulseaudio-libs-devel \
|
|
|
|
# EOF
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
2024-01-15 20:59:19 +00:00
|
|
|
echo "::group::Install video drivers"
|
|
|
|
# These video libs are to make sure the SDL version of vcpkg adds
|
|
|
|
# video-support; these libraries are not added to the resulting
|
|
|
|
# binary, but the headers are used to enable them in SDL.
|
|
|
|
yum install -y \
|
|
|
|
libX11-devel \
|
|
|
|
libXcursor-devel \
|
|
|
|
libXext-devel \
|
|
|
|
libXfixes-devel \
|
|
|
|
libXi-devel \
|
|
|
|
libxkbcommon-devel \
|
|
|
|
libXrandr-devel \
|
|
|
|
libXScrnSaver-devel \
|
2024-01-15 21:30:52 +00:00
|
|
|
mesa-libEGL-devel \
|
|
|
|
mesa-libGL-devel \
|
|
|
|
mesa-libGLES-devel \
|
|
|
|
wayland-devel \
|
|
|
|
wayland-protocols-devel \
|
2024-01-15 20:59:19 +00:00
|
|
|
# EOF
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
2023-06-20 16:43:12 +00:00
|
|
|
# We use vcpkg for our dependencies, to get more up-to-date version.
|
|
|
|
echo "::group::Install vcpkg and dependencies"
|
|
|
|
|
2023-12-30 16:58:18 +00:00
|
|
|
git clone https://github.com/microsoft/vcpkg /vcpkg
|
|
|
|
|
|
|
|
(
|
|
|
|
cd /vcpkg
|
|
|
|
./bootstrap-vcpkg.sh -disableMetrics
|
|
|
|
)
|
|
|
|
|
2023-06-20 16:43:12 +00:00
|
|
|
- name: Install GCC problem matcher
|
|
|
|
uses: ammaraskar/gcc-problem-matcher@master
|
|
|
|
|
|
|
|
- name: Build
|
|
|
|
run: |
|
|
|
|
mkdir -p build
|
|
|
|
cd build
|
|
|
|
|
|
|
|
echo "::group::CMake"
|
|
|
|
cmake ${GITHUB_WORKSPACE} \
|
|
|
|
-DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
2023-06-20 17:25:03 +00:00
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DOPTION_COMPRESS_DEBUG=ON \
|
|
|
|
-DOPTION_LTO=ON \
|
2023-08-17 12:59:48 +00:00
|
|
|
-DOPTION_TRIM_PATH_PREFIX=ON \
|
2023-06-20 16:43:12 +00:00
|
|
|
-DOPTION_SURVEY_KEY=${{ inputs.survey_key }} \
|
|
|
|
-DOPTION_PACKAGE_DEPENDENCIES=ON \
|
|
|
|
# EOF
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Build"
|
|
|
|
echo "Running on $(nproc) cores"
|
|
|
|
cmake --build . -j $(nproc) --target openttd
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
- name: Create bundles
|
|
|
|
run: |
|
|
|
|
cd ${GITHUB_WORKSPACE}/build
|
|
|
|
echo "::group::Run CPack"
|
|
|
|
cpack
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Cleanup"
|
|
|
|
# Remove the sha256 files CPack generates; we will do this ourself at
|
|
|
|
# the end of this workflow.
|
|
|
|
rm -f bundles/*.sha256
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
- name: Store bundles
|
2024-01-25 21:22:33 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-06-20 16:43:12 +00:00
|
|
|
with:
|
|
|
|
name: openttd-linux-generic
|
|
|
|
path: build/bundles
|
|
|
|
retention-days: 5
|