guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 186a9714a3ab6d6d4342d8a85873ad071f7b3617
Author: Maxim Cournoyer <[email protected]>
AuthorDate: Thu Jul 24 15:11:34 2025 +0900

    gnu: dolphin-emu: Update to 2506-0.79a3af2.
    
    * gnu/packages/emulators.scm (dolphin-emu): Update to 2506-0.79a3af2.
    [source] {patches}: Update patches.
    (dolphin-rcheevos-submodule): New variable.
    [source]: Refine and update snippet.
    [#:phases] {remove-unittests-target-post-build-command}: Delete.
    {generate-fonts&hardcode-libvulkan-path}: Fix typo in phase name. Remove
    obsolete cstdint patching.
    {post-check}: Delete.
    [#:configure-flags]: Streamline. Add -DUSE_DISCORD_PRESENCE=OFF.
    [native-inputs]: Add googletest
    [inputs]: Replace ffmpeg-4 with ffmpeg. Replace fmt-7 with fmt-11. Replace
    gtk+-2 with gtk+ and minizip-ng-compat with minizip-ng. Add lz4,
    mgba-for-dolphin, qtsvg, spirv-cross, spng, tinygltf, vulkan-headers,
    vulkan-memory-allocator and watcher. Replace qtbase-5 with qtbase. Replace
    sdl2 with sdl3. Replace sfml-2 with sfml. Remove 
soundtouch-1/integer-samples.
    (libretro-dolphin-emu): Update to 5.0-1.a09f78f.
    [source]: Break inheritance with dolphin-emu, adjusting snippet for its 
older
    code base.
    [patches]: Apply libretro-dolphin-emu-libusb-assert.patch and
    libretro-dolphin-emu-vulkan-headers.patch.
    [#:phases] {link-unittest-to-gtest}: New phase.
    [inputs]: Do not inherit from dolphin-emu. Replace fmt-7 with fmt. Replace
    minizip-ng with minizip-ng-compat.
    googletest, vulkan-headers.
    * gnu/packages/patches/dolphin-emu-data.patch: Delete file.
    * gnu/packages/patches/dolphin-emu-unbundle-tinygltf.patch
    * gnu/packages/patches/dolphin-emu-unbundle-watcher.patch
    * gnu/packages/patches/libretro-dolphin-emu-gc-font-tool.patch
    * gnu/packages/patches/libretro-dolphin-emu-libusb-assert.patch
    * gnu/packages/patches/libretro-dolphin-emu-vulkan-headers.patch: New files.
    * gnu/local.mk (dist_patch_DATA): Update accordingly.
    
    Fixes: #1327
    Change-Id: I5a870a5e29c1ca243fb1d5e049ee06c5e254a04f
---
 gnu/local.mk                                       |   6 +-
 gnu/packages/emulators.scm                         | 340 +++++++++++++--------
 gnu/packages/patches/dolphin-emu-data.patch        |  15 -
 .../patches/dolphin-emu-unbundle-tinygltf.patch    |  80 +++++
 .../patches/dolphin-emu-unbundle-watcher.patch     |  50 +++
 .../libretro-dolphin-emu-gc-font-tool.patch        |  17 ++
 .../libretro-dolphin-emu-libusb-assert.patch       |  33 ++
 .../libretro-dolphin-emu-vulkan-headers.patch      |  16 +
 8 files changed, 412 insertions(+), 145 deletions(-)

diff --git a/gnu/local.mk b/gnu/local.mk
index 76f2e402b5..17375a2903 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1214,7 +1214,8 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/docbook2x-static-datadir-evaluation.patch       \
   %D%/packages/patches/doc++-include-directives.patch          \
   %D%/packages/patches/doc++-segfault-fix.patch                        \
-  %D%/packages/patches/dolphin-emu-data.patch                  \
+  %D%/packages/patches/dolphin-emu-unbundle-tinygltf.patch      \
+  %D%/packages/patches/dolphin-emu-unbundle-watcher.patch       \
   %D%/packages/patches/dovecot-opensslv3.patch                 \
   %D%/packages/patches/dovecot-trees-support-dovecot-2.3.patch \
   %D%/packages/patches/dstat-fix-crash-when-specifying-delay.patch     \
@@ -1687,6 +1688,9 @@ dist_patch_DATA =                                         
\
   %D%/packages/patches/libguestfs-syms.patch                   \
   %D%/packages/patches/libinfinity-renew-test-certificate.patch \
   %D%/packages/patches/libretro-dolphin-emu-data.patch         \
+  %D%/packages/patches/libretro-dolphin-emu-gc-font-tool.patch  \
+  %D%/packages/patches/libretro-dolphin-emu-libusb-assert.patch \
+  %D%/packages/patches/libretro-dolphin-emu-vulkan-headers.patch        \
   %D%/packages/patches/librewolf-add-store-to-rdd-allowlist.patch       \
   %D%/packages/patches/librewolf-neuter-locale-download.patch  \
   %D%/packages/patches/librewolf-use-system-wide-dir.patch     \
diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 366007fdb0..b7ead65fa5 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -15,7 +15,7 @@
 ;;; Copyright © 2020 Christopher Howard <[email protected]>
 ;;; Copyright © 2021 Felipe Balbi <[email protected]>
 ;;; Copyright © 2021, 2024 Felix Gruber <[email protected]>
-;;; Copyright © 2021, 2024, 2025 Maxim Cournoyer <[email protected]>
+;;; Copyright © 2021, 2024-2025 Maxim Cournoyer <[email protected]>
 ;;; Copyright © 2021 Guillaume Le Vaillant <[email protected]>
 ;;; Copyright © 2023 c4droid <[email protected]>
 ;;; Copyright © 2023 Yovan Naumovski <[email protected]>
@@ -73,6 +73,7 @@
   #:use-module (gnu packages digest)
   #:use-module (gnu packages engineering)
   #:use-module (gnu packages elf)
+  #:use-module (gnu packages file-systems)
   #:use-module (gnu packages flex)
   #:use-module (gnu packages fltk)
   #:use-module (gnu packages fonts)
@@ -111,6 +112,7 @@
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages textutils)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages toolkits)
   #:use-module (gnu packages upnp)
   #:use-module (gnu packages video)
   #:use-module (gnu packages vulkan)
@@ -322,97 +324,96 @@ console.")
 It aims to support Nintendo DSi and 3DS as well.")
    (license license:gpl3+)))
 
