summary refs log tree commit diff
path: root/pkgs/tools/graphics/mangohud/hardcode-dependencies.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/tools/graphics/mangohud/hardcode-dependencies.patch')
-rw-r--r--pkgs/tools/graphics/mangohud/hardcode-dependencies.patch74
1 files changed, 46 insertions, 28 deletions
diff --git a/pkgs/tools/graphics/mangohud/hardcode-dependencies.patch b/pkgs/tools/graphics/mangohud/hardcode-dependencies.patch
index 2ee5e2dd547..379e1dd7ba2 100644
--- a/pkgs/tools/graphics/mangohud/hardcode-dependencies.patch
+++ b/pkgs/tools/graphics/mangohud/hardcode-dependencies.patch
@@ -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
+