Subject: [bug#73522] [PATCH games-team 04/14] gnu: retroarch: Use gexps.

From: Maxim Cournoyer <[email-masked]>
Date: Sun, 6 Oct 2024 14:32:00 +0900

* gnu/packages/emulators.scm (retroarch) [arguments]
<phases>: Use gexps; locate resources using `search-input-file' and
`search-input-directory'.

Change-Id: I0b1c4ff074e6f8287c14ac3327a8d0271391fec2
---

 gnu/packages/emulators.scm | 70 ++++++++++++++++++--------------------
 1 file changed, 34 insertions(+), 36 deletions(-)

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index a1e5a1f0c9..92156f10df 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -1592,43 +1592,41 @@ (define-public retroarch
         (base32 "15nh4y4vpf4n1ryhiy4fwvzn5xz5idzfzn9fsi5v9hzp25vbjmrm"))))
     (build-system gnu-build-system)
     (arguments
-     `(#:tests? #f                      ; no tests
-       #:phases
-       (modify-phases %standard-phases
-         (replace 'configure
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let* ((out (assoc-ref outputs "out"))
-                    (etc (string-append out "/etc"))
-                    (vulkan (assoc-ref inputs "vulkan-loader"))
-                    (wayland-protocols (assoc-ref inputs "wayland-protocols")))
-               ;; Hard-code some store file names.
-               (substitute* "gfx/common/vulkan_common.c"
-                 (("libvulkan.so") (string-append vulkan "/lib/libvulkan.so")))
-               (substitute* "gfx/common/wayland/generate_wayland_protos.sh"
-                 (("/usr/local/share/wayland-protocols")
-                 (string-append wayland-protocols "/share/wayland-protocols")))
-
-               ;; Without HLSL, we can still enable GLSLANG and Vulkan support.
-               (substitute* "qb/config.libs.sh"
-                 (("[$]HAVE_GLSLANG_HLSL") "notcare"))
-
-               ;; The configure script does not yet accept the extra arguments
-               ;; (like ‘CONFIG_SHELL=’) passed by the default configure phase.
-               (invoke
-                 "./configure"
-                 ,@(if (string-prefix? "armhf" (or (%current-target-system)
+     (list
+      #:tests? #f                       ; no tests
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'configure
+            (lambda* (#:key inputs #:allow-other-keys)
+              ;; Hard-code some store file names.
+              (substitute* "gfx/common/vulkan_common.c"
+                (("libvulkan.so")
+                 (search-input-file inputs "lib/libvulkan.so")))
+              (substitute* "gfx/common/wayland/generate_wayland_protos.sh"
+                (("/usr/local/share/wayland-protocols")
+                 (search-input-directory inputs "share/wayland-protocols")))
+
+              ;; Without HLSL, we can still enable GLSLANG and Vulkan support.
+              (substitute* "qb/config.libs.sh"
+                (("[$]HAVE_GLSLANG_HLSL") "notcare"))
+
+              ;; The configure script does not yet accept the extra arguments
+              ;; (like ‘CONFIG_SHELL=’) passed by the default configure phase.
+              (invoke
+               "./configure"
+               #$@(if (string-prefix? "armhf" (or (%current-target-system)
                                                   (%current-system)))
-                       '("--enable-neon" "--enable-floathard")
-                       '())
-                 (string-append "--prefix=" out)
-                 ;; Non-free software are available through the core updater,
-                 ;; disable it.  See <https://issues.guix.gnu.org/38360>.
-                 "--disable-update_cores"
-                 "--disable-builtinmbedtls"
-                 "--disable-builtinbearssl"
-                 "--disable-builtinzlib"
-                 "--disable-builtinflac"
-                 "--disable-builtinglslang")))))))
+                      '("--enable-neon" "--enable-floathard")
+                      '())
+               (string-append "--prefix=" #$output)
+               ;; Non-free software are available through the core updater,
+               ;; disable it.  See <https://issues.guix.gnu.org/38360>.
+               "--disable-update_cores"
+               "--disable-builtinmbedtls"
+               "--disable-builtinbearssl"
+               "--disable-builtinzlib"
+               "--disable-builtinflac"
+               "--disable-builtinglslang"))))))
     (inputs
      (list alsa-lib
            eudev
-- 
2.46.0