From 526ddf652a2225508d6f7639e578e392db7b94a0 Mon Sep 17 00:00:00 2001 From: John Date: Tue, 18 Feb 2025 23:14:10 +0100 Subject: [PATCH] MangoHud: update to 0.8.0. --- ...001-mangohud-fix-version-meson-build.patch | 12 --- srcpkgs/MangoHud/patches/0001-musl-fix.patch | 90 +++++++++++++++++++ ...b9c8e8767d49af81eb975c818bcf9d2e674a.patch | 26 ++++++ srcpkgs/MangoHud/template | 8 +- 4 files changed, 120 insertions(+), 16 deletions(-) delete mode 100644 srcpkgs/MangoHud/patches/0001-mangohud-fix-version-meson-build.patch create mode 100644 srcpkgs/MangoHud/patches/0001-musl-fix.patch create mode 100644 srcpkgs/MangoHud/patches/dea0b9c8e8767d49af81eb975c818bcf9d2e674a.patch diff --git a/srcpkgs/MangoHud/patches/0001-mangohud-fix-version-meson-build.patch b/srcpkgs/MangoHud/patches/0001-mangohud-fix-version-meson-build.patch deleted file mode 100644 index 666365ea099..00000000000 --- a/srcpkgs/MangoHud/patches/0001-mangohud-fix-version-meson-build.patch +++ /dev/null @@ -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'] diff --git a/srcpkgs/MangoHud/patches/0001-musl-fix.patch b/srcpkgs/MangoHud/patches/0001-musl-fix.patch new file mode 100644 index 00000000000..ac50f6c8cb8 --- /dev/null +++ b/srcpkgs/MangoHud/patches/0001-musl-fix.patch @@ -0,0 +1,90 @@ +From 4cf755ad73587fba904debe918ef281491cdd919 Mon Sep 17 00:00:00 2001 +From: John Zimmermann +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 + diff --git a/srcpkgs/MangoHud/patches/dea0b9c8e8767d49af81eb975c818bcf9d2e674a.patch b/srcpkgs/MangoHud/patches/dea0b9c8e8767d49af81eb975c818bcf9d2e674a.patch new file mode 100644 index 00000000000..693c12c5a7b --- /dev/null +++ b/srcpkgs/MangoHud/patches/dea0b9c8e8767d49af81eb975c818bcf9d2e674a.patch @@ -0,0 +1,26 @@ +From dea0b9c8e8767d49af81eb975c818bcf9d2e674a Mon Sep 17 00:00:00 2001 +From: fossdd +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 + #include + ++#ifndef RTLD_DEEPBIND ++#define RTLD_DEEPBIND 0 ++#endif ++ + static void* handle = NULL; + static bool mangoHudLoaded = false; + diff --git a/srcpkgs/MangoHud/template b/srcpkgs/MangoHud/template index ad1334062d2..4ecb46ed26e 100644 --- a/srcpkgs/MangoHud/template +++ b/srcpkgs/MangoHud/template @@ -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 " +maintainer="Orphaned " 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"