mangohud: 0.6.5 -> 0.6.7-1

Updated patches and added new dependency on spdlog
This commit is contained in:
Atemu 2022-05-17 17:11:09 +02:00
parent 43ff6cb1c0
commit ad241745c3
3 changed files with 63 additions and 30 deletions

View File

@ -26,6 +26,7 @@
, vulkan-loader
, libXNVCtrl
, wayland
, spdlog
, addOpenGLRunpath
}:
@ -46,14 +47,14 @@ let
};
in stdenv.mkDerivation rec {
pname = "mangohud";
version = "0.6.5";
version = "0.6.7-1";
src = fetchFromGitHub {
owner = "flightlessmango";
repo = "MangoHud";
rev = "v${version}";
fetchSubmodules = true;
sha256 = "sha256-RRtti0VnB6SXrpFYaEqANvpgvP/Dkvc+x/I40AXaspU=";
sha256 = "sha256-60cZYo+d679KRggLBGbpLYM5Iu1XySEEGp+MxZs6wF0=";
};
outputs = [ "out" "doc" "man" ];
@ -103,6 +104,7 @@ in stdenv.mkDerivation rec {
"-Duse_system_vulkan=enabled"
"-Dvulkan_datadir=${vulkan-headers}/share"
"-Dwith_wayland=enabled"
"-Duse_system_spdlog=enabled"
];
nativeBuildInputs = [
@ -122,6 +124,7 @@ in stdenv.mkDerivation rec {
libX11
libXNVCtrl
wayland
spdlog
];
# Support 32bit Vulkan applications by linking in 32bit Vulkan layer

View File

@ -1,57 +1,75 @@
From 56a191f6db6d530c2bc89d9d3395b4c9768d108f Mon Sep 17 00:00:00 2001
From: Atemu <atemu.main@gmail.com>
Date: Tue, 17 May 2022 16:58:08 +0200
Subject: [PATCH 1/2] hardcode dependencies
---
src/dbus.cpp | 2 +-
src/loaders/loader_x11.cpp | 2 +-
src/logging.cpp | 7 +++++++
src/pci_ids.cpp | 6 ++----
4 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/dbus.cpp b/src/dbus.cpp
index 44ffafc..9baf57b 100644
index 3b3cccb..1405725 100644
--- a/src/dbus.cpp
+++ b/src/dbus.cpp
@@ -162,7 +162,7 @@ bool dbus_manager::init(const std::string& requested_player) {
return true;
}
@@ -152,7 +152,7 @@ bool dbus_manager::get_media_player_metadata(metadata& meta, std::string name) {
}
bool dbus_manager::init_internal() {
- if (!m_dbus_ldr.IsLoaded() && !m_dbus_ldr.Load("libdbus-1.so.3")) {
+ if (!m_dbus_ldr.IsLoaded() && !m_dbus_ldr.Load("@libdbus@/lib/libdbus-1.so.3")) {
std::cerr << "MANGOHUD: Could not load libdbus-1.so.3\n";
SPDLOG_ERROR("Could not load libdbus-1.so.3");
return false;
}
diff --git a/src/loaders/loader_x11.cpp b/src/loaders/loader_x11.cpp
index 25c65bf..87488d5 100644
index 4db6f78..c60d08c 100644
--- a/src/loaders/loader_x11.cpp
+++ b/src/loaders/loader_x11.cpp
@@ -88,4 +88,4 @@ void libx11_loader::CleanUp(bool unload) {
@@ -89,4 +89,4 @@ void libx11_loader::CleanUp(bool unload) {
}
-std::shared_ptr<libx11_loader> g_x11(new libx11_loader("libX11.so.6"));
+std::shared_ptr<libx11_loader> g_x11(new libx11_loader("@libX11@/lib/libX11.so.6"));
diff --git a/src/logging.cpp b/src/logging.cpp
index ee8600b..c7c91a0 100644
index b27f21e..48f5e03 100644
--- a/src/logging.cpp
+++ b/src/logging.cpp
@@ -19,7 +19,10 @@ string exec(string command) {
#ifdef __gnu_linux__
// Open pipe to file
+ char* originalPath = getenv("PATH");
+ setenv("PATH", "@path@", 1);
FILE* pipe = popen(command.c_str(), "r");
+ setenv("PATH", originalPath, 1);
if (!pipe) {
@@ -22,7 +22,14 @@ string exec(string command) {
#endif
std::array<char, 128> buffer;
std::string result;
+
+ char* originalPath = getenv("PATH");
+ setenv("PATH", "@path@", 1);
+
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(command.c_str(), "r"), pclose);
+
+ setenv("PATH", originalPath, 1);
+
if (!pipe) {
return "popen failed!";
}
}
diff --git a/src/pci_ids.cpp b/src/pci_ids.cpp
index 4e2a6d2..9490869 100644
index feec222..6baa707 100644
--- a/src/pci_ids.cpp
+++ b/src/pci_ids.cpp
@@ -22,12 +22,9 @@ std::istream& get_uncommented_line(std::istream& is, std::string &line)
@@ -24,11 +24,9 @@ std::istream& get_uncommented_line(std::istream& is, std::string &line)
void parse_pciids()
{
- std::ifstream file("/usr/share/hwdata/pci.ids");
+ std::ifstream file("@hwdata@/share/hwdata/pci.ids");
if(file.fail()){
- std::ifstream file("/usr/share/misc/pci.ids");
std::ifstream file;
- file.open("/usr/share/hwdata/pci.ids");
+ file.open("@hwdata@/share/hwdata/pci.ids");
if (file.fail()){
- file.open("/usr/share/misc/pci.ids");
- if (file.fail())
- printf("MANGOHUD: can't find file pci.ids\n");
-
+ printf("MANGOHUD: can't find file pci.ids\n");
- SPDLOG_ERROR("can't find file pci.ids");
+ SPDLOG_ERROR("can't find file pci.ids");
}
std::string line;
--
2.36.0

View File

@ -1,3 +1,12 @@
From 1ac93cbf0eed951af6967a81f731a0f418ea0b3d Mon Sep 17 00:00:00 2001
From: Atemu <atemu.main@gmail.com>
Date: Tue, 17 May 2022 16:58:45 +0200
Subject: [PATCH 2/2] opengl32 nix workaround
---
bin/mangohud.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/bin/mangohud.in b/bin/mangohud.in
index 8ec21de..f65304a 100755
--- a/bin/mangohud.in
@ -10,3 +19,6 @@ index 8ec21de..f65304a 100755
+LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:@ld_libdir_mangohud@:@mangohud32@/lib/mangohud"
exec env MANGOHUD=1 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" LD_PRELOAD="${LD_PRELOAD}" "$@"
--
2.36.0