Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: [Actions / CMake] support for generic linux builds #8641

Merged
merged 1 commit into from Feb 5, 2021

Conversation

TrueBrain
Copy link
Member

@TrueBrain TrueBrain commented Feb 4, 2021

Motivation / Problem

For Steam we would like to have a Linux release too. As we didn't build a generic linux build yet, this was a bit of a challenge ;)

Description

These bundles can be opened on any "modern" Linux machine with
a driver that SDL2 supports.

Machines needs at least glibc 2.15, which was released 10 years ago.
It is build with CentOS 7 as base, and only assumes the following
libraries are available on the system:
- libc
- libdl
- libgcc_s
- libpthread
- librt
- libstdc++

All other libraries the game depends on are bundled together with
the game, so users don't need any library installed to use this
bundle. The downside of course is that this increases the binary
size a bit: 30 MiB of libraries are in this bundle.

RPATH is used to make ld-linux find the folder libraries are
stored in; however, system libraries are always used before these,
in the assumption libraries on the user system are more up-to-date.

Using -DOPTION_PACKAGE_DEPENDENCIES=ON switches on packaging
of libraries in the "lib" folder. This requires CMake 3.16 to
be installed; otherwise it will fail.

Limitations

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

CMakeLists.txt Outdated Show resolved Hide resolved
These bundles can be opened on any "modern" Linux machine with
a driver that SDL2 supports.

Machines needs at least glibc 2.15, which was released 10 years ago.
It is build with CentOS 7 as base, and only assumes the following
libraries are available on the system:
- libc
- libdl
- libgcc_s
- libpthread
- librt
- libstdc++

All other libraries the game depends on are bundled together with
the game, so users don't need any library installed to use this
bundle. The downside of course is that this increases the binary
size a bit: 30 MiB of libraries are in this bundle.

RPATH is used to make ld-linux find the folder libraries are
stored in; however, system libraries are always used before these,
in the assumption libraries on the user system are more up-to-date.

Using -DOPTION_PACKAGE_DEPENDENCIES=ON switches on packaging
of libraries in the "lib" folder. This requires CMake 3.16 to
be installed; otherwise it will fail.
glx22
glx22 approved these changes Feb 5, 2021
Copy link
Contributor

@glx22 glx22 left a comment

Simple and smart solution

@TrueBrain TrueBrain merged commit 05df799 into OpenTTD:master Feb 5, 2021
8 checks passed
@TrueBrain TrueBrain deleted the generic-linux branch Feb 5, 2021
embeddedt added a commit to embeddedt/OpenTTD-modded that referenced this issue Feb 5, 2021
# The yum variant of fluidsynth depends on all possible audio drivers.
# This is not really useful for us, as that would require a user to
# have them all before he can start OpenTTD. Instead, compile a
# version that can only use SDL2. As OpenTTD does sound via SDL2,
# this simply means we either have sound and music, or have none.
Copy link
Contributor

@nielsmh nielsmh Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect. OpenTTD does not depend on fluidsynth having output via a sound driver at all. The fluidsynth music driver sets up fluidsynth to call an internal callback to deliver samples, which are then mixed by our own sound mixer. If it's possible to build fluidsynth without any output drivers at all, you may as well do that.

/* Install the music render routine and set up the samplerate */
uint32 samplerate = MxSetMusicSource(RenderMusicStream);
fluid_settings_setnum(_midi.settings, "synth.sample-rate", samplerate);
DEBUG(driver, 1, "Fluidsynth: samplerate %.0f", (float)samplerate);

TrueBrain added a commit to TrueBrain/OpenTTD that referenced this issue Feb 5, 2021
nielsmh nicely correct us in OpenTTD#8641, pointing out the old comment
is not telling a complete truth. The result, is the same, but it
is better to not mislead future-us.
TrueBrain added a commit that referenced this issue Feb 5, 2021
…#8646)

nielsmh nicely correct us in #8641, pointing out the old comment
is not telling a complete truth. The result is the same, but it
is better to not mislead future-us.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants