Meson option to have absolute paths in LD_PRELOAD

pull/408/head v0.6.0-beta.1
jackun 3 years ago
parent 9af4ac546f
commit 6a5cd38127
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -13,10 +13,10 @@ if [ "$1" = "--dlsym" ]; then
shift
fi
MANGOHUD_LIB_NAME="libMangoHud.so"
MANGOHUD_LIB_NAME="@ld_libdir_mangohud_abs@libMangoHud.so"
if [ "$MANGOHUD_DLSYM" = "1" ]; then
MANGOHUD_LIB_NAME="libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
MANGOHUD_LIB_NAME="@ld_libdir_mangohud_abs@libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
fi
# Preload using the plain filesnames of the libs, the dynamic linker will

@ -142,14 +142,14 @@ configure() {
dependencies
git submodule update --init --depth 50
if [[ ! -f "build/meson64/build.ninja" ]]; then
meson build/meson64 --libdir lib/mangohud/lib --prefix /usr -Dappend_libdir_mangohud=false -Dld_libdir_prefix=true $@ ${CONFIGURE_OPTS}
meson build/meson64 --libdir lib/mangohud/lib --prefix /usr -Dappend_libdir_mangohud=false -Dld_libdir_prefix=true -Dld_libdir_abs=true $@ ${CONFIGURE_OPTS}
fi
if [[ ! -f "build/meson32/build.ninja" ]]; then
export CC="gcc -m32"
export CXX="g++ -m32"
export PKG_CONFIG_PATH="/usr/lib32/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig:${PKG_CONFIG_PATH_32}"
export LLVM_CONFIG="/usr/bin/llvm-config32"
meson build/meson32 --libdir lib/mangohud/lib32 --prefix /usr -Dappend_libdir_mangohud=false -Dld_libdir_prefix=true $@ ${CONFIGURE_OPTS}
meson build/meson32 --libdir lib/mangohud/lib32 --prefix /usr -Dappend_libdir_mangohud=false -Dld_libdir_prefix=true -Dld_libdir_abs=true $@ ${CONFIGURE_OPTS}
fi
}

@ -2,6 +2,7 @@ option('glibcxx_asserts', type : 'boolean', value : false)
option('use_system_vulkan', type : 'feature', value : 'disabled', description: 'Use system vulkan headers instead of the provided ones')
option('append_libdir_mangohud', type : 'boolean', value : true, description: 'Append "mangohud" to libdir path or not.')
option('ld_libdir_prefix', type : 'boolean', value : false, description: 'Set ld libdir to "$prefix/lib/mangohud/\$LIB"')
option('ld_libdir_abs', type : 'boolean', value : false, description: 'Use absolute path in LD_PRELOAD')
option('include_doc', type : 'boolean', value : true, description: 'Include the example config')
option('with_nvml', type : 'combo', value : 'enabled', choices: ['enabled', 'system', 'disabled'], description: 'Enable NVML support')
option('with_xnvctrl', type : 'feature', value : 'enabled', description: 'Enable XNVCtrl support')

@ -1,5 +1,6 @@
glslang = find_program('glslangValidator')
ld_libdir_mangohud_abs = ''
# Needs prefix for configure_file()
if get_option('append_libdir_mangohud')
libdir_mangohud = join_paths(get_option('libdir'), 'mangohud')
@ -15,6 +16,10 @@ if get_option('ld_libdir_prefix')
ld_libdir_mangohud = get_option('prefix') + '/lib/mangohud/\$LIB/'
endif
if get_option('ld_libdir_abs')
ld_libdir_mangohud_abs = ld_libdir_mangohud
endif
overlay_shaders = [
'overlay.frag',
'overlay.vert',
@ -205,7 +210,8 @@ configure_file(input : 'mangohud.json.in',
configure_file(input : '../bin/mangohud.in',
output : 'mangohud',
configuration : {'ld_libdir_mangohud' : ld_libdir_mangohud},
configuration : {'ld_libdir_mangohud' : ld_libdir_mangohud,
'ld_libdir_mangohud_abs': ld_libdir_mangohud_abs},
install_dir : get_option('bindir'),
)

Loading…
Cancel
Save