simplify libgamemodeauto preloading

Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com>
This commit is contained in:
Stephan Lachnit 2020-07-06 20:32:34 +02:00 committed by afayaz-feral
parent 8b408694b0
commit 7a68a178ac
4 changed files with 11 additions and 25 deletions

9
data/gamemoderun Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
# Helper script to launch games with gamemode
GAMEMODEAUTO_NAME="libgamemodeauto.so.0"
# ld will find the right path to load the library, including for 32-bit apps.
LD_PRELOAD="${GAMEMODEAUTO_NAME}${LD_PRELOAD:+:$LD_PRELOAD}"
exec $GAMEMODERUNEXEC env LD_PRELOAD="${LD_PRELOAD}" "$@"

View File

@ -1,10 +0,0 @@
#!/bin/bash
# Helper script to launch games with gamemode
# Path to installed libgamemodeauto. ld.so will substitute "\$LIB" to get the
# appropriate path depending on whether the app is 32- or 64-bit.
GAMEMODEAUTO="@GAMEMODERUN_PREFIX@libgamemodeauto.so.0"
LD_PRELOAD="${GAMEMODEAUTO}${LD_PRELOAD:+:$LD_PRELOAD}"
exec $GAMEMODERUNEXEC env LD_PRELOAD="${LD_PRELOAD}" "$@"

View File

@ -4,14 +4,6 @@ data_conf.set('LIBEXECDIR', path_libexecdir)
data_conf.set('GAMEMODE_PREFIX', path_prefix) data_conf.set('GAMEMODE_PREFIX', path_prefix)
data_conf.set('GAMEMODE_VERSION', meson.project_version()) data_conf.set('GAMEMODE_VERSION', meson.project_version())
# Set gamemoderun lib dir
gamemoderun_lib_dir = get_option('with-gamemoderun-lib-dir')
if gamemoderun_lib_dir == 'default'
data_conf.set('GAMEMODERUN_PREFIX', path_prefix + '/\$LIB/')
else
data_conf.set('GAMEMODERUN_PREFIX', gamemoderun_lib_dir)
endif
# Pull in the example config # Pull in the example config
config_example = run_command( config_example = run_command(
'cat', 'cat',
@ -47,10 +39,8 @@ configure_file(
) )
# Install the helper run script # Install the helper run script
configure_file( install_data(
input: 'gamemoderun.in', files('gamemoderun'),
output: 'gamemoderun',
configuration: data_conf,
install_dir: path_bindir, install_dir: path_bindir,
install_mode: 'rwxr-xr-x', install_mode: 'rwxr-xr-x',
) )

View File

@ -10,9 +10,6 @@ option('with-systemd-user-unit-dir', type: 'string', description: 'Explicitly se
# Not using systemd # Not using systemd
option('with-dbus-service-dir', type: 'string', description: 'Explicitly set the D-BUS session directory') option('with-dbus-service-dir', type: 'string', description: 'Explicitly set the D-BUS session directory')
# lib dir in gamemoderun
option('with-gamemoderun-lib-dir', type: 'string', value: 'default', description: 'Explicitly set lib dir in gamemoderun')
# General options # General options
option('with-examples', type: 'boolean', description: 'Build sample programs', value: 'true') option('with-examples', type: 'boolean', description: 'Build sample programs', value: 'true')
option('with-util', type: 'boolean', description: 'Build the utilities', value: 'true') option('with-util', type: 'boolean', description: 'Build the utilities', value: 'true')