[PATCH 0/4] Add mangohud (update dear-imgui)

DoneSubmitted by John Kehayias.
Details
3 participants
  • John Kehayias
  • Brendan Tildesley
  • Maxim Cournoyer
Owner
unassigned
Severity
normal
J
J
John Kehayias wrote on 4 Jan 23:20 +0100
(name . Guix-patches)(address . guix-patches@gnu.org)
Q7tnT9BK6ONvH70UZEXzlqJR968TW3cdJCw99_OCDwa0EHxp7k0YTRLa0XHOHsCsR6bMjuJdzqWOfuuilwIRolVj5mNo148mDaUwJtZ1hE8=@protonmail.com
Hi Guix,

Here is a short series of patches to add mangohud (a cool Vulkan/OpenGL overlay for things like framerate and hardware display in games). There were a few steps involved that required some tweaks to other packages. Here is the breakdown, corresponding to the forthcoming patches:

1. pciutils-no-zlib: A new hidden package to provide uncompressed hardware info (pci.ids). Mangohud and at least one other package I have read this file directly, which is typically uncompressed, i.e. on Arch. We could later change it in pciutils or have both uncompressed and compressed, or a separate package just for the hardware info. Since this would be a bigger change, I opted for a simple hidden package of the full pciutils (I think programs will need the rest of the package anyway).

2. spdlog: Build with '-fpic'. Since this is compiled as a static library, and upstream implies this is more typical, compile it in a way to be useful to shared libraries as well (needed for mangohud). I checked a random package that uses spdlog and it built fine at least.

3. dear-imgui: Update to 1.81. This not the latest, but most recent of the Debian makefiles we use. The only dependent is Ogre (very out of date) which just uses the source, but needs 1.79. I made the previous one a hidden package and updated Ogre to use that. There were enough build changes that I didn't think an inherit would be very clean. Also added in the static library output (preferred by mangohud). New is many inputs for the backends (optional).

4. mangohud: The new addition. Unbundled libraries to use guix's spdlog, dear-imgui, fixed hardcoded paths. Tested that it builds and works. The only guix lint complaint was about the dear-imgui static input name not matching (also needed dear-imgui for the headers and pkgconfig file).

Okay, that's it! A few changes but I think these are not invasive and were the cleanest on my end to use.

Thanks!
John
J
J
John Kehayias wrote on 4 Jan 23:23 +0100
[PATCH 1/4] gnu: Add pciutils-no-zlib.
(name . 53015@debbugs.gnu.org)(address . 53015@debbugs.gnu.org)
5P1tW8O5FTcp3WD4j3xIl-XLhBKkPhcqkNzoSzxFaihpC7qgFsz5y6o9KTXZaMz0dsMPT65dYa8FWU7CUAOXUE_iysyNYtfqzxHjVzGWsT0=@protonmail.com
Empty Message
From 0e8b852e0ff58a34141d804747b13b55088993b4 Mon Sep 17 00:00:00 2001
From: John Kehayias <john.kehayias@protonmail.com>
Date: Tue, 4 Jan 2022 16:40:14 -0500
Subject: [PATCH 1/4] gnu: Add pciutils-no-zlib.

* gnu/packages/pciutils.scm (pciutils-no-zlib): New variable. A hidden package
to provide pciutils with uncompressed pci.ids.
---
gnu/packages/pciutils.scm | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)

Toggle diff (38 lines)
diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
index 47275a8ff0..a8c46528d0 100644
--- a/gnu/packages/pciutils.scm
+++ b/gnu/packages/pciutils.scm
@@ -4,6 +4,7 @@
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -129,3 +130,23 @@ (define-public pciutils
 of operating systems.  This includes the @command{lspci} and @command{setpci}
 commands.")
     (license license:gpl2+)))
