diff mbox series

[bug#48952,2/3] gnu: superstarfighter: Use godot-build-system.

Message ID 20210611005546.429055-2-monego@posteo.net
State New
Headers show
Series build-system: Add godot-build-system. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Vinicius Monego June 11, 2021, 12:55 a.m. UTC
* gnu/packages/games.scm (superstarfighter)[build-system]: Use
godot-build-system.
[arguments]: Remove #:tests?. <#:game, #:project-directory>: New fields.
<#:phases>: Do not replace configure, build and install. Add phase
'install-desktop-file after 'install.
---
 gnu/packages/games.scm | 61 +++++++++---------------------------------
 1 file changed, 12 insertions(+), 49 deletions(-)
diff mbox series

Patch

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 2eaea5868e..55f468da2c 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -62,6 +62,7 @@ 
 ;;; Copyright © 2021 David Pflug <david@pflug.io>
 ;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
 ;;; Copyright © 2021 Solene Rapenne <solene@perso.pw>
+;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -199,6 +200,7 @@ 
   #:use-module (guix build-system glib-or-gtk)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
+  #:use-module (guix build-system godot)
   #:use-module (guix build-system meson)
   #:use-module (guix build-system perl)
   #:use-module (guix build-system python)
@@ -2464,62 +2466,23 @@  modify quests for the Solarus engine.")))
        (file-name (git-file-name name version))
        (sha256
         (base32 "1fly63yf5ls1xwm15if4lxwy67wi84k4gvjllljpykrl18vw2y0y"))))
-    (build-system gnu-build-system)
+    (build-system godot-build-system)
     (arguments
-     `(#:tests? #f                      ;there are no tests
+     `(#:game ,name
+       #:project-directory "godot"
        #:phases
        (modify-phases %standard-phases
-         (replace 'configure
-           (lambda _
-             (chdir "godot")
-             (setenv "HOME" (getcwd))
-             (with-output-to-file "export_presets.cfg"
-               (lambda ()
-                 (display
-                  "[preset.0]
-name=\"Guix\"
-platform=\"Linux/X11\"
-runnable=true
-[preset.0.options]")))
-             #t))
-         (replace 'build
-           (lambda _
-             (let ((godot (assoc-ref %build-inputs "godot-headless")))
-               (invoke (string-append godot "/bin/godot_server")
-                       "--export-pack" "Guix"
-                       "superstarfighter.pck" "project.godot"))
-             #t))
-         (replace 'install
-           (lambda* (#:key inputs outputs #:allow-other-keys)
+         (add-after 'install 'install-desktop-file
+           (lambda* (#:key inputs outputs game #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
-                    (bin (string-append out "/bin"))
-                    (share (string-append out "/share"))
-                    (data (string-append share "/superstarfighter"))
-                    (icons (string-append share "/icons/hicolor/256x256/apps")))
-               (install-file "superstarfighter.pck" data)
-               (mkdir-p bin)
-               (call-with-output-file (string-append bin "/superstarfighter")
-                 (lambda (port)
-                   (format port
-                           "#!/bin/sh~@
-                            exec ~a/bin/godot --main-pack ~a/superstarfighter.pck~%"
-                           (assoc-ref inputs "godot")
-                           data)
-                   (chmod port #o755)))
-               (mkdir-p icons)
-               (copy-file "icon.png" (string-append icons "/" ,name ".png"))
+                    (share (string-append out "/share")))
                (make-desktop-entry-file
-                (string-append share "/applications/" ,name ".desktop")
+                (string-append share "/applications/" game ".desktop")
                 #:name "SuperStarfighter"
                 #:comment "Fast-paced arcade combat game"
-                #:exec ,name
-                #:icon ,name
-                #:categories '("Game" "ArcadeGame")))
-             #t)))))
-    (native-inputs
-     `(("godot-headless" ,godot "headless")))
-    (inputs
-     `(("godot" ,godot)))
+                #:exec game
+                #:icon game
+                #:categories '("Game" "ArcadeGame"))))))))
     (home-page "https://notapixel.itch.io/superstarfighter")
     (synopsis "Fast-paced local multiplayer arcade game")
     (description "In SuperStarfighter, up to four local players compete in a