[bug#76458,v2] gnu: Add flycast.

Message ID c5a1efc3308e6231e21e382fa85a1a9b5ac217cc.1740123127.git.wongandj@icloud.com
State New
Headers
Series [bug#76458,v2] gnu: Add flycast. |

Commit Message

Andrew Wong Feb. 21, 2025, 7:32 a.m. UTC
  * gnu/packages/emulators.scm (flycast): New variable.

Change-Id: I358235492a3493c3126f7ca9f738ed2706e36105
---
I sent an earlier version of this patch, but it got mixed up in another thread(#75856). This version addresses the previous issues.
 gnu/packages/emulators.scm | 71 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)


base-commit: cd20619cfcb32c2631fb602729512740bc510550
  

Comments

Liliana Marie Prikler Feb. 21, 2025, 8:43 a.m. UTC | #1
Am Freitag, dem 21.02.2025 um 02:32 -0500 schrieb Andrew Wong:
> * gnu/packages/emulators.scm (flycast): New variable.
> 
> Change-Id: I358235492a3493c3126f7ca9f738ed2706e36105
> ---
> I sent an earlier version of this patch, but it got mixed up in
> another thread(#75856). This version addresses the previous issues.
>  gnu/packages/emulators.scm | 71
> ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 71 insertions(+)
> 
> diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
> index 0eafc3df9e..579f1e1f0f 100644
> --- a/gnu/packages/emulators.scm
> +++ b/gnu/packages/emulators.scm
> @@ -4072,6 +4072,77 @@ (define-public exomizer
>      ;; zlib license with an (non-)advertising clause.
>      (license license:zlib)))
>  
> +(define-public flycast
> +  (package
> +    (name "flycast")
> +    (version "2.4")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/flyinghead/flycast")
> +             (commit (string-append "v" version))
> +             ;; There are many bundled packages here included as git
> +             ;; submodules. Removing many of them would require
> patching the
> +             ;; source code and repository layout.
> +             (recursive? #t)))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32
> "0ainy75gkrvilcm89hq6wq9md41w0mxgp6l27q5fzrxxykpjh6ym"))
> +       (modules '((guix build utils)))
> +       (snippet #~(begin
> +                    (substitute* "CMakeLists.txt"
> +                      (("add_subdirectory\\(core/deps/Vulkan-
> Headers\\)")
> +                       "find_package(VulkanHeaders)"))
> +                    (with-directory-excursion "core/deps"
> +                      (for-each delete-file-recursively
> +                                '("SDL"
> +                                  "Spout"
> +                                  "Syphon"
> +                                  "Vulkan-Headers"
> +                                  "breakpad"
> +                                  "discord-rpc"
> +                                  "libzip"
> +                                  "oboe")))))))
The preferred way is to use a keep list.  Also review this in line with
the recursive checkout above.
> +    (build-system cmake-build-system)
> +    (inputs (list alsa-lib
> +                  ao
> +                  curl
> +                  glslang
> +                  libzip
> +                  lua
> +                  miniupnpc
> +                  pulseaudio
> +                  sdl2
> +                  spirv-tools
> +                  vulkan-headers
> +                  pkg-config))
> +    (arguments
> +     (list
> +      #:tests? #f
> +      ;; There are no test targets. Instead, there are configuration
> options
> +      ;; which turn the main target (bin/flymake) into a set of unit
> tests.
Interesting design.  Maybe we can make a patch that provides them as an
extra target instead?  Otherwise it's fine to say "; no test suite" or
use this comment as a prefix.
> +      #:configure-flags
> +      #~(list "-DUSE_ALSA=ON"
> +              "-DUSE_BREAKPAD=OFF"
> +              "-DUSE_DX11=OFF"
> +              "-DUSE_DX9=OFF"
> +              "-DUSE_HOST_GLSLANG=OFF"
> +              ;; ^^ This option is not implemented correctly, but
> may be in
> +              ;; the future. Review all of these options on the next
> update!
> +              ;; (see:
> https://github.com/flyinghead/flycast/issues/1843)
We prefer comments to be above a line of code or in the same line as
the code.  For the others you could add a line comment like
"; XXX: review when updating"
> +              "-DUSE_HOST_LIBZIP=ON"
> +              "-DUSE_HOST_SDL=ON"
> +              "-DUSE_LIBAO=ON"
> +              "-DUSE_LUA=ON"
> +              "-DUSE_PULSEAUDIO=ON"
> +              "-DUSE_VULKAN=ON")))
> +    (home-page "https://github.com/flyinghead/flycast")
> +    (synopsis "Sega Dreamcast, Naomi, Naomi 2, and Atomiswave
> emulator")
> +    (description "Flycast is a multi-platform Sega Dreamcast, Naomi,
> Naomi 2,
> +and Atomiswave emulator derived from reicast.")
> +    (license license:gpl2+)))
> +
>  (define-public freedisksysrom
>    ;; There is no release; use the latest commit.
>    (let ((commit "0d5f95f109bb3aadf2bb9510bfda13879bbd5266")
> 
> base-commit: cd20619cfcb32c2631fb602729512740bc510550
Cheers
  
Andrew Wong Feb. 22, 2025, 7:41 a.m. UTC | #2
> The preferred way is to use a keep list.
What do you mean by 'keep list'? If you mean defining (delete-all-but)
and naming only the kept directories*, the issue is that there are 37(!)
bundled directories in total, so this list would be shorter. So also,
yes, the recursive checkout is still necessary.
 > Interesting design.  Maybe we can make a patch that provides them as
 > an extra target instead?  Otherwise it's fine to say "; no test suite"
 > or use this comment as a prefix.
I would do that if I knew how; unfortunately I don't have the CMake
chops to make such a fix, given how tangled this project's build system
is. What do you mean 'use this comment as a prefix'?
 > We prefer comments to be above a line of code or in the same line as
 > the code.  For the others you could add a line comment like
 > "; XXX: review when updating"
Will do.

*Also, would the project appreciate a patch integrating that function
into (guix build utils) or other guix module? I count a total of 11
times delete-all-but is defined in gnu/packages.
  

Patch

diff --git a/gnu/packages/emulators.scm b/gnu/packages/emulators.scm
index 0eafc3df9e..579f1e1f0f 100644
--- a/gnu/packages/emulators.scm
+++ b/gnu/packages/emulators.scm
@@ -4072,6 +4072,77 @@  (define-public exomizer
     ;; zlib license with an (non-)advertising clause.
     (license license:zlib)))
 
+(define-public flycast
+  (package
+    (name "flycast")
+    (version "2.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/flyinghead/flycast")
+             (commit (string-append "v" version))
+             ;; There are many bundled packages here included as git
+             ;; submodules. Removing many of them would require patching the
+             ;; source code and repository layout.
+             (recursive? #t)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0ainy75gkrvilcm89hq6wq9md41w0mxgp6l27q5fzrxxykpjh6ym"))
+       (modules '((guix build utils)))
+       (snippet #~(begin
+                    (substitute* "CMakeLists.txt"
+                      (("add_subdirectory\\(core/deps/Vulkan-Headers\\)")
+                       "find_package(VulkanHeaders)"))
+                    (with-directory-excursion "core/deps"
+                      (for-each delete-file-recursively
+                                '("SDL"
+                                  "Spout"
+                                  "Syphon"
+                                  "Vulkan-Headers"
+                                  "breakpad"
+                                  "discord-rpc"
+                                  "libzip"
+                                  "oboe")))))))
+    (build-system cmake-build-system)
+    (inputs (list alsa-lib
+                  ao
+                  curl
+                  glslang
+                  libzip
+                  lua
+                  miniupnpc
+                  pulseaudio
+                  sdl2
+                  spirv-tools
+                  vulkan-headers
+                  pkg-config))
+    (arguments
+     (list
+      #:tests? #f
+      ;; There are no test targets. Instead, there are configuration options
+      ;; which turn the main target (bin/flymake) into a set of unit tests.
+      #:configure-flags
+      #~(list "-DUSE_ALSA=ON"
+              "-DUSE_BREAKPAD=OFF"
+              "-DUSE_DX11=OFF"
+              "-DUSE_DX9=OFF"
+              "-DUSE_HOST_GLSLANG=OFF"
+              ;; ^^ This option is not implemented correctly, but may be in
+              ;; the future. Review all of these options on the next update!
+              ;; (see: https://github.com/flyinghead/flycast/issues/1843)
+              "-DUSE_HOST_LIBZIP=ON"
+              "-DUSE_HOST_SDL=ON"
+              "-DUSE_LIBAO=ON"
+              "-DUSE_LUA=ON"
+              "-DUSE_PULSEAUDIO=ON"
+              "-DUSE_VULKAN=ON")))
+    (home-page "https://github.com/flyinghead/flycast")
+    (synopsis "Sega Dreamcast, Naomi, Naomi 2, and Atomiswave emulator")
+    (description "Flycast is a multi-platform Sega Dreamcast, Naomi, Naomi 2,
+and Atomiswave emulator derived from reicast.")
+    (license license:gpl2+)))
+
 (define-public freedisksysrom
   ;; There is no release; use the latest commit.
   (let ((commit "0d5f95f109bb3aadf2bb9510bfda13879bbd5266")