MangoHud: update to 0.8.0.

This commit is contained in:
John 2025-02-18 23:14:10 +01:00 committed by John Zimmermann
parent 1ea20f6d8e
commit 526ddf652a
4 changed files with 120 additions and 16 deletions

View File

@ -1,12 +0,0 @@
diff --git a/meson.build b/meson.build
index 76a0340..c624622 100644
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('MangoHud',
['c', 'cpp'],
- version : 'v0.7.1',
+ version : 'v0.7.2',
license : 'MIT',
meson_version: '>=0.60.0',
default_options : ['buildtype=release', 'c_std=c99', 'cpp_std=c++14', 'warning_level=2']

View File

@ -0,0 +1,90 @@
From 4cf755ad73587fba904debe918ef281491cdd919 Mon Sep 17 00:00:00 2001
From: John Zimmermann <me@johnnynator.dev>
Date: Tue, 18 Feb 2025 23:57:44 +0100
Subject: [PATCH] musl fix
---
src/gl/shim.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 53 insertions(+), 2 deletions(-)
diff --git a/src/gl/shim.c b/src/gl/shim.c
index 98b61e9..322af56 100644
--- a/src/gl/shim.c
+++ b/src/gl/shim.c
@@ -77,6 +77,59 @@ static bool load_adjacent_opengl_lib(void)
return true;
}
+#else
+static inline void
+free_indirect(char **p)
+{
+ free(*p);
+}
+static bool load_adjacent_opengl_lib(void)
+{
+ __attribute__((cleanup(free_indirect))) char *location = NULL;
+ __attribute__((cleanup(free_indirect))) char *lib = NULL;
+ Dl_info info = {};
+
+ // The first argument can be any symbol in this shared library,
+ // mangoHudLoaded is a convenient one
+ if (!dladdr(&mangoHudLoaded, &info))
+ {
+ fprintf(stderr, "shim: Unable to find my own location: %s\n", dlerror());
+ return false;
+ }
+
+ if (info.dli_fname == NULL)
+ {
+ fprintf(stderr, "shim: Unable to find my own location: NULL dli_fname\n");
+ return false;
+ }
+
+ location = realpath(info.dli_fname, NULL);
+ char *slash = strrchr(location, '/');
+
+ if (slash == NULL)
+ {
+ fprintf(stderr, "shim: Unable to find my own location: no directory separator\n");
+ return false;
+ }
+
+ *slash = '\0';
+
+ if (asprintf(&lib, "%s/libMangoHud_opengl.so", location) < 0)
+ {
+ fprintf(stderr, "shim: asprintf: %s\n", strerror(errno));
+ return false;
+ }
+
+ handle = dlopen(lib, RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND);
+
+ if (handle == NULL)
+ {
+ fprintf(stderr, "shim: Failed to load from \"%s\": %s\n", lib, dlerror());
+ return false;
+ }
+
+ return true;
+}
#endif
// Load MangoHud after EGL/GLX functions have been intercepted
@@ -110,13 +163,11 @@ static void loadMangoHud() {
}
}
-#ifdef __GLIBC__
if (load_adjacent_opengl_lib())
{
mangoHudLoaded = true;
return;
}
-#endif
if (!mangoHudLoaded)
{
--
2.48.1

View File

@ -0,0 +1,26 @@
From dea0b9c8e8767d49af81eb975c818bcf9d2e674a Mon Sep 17 00:00:00 2001
From: fossdd <fossdd@pwned.life>
Date: Wed, 12 Feb 2025 09:03:42 +0100
Subject: [PATCH] shim: Define RTLD_DEEPBIND if not already
RTLD_DEEPBIND is a glibc quirc and is not defined on other libc like
musl libc
---
src/gl/shim.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/gl/shim.c b/src/gl/shim.c
index 5ac335ed4d..98b61e9d56 100644
--- a/src/gl/shim.c
+++ b/src/gl/shim.c
@@ -9,6 +9,10 @@
#include <stdbool.h>
#include <stdlib.h>
+#ifndef RTLD_DEEPBIND
+#define RTLD_DEEPBIND 0
+#endif
+
static void* handle = NULL;
static bool mangoHudLoaded = false;

View File

@ -1,7 +1,7 @@
# Template file for 'MangoHud'
pkgname=MangoHud
version=0.7.2
revision=2
version=0.8.0
revision=1
build_style=meson
configure_args="-Dwith_xnvctrl=disabled
-Dwith_nvml=disabled -Duse_system_spdlog=enabled"
@ -9,11 +9,11 @@ hostmakedepends="Vulkan-Headers python3-Mako glslang pkg-config"
makedepends="libglvnd-devel dbus-devel vulkan-loader spdlog json-c++
wayland-devel libxkbcommon-devel"
short_desc="Vulkan and OpenGL overlay for monitoring FPS, temperatures and more"
maintainer="John <me@johnnynator.dev>"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://github.com/flightlessmango/MangoHud"
distfiles="https://github.com/flightlessmango/MangoHud/releases/download/v${version}/MangoHud-v${version}-Source-DFSG.tar.xz"
checksum=39d41ff564cd46b99a8514d35ff0cc1cd4ec5ab093347ca552bd7f7572a4064f
checksum=9627587e05e0a570935d2177bd5f704ef6b72d66f7f773a48d8d86ec0e8aa673
python_version=3
lib32files="/usr/share/vulkan/implicit_layer.d/MangoHud.x86.json"