-;; Building from recent Git because the official 5.0 release no longer builds.
-;; Following commits and revision numbers of beta versions listed at
-;; https://dolphin-emu.org/download/.
+(define dolphin-rcheevos-submodule
+  (origin
+    (method git-fetch)
+    (uri (git-reference
+           (url "https://github.com/RetroAchievements/rcheevos";)
+           (commit "b443902b1cdfee5a66b09fec20a94d2d2afaf2ec")))
+    (file-name "dolphin-rcheevos-submodule-checkout")
+    (sha256
+     (base32
+      "1118l6ln73rjj7hw45712lm2i24m96nygiiw57hlcyaxijppl1vj"))))
+
 (define-public dolphin-emu
-  (let ((commit "f9deb68aee962564b1495ff04c54c015e58d086f")
-        (revision "13669"))
+  ;; Note: make sure to update the above rcheevos commit to match that of the
+  ;; corresponding git submodule in dolphin (see:
+  ;; <https://github.com/dolphin-emu/dolphin/tree/master/Externals/>).
+  (let ((commit "64d4c4020cf444d5afea708b38d1b363e532c7ba")
+        (revision "0"))
     (package
       (name "dolphin-emu")
-      (version (git-version "5.0" revision commit))
+      (version (git-version "2506" revision commit))
       (source
        (origin
          (method git-fetch)
          (uri (git-reference
-               (url "https://github.com/dolphin-emu/dolphin";)
-               (commit commit)))
+                (url "https://github.com/dolphin-emu/dolphin";)
+                (commit commit)))
          (file-name (git-file-name name version))
          (sha256
-          (base32 "1p8qsxlabgmz3nic0a9ghh9d3lzl5f8i3kmdrrvx6w8kdlp33018"))
+          (base32 "095326n1dznaplll5crlfdg2d39qxxlhgch5fn7vz8majz0qb5pg"))
          (modules '((guix build utils)
-                    (ice-9 regex)))
+                    (ice-9 ftw)
+                    (ice-9 regex)
+                    (srfi srfi-26)))
          (snippet
-          '(begin
-             ;; Remove external stuff we don't need.
-             (for-each (lambda (dir)
-                         (delete-file-recursively
-                          (string-append "Externals/" dir)))
-                       '("LZO" "OpenAL" "Qt" "SFML" "bzip2"
-                         ;; XXX: Attempting to use the vulkan-headers package
-                         ;; results in "error:
-                         ;; ‘VK_PRESENT_MODE_RANGE_SIZE_KHR’ was not declared
-                         ;; in this scope".
-                         ;;"Vulkan"
-                         "cubeb" "curl" "enet"
-                         "ffmpeg" "fmt" "gettext"
-                         ;; XXX: Attempting to use an unbundled glslang at the
-                         ;; exact commit used by Dolphin still results in
-                         ;; "error: ‘DefaultTBuiltInResource’ is not a member
-                         ;; of ‘glslang’".
-                         ;;"glslang"
-                         ;; XXX: Googletest cannot currently easily be
-                         ;; unbundled, as there are missing linking
-                         ;; directives.
-                         ;;"gtest"
-                         "hidapi" "libpng" "libusb" "mbedtls"
-                         "miniupnpc" "minizip" "MoltenVK" "pugixml"
-                         "soundtouch"
-                         "xxhash" "zlib" "zstd"))
-             ;; Clean up the source.
-             (for-each delete-file
-                       (find-files
-                        "."
-                        (lambda (file _)
-                          (and (string-match "\\.(bin|dsy|exe|jar|rar)$" file)
-                               ;; Preserve the important wc24 .bin
-                               ;; configuration *data* files.
-                               (not (member (basename file)
-                                            '("misc.bin"
-                                              "nwc24dl.bin"
-                                              "nwc24fl.bin"
-                                              "nwc24fls.bin")))))))
-             ;; Do not attempt to include now-missing directories.
-             (substitute* "CMakeLists.txt"
-               ((".*add_subdirectory.*Externals/enet.*") "")
-               ((".*add_subdirectory.*Externals/soundtouch.*") "")
-               ((".*add_subdirectory.*Externals/xxhash.*") ""))))
-         (patches (search-patches "dolphin-emu-data.patch"))))
+          #~(begin
+              (define (delete-all-but directory . preserve)
+                (with-directory-excursion directory
+                  (let* ((pred (negate (cut member <>
+                                            (cons* "." ".." preserve))))
+                         (items (scandir "." pred)))
+                    (for-each (cut delete-file-recursively <>) items))))
+
+              ;; Clean up the source from bundled libraries we don't need.
+              (delete-all-but "Externals"
+                              ;; XXX: The build system is currently hard-coded
+                              ;; to rely on these bundled copies.
+                              "Bochs_disasm"
+                              "FatFs"
+                              "FreeSurround"
+                              "cpp-optparse"
+                              "expr"
+                              "glslang"
+                              "imgui"
+                              "implot"  ;submodule
+                              "picojson"
+                              "rangeset"
+                              "rcheevos") ;submodule
+              (with-directory-excursion "Externals"
+                (copy-recursively #$dolphin-rcheevos-submodule
+                                  "rcheevos/rcheevos")
+                (copy-recursively #$(package-source implot)
+                                  "implot/implot"))
+
+              (for-each delete-file
+                        (find-files
+                         "."
+                         (lambda (file _)
+                           (and (string-match "\\.(bin|dsy|exe|jar|rar)$" file)
+                                ;; Preserve the important wc24 .bin
+                                ;; configuration *data* files.
+                                (not (member (basename file)
+                                             '("misc.bin"
+                                               "nwc24dl.bin"
+                                               "nwc24fl.bin"
+                                               "nwc24fls.bin")))))))))
+         (patches (search-patches "dolphin-emu-unbundle-watcher.patch"
+                                  "dolphin-emu-unbundle-tinygltf.patch"))))
       (build-system cmake-build-system)
       (arguments
        (list
         #:phases
         #~(modify-phases %standard-phases
-            (add-before 'configure 'remove-unittests-target-post-build-command
-              (lambda _
-                ;; To skip a few problematic tests, CTest will be manually
-                ;; invoked in the post-check phase.
-                (with-directory-excursion "Source/UnitTests"
-                  (substitute* "CMakeLists.txt"
-                    (("add_custom_command\\(TARGET unittests POST_BUILD.*")
-                     "")))))
-            (add-before 'configure 'generate-fonts&hardcore-libvulkan-path
+            (add-before 'configure 'generate-fonts&hardcode-libvulkan-path
               (lambda* (#:key inputs #:allow-other-keys)
                 (let ((fontfile
-                       (search-input-file inputs
-                                          
"/share/fonts/truetype/wqy-microhei.ttc"))
+                       (search-input-file
+                        inputs "/share/fonts/truetype/wqy-microhei.ttc"))
                       (libvulkan
                        (search-input-file inputs "/lib/libvulkan.so")))
                   (chdir "docs")
-                  ;; Include a missing header, needed for gcc@14.
-                  (substitute* "gc-font-tool.cpp"
-                    (("#include <cstring>" all)
-                      (string-append all "\n#include <cstdint>")))
                   (invoke "bash" "-c" "g++ -O2 $(freetype-config \
 --cflags --libs) gc-font-tool.cpp -o gc-font-tool")
                   (invoke "./gc-font-tool" "a" fontfile "font_western.bin")
@@ -424,21 +425,6 @@ It aims to support Nintendo DSi and 3DS as well.")
                     (("\"vulkan\", 1") (string-append "\"vulkan\""))
                     (("\"vulkan\"") (string-append "\"" libvulkan "\""))
                     (("Common::DynamicLibrary::GetVersionedFilename") "")))))
-            (add-after 'check 'post-check
-              (lambda* (#:key tests? #:allow-other-keys)
-                (when tests?
-                  (with-directory-excursion "Source/UnitTests"
-                    (invoke "ctest" "-V" "--output-on-failure"
-                            ;; These tests fail due to libusb failing to
-                            ;; init inside the build container.
-                            "-E" (string-join
-                                  '("MMIOTest"
-                                    "PageFaultTest"
-                                    "CoreTimingTest"
-                                    "FileSystemTest"
-                                    "PowerPCTest"
-                                    "VertexLoaderTest")
-                                  "|"))))))
             (add-before 'install 'build-codeloader.bin
               (lambda _
                 (with-directory-excursion "../source/docs"
@@ -462,26 +448,14 @@ It aims to support Nintendo DSi and 3DS as well.")
                 (with-directory-excursion "../source"
                   (invoke "python3" "docs/DSP/free_dsp_rom/generate_coefs.py")
                   (rename-file "dsp_coef.bin" "Data/Sys/GC/dsp_coef.bin")))))
-        ;; The FindGTK2 cmake script only checks hardcoded directories for
-        ;; glib/gtk headers.  Also add some include directories via the CXX
-        ;; flags to let GCC find some headers not actively searched by the
-        ;; build system.
         #:configure-flags
-        #~(list (string-append "-DCMAKE_CXX_FLAGS="
-                               "-I" (search-input-directory
-                                     %build-inputs "include/soundtouch"))
-                "-DDSPTOOL=ON"
-                (string-append "-DX11_INCLUDE_DIR="
-                               #$(this-package-input "libx11")
-                               "/include")
-                (string-append "-DX11_LIBRARIES="
-                               (search-input-file %build-inputs
-                                                  "lib/libX11.so"))
-                "-DX11_FOUND=1")
+        #~(list "-DUSE_DISCORD_PRESENCE=OFF" ;avoid bundled discord-rpc lib
+                "-DDSPTOOL=ON")
         #:test-target "unittests"))
       (native-inputs
        (list (cross-gcc "powerpc-linux-gnu")
              gettext-minimal
+             googletest
              pkg-config
              python-minimal
              python-numpy))
