2023-01-28 12:32:30 +00:00
|
|
|
name: Release (Linux)
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
linux:
|
|
|
|
name: Linux (Generic)
|
|
|
|
|
|
|
|
runs-on: ubuntu-20.04
|
|
|
|
container:
|
|
|
|
# manylinux2014 is based on CentOS 7, but already has a lot of things
|
|
|
|
# installed and preconfigured. It makes it easier to build OpenTTD.
|
|
|
|
image: quay.io/pypa/manylinux2014_x86_64
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Download source
|
|
|
|
uses: actions/download-artifact@v3
|
|
|
|
with:
|
|
|
|
name: internal-source
|
|
|
|
|
|
|
|
- name: Unpack source
|
|
|
|
run: |
|
|
|
|
tar -xf source.tar.gz --strip-components=1
|
|
|
|
|
2023-02-15 21:18:23 +00:00
|
|
|
- name: Enable vcpkg cache
|
|
|
|
uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: /vcpkg/installed
|
|
|
|
key: ubuntu-20.04-vcpkg-release-0 # Increase the number whenever dependencies are modified
|
|
|
|
restore-keys: |
|
|
|
|
ubuntu-20.04-vcpkg-release
|
|
|
|
|
2023-01-28 12:32:30 +00:00
|
|
|
- name: Install dependencies
|
|
|
|
run: |
|
2023-02-15 21:18:23 +00:00
|
|
|
echo "::group::Install system dependencies"
|
2023-04-30 18:37:40 +00:00
|
|
|
# perl-IPC-Cmd, wget, and zip are needed to run vcpkg.
|
|
|
|
# autoconf-archive is needed to build ICU.
|
2023-01-28 12:32:30 +00:00
|
|
|
yum install -y \
|
2023-04-30 18:37:40 +00:00
|
|
|
autoconf-archive \
|
2023-02-15 21:18:23 +00:00
|
|
|
perl-IPC-Cmd \
|
2023-01-28 12:32:30 +00:00
|
|
|
wget \
|
2023-02-15 21:18:23 +00:00
|
|
|
zip \
|
2023-01-28 12:32:30 +00:00
|
|
|
# EOF
|
2023-04-30 18:37:40 +00:00
|
|
|
|
|
|
|
# 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/
|
2023-01-28 12:32:30 +00:00
|
|
|
echo "::endgroup::"
|
|
|
|
|
2023-02-15 21:18:23 +00:00
|
|
|
# We use vcpkg for our dependencies, to get more up-to-date version.
|
|
|
|
echo "::group::Install vcpkg and dependencies"
|
|
|
|
|
|
|
|
# We do a little dance to make sure we copy the cached install folder
|
|
|
|
# into our new clone.
|
|
|
|
git clone --depth=1 https://github.com/microsoft/vcpkg /vcpkg-clone
|
|
|
|
if [ -e /vcpkg/installed ]; then
|
|
|
|
mv /vcpkg/installed /vcpkg-clone/
|
|
|
|
rm -rf /vcpkg
|
|
|
|
fi
|
|
|
|
mv /vcpkg-clone /vcpkg
|
|
|
|
|
|
|
|
(
|
|
|
|
cd /vcpkg
|
|
|
|
./bootstrap-vcpkg.sh -disableMetrics
|
|
|
|
|
|
|
|
# Make Python3 available for other packages.
|
|
|
|
./vcpkg install python3
|
|
|
|
ln -sf $(pwd)/installed/x64-linux/tools/python3/python3.[0-9][0-9] /usr/bin/python3
|
|
|
|
|
|
|
|
./vcpkg install \
|
|
|
|
curl[http2] \
|
|
|
|
fontconfig \
|
|
|
|
freetype \
|
2023-04-30 18:37:40 +00:00
|
|
|
harfbuzz \
|
|
|
|
icu \
|
2023-02-15 21:18:23 +00:00
|
|
|
liblzma \
|
|
|
|
libpng \
|
|
|
|
lzo \
|
|
|
|
sdl2 \
|
|
|
|
zlib \
|
|
|
|
# EOF
|
|
|
|
)
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
2023-01-28 12:32:30 +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
|
2023-02-15 21:18:23 +00:00
|
|
|
# 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. This currently means it picks up SDL2, but
|
|
|
|
# this is fine, as we need SDL2 anyway.
|
2023-01-28 12:32:30 +00:00
|
|
|
echo "::group::Install fluidsynth"
|
|
|
|
wget https://github.com/FluidSynth/fluidsynth/archive/v2.1.6.tar.gz
|
|
|
|
tar xf v2.1.6.tar.gz
|
|
|
|
(
|
|
|
|
cd fluidsynth-2.1.6
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake .. -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr
|
|
|
|
cmake --build . -j $(nproc)
|
|
|
|
cmake --install .
|
|
|
|
)
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
- 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} \
|
2023-02-15 21:18:23 +00:00
|
|
|
-DCMAKE_TOOLCHAIN_FILE=/vcpkg/scripts/buildsystems/vcpkg.cmake \
|
2023-01-28 12:32:30 +00:00
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
-DOPTION_PACKAGE_DEPENDENCIES=ON \
|
|
|
|
# EOF
|
|
|
|
echo "::endgroup::"
|
|
|
|
|
|
|
|
echo "::group::Build"
|
|
|
|
echo "Running on $(nproc) cores"
|
2023-05-02 21:43:16 +00:00
|
|
|
cmake --build . -j $(nproc) --target openttd
|
2023-01-28 12:32:30 +00:00
|
|
|
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
|
|
|
|
uses: actions/upload-artifact@v3
|
|
|
|
with:
|
|
|
|
name: openttd-linux-generic
|
|
|
|
path: build/bundles
|
|
|
|
retention-days: 5
|