2020-08-24 14:48:27 +00:00
|
|
|
#!/bin/sh
|
2020-03-11 16:04:10 +00:00
|
|
|
|
|
|
|
if [ "$#" -eq 0 ]; then
|
|
|
|
programname=`basename "$0"`
|
|
|
|
echo "ERROR: No program supplied"
|
|
|
|
echo
|
|
|
|
echo "Usage: $programname <program>"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-08-04 17:50:38 +00:00
|
|
|
if [ "$1" = "--dlsym" ]; then
|
|
|
|
MANGOHUD_DLSYM=1
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
2020-11-27 15:43:44 +00:00
|
|
|
MANGOHUD_LIB_NAME="@ld_libdir_mangohud_abs@libMangoHud.so"
|
2020-03-11 16:04:10 +00:00
|
|
|
|
2020-07-06 16:59:17 +00:00
|
|
|
if [ "$MANGOHUD_DLSYM" = "1" ]; then
|
2020-11-27 15:43:44 +00:00
|
|
|
MANGOHUD_LIB_NAME="@ld_libdir_mangohud_abs@libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
|
2020-06-03 20:00:48 +00:00
|
|
|
fi
|
2020-07-06 16:59:17 +00:00
|
|
|
|
2021-02-03 01:33:03 +00:00
|
|
|
# Preload using the plain filenames of the libs, the dynamic linker will
|
2020-07-06 16:59:17 +00:00
|
|
|
# figure out whether the 32 or 64 bit version should be used, and will search
|
|
|
|
# for it in the correct directory
|
|
|
|
LD_PRELOAD="${LD_PRELOAD}:${MANGOHUD_LIB_NAME}"
|
|
|
|
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:@ld_libdir_mangohud@"
|
|
|
|
|
2021-06-08 16:28:54 +00:00
|
|
|
exec env MANGOHUD=1 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" LD_PRELOAD="${LD_PRELOAD}" "$@"
|