+
+;; This is a version of pciutils without zlib, so that the hardware pci.ids is
+;; uncompressed.  This is useful for packages that try to read pci.ids
+;; directly.  Alternatively, the uncompressed file could also be present in
+;; pciutils or the direct source of pci.ids could be made available
+;; separately, see: https://pci-ids.ucw.cz/
+(define-public pciutils-no-zlib
+  (hidden-package
+   (package
+     (inherit pciutils)
+     (arguments
+      (substitute-keyword-arguments (package-arguments pciutils)
+        ((#:phases phases)
+         `(modify-phases ,phases
+            (add-after 'configure 'disable-zlib
+              ;; remove zlib from Makefile to have uncompressed pci.ids
+              (lambda* (#:key outputs #:allow-other-keys)
+                (substitute* "Makefile"
+                  (("^ZLIB := .*$")
+                   "ZLIB := no\n")))))))))))
-- 
2.34.0
J
J
John Kehayias wrote on 4 Jan 23:24 +0100
[PATCH 2/4] gnu: spdlog: Build with '-fpic'.
(name . 53015@debbugs.gnu.org)(address . 53015@debbugs.gnu.org)
WKX-vcLj5jIxkk1xGaGz3gMBXCW-J0fOc9kOgQ0YJiqfOIp2cqFcK7Z70081d9aqNeWbRFvlLUa6mEmc6IAdHKc3ALz9zwONM44Ehu12CKA=@protonmail.com
Empty Message
From 79f30cf17e88ca50fd8444f1ad34ceb795b1d255 Mon Sep 17 00:00:00 2001
From: John Kehayias <john.kehayias@protonmail.com>
Date: Tue, 4 Jan 2022 16:41:48 -0500
Subject: [PATCH 2/4] gnu: spdlog: Build with '-fpic'.

* gnu/packages/logging.scm (spdlog)[arguments]: Add "-DCMAKE_CXX_FLAGS=-fpic"
to #:configure-flags.
---
gnu/packages/logging.scm | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

Toggle diff (27 lines)
diff --git a/gnu/packages/logging.scm b/gnu/packages/logging.scm
index be144e2daa..3c8f67b3ce 100644
--- a/gnu/packages/logging.scm
+++ b/gnu/packages/logging.scm
@@ -8,6 +8,7 @@
 ;;; Copyright © 2019 Meiyo Peng <meiyo@riseup.net>
 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -207,7 +208,11 @@ (define-public spdlog
     ;; (gnu packages benchmark) forms a dependency cycle
     (arguments
      '(#:configure-flags
-       (list "-DSPDLOG_BUILD_BENCH=OFF"
+       ;; Typically this library is meant to be compiled statically, see
+       ;; https://github.com/gabime/spdlog/wiki/How-to-use-spdlog-in-DLLs
+       ;; So build with -fpic to allow linking in shared libraries.
+       (list "-DCMAKE_CXX_FLAGS=-fpic"
+             "-DSPDLOG_BUILD_BENCH=OFF"
              "-DSPDLOG_BUILD_TESTS=ON")))
     (home-page "https://github.com/gabime/spdlog")
     (synopsis "Fast C++ logging library")
-- 
2.34.0
J
J
John Kehayias wrote on 4 Jan 23:25 +0100
[PATCH 3/4] gnu: dear-imgui: Update to 1.81, hide version 1.79.
(name . 53015@debbugs.gnu.org)(address . 53015@debbugs.gnu.org)
SmkWDygJ2Yg5ggG3XNIW4atQSp1z6dxOYweJvhM57fLpj4n5jID08xXP7oin93SCP71A945SL5TMXJKB9KH8MpmxQ_s36WXagSM-_zWce60=@protonmail.com
Empty Message
From d4eeb30544c9681899b12fe27baf2ad5d20a4330 Mon Sep 17 00:00:00 2001
From: John Kehayias <john.kehayias@protonmail.com>
Date: Tue, 4 Jan 2022 16:48:39 -0500
Subject: [PATCH 3/4] gnu: dear-imgui: Update to 1.81, hide version 1.79.

* gnu/packages/graphics.scm: Import (gnu packages game-development).
(dear-imgui): Update to 1.81.
[outputs]: Add static output.
[phases]{unpack-debian-files}: Build the static library, remove references to
non-existent stb library.
{move-static-libraries}: New phase to install static libraries.
[inputs]: Add allegro, freeglut, glew, glfw, mesa, sdl2, and vulkan-headers.
(dear-imgui-1.79): New variable. Hidden package of the previous version of
dear-imgui.
(ogre)[native-inputs]: Use it.
---
gnu/packages/graphics.scm | 122 ++++++++++++++++++++++++++++++++++----
1 file changed, 110 insertions(+), 12 deletions(-)

Toggle diff (189 lines)
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index fe35aaad2d..438a01ba72 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -27,6 +27,7 @@
 ;;; Copyright © 2021 Andy Tai <atai@atai.org>
 ;;; Copyright © 2021 Ekaitz Zarraga <ekaitz@elenq.tech>
 ;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -62,6 +63,7 @@ (define-module (gnu packages graphics)
   #:use-module (gnu packages fonts)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
+  #:use-module (gnu packages game-development)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages gl)
@@ -867,10 +869,81 @@ (define-public pstoedit
 @end itemize")
     (license license:gpl2+)))
 
+(define-public dear-imgui-1.79
+  (hidden-package
+   (package
+     (name "dear-imgui-1.79")
+     (version "1.79")
+     (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+              (url "https://github.com/ocornut/imgui")
+              (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32 "0x26igynxp6rlpp2wfc5dr7x6yh583ajb7p23pgycn9vqikn318q"))))
+     (build-system gnu-build-system)
+     (arguments
+      `(#:make-flags
+        (list (string-append "CC=" ,(cc-for-target))
+              (string-append "PREFIX=" (assoc-ref %outputs "out"))
+              (string-append "VERSION=" ,version))
+        #:tests? #f                      ; no test suite
+        #:phases
+        (modify-phases %standard-phases
+          (add-after 'unpack 'unpack-debian-files
+            (lambda* (#:key inputs #:allow-other-keys)
+              (invoke "tar" "xvf" (assoc-ref inputs "debian-files"))
+              (apply invoke "patch" "-Np1" "-i"
+                     (find-files "debian/patches" "\\.patch$"))
+              (substitute* "Makefile"
+                (("<stb/") "<")          ; Guix doesn't use this subdirectory
+                ;; Don't build or install the static library.
+                (("^all: .*") "all: $(SHLIB) $(PCFILE)"))
+              (substitute* (list "imgui.pc.in"
+                                 "Makefile")
+                ;; Don't link against a non-existent library.
+                (("-lstb") ""))
+              #t))
+          (delete 'configure)            ; no configure script
+          (replace 'install
+            ;; The default ‘install’ target installs the static library.  Don't.
+            (lambda* (#:key make-flags #:allow-other-keys)
+              (apply invoke "make" "install-shared" "install-header"
+                     make-flags))))))
+     (native-inputs
+      `(("debian-files"
+         ;; Upstream doesn't provide a build system.  Use Debian's.
+         ,(origin
+            (method url-fetch)
+            (uri (string-append "mirror://debian/pool/main/i/imgui/imgui_"
+                                version "+ds-1.debian.tar.xz"))
+            (sha256
+             (base32 "1xhk34pzpha6k5l2j150capq66y8czhmsi04ib09wvb34ahqxpby"))))
+        ("pkg-config" ,pkg-config)))
+     (inputs
+      (list freetype stb-rect-pack stb-truetype))
+     (home-page "https://github.com/ocornut/imgui")
+     (synopsis "Immediate-mode C++ GUI library with minimal dependencies")
+     (description
+      "Dear ImGui is a @acronym{GUI, graphical user interface} library for C++.
+It creates optimized vertex buffers that you can render anytime in your
+3D-pipeline-enabled application.  It's portable, renderer-agnostic, and
+self-contained, without external dependencies.
+
+Dear ImGui is aimed at content creation, visualization, and debugging tools as
+opposed to average end-user interfaces.  Hence it favors simplicity and
+productivity but lacks certain features often found in higher-level libraries.
+It is particularly suited to integration in game engine tooling, real-time 3D
+applications, full-screen applications, and embedded platforms without standard
+operating system features.")
+     (license license:expat))))           ; some examples/ use the zlib licence
+
 (define-public dear-imgui
   (package
     (name "dear-imgui")
-    (version "1.79")
+    (version "1.81")
     (source
      (origin
        (method git-fetch)
@@ -879,8 +952,10 @@ (define-public dear-imgui
              (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
-        (base32 "0x26igynxp6rlpp2wfc5dr7x6yh583ajb7p23pgycn9vqikn318q"))))
+        (base32 "0pr740fhrqbqvqfw6iwd5sx5zvjjkb299bzyybwkxirpg74il6dd"))))
     (build-system gnu-build-system)
+    (outputs '("out"
+               "static"))
     (arguments
      `(#:make-flags
        (list (string-append "CC=" ,(cc-for-target))
@@ -896,19 +971,32 @@ (define-public dear-imgui
                     (find-files "debian/patches" "\\.patch$"))
              (substitute* "Makefile"
                (("<stb/") "<")          ; Guix doesn't use this subdirectory
-               ;; Don't build or install the static library.
-               (("^all: .*") "all: $(SHLIB) $(PCFILE)"))
+               ;; Install the static library as well.
+               (("^install: .*") "install: install-shared install-static install-header")
+               ;; Don't build with a non-existent library.
+               (("-DIMGUI") "# -DIMGUI"))
              (substitute* (list "imgui.pc.in"
                                 "Makefile")
                ;; Don't link against a non-existent library.
                (("-lstb") ""))
+             ;; Don't require a non-existent library.
+             (substitute* "imgui.pc.in"
+               (("Requires: stb") ""))
              #t))
          (delete 'configure)            ; no configure script
-         (replace 'install
-           ;; The default ‘install’ target installs the static library.  Don't.
-           (lambda* (#:key make-flags #:allow-other-keys)
-             (apply invoke "make" "install-shared" "install-header"
-                    make-flags))))))
+         (add-after 'install 'move-static-libraries
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; Move static libraries to the "static" output.
+             (let* ((out    (assoc-ref outputs "out"))
+                    (lib    (string-append out "/lib"))
+                    (static (assoc-ref outputs "static"))
+                    (slib   (string-append static "/lib")))
+               (mkdir-p slib)
+               (for-each (lambda (file)
+                           (install-file file slib)
+                           (delete-file file))
+                         (find-files lib "\\.a$"))
+               #t))))))
     (native-inputs
      `(("debian-files"
         ;; Upstream doesn't provide a build system.  Use Debian's.
@@ -917,10 +1005,20 @@ (define-public dear-imgui
            (uri (string-append "mirror://debian/pool/main/i/imgui/imgui_"
                                version "+ds-1.debian.tar.xz"))
            (sha256
-            (base32 "1xhk34pzpha6k5l2j150capq66y8czhmsi04ib09wvb34ahqxpby"))))
+            (base32 "02ld250dlqmz8zwy14hnlr49lizvbigvdva9c2rx4f5ily1dajw4"))))
        ("pkg-config" ,pkg-config)))
     (inputs
-     (list freetype stb-rect-pack stb-truetype))
+     ;; Most of these are optional for the different graphics backends.
+     (list allegro
+           freeglut
+           freetype
+           glew
+           glfw
+           mesa
+           sdl2
+           stb-rect-pack
+           stb-truetype
+           vulkan-headers))
     (home-page "https://github.com/ocornut/imgui")
     (synopsis "Immediate-mode C++ GUI library with minimal dependencies")
     (description
@@ -1006,7 +1104,7 @@ (define-public ogre
                "-DOGRE_INSTALL_SAMPLES_SOURCE=TRUE"))))
     (native-inputs
      `(("boost" ,boost)
-       ("dear-imgui-source" ,(package-source dear-imgui))
+       ("dear-imgui-source" ,(package-source dear-imgui-1.79))
        ("doxygen" ,doxygen)
        ("googletest" ,googletest-1.8)
        ("pkg-config" ,pkg-config)))
-- 
2.34.0
J
J
John Kehayias wrote on 4 Jan 23:34 +0100
[PATCH 4/4] gnu: Add mangohud.
(name . 53015@debbugs.gnu.org)(address . 53015@debbugs.gnu.org)
g3D6Vsvmf0UqGPuWRM5CZLHmYOgQBjfgw2kti9R53v_vrmQ8SlOUsLFY_bFxQYwkbkGm8QRoPXrnfZFTyUrOPrLeXJCjH3acpnB4C_lnMVc=@protonmail.com
Empty Message
From ba253276636a18cb9af0b7982cd7db34942d39e2 Mon Sep 17 00:00:00 2001
From: John Kehayias <john.kehayias@protonmail.com>
Date: Tue, 4 Jan 2022 17:02:31 -0500
Subject: [PATCH 4/4] gnu: Add mangohud.

* gnu/packages/graphics.scm (mangohud): New variable.
* gnu/packages/patches/mangohud-imgui.patch: New file.
* gnu/local.mk (dist_path_DATA): Add it.
---
gnu/local.mk | 1 +
gnu/packages/graphics.scm | 81 +++++++++++++++++++++++
gnu/packages/patches/mangohud-imgui.patch | 50 ++++++++++++++
3 files changed, 132 insertions(+)
create mode 100644 gnu/packages/patches/mangohud-imgui.patch

Toggle diff (180 lines)
diff --git a/gnu/local.mk b/gnu/local.mk
index c8ec622aa1..aab5331bf1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1466,6 +1466,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/mcrypt-CVE-2012-4527.patch			\
   %D%/packages/patches/libmemcached-build-with-gcc7.patch	\
   %D%/packages/patches/libmhash-hmac-fix-uaf.patch		\
+  %D%/packages/patches/mangohud-imgui.patch			\
   %D%/packages/patches/mercurial-hg-extension-path.patch       \
   %D%/packages/patches/mesa-opencl-all-targets.patch		\
   %D%/packages/patches/mesa-skip-tests.patch			\
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 438a01ba72..85211fb25d 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -81,10 +81,12 @@ (define-module (gnu packages graphics)
   #:use-module (gnu packages kde-frameworks)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages logging)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mp3)
   #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages pciutils)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages photo)
@@ -116,6 +118,7 @@ (define-module (gnu packages graphics)
   #:use-module (guix build-system python)
   #:use-module (guix build-system qt)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix hg-download)
   #:use-module ((guix licenses) #:prefix license:)
@@ -1059,6 +1062,84 @@ (define-public alembic
 distills complex, animated scenes into a set of baked geometric results.")
     (license license:bsd-3)))
 
+(define-public mangohud
+  (package
+    (name "mangohud")
+    (version "0.6.6-1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/flightlessmango/MangoHud/")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (patches (search-patches "mangohud-imgui.patch"))
+       (sha256
+        (base32 "0ka004wxkajmvs5vy60r4ckm7f169c61rrd46w6gywkaqf5yp1ab"))))
+    (build-system meson-build-system)
+    (arguments
+     (list
+      #:build-type "release"
+      #:configure-flags
+      #~(list "-Duse_system_vulkan=enabled"
+              "-Duse_system_spdlog=enabled"
+              "-Dwith_xnvctrl=disabled"
+              "-Dappend_libdir_mangohud=false"
+              (string-append "-Dvulkan_datadir="
+                             #$(this-package-input "vulkan-headers")
+                             "/share"))
+      #:phases
+      `(modify-phases %standard-phases
+         (add-after 'unpack 'patch-paths
+           (lambda* (#:key inputs #:allow-other-keys)
+             ;; Don't use $LIB.
+             (substitute* "src/meson.build"
+               (("\\\\\\$LIB")
+                "lib"))
+             ;; Adjust hardcoded paths.
+             (substitute* "src/loaders/loader_libdrm.cpp"
+               (("libdrm.so.2")
+                (search-input-file inputs "/lib/libdrm.so.2"))
+               (("libdrm_amdgpu.so.1")
+                (search-input-file inputs "/lib/libdrm_amdgpu.so.1")))
+             (substitute* "src/overlay.cpp"
+               (("glxinfo")
+                (search-input-file inputs "/bin/glxinfo")))
+             (substitute* "src/loaders/loader_x11.cpp"
+               (("libX11.so.6")
+                (search-input-file inputs "/lib/libX11.so.6")))
+             (substitute* "src/pci_ids.cpp"
+               (("/usr/share/hwdata/pci.ids")
+                (search-input-file inputs "share/hwdata/pci.ids")))
+             (substitute* "src/dbus.cpp"
+               (("libdbus-1.so.3")
+                (search-input-file inputs "lib/libdbus-1.so.3"))))))))
+    (inputs
+     (list dbus
+           dear-imgui
+           `(,dear-imgui "static") ;static imgui preferred
+           glslang
+           libdrm
+           libx11
+           mesa
+           mesa-utils
+           pciutils-no-zlib
+           python-mako
+           spdlog
+           vulkan-loader
+           vulkan-headers))
+    (native-inputs
+     (list pkg-config))
+    (synopsis "Vulkan and OpenGL overlay for monitoring framerate, temperatures and more")
+    (description
+     "MangoHud is a Vulkan and OpenGL overlay for monitoring FPS, temperatures,
+CPU/GPU load and more.  Configuration is customizable though configuration
+files or the variable @code{MANGOHUD_CONFIG}, including position, color, media
+info, framerate logging, and so on.  MangoHud can be run with @code{mangohud}
+or with @code{MANGOHUD=1} (for Vulkan only).")
+    (home-page "https://github.com/flightlessmango/MangoHud/")
+    (license license:expat)))
+
 (define-public ogre
   (package
     (name "ogre")
diff --git a/gnu/packages/patches/mangohud-imgui.patch b/gnu/packages/patches/mangohud-imgui.patch
new file mode 100644
index 0000000000..d5dff193fa
--- /dev/null
+++ b/gnu/packages/patches/mangohud-imgui.patch
@@ -0,0 +1,50 @@
+This patch removes trying to build the bundled dear-imgui library in favor of
+the input version. The static option is set in the dependency to mirror the
+upstream build (though dear-imgui is built with all available backends
+already).
+
+diff --git a/meson.build b/meson.build
+index e5cf395..7f8a8e1 100644
+--- a/meson.build
++++ b/meson.build
+@@ -220,39 +220,14 @@ util_files = files(
+   'src/mesa/util/os_time.c',
+ )
+ 
+-imgui_options = [
+-  'default_library=static',
+-  # use 'auto_features=disabled' once available: https://github.com/mesonbuild/meson/issues/5320
+-  'dx9=disabled',
+-  'dx10=disabled',
+-  'dx11=disabled',
+-  'dx12=disabled',
+-  'metal=disabled',
+-  'opengl=disabled',
+-  'vulkan=disabled',
+-  'glfw=disabled',
+-  'sdl2=disabled',
+-  'osx=disabled',
+-  'win=disabled',
+-  'marmalade=disabled',
+-  'allegro5=disabled',
+-]
+-
+ sizeof_ptr = cc.sizeof('void*')
+ if sizeof_ptr == 8
+   pre_args += '-DMANGOHUD_ARCH="64bit"'
+-  if get_option('mangoapp')
+-    imgui_options += [
+-      'opengl=enabled',
+-      'glfw=enabled',
+-    ]
+-  endif
+ elif sizeof_ptr == 4
+   pre_args += '-DMANGOHUD_ARCH="32bit"'
+ endif
+ 
+-dearimgui_sp = subproject('imgui', default_options: imgui_options)
+-dearimgui_dep = dearimgui_sp.get_variable('imgui_dep')
++dearimgui_dep = dependency('imgui', static: true)
+ 
+ spdlog_dep = cpp.find_library('spdlog', required: get_option('use_system_spdlog'))
+ if not spdlog_dep.found()
-- 
2.34.0
J
J
John Kehayias wrote on 22 Jan 06:06 +0100
Re: [PATCH 2/4] gnu: spdlog: Build with '-fpic'.
(name . 53015@debbugs.gnu.org)(address . 53015@debbugs.gnu.org)(name . Nicolas Goaziou)(address . mail@nicolasgoaziou.fr)
20wqWzWXCQm8C64APXWiUBQfFY0dYThLJMM9eoq7iiTvAoYra7wo97BUbAZwwW8O8PUdY5JNx_7gdA6QIAv-x6-dU3QsnkXKGW7V6mJjpaY=@protonmail.com
Hello,

This patch (2/4 build option for spdlog, part of the MangoHud patch series) may be superseded by https://git.savannah.gnu.org/cgit/guix.git/commit/?id=b1542d59606919d0da04914fa6916b85354e2f89 (CCing Nicolas, hope that's okay!) I've built MangoHud with the shared spdlog before, seems to work.

However, given what spdlog has in its documentation, I wonder if it would be better to default to the static version as before? I think the "-fpic" build option would also work for shared linking in general? Or does that not work for nheko, which this change was for I believe?

I'm not really sure though, nor have a strong opinion, just going based on spdlog's info and that some projects (like MangoHud) build spdlog as a static library by default when bundling. I'm guessing it is for performance reasons, though I don't know if that is realized.

John
J
J
John Kehayias wrote on 16 Feb 02:48 +0100
Re: [PATCH 0/4] Add mangohud (update dear-imgui)
UA7Id7NG1qIZ0gPHeEhPI7jBM-wWJyHiFJaD7QOfPA3F85AG54ggtBWYCGI1FfyS6gZQbYEEoD53RLIa8_8aBNSxo6Y5UHZCz3kWVpmqBuU=@protonmail.com
Hi Maxim,

I wanted to ping you on (at least) the imgui part of this patch, since you had added imgui 1.86 in 1a4cc954d2fcea172a450ae03419b7fdda28b81e to see how we should sort out the different imgui versions we have. I hope that is okay!

This was my note in the original patch:

Toggle quote (2 lines)
> 3. dear-imgui: Update to 1.81. This not the latest, but most recent of the Debian makefiles we use. The only dependent is Ogre (very out of date) which just uses the source, but needs 1.79. I made the previous one a hidden package and updated Ogre to use that. There were enough build changes that I didn't think an inherit would be very clean. Also added in the static library output (preferred by mangohud). New is many inputs for the backends (optional).

My inclination is to keep the old 1.79 as a hidden package for Ogre until Ogre can be updated. Likewise, the package I'm trying to add, mangohud, currently requires imgui 1.81, so perhaps add this as a hidden package as well?

Or it could be a public version since it is the current one that follows the Debian makefiles of the dear-imgui package we currently have. And for one, it adds the pkg-config file which is useful. Then once mangohud has a newer version with the current imgui version it could be removed, as the only package using it as an input.

WDYT?

Thanks!
John
M
M
Maxim Cournoyer wrote on 21 Feb 05:11 +0100
Re: bug#53015: [PATCH 0/4] Add mangohud (update dear-imgui)
(name . John Kehayias)(address . john.kehayias@protonmail.com)
87czjgq2np.fsf_-_@gmail.com
Hi John,

John Kehayias <john.kehayias@protonmail.com> writes:

Toggle quote (8 lines)
> Hello,
>
> This patch (2/4 build option for spdlog, part of the MangoHud patch
> series) may be superseded by
> https://git.savannah.gnu.org/cgit/guix.git/commit/?id=b1542d59606919d0da04914fa6916b85354e2f89
> (CCing Nicolas, hope that's okay!) I've built MangoHud with the shared
> spdlog before, seems to work.

That should solve the problem, yes!

Toggle quote (6 lines)
> However, given what spdlog has in its documentation, I wonder if it
> would be better to default to the static version as before? I think
> the "-fpic" build option would also work for shared linking in
> general? Or does that not work for nheko, which this change was for I
> believe?

Toggle quote (5 lines)
> I'm not really sure though, nor have a strong opinion, just going
> based on spdlog's info and that some projects (like MangoHud) build
> spdlog as a static library by default when bundling. I'm guessing it
> is for performance reasons, though I don't know if that is realized.

Typically in Guix the libraries are offered as shared objects by
default; and when desirable a static output can be added to which the
static objects are copied.

You could add a static output if you have such a need :-).

Maxim
J
J
John Kehayias wrote on 21 Feb 17:36 +0100
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
HjyxReRWzOI9cItOZA1-q3JuV_rh6cWUG_XRfN6A3yLFfOxmJZnKLRlnK8ww7hkUe4-78DO0wMdU5VU_aEZaUB5VmeLeGW59CGzjxl7Sy0Q=@protonmail.com
Hi Maxim,

------- Original Message -------

On Sunday, February 20th, 2022 at 11:11 PM, Maxim Cournoyer wrote:

Toggle quote (24 lines)
> Hi John,
>
> John Kehayias john.kehayias@protonmail.com writes:
>
> > Hello,
> >
> > This patch (2/4 build option for spdlog, part of the MangoHud patch
> > series) may be superseded by
> > https://git.savannah.gnu.org/cgit/guix.git/commit/?id=b1542d59606919d0da04914fa6916b85354e2f89
> > (CCing Nicolas, hope that's okay!) I've built MangoHud with the shared
> > spdlog before, seems to work.
>
> That should solve the problem, yes!
>
> > However, given what spdlog has in its documentation, I wonder if it
> > would be better to default to the static version as before? I think
> > the "-fpic" build option would also work for shared linking in
> > general? Or does that not work for nheko, which this change was for I
> > believe?
>
> Do you mean this:
> https://github.com/gabime/spdlog/wiki/How-to-use-spdlog-in-DLLs ?
>

Yes, that's what I meant. I'm not familiar with spdlog, but was just going based on that and seeing packages build a static spdlog to use.

Toggle quote (12 lines)
> > I'm not really sure though, nor have a strong opinion, just going
> > based on spdlog's info and that some projects (like MangoHud) build
> > spdlog as a static library by default when bundling. I'm guessing it
> > is for performance reasons, though I don't know if that is realized.
>
> Typically in Guix the libraries are offered as shared objects by
> default; and when desirable a static output can be added to which the
> static objects are copied.
>
> You could add a static output if you have such a need :-).
>

Got it. Personally, it doesn't matter much to me, I'm only assuming projects use the static version due to what upstream says and/or for performance reasons (no idea if that is realized though).

In the interest of moving this forward, I'm definitely fine leaving spdlog as it was updated. We could add a note that upstream and other projects prefer a static build and leave that to add as a TODO. I did take a stab at it some time ago, but it got slightly messy in trying to do it all together (I suppose I could just run the build a second time, but I think it also required modifications to other files to make the static build work separately? I forget now.)

Any thoughts on the imgui details? For me, I'd go for keeping both current (old) dear-imgui as hidden for ogre, adding the one I have here (hidden too? though useful Debian additions in the build) for mangohud, and consolidating to one up to date version once everything can use that. We could use the imgui you added for that, or wait for the more complete Debian build files we are using for dear-imgui right now (the pkg-config, for instance, is helpful).

Finally, the pciutils hardware data pci.ids came up in a new patch: https://issues.guix.gnu.org/54069I commented on that issue about doing something similar here. I think we can figure out what to do in a core updates change (due to pciutils dependents). In the meantime, a pciutils variant and/or a separate hwdata package would be helpful. Funny enough, this is the last non-trivial change in this patch series, brought up by someone else. I guess the repeated work shows this would be useful though.

Would love to finally get this merged, with whatever changes we decide for imgui and pciutils. WDYT?

Thanks!
John
M
M
Maxim Cournoyer wrote on 21 Feb 18:31 +0100
(name . John Kehayias)(address . john.kehayias@protonmail.com)
87v8x8nn2z.fsf@gmail.com
Hi John,

John Kehayias <john.kehayias@protonmail.com> writes:

[...]

Toggle quote (8 lines)
> Any thoughts on the imgui details? For me, I'd go for keeping both
> current (old) dear-imgui as hidden for ogre, adding the one I have
> here (hidden too? though useful Debian additions in the build) for
> mangohud, and consolidating to one up to date version once everything
> can use that. We could use the imgui you added for that, or wait for
> the more complete Debian build files we are using for dear-imgui right
> now (the pkg-config, for instance, is helpful).

I sorted out the imgui vs dear-imgui mess I had created yesterday by
upgrading our 'ogre' package to its latest version and using imgui 1.86
for it (it wouldn't work with 1.87).

So now we have imgui@1.87 and imgui@1.86 available. I suggest you try
one of these and if it fails you can try adding yet another public
version for it.

I've looked at the pciutils issue; it seems suboptimal that pciutils
support having the database compressed yet doesn't provide an easy API
to look things from it (or perhaps it does and this is what mangohud
should use? to be investigated).

I'll try to have a look later into pciutils and whether it offers some
kind of API that users of the DB should use instead of manually parsing
their way through :-).

Thanks,

Maxim
J
J
John Kehayias wrote on 23 Feb 23:35 +0100
bug#53015: [PATCH v2] Add mangohud.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
Ux6t747BBOFcxhLdAPRfNVY4zXwB-E3fOWOBgEsbDgFifIowJRxamrRaAh6zleg_MkdAfpZ08Eb6Q8KNRlRBAiUge77e9o_aeCPAI1c7BIg=@protonmail.com
Hi Maxim (and anyone else),

Attached is an update to this patch series, reduced to just one patch. This relies on the hwdata package added in https://issues.guix.gnu.org/54069#2 and the update to imgui I sent in https://issues.guix.gnu.org/54132

With that, mangohud just uses imgui-1.86 (the newer version has a breaking change). The modifications to the meson.build is handled in a build phase substitute* rather than a patch, as it needs the imgui location.

I've checked this builds and works. Let me know if any other modifications are needed, other than the hwdata and imgui fixes referenced.

Thanks!
John
From 73babfb8747916fb8bd0584cffb7fcd4a2c469c7 Mon Sep 17 00:00:00 2001
From: John Kehayias <john.kehayias@protonmail.com>
Date: Wed, 23 Feb 2022 17:29:39 -0500
Subject: [PATCH] gnu: Add mangohud.

* gnu/packages/graphics.scm (mangohud): New variable.
---
gnu/packages/graphics.scm | 86 +++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)

Toggle diff (125 lines)
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 04f92e2b07..40ed72b323 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -28,6 +28,7 @@
 ;;; Copyright © 2021 Ekaitz Zarraga <ekaitz@elenq.tech>
 ;;; Copyright © 2021, 2022 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2022 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -80,11 +81,13 @@ (define-module (gnu packages graphics)
   #:use-module (gnu packages kde-frameworks)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages logging)
   #:use-module (gnu packages llvm)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mp3)
   #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages pciutils)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages photo)
@@ -117,6 +120,7 @@ (define-module (gnu packages graphics)
   #:use-module (guix build-system python)
   #:use-module (guix build-system qt)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix hg-download)
   #:use-module ((guix licenses) #:prefix license:)
@@ -863,6 +867,88 @@ (define-public alembic
 distills complex, animated scenes into a set of baked geometric results.")
     (license license:bsd-3)))
 
+(define-public mangohud
+  (package
+    (name "mangohud")
+    (version "0.6.6-1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/flightlessmango/MangoHud/")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ka004wxkajmvs5vy60r4ckm7f169c61rrd46w6gywkaqf5yp1ab"))))
+    (build-system meson-build-system)
+    (arguments
+     (list
+      #:build-type "release"
+      #:configure-flags
+      #~(list "-Duse_system_vulkan=enabled"
+              "-Duse_system_spdlog=enabled"
+              "-Dwith_xnvctrl=disabled"
+              "-Dappend_libdir_mangohud=false"
+              (string-append "-Dvulkan_datadir="
+                             #$(this-package-input "vulkan-headers")
+                             "/share"))
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; Mangohud tries to build the imgui library as a meson submodule,
+          ;; so we change the dependency to the imgui input instead.
+          (add-after 'unpack 'unbundle-imgui
+            (lambda _
+              (substitute* "meson.build"
+                (("dearimgui_sp = .*")
+                 "")
+                (("dearimgui_sp.get_variable\\('imgui_dep'\\)")
+                 (string-append "declare_dependency(dependencies: "
+                                "cpp.find_library('imgui'), include_directories: '"
+                                #$(this-package-input "imgui") "/include/imgui')")))))
+          (add-after 'unpack 'patch-paths
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "src/meson.build"
+                (("\\\\\\$LIB")
+                 "lib"))
+              (substitute* "src/loaders/loader_libdrm.cpp"
+                (("libdrm.so.2")
+                 (search-input-file inputs "/lib/libdrm.so.2"))
+                (("libdrm_amdgpu.so.1")
+                 (search-input-file inputs "/lib/libdrm_amdgpu.so.1")))
+              (substitute* "src/overlay.cpp"
+                (("glxinfo")
+                 (search-input-file inputs "/bin/glxinfo")))
+              (substitute* "src/loaders/loader_x11.cpp"
+                (("libX11.so.6")
+                 (search-input-file inputs "/lib/libX11.so.6")))
+              (substitute* "src/pci_ids.cpp"
+                (("/usr/share/hwdata/pci.ids")
+                 (search-input-file inputs "share/hwdata/pci.ids")))
+              (substitute* "src/dbus.cpp"
+                (("libdbus-1.so.3")
+                 (search-input-file inputs "lib/libdbus-1.so.3"))))))))
+    (inputs
+     (list dbus
+           glslang
+           hwdata
+           imgui-1.86
+           mesa
+           mesa-utils
+           libdrm
+           libx11
+           python-mako
+           spdlog
+           vulkan-loader
+           vulkan-headers))
+    (native-inputs
+     (list pkg-config python))
+    (synopsis "Vulkan and OpenGL overlay for monitoring performance and hardware")
+    (description
+     "MangoHud is a Vulkan and OpenGL overlay for monitoring frames per second (FPS),
+temperatures, CPU/GPU load and more.")
+    (home-page "https://github.com/flightlessmango/MangoHud/")
+    (license license:expat)))
+
 (define-public ogre
   (package
     (name "ogre")
-- 
2.34.0
J
J
John Kehayias wrote on 27 Feb 02:14 +0100
Re: bug#53015: [PATCH v3] Add mangohud.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
An66NkD40n-mjbCw27e48uZ8CpGvOlLuIuETg6dbT5M5LJ4dytLBBpnmw_7hx5MEfIsJRcE2KSIP4O5EcapPOjBJQUbh5j6_rif9duxCnlY=@protonmail.com
Toggle quote (8 lines)
>
> Attached is an update to this patch series, reduced to just one patch. This relies on the hwdata package added in https://issues.guix.gnu.org/54069#2 and the update to imgui I sent in https://issues.guix.gnu.org/54132
>
> With that, mangohud just uses imgui-1.86 (the newer version has a breaking change). The modifications to the meson.build is handled in a build phase substitute* rather than a patch, as it needs the imgui location.
>
> I've checked this builds and works. Let me know if any other modifications are needed, other than the hwdata and imgui fixes referenced.
>

Attached is a revised patch to use the new hwdata package with inputs, so the correct input is now `(,hwdata "pci"). I checked that it applied and built on master.

John
From 73babfb8747916fb8bd0584cffb7fcd4a2c469c7 Mon Sep 17 00:00:00 2001
From: John Kehayias <john.kehayias@protonmail.com>
Date: Wed, 23 Feb 2022 17:29:39 -0500
Subject: [PATCH] gnu: Add mangohud.

* gnu/packages/graphics.scm (mangohud): New variable.
---
gnu/packages/graphics.scm | 86 +++++++++++++++++++++++++++++++++++++++
1 file changed, 86 insertions(+)

Toggle diff (125 lines)
diff --git a/gnu/packages/graphics.scm b/gnu/packages/graphics.scm
index 04f92e2b07..40ed72b323 100644
--- a/gnu/packages/graphics.scm
+++ b/gnu/packages/graphics.scm
@@ -28,6 +28,7 @@
 ;;; Copyright © 2021 Ekaitz Zarraga <ekaitz@elenq.tech>
 ;;; Copyright © 2021, 2022 Vinicius Monego <monego@posteo.net>
 ;;; Copyright © 2022 Michael Rohleder <mike@rohleder.de>
+;;; Copyright © 2022 John Kehayias <john.kehayias@protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -80,11 +81,13 @@ (define-module (gnu packages graphics)
   #:use-module (gnu packages kde-frameworks)
   #:use-module (gnu packages libusb)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages logging)
   #:use-module (gnu packages llvm)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages mp3)
   #:use-module (gnu packages multiprecision)
+  #:use-module (gnu packages pciutils)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages perl)
   #:use-module (gnu packages photo)
@@ -117,6 +120,7 @@ (define-module (gnu packages graphics)
   #:use-module (guix build-system python)
   #:use-module (guix build-system qt)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix hg-download)
   #:use-module ((guix licenses) #:prefix license:)
@@ -863,6 +867,88 @@ (define-public alembic
 distills complex, animated scenes into a set of baked geometric results.")
     (license license:bsd-3)))
 
+(define-public mangohud
+  (package
+    (name "mangohud")
+    (version "0.6.6-1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/flightlessmango/MangoHud/")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ka004wxkajmvs5vy60r4ckm7f169c61rrd46w6gywkaqf5yp1ab"))))
+    (build-system meson-build-system)
+    (arguments
+     (list
+      #:build-type "release"
+      #:configure-flags
+      #~(list "-Duse_system_vulkan=enabled"
+              "-Duse_system_spdlog=enabled"
+              "-Dwith_xnvctrl=disabled"
+              "-Dappend_libdir_mangohud=false"
+              (string-append "-Dvulkan_datadir="
+                             #$(this-package-input "vulkan-headers")
+                             "/share"))
+      #:phases
+      #~(modify-phases %standard-phases
+          ;; Mangohud tries to build the imgui library as a meson submodule,
+          ;; so we change the dependency to the imgui input instead.
+          (add-after 'unpack 'unbundle-imgui
+            (lambda _
+              (substitute* "meson.build"
+                (("dearimgui_sp = .*")
+                 "")
+                (("dearimgui_sp.get_variable\\('imgui_dep'\\)")
+                 (string-append "declare_dependency(dependencies: "
+                                "cpp.find_library('imgui'), include_directories: '"
+                                #$(this-package-input "imgui") "/include/imgui')")))))
+          (add-after 'unpack 'patch-paths
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "src/meson.build"
+                (("\\\\\\$LIB")
+                 "lib"))
+              (substitute* "src/loaders/loader_libdrm.cpp"
+                (("libdrm.so.2")
+                 (search-input-file inputs "/lib/libdrm.so.2"))
+                (("libdrm_amdgpu.so.1")
+                 (search-input-file inputs "/lib/libdrm_amdgpu.so.1")))
+              (substitute* "src/overlay.cpp"
+                (("glxinfo")
+                 (search-input-file inputs "/bin/glxinfo")))
+              (substitute* "src/loaders/loader_x11.cpp"
+                (("libX11.so.6")
+                 (search-input-file inputs "/lib/libX11.so.6")))
+              (substitute* "src/pci_ids.cpp"
+                (("/usr/share/hwdata/pci.ids")
+                 (search-input-file inputs "share/hwdata/pci.ids")))
+              (substitute* "src/dbus.cpp"
+                (("libdbus-1.so.3")
+                 (search-input-file inputs "lib/libdbus-1.so.3"))))))))
+    (inputs
+     (list dbus
+           glslang
+           `(,hwdata "pci")
+           imgui-1.86
+           mesa
+           mesa-utils
+           libdrm
+           libx11
+           python-mako
+           spdlog
+           vulkan-loader
+           vulkan-headers))
+    (native-inputs
+     (list pkg-config python))
+    (synopsis "Vulkan and OpenGL overlay for monitoring performance and hardware")
+    (description
+     "MangoHud is a Vulkan and OpenGL overlay for monitoring frames per second (FPS),
+temperatures, CPU/GPU load and more.")
+    (home-page "https://github.com/flightlessmango/MangoHud/")
+    (license license:expat)))
+
 (define-public ogre
   (package
     (name "ogre")
-- 
2.34.0
M
M
Maxim Cournoyer wrote on 27 Feb 03:31 +0100
(name . John Kehayias)(address . john.kehayias@protonmail.com)
87v8x1ujj8.fsf@gmail.com
Hi John,

John Kehayias <john.kehayias@protonmail.com> writes:

Toggle quote (22 lines)
>>
>> Attached is an update to this patch series, reduced to just one
>> patch. This relies on the hwdata package added in
>> https://issues.guix.gnu.org/54069#2 and the update to imgui I sent
>> in https://issues.guix.gnu.org/54132
>>
>> With that, mangohud just uses imgui-1.86 (the newer version has a
>> breaking change). The modifications to the meson.build is handled in
>> a build phase substitute* rather than a patch, as it needs the imgui
>> location.
>>
>> I've checked this builds and works. Let me know if any other
>> modifications are needed, other than the hwdata and imgui fixes
>> referenced.
>>
>
> Attached is a revised patch to use the new hwdata package with inputs,
> so the correct input is now `(,hwdata "pci"). I checked that it
> applied and built on master.
>
> John

I took the freedom to make some cosmetic adjustments:

1. ordering of inputs
2. ordering of fields (match the conventions, such as the 'home-page'
field appearing before the synopsis)
3. indent some longer lines so they fit under 80 columns
4. normalize paths passed to search-input-file by stripping lead '/'.

like so:

Toggle snippet (75 lines)
modified gnu/packages/graphics.scm
@@ -890,8 +890,7 @@ (define-public mangohud
"-Dwith_xnvctrl=disabled"
"-Dappend_libdir_mangohud=false"
(string-append "-Dvulkan_datadir="
- #$(this-package-input "vulkan-headers")
- "/share"))
+ #$(this-package-input "vulkan-headers") "/share"))
#:phases
#~(modify-phases %standard-phases
;; Mangohud tries to build the imgui library as a meson submodule,
@@ -902,9 +901,10 @@ (define-public mangohud
(("dearimgui_sp = .*")
"")
(("dearimgui_sp.get_variable\\('imgui_dep'\\)")
- (string-append "declare_dependency(dependencies: "
- "cpp.find_library('imgui'), include_directories: '"
- #$(this-package-input "imgui") "/include/imgui')")))))
+ (string-append
+ "declare_dependency(dependencies: "
+ "cpp.find_library('imgui'), include_directories: '"
+ #$(this-package-input "imgui") "/include/imgui')")))))
(add-after 'unpack 'patch-paths
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "src/meson.build"
@@ -912,15 +912,15 @@ (define-public mangohud
"lib"))
(substitute* "src/loaders/loader_libdrm.cpp"
(("libdrm.so.2")
- (search-input-file inputs "/lib/libdrm.so.2"))
+ (search-input-file inputs "lib/libdrm.so.2"))
(("libdrm_amdgpu.so.1")
- (search-input-file inputs "/lib/libdrm_amdgpu.so.1")))
+ (search-input-file inputs "lib/libdrm_amdgpu.so.1")))
(substitute* "src/overlay.cpp"
(("glxinfo")
- (search-input-file inputs "/bin/glxinfo")))
+ (search-input-file inputs "bin/glxinfo")))
(substitute* "src/loaders/loader_x11.cpp"
(("libX11.so.6")
- (search-input-file inputs "/lib/libX11.so.6")))
+ (search-input-file inputs "lib/libX11.so.6")))
(substitute* "src/pci_ids.cpp"
(("/usr/share/hwdata/pci.ids")
(search-input-file inputs "share/hwdata/pci.ids")))
@@ -932,21 +932,19 @@ (define-public mangohud
glslang
`(,hwdata "pci")
imgui-1.86
- mesa
- mesa-utils
libdrm
libx11
+ mesa
+ mesa-utils
python-mako
spdlog
- vulkan-loader
- vulkan-headers))
- (native-inputs
- (list pkg-config python))
- (synopsis "Vulkan and OpenGL overlay for monitoring performance and hardware")
- (description
- "MangoHud is a Vulkan and OpenGL overlay for monitoring frames per second (FPS),
-temperatures, CPU/GPU load and more.")
+ vulkan-headers
+ vulkan-loader))
+ (native-inputs (list pkg-config python))
(home-page "https://github.com/flightlessmango/MangoHud/")
+ (synopsis "Vulkan and OpenGL overlay for monitoring performance and hardware")
+ (description "MangoHud is a Vulkan and OpenGL overlay for monitoring
+frames per second (FPS), temperatures, CPU/GPU load and more.")
(license license:expat)))

And pushed 31ecd80db7.

Thank you!

Closing.

Maxim
J
J
John Kehayias wrote on 27 Feb 05:31 +0100
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(name . 53015-done@debbugs.gnu.org)(address . 53015@debbugs.gnu.org)
Ijeku9TXYyk1fvym9pRXASpEpai6J6PDaEZx2cHvpdj5olbdzIwuvhdRKnSPfwtvnN8G4-1Z0ci7FwLlL1IiisEj5UNJf4Rtt12VyStih1Q=@protonmail.com
Hi Maxim,

------- Original Message -------

On Saturday, February 26th, 2022 at 9:31 PM, Maxim Cournoyer wrote:

Toggle quote (9 lines)
> I took the freedom to make some cosmetic adjustments:
>
> 1. ordering of inputs
> 2. ordering of fields (match the conventions, such as the 'home-page'
> field appearing before the synopsis)
> 3. indent some longer lines so they fit under 80 columns
> 4. normalize paths passed to search-input-file by stripping lead '/'.
>

Thanks, will take note for the future. No excuse for not alphabetizing when I know I did it twice. Insert ashamed emoji.

Toggle quote (5 lines)
>
> And pushed 31ecd80db7.
>
> Thank you!

Thank you! Very happy to finally have this in, along with the various other package changes along the way.

John
B
B
Brendan Tildesley wrote on 2 Mar 02:37 +0100
[PATCH 0/4] Add mangohud (update dear-imgui)
1849006731.391340.1646185041356@office.mailbox.org
I think it requires `(,hwdata "pci") as input, not just hwdata?
J
J
John Kehayias wrote on 2 Mar 05:54 +0100
(name . Brendan Tildesley)(address . mail@brendan.scot)(name . 53015@debbugs.gnu.org)(address . 53015@debbugs.gnu.org)
AtwAPYEMmH-n6epfKkYT-2JGD5j-NcRW1lEK4OEOSBi6ooxnRkWGMN1_toB-TeYNvBEawpoE9isW_VfQfzkVeNgrnr6mIb_m6M0gcMmovHo=@protonmail.com
------- Original Message -------

On Tuesday, March 1st, 2022 at 8:37 PM, Brendan Tildesley wrote:

Toggle quote (2 lines)
> I think it requires `(,hwdata "pci") as input, not just hwdata?

Yes, that's right, and what was in the most recent version of the patch (which was pushed).
M
M
Maxim Cournoyer wrote on 23 Jun 18:12 +0200
control message for bug #53015
(address . control@debbugs.gnu.org)
87tu8b2wbc.fsf@gmail.com
close 53015
quit
?
Your comment

This issue is archived.

To comment on this conversation send email to 53015@debbugs.gnu.org