@@ -494,14 +468,14 @@ It aims to support Nintendo DSi and 3DS as well.")
              curl
              enet
              eudev
-             ffmpeg-4
-             fmt-7
+             ffmpeg
+             fmt-11
              font-wqy-microhei
              freetype
              glew
              glib
              glu
-             gtk+-2
+             gtk+
              hidapi
              libevdev
              libpng
@@ -509,20 +483,28 @@ It aims to support Nintendo DSi and 3DS as well.")
              libx11
              libxi
              libxrandr
+             lz4
              lzo
              mbedtls-lts
+             mgba-for-dolphin
              mesa
              miniupnpc
-             minizip-ng-compat
+             minizip-ng
              openal
              pugixml
              pulseaudio
-             qtbase-5
-             sdl2
-             sfml-2
+             qtbase
+             qtsvg
+             sdl3
+             sfml
              soil
-             soundtouch-1/integer-samples
+             spirv-cross
+             spng
+             tinygltf
+             vulkan-headers             ;references loader
              vulkan-loader
+             vulkan-memory-allocator
+             watcher
              xxhash
              zlib
              `(,zstd "lib")))
@@ -536,36 +518,102 @@ turbo speed, networked multiplayer, and graphical 
enhancements.")
       ;; dolphin/Data/Sys/GC/font_*.bin: Licensed under ASL2.0.
       (license (list license:gpl2+ license:asl2.0 license:fdl1.2+)))))
 
+;;; XXX: The libretro port is currently based on an old version of dolphin, so
+;;; its packaging/inputs are lagging behind.
 (define-public libretro-dolphin-emu
   ;; There are no tag or release; use the latest commit.
-  (let ((commit "89a4df725d4eb24537728f7d655cddb1add25c18")
-        (revision "0"))
+  (let ((commit "a09f78f735f0d2184f64ba5b134abe98ee99c65f")
+        (revision "1"))
     (package
       (inherit dolphin-emu)
       (name "libretro-dolphin-emu")
       (version (git-version "5.0" revision commit))
-      (source (origin
-                (inherit (package-source dolphin-emu))
-                (method git-fetch)
-                (uri (git-reference
-                      (url "https://github.com/libretro/dolphin";)
-                      (commit commit)))
-                (file-name (git-file-name name version))
-                (sha256
-                 (base32
-                  "1fvm6hy0ihc0j3sgv88a7ak08c0kyikmmiif827j981fy7zvglvz"))
-                (patches (search-patches "libretro-dolphin-emu-data.patch"))))
+      (source
+       (origin
+         (inherit (package-source dolphin-emu))
+         (method git-fetch)
+         (uri (git-reference
+                (url "https://github.com/libretro/dolphin";)
+                (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "15vv3kz1vcsk53m4b19ckx9xx9cx8l0lgpzalpy625iv7qvdcj9m"))
+         (modules '((guix build utils)
+                    (ice-9 ftw)
+                    (ice-9 regex)
+                    (srfi srfi-26)))
+         (snippet
+          #~(begin
+              ;; XXX: 'delete-all-but' is copied from the turbovnc package.
+              (define (delete-all-but directory . preserve)
+                (define (directory? x)
+                  (and=> (stat x #f)
+                         (compose (cut eq? 'directory <>) stat:type)))
+                (with-directory-excursion directory
+                  (let* ((pred
+                          (negate (cut member <> (append '("." "..") 
preserve))))
+                         (items (scandir "." pred)))
+                    (for-each (lambda (item)
+                                (if (directory? item)
+                                    (delete-file-recursively item)
+                                    (delete-file item)))
+                              items))))
+
+              ;; Clean up the source from bundled libraries we don't need.
+              (delete-all-but "Externals"
+                              ;; XXX: The build system is currently hard-coded
+                              ;; to rely on these bundled copies.
+                              "Bochs_disasm"
+                              "FreeSurround"
+                              "Libretro"
+                              "cpp-optparse"
+                              "glslang"
+                              "imgui"
+                              "picojson")
+              (for-each delete-file
+                        (find-files
+                         "."
+                         (lambda (file _)
+                           (and (string-match "\\.(bin|dsy|exe|jar|rar)$" file)
+                                ;; Preserve the important wc24 .bin
+                                ;; configuration *data* files.
+                                (not (member (basename file)
+                                             '("misc.bin"
+                                               "nwc24dl.bin"
+                                               "nwc24fl.bin"
+                                               "nwc24fls.bin")))))))))
+         (patches
+          (search-patches "libretro-dolphin-emu-data.patch"
+                          "libretro-dolphin-emu-gc-font-tool.patch"
+                          "libretro-dolphin-emu-libusb-assert.patch"
+                          "libretro-dolphin-emu-vulkan-headers.patch"))))
       (arguments
        (substitute-keyword-arguments (package-arguments dolphin-emu)
          ((#:configure-flags flags ''())
-          #~(cons "-DLIBRETRO=ON" #$flags))
+          #~(cons* (string-append "-DCMAKE_CXX_FLAGS="
+                                  "-I" (search-input-directory
+                                        %build-inputs "include/soundtouch"))
+                   "-DLIBRETRO=ON"
+                   "-DUSE_SHARED_ENET=ON"
+                   #$flags))
          ((#:phases phases '%standard-phases)
           #~(modify-phases #$phases
+              (add-after 'unpack 'link-unittest-to-gtest
+                (lambda _
+                  ;; Otherwise, linking with the tests with gtest_main fails
+                  ;; with a "DSO missing from command line"
+                  (substitute* "Source/UnitTests/CMakeLists.txt"
+                    (("PRIVATE core uicommon gtest_main" all)
+                     (string-append all " gtest")))))
               (add-after 'unpack 'deregister-bundled-sources
                 (lambda _
                   (substitute* "CMakeLists.txt"
                     ((".*add_subdirectory.*Externals/curl.*") "")
-                    ((".*add_subdirectory.*Externals/libpng.*") ""))))
+                    ((".*add_subdirectory.*Externals/gtest.*") "")
+                    ((".*add_subdirectory.*Externals/libpng.*") "")
+                    ((".*add_subdirectory.*Externals/soundtouch.*") "")
+                    ((".*add_subdirectory.*Externals/xxhash.*") ""))))
               (replace 'install
                 (lambda _
                   (install-file "dolphin_libretro.so"
@@ -581,11 +629,45 @@ turbo speed, networked multiplayer, and graphical 
enhancements.")
                     (copy-recursively "../source/Data/Sys"
                                       (string-append sysdir "/Sys")))))))))
       (inputs
-       ;; Delete large and extraneous inputs.
-       (modify-inputs (package-inputs dolphin-emu)
-         (delete "ffmpeg"
-                 "gtk+"
-                 "qtbase")))
+       (list alsa-lib
+             ao
+             bluez
+             bzip2
+             cubeb
+             curl
+             enet
+             eudev
+             fmt
+             font-wqy-microhei
+             freetype
+             glew
+             glib
+             glu
+             googletest
+             hidapi
+             libevdev
+             libpng
+             libusb
+             libx11
+             libxi
+             libxrandr
+             lzo
+             mbedtls-lts
+             mesa
+             miniupnpc
+             minizip-ng-compat
+             openal
+             pugixml
+             pulseaudio
+             sdl2
+             sfml-2
+             soil
+             soundtouch-1/integer-samples
+             xxhash
+             vulkan-loader
+             vulkan-headers
+             zlib
+             `(,zstd "lib")))
       (synopsis "Libretro port of Dolphin, the Nintendo Wii/GameCube 
emulator"))))
 
 (define-public dosbox
diff --git a/gnu/packages/patches/dolphin-emu-data.patch 
b/gnu/packages/patches/dolphin-emu-data.patch
deleted file mode 100644
index 6ba959b929..0000000000
--- a/gnu/packages/patches/dolphin-emu-data.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-Resolve a hang in the menu of this game.
-
-Upstream-status: https://github.com/dolphin-emu/dolphin/pull/13285
-
-diff --git a/Data/Sys/GameSettings/GWR.ini b/Data/Sys/GameSettings/GWR.ini
-new file mode 100644
-index 0000000000..fdbc0c312f
---- /dev/null
-+++ b/Data/Sys/GameSettings/GWR.ini
-@@ -0,0 +1,5 @@
-+# GWR - WAVE RACE / BLUE STORM
-+
-+[Core]
-+# Disable multi-threading to avoid a hang in the game menu.
-+CPUThread = False
diff --git a/gnu/packages/patches/dolphin-emu-unbundle-tinygltf.patch 
b/gnu/packages/patches/dolphin-emu-unbundle-tinygltf.patch
new file mode 100644
index 0000000000..1c91823785
--- /dev/null
+++ b/gnu/packages/patches/dolphin-emu-unbundle-tinygltf.patch
@@ -0,0 +1,80 @@
+Upstream-status: https://github.com/dolphin-emu/dolphin/pull/13824
+
+diff --git a/CMake/DolphinLibraryTools.cmake b/CMake/DolphinLibraryTools.cmake
+index 4c395a8ef9..efa0d6a9e2 100644
+--- a/CMake/DolphinLibraryTools.cmake
++++ b/CMake/DolphinLibraryTools.cmake
+@@ -1,14 +1,3 @@
+-# like add_library(new ALIAS old) but avoids add_library cannot create ALIAS 
target "new" because target "old" is imported but not globally visible. on 
older cmake
+-# This can be replaced with a direct alias call once our minimum is cmake 3.18
+-function(dolphin_alias_library new old)
+-  string(REPLACE "::" "" library_no_namespace ${old})
+-  if (NOT TARGET _alias_${library_no_namespace})
+-    add_library(_alias_${library_no_namespace} INTERFACE)
+-    target_link_libraries(_alias_${library_no_namespace} INTERFACE ${old})
+-  endif()
+-  add_library(${new} ALIAS _alias_${library_no_namespace})
+-endfunction()
+-
+ # Makes an imported target if it doesn't exist.  Useful for when find scripts 
from older versions of cmake don't make the targets you need
+ function(dolphin_make_imported_target_if_missing target lib)
+   if(${lib}_FOUND AND NOT TARGET ${target})
+@@ -85,7 +74,7 @@ function(dolphin_find_optional_system_library_pkgconfig 
library search alias bun
+   endif()
+   if(${library}_FOUND)
+     message(STATUS "Using system ${library}")
+-    dolphin_alias_library(${alias} PkgConfig::${library})
++    add_library(${alias} ALIAS PkgConfig::${library})
+     set(${library}_TYPE "System" PARENT_SCOPE)
+   else()
+     dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c277e2a10a..67b72179f3 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,7 +1,7 @@
+ ########################################
+ # General setup
+ #
+-cmake_minimum_required(VERSION 3.13)
++cmake_minimum_required(VERSION 3.18)
+ 
+ cmake_policy(SET CMP0079 NEW) # let target_link_libraries() link to a target 
defined in a different directory
+ cmake_policy(SET CMP0080 OLD) # allow using BundleUtilities at configure time
+@@ -657,7 +657,11 @@ add_subdirectory(Externals/glslang)
+ if(WIN32 OR APPLE)
+   add_subdirectory(Externals/spirv_cross)
+ endif()
+-add_subdirectory(Externals/tinygltf)
++
++dolphin_find_optional_system_library(TinyGLTF Externals/tinygltf)
++if(NOT DEFINED tinygltf)
++  add_library(tinygltf ALIAS tinygltf::tinygltf) # using system library
++endif()
+ 
+ if(ENABLE_VULKAN)
+   add_definitions(-DHAS_VULKAN)
+diff --git a/Externals/tinygltf/CMakeLists.txt 
b/Externals/tinygltf/CMakeLists.txt
+index 0d86268bbe..9e6a99c6f8 100644
+--- a/Externals/tinygltf/CMakeLists.txt
++++ b/Externals/tinygltf/CMakeLists.txt
+@@ -7,5 +7,5 @@ if (NOT MSVC)
+ endif()
+ target_sources(tinygltf PRIVATE
+   tinygltf/tiny_gltf.cc)
+-target_include_directories(tinygltf INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
++target_include_directories(tinygltf INTERFACE 
${CMAKE_CURRENT_SOURCE_DIR}/tinygltf)
+ dolphin_disable_warnings(tinygltf)
+diff --git a/Source/Core/VideoCommon/Assets/MeshAsset.cpp 
b/Source/Core/VideoCommon/Assets/MeshAsset.cpp
+index bde8c8aab6..13eb2b4448 100644
+--- a/Source/Core/VideoCommon/Assets/MeshAsset.cpp
++++ b/Source/Core/VideoCommon/Assets/MeshAsset.cpp
+@@ -7,7 +7,7 @@
+ #include <array>
+ #include <utility>
+ 
+-#include <tinygltf/tiny_gltf.h>
++#include <tiny_gltf.h>
+ 
+ #include "Common/IOFile.h"
+ #include "Common/Logging/Log.h"
diff --git a/gnu/packages/patches/dolphin-emu-unbundle-watcher.patch 
b/gnu/packages/patches/dolphin-emu-unbundle-watcher.patch
new file mode 100644
index 0000000000..c18a6c2ec4
--- /dev/null
+++ b/gnu/packages/patches/dolphin-emu-unbundle-watcher.patch
@@ -0,0 +1,50 @@
+Upstream-status: https://github.com/dolphin-emu/dolphin/pull/13823
+
+diff --git a/CMake/DolphinLibraryTools.cmake b/CMake/DolphinLibraryTools.cmake
+index 4c395a8ef9..fb806b1b90 100644
+--- a/CMake/DolphinLibraryTools.cmake
++++ b/CMake/DolphinLibraryTools.cmake
+@@ -92,3 +92,30 @@ function(dolphin_find_optional_system_library_pkgconfig 
library search alias bun
+     set(${library}_TYPE "Bundled" PARENT_SCOPE)
+   endif()
+ endfunction()
++
++# This can be used for header-only libraries that doesn't offer a
++# pkg-config or CMake file. It uses CMake's find_file. LIBRARY is the
++# name of the library providing it, INCLUDE is the header file name
++# without its installation prefix (e.g. "wtr/watcher.hpp") while
++# BUNDLED_PATH is the root directory of the bundled library.
++function(dolphin_find_optional_system_include library include bundled_path)
++  dolphin_optional_system_library(use_system ${library})
++  string(TOUPPER ${library} upperlib)
++  if(use_system)
++    find_file(${library}_INCLUDE ${include})
++    if((NOT ${library}_INCLUDE) AND (NOT ${use_system} STREQUAL "AUTO"))
++      message(FATAL_ERROR "No system ${library} headers found. \
++Please install it or set USE_SYSTEM_${upperlib} to AUTO or OFF.")
++    endif()
++  endif()
++  if(${library}_INCLUDE)
++    message(STATUS "Using system ${library} headers")
++    set(${library}_TYPE "System" PARENT_SCOPE)
++    add_library(${library} INTERFACE IMPORTED GLOBAL)
++    set_target_properties(${library} PROPERTIES
++      INTERFACE_INCLUDE_DIRECTORIES ${${library}_INCLUDE})
++  else()
++    dolphin_add_bundled_library(${library} ${use_system} ${bundled_path})
++    set(${library}_TYPE "Bundled" PARENT_SCOPE)
++  endif()
++endfunction()
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c277e2a10a..12b1c36ef0 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -786,7 +786,7 @@ if (USE_RETRO_ACHIEVEMENTS)
+       add_subdirectory(Externals/rcheevos)
+ endif()
+ 
+-add_subdirectory(Externals/watcher)
++dolphin_find_optional_system_include(watcher wtr/watcher.hpp 
Externals/watcher)
+ 
+ ########################################
+ # Pre-build events: Define configuration variables and write SCM info header
diff --git a/gnu/packages/patches/libretro-dolphin-emu-gc-font-tool.patch 
b/gnu/packages/patches/libretro-dolphin-emu-gc-font-tool.patch
new file mode 100644
index 0000000000..6aeeec0e4f
--- /dev/null
+++ b/gnu/packages/patches/libretro-dolphin-emu-gc-font-tool.patch
@@ -0,0 +1,17 @@
+This patch is already merged in dolphin.
+
+It'll appear in libretro-dolphin whenever it is rebased on top of current
+dolphin source.
+
+diff --git a/docs/gc-font-tool.cpp b/docs/gc-font-tool.cpp
+index f09964609a..c43496d2fa 100644
+--- a/docs/gc-font-tool.cpp
++++ b/docs/gc-font-tool.cpp
+@@ -76,6 +76,7 @@
+ // Font data is encoded in 2 bit greyscale and in 8x8 blocks.
+ 
+ #include <cerrno>
++#include <cstdint>
+ #include <cstring>
+ #include <fstream>
+ #include <iostream>
diff --git a/gnu/packages/patches/libretro-dolphin-emu-libusb-assert.patch 
b/gnu/packages/patches/libretro-dolphin-emu-libusb-assert.patch
new file mode 100644
index 0000000000..ae07987602
--- /dev/null
+++ b/gnu/packages/patches/libretro-dolphin-emu-libusb-assert.patch
@@ -0,0 +1,33 @@
+This patch is already merged in dolphin.
+
+It'll appear in libretro-dolphin whenever it is rebased on top of current
+dolphin source.
+
+diff --git a/Source/Core/Core/LibusbUtils.cpp 
b/Source/Core/Core/LibusbUtils.cpp
+index a4083e2d06..1ef9777e71 100644
+--- a/Source/Core/Core/LibusbUtils.cpp
++++ b/Source/Core/Core/LibusbUtils.cpp
+@@ -9,8 +9,8 @@
+ #include <libusb.h>
+ #endif
+ 
+-#include "Common/Assert.h"
+ #include "Common/Flag.h"
++#include "Common/Logging/Log.h"
+ #include "Common/Thread.h"
+ #include "Core/LibusbUtils.h"
+ 
+@@ -23,9 +23,12 @@ public:
+   Impl()
+   {
+     const int ret = libusb_init(&m_context);
+-    ASSERT_MSG(IOS_USB, ret == LIBUSB_SUCCESS, "Failed to init libusb: %s", 
libusb_error_name(ret));
+     if (ret != LIBUSB_SUCCESS)
++    {
++      ERROR_LOG(IOS_USB, "Failed to init libusb: %s", libusb_error_name(ret));
+       return;
++    }
++
+ 
+ #ifdef _WIN32
+     libusb_set_option(m_context, LIBUSB_OPTION_USE_USBDK);
diff --git a/gnu/packages/patches/libretro-dolphin-emu-vulkan-headers.patch 
b/gnu/packages/patches/libretro-dolphin-emu-vulkan-headers.patch
new file mode 100644
index 0000000000..9453f60688
--- /dev/null
+++ b/gnu/packages/patches/libretro-dolphin-emu-vulkan-headers.patch
@@ -0,0 +1,16 @@
+Partial backport from dolphin commit
+8e3dbe9671afa631e7a64496f5bfcb2a8206f152 ("Vulkan: update Vulkan headers to 
v1.3.204.")
+
+diff --git a/Source/Core/VideoBackends/Vulkan/SwapChain.h 
b/Source/Core/VideoBackends/Vulkan/SwapChain.h
+index 0077a93ec1..d83ee57051 100644
+--- a/Source/Core/VideoBackends/Vulkan/SwapChain.h
++++ b/Source/Core/VideoBackends/Vulkan/SwapChain.h
+@@ -94,7 +94,7 @@ private:
+   WindowSystemInfo m_wsi;
+   VkSurfaceKHR m_surface = VK_NULL_HANDLE;
+   VkSurfaceFormatKHR m_surface_format = {};
+-  VkPresentModeKHR m_present_mode = VK_PRESENT_MODE_RANGE_SIZE_KHR;
++  VkPresentModeKHR m_present_mode = VK_PRESENT_MODE_IMMEDIATE_KHR;
+   AbstractTextureFormat m_texture_format = AbstractTextureFormat::Undefined;
+   bool m_vsync_enabled = false;
+   bool m_fullscreen_supported = false;

Reply via email to