depot/third_party/nixpkgs/pkgs/tools/graphics/mangohud/preload-nix-workaround.patch

40 lines
1.5 KiB
Diff
Raw Normal View History

diff --git a/bin/mangohud.in b/bin/mangohud.in
index 53c72ef..18240ea 100755
--- a/bin/mangohud.in
+++ b/bin/mangohud.in
@@ -13,13 +13,15 @@ fi
DISABLE_LD_PRELOAD="cs2.sh
some_other_exe"
-MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_opengl.so"
+LD_LIBRARY_PATH="@libraryPath@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
+XDG_DATA_DIRS="@dataDir@${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
+MANGOHUD_LIB_NAME="libMangoHud_opengl.so"
if [ "$1" = "--dlsym" ]; then
- MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
+ MANGOHUD_LIB_NAME="libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
shift # shift will only be executed if $1 is "--dlsym"
elif [ "$MANGOHUD_DLSYM" = "1" ]; then
- MANGOHUD_LIB_NAME="@ld_libdir_mangohud@libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
+ MANGOHUD_LIB_NAME="libMangoHud_dlsym.so:${MANGOHUD_LIB_NAME}"
fi
if [ "$1" = "--version" ]; then
@@ -41,7 +43,7 @@ for exe in $DISABLE_LD_PRELOAD; do
done
if [ "$disable_preload" = true ]; then
- exec env MANGOHUD=1 "$@"
+ exec env MANGOHUD=1 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" XDG_DATA_DIRS="${XDG_DATA_DIRS}" "$@"
else
# Make sure we don't append mangohud lib multiple times
# otherwise, this could cause issues with the steam runtime
@@ -54,5 +56,5 @@ else
LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}${MANGOHUD_LIB_NAME}"
esac
- exec env MANGOHUD=1 LD_PRELOAD="${LD_PRELOAD}" "$@"
+ exec env MANGOHUD=1 LD_PRELOAD="${LD_PRELOAD}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" XDG_DATA_DIRS="${XDG_DATA_DIRS}" "$@"
fi