Subject: [bug#75106] [PATCH v2 2/2] gnu: Add ringracers.

From: Andrew Wong <[email-masked]>
Date: Wed, 25 Dec 2024 20:43:37 -0500

Change-Id: Iaa92026e4d9a62fa3549b39aff7da0dd6f078013
---
 gnu/packages/games.scm | 56 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index c2bb9aa1c4..cccfd91e1c 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -249,6 +249,62 @@ (define-module (gnu packages games)
   #:use-module ((srfi srfi-1) #:hide (zip))
   #:use-module (srfi srfi-26))
 
+(define-public ring-racers
+  (package
+    (name "ring-racers")
+    (version "2.3")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+	     (url "https://git.do.srb2.org/KartKrew/RingRacers")
+	     (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+	(base32 "05lf799imbk0x3i2adaj0r84ck5yyrvzjvhs4k9dj7l4jg0x4sjz"))
+       ;; (snippet
+       ;;  '(begin
+       ;;     (with-directory-excursion "thirdparty"
+       ;;       (for-each delete-file-recursively '("fmt")))
+       ;;     #t))
+       ))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f
+       #:configure-flags
+       (list "-DCMAKE_C_FLAGS_RELWITHDEBINFO='-O3 -g -DNDEBUG'"
+	     "-DCMAKE_CXX_FLAGS_RELWITHDEBINFO='-O3 -g -DNDEBUG'"
+	     "-DSRB2_CONFIG_DEV_BUILD=OFF"
+	     "-DCMAKE_BUILD_TYPE=RelWithDebInfo")
+       #:phases
+       (modify-phases %standard-phases
+         ;; (add-after 'unpack 'unbundle-font
+         ;;   (lambda* (#:key inputs #:allow-other-keys)
+         ;;     (with-directory-excursion "thirdparty"
+         ;;       (for-each delete-file-recursively '("fmt")))
+         ;;     #t))
+         ;; ^^ This is how to remove the bundles, but how to replace them???
+         (add-after 'install 'move-binary
+           ;; Symlink executable to $out/bin.
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (bin (string-append out "/bin")))
+               (mkdir-p bin)
+               (with-directory-excursion bin
+                 (symlink "../ringracers"
+                          "ringracers"))
+               #t))))))
+    (inputs (list curl zlib libpng libogg libvorbis libvpx libyuv sdl2))
+    (home-page "https://kartkrew.org")
+    (synopsis "Technical kart racing game")
+    (description
+     "\"Dr. Robotnik’s Ring Racers\" is a Technical Kart Racer, drawing
+inspiration from \"antigrav\" racers, fighting games, and traditional-style kart
+racing.  Designed to minimize randomness and emphasize player expression, Ring
+Racers isn’t just about precise handling—you’ll need to master tense combat,
+resource management, and taking risks under pressure.")
+    (license license:gpl2)))
+
 (define-public hexahop
   (package
     (name "hexahop")
-- 
2.46.0