MangoHud: update to 0.8.1.

This commit is contained in:
Romain Lanz 2025-06-16 19:53:21 +02:00 committed by Duncan Overbruck
parent 9b5274553e
commit cc761671b9
3 changed files with 2 additions and 118 deletions

View file

@ -1,90 +0,0 @@
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

@ -1,26 +0,0 @@
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,6 +1,6 @@
# Template file for 'MangoHud' # Template file for 'MangoHud'
pkgname=MangoHud pkgname=MangoHud
version=0.8.0 version=0.8.1
revision=1 revision=1
build_style=meson build_style=meson
configure_args="-Dwith_xnvctrl=disabled configure_args="-Dwith_xnvctrl=disabled
@ -13,7 +13,7 @@ maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT" license="MIT"
homepage="https://github.com/flightlessmango/MangoHud" homepage="https://github.com/flightlessmango/MangoHud"
distfiles="https://github.com/flightlessmango/MangoHud/releases/download/v${version}/MangoHud-v${version}-Source-DFSG.tar.xz" distfiles="https://github.com/flightlessmango/MangoHud/releases/download/v${version}/MangoHud-v${version}-Source-DFSG.tar.xz"
checksum=9627587e05e0a570935d2177bd5f704ef6b72d66f7f773a48d8d86ec0e8aa673 checksum=40c024170eb57e55f7c602521f1fb385a44238ff87294de063dad3c36e6daa55
python_version=3 python_version=3
lib32files="/usr/share/vulkan/implicit_layer.d/MangoHud.x86.json" lib32files="/usr/share/vulkan/implicit_layer.d/MangoHud.x86.json"