mangohud: 0.7.0 -> 0.7.1

https://github.com/flightlessmango/MangoHud/releases/tag/v0.7.1
This commit is contained in:
Kira Bruneau 2024-02-14 20:41:01 -05:00
parent 89653a03e0
commit bab16f2259
3 changed files with 83 additions and 43 deletions

View File

@ -4,6 +4,7 @@
, fetchFromGitHub
, fetchurl
, substituteAll
, fetchpatch
, coreutils
, curl
, glxinfo
@ -38,7 +39,6 @@
let
# Derived from subprojects/cmocka.wrap
cmocka = {
version = "1.81";
src = fetchFromGitLab {
owner = "cmocka";
repo = "cmocka";
@ -47,18 +47,33 @@ let
};
};
# Derived from subprojects/implot.wrap
implot = rec {
version = "0.16";
src = fetchFromGitHub {
owner = "epezent";
repo = "implot";
rev = "refs/tags/v${version}";
hash = "sha256-/wkVsgz3wiUVZBCgRl2iDD6GWb+AoHN+u0aeqHHgem0=";
};
patch = fetchurl {
url = "https://wrapdb.mesonbuild.com/v2/implot_${version}-1/get_patch";
hash = "sha256-HGsUYgZqVFL6UMHaHdR/7YQfKCMpcsgtd48pYpNlaMc=";
};
};
# Derived from subprojects/imgui.wrap
imgui = rec {
version = "1.81";
version = "1.89.9";
src = fetchFromGitHub {
owner = "ocornut";
repo = "imgui";
rev = "refs/tags/v${version}";
hash = "sha256-rRkayXk3xz758v6vlMSaUu5fui6NR8Md3njhDB0gJ18=";
hash = "sha256-0k9jKrJUrG9piHNFQaBBY3zgNIKM23ZA879NY+MNYTU=";
};
patch = fetchurl {
url = "https://wrapdb.mesonbuild.com/v2/imgui_${version}-1/get_patch";
hash = "sha256-bQC0QmkLalxdj4mDEdqvvOFtNwz2T1MpTDuMXGYeQ18=";
hash = "sha256-myEpDFl9dr+NTus/n/oCSxHZ6mxh6R1kjMyQtChD1YQ=";
};
};
@ -68,7 +83,7 @@ let
src = fetchFromGitHub {
owner = "KhronosGroup";
repo = "Vulkan-Headers";
rev = "v${version}";
rev = "refs/tags/v${version}";
hash = "sha256-5uyk2nMwV1MjXoa3hK/WUeGLwpINJJEvY16kc5DEaks=";
};
patch = fetchurl {
@ -79,14 +94,14 @@ let
in
stdenv.mkDerivation (finalAttrs: {
pname = "mangohud";
version = "0.7.0";
version = "0.7.1";
src = fetchFromGitHub {
owner = "flightlessmango";
repo = "MangoHud";
rev = "refs/tags/v${finalAttrs.version}";
fetchSubmodules = true;
hash = "sha256-KkMN7A3AcS/v+b9GCs0pI6MBBk3WwOMciaoiBzL5xOQ=";
hash = "sha256-Gnq+1j+PFbeipAfXGnTq7wZdVQeG9R9vLAKZnZj7Bvs=";
};
outputs = [ "out" "doc" "man" ];
@ -97,6 +112,7 @@ stdenv.mkDerivation (finalAttrs: {
${lib.optionalString finalAttrs.finalPackage.doCheck ''
cp -R --no-preserve=mode,ownership ${cmocka.src} cmocka
''}
cp -R --no-preserve=mode,ownership ${implot.src} implot-${implot.version}
cp -R --no-preserve=mode,ownership ${imgui.src} imgui-${imgui.version}
cp -R --no-preserve=mode,ownership ${vulkan-headers.src} Vulkan-Headers-${vulkan-headers.version}
)'';
@ -124,6 +140,13 @@ stdenv.mkDerivation (finalAttrs: {
libdbus = dbus.lib;
inherit hwdata;
})
# Add dep_vulkan to mangoapp and test_amdgpu to fix build failure
# TODO: Remove in next release
(fetchpatch {
url = "https://github.com/flightlessmango/MangoHud/commit/cba217ffaf93aea6acb4e59e3e46bf912f740ccf.patch";
hash = "sha256-1My4/EuSMpe3AFhhFOJr8rz/wnywp+BW+F4dSgxToe0=";
})
];
postPatch = ''
@ -138,6 +161,7 @@ stdenv.mkDerivation (finalAttrs: {
(
cd subprojects
unzip ${implot.patch}
unzip ${imgui.patch}
unzip ${vulkan-headers.patch}
)
@ -198,33 +222,36 @@ stdenv.mkDerivation (finalAttrs: {
''}
'';
postFixup = let
archMap = {
"x86_64-linux" = "x86_64";
"i686-linux" = "x86";
};
layerPlatform = archMap."${stdenv.hostPlatform.system}" or null;
# We need to give the different layers separate names or else the loader
# might try the 32-bit one first, fail and not attempt to load the 64-bit
# layer under the same name.
in lib.optionalString (layerPlatform != null) ''
substituteInPlace $out/share/vulkan/implicit_layer.d/MangoHud.${layerPlatform}.json \
--replace "VK_LAYER_MANGOHUD_overlay" "VK_LAYER_MANGOHUD_overlay_${toString stdenv.hostPlatform.parsed.cpu.bits}"
'' + ''
# Add OpenGL driver path to RUNPATH to support NVIDIA cards
addOpenGLRunpath "$out/lib/mangohud/libMangoHud.so"
'' + lib.optionalString gamescopeSupport ''
addOpenGLRunpath "$out/bin/mangoapp"
'' + lib.optionalString finalAttrs.finalPackage.doCheck ''
# libcmocka.so is only used for tests
rm "$out/lib/libcmocka.so"
'';
postFixup =
let
archMap = {
"x86_64-linux" = "x86_64";
"i686-linux" = "x86";
};
layerPlatform = archMap."${stdenv.hostPlatform.system}" or null;
# We need to give the different layers separate names or else the loader
# might try the 32-bit one first, fail and not attempt to load the 64-bit
# layer under the same name.
in
lib.optionalString (layerPlatform != null) ''
substituteInPlace $out/share/vulkan/implicit_layer.d/MangoHud.${layerPlatform}.json \
--replace "VK_LAYER_MANGOHUD_overlay" "VK_LAYER_MANGOHUD_overlay_${toString stdenv.hostPlatform.parsed.cpu.bits}"
'' + ''
# Add OpenGL driver path to RUNPATH to support NVIDIA cards
addOpenGLRunpath "$out/lib/mangohud/libMangoHud.so"
'' + lib.optionalString gamescopeSupport ''
addOpenGLRunpath "$out/bin/mangoapp"
'' + lib.optionalString finalAttrs.finalPackage.doCheck ''
# libcmocka.so is only used for tests
rm "$out/lib/libcmocka.so"
'';
passthru.updateScript = nix-update-script { };
meta = with lib; {
description = "A Vulkan and OpenGL overlay for monitoring FPS, temperatures, CPU/GPU load and more";
homepage = "https://github.com/flightlessmango/MangoHud";
changelog = "https://github.com/flightlessmango/MangoHud/releases/tag/v${finalAttrs.version}";
platforms = platforms.linux;
license = licenses.mit;
maintainers = with maintainers; [ kira-bruneau zeratax ];

View File

@ -12,7 +12,7 @@ index 7379af1..4eef3fe 100644
return false;
}
diff --git a/src/logging.cpp b/src/logging.cpp
index 046c847..42782be 100644
index ca33ee3..90d3638 100644
--- a/src/logging.cpp
+++ b/src/logging.cpp
@@ -26,7 +26,11 @@ string exec(string command) {

View File

@ -1,26 +1,39 @@
diff --git a/bin/mangohud.in b/bin/mangohud.in
index 6c3c6e8..8847cdc 100755
index 53c72ef..18240ea 100755
--- a/bin/mangohud.in
+++ b/bin/mangohud.in
@@ -8,10 +8,10 @@ if [ "$#" -eq 0 ]; then
exit 1
fi
@@ -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
- 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
@@ -31,5 +31,7 @@ case ":${LD_PRELOAD-}:" in
LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}${MANGOHUD_LIB_NAME}"
esac
if [ "$1" = "--version" ]; then
@@ -41,7 +43,7 @@ for exe in $DISABLE_LD_PRELOAD; do
done
+LD_LIBRARY_PATH="@libraryPath@${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
+XDG_DATA_DIRS="@dataDir@${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"
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}" "$@"
- 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