GNU bug report logs - #41365
[PATCH 0/5] Add superstarfighter

Previous Next

Package: guix-patches;

Reported by: Timotej Lazar <timotej.lazar <at> araneo.si>

Date: Sun, 17 May 2020 15:53:01 UTC

Severity: normal

Tags: patch

Done: Nicolas Goaziou <mail <at> nicolasgoaziou.fr>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41365 in the body.
You can then email your comments to 41365 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#41365; Package guix-patches. (Sun, 17 May 2020 15:53:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Timotej Lazar <timotej.lazar <at> araneo.si>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 17 May 2020 15:53:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Timotej Lazar <timotej.lazar <at> araneo.si>
To: guix-patches <at> gnu.org
Subject: [PATCH 0/5] Add superstarfighter
Date: Sun, 17 May 2020 17:52:00 +0200
Hi,

this series adds SuperStarfighter¹, a small game built with the Godot
engine. I’m submitting it together with patches for godot needed to
build the game, and some other improvements. I built the game for x86,
x86_64 and aarch64 (can’t run it there due to missing 3D acceleration).

The main change to godot is building the headless binary, which is used
to compile game assets without requiring X. I put this into a separate
output because it doubles the install size. Compile time is also nearly
doubled, since most files get compiled twice.

If the longer compile time (in total ~20 minutes on an old i7, and
~80 minutes on an even older core duo) is problematic, this can be split
in two packages. The game depends on both versions to build and run
though. Thoughts?

I also enabled release build for Godot, removed an old workaround for
aarch64 (disabling threads caused an infinite loop when building the
game), and installed the icons to the correct location to be used with
the .desktop file.

Thanks!

¹ https://notapixel.itch.io/superstarfighter

Timotej Lazar (5):
  gnu: godot: Enable release build.
  gnu: godot: Remove obsolete workaround for aarch64.
  gnu: godot: Build and install the headless version.
  gnu: godot: Install provided .desktop file and icons.
  gnu: Add superstarfighter.

 gnu/packages/game-development.scm | 68 ++++++++++++++--------------
 gnu/packages/games.scm            | 75 +++++++++++++++++++++++++++++++
 2 files changed, 109 insertions(+), 34 deletions(-)

-- 
2.26.2




Information forwarded to guix-patches <at> gnu.org:
bug#41365; Package guix-patches. (Sun, 17 May 2020 15:56:02 GMT) Full text and rfc822 format available.

Message #8 received at 41365 <at> debbugs.gnu.org (full text, mbox):

From: Timotej Lazar <timotej.lazar <at> araneo.si>
To: 41365 <at> debbugs.gnu.org
Cc: Timotej Lazar <timotej.lazar <at> araneo.si>
Subject: [PATCH 2/5] gnu: godot: Remove obsolete workaround for aarch64.
Date: Sun, 17 May 2020 17:55:17 +0200
* gnu/packages/game-development.scm (godot)[arguments]: Remove -DNO_THREADS
from scons-flags as Godot now builds and runs without it on aarch64.
---
 gnu/packages/game-development.scm | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index dfa55b136f..d84b3fb24a 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1586,10 +1586,6 @@ games.")
     (arguments
      `(#:scons ,scons-python2
        #:scons-flags (list "platform=x11" "target=release_debug"
-                           ,@(if (string-prefix? "aarch64" (or (%current-target-system)
-                                                               (%current-system)))
-                               `("CCFLAGS=-DNO_THREADS")
-                               '())
                            ;; Avoid using many of the bundled libs.
                            ;; Note: These options can be found in the SConstruct file.
                            "builtin_bullet=no"
-- 
2.26.2





Information forwarded to guix-patches <at> gnu.org:
bug#41365; Package guix-patches. (Sun, 17 May 2020 15:56:02 GMT) Full text and rfc822 format available.

Message #11 received at 41365 <at> debbugs.gnu.org (full text, mbox):

From: Timotej Lazar <timotej.lazar <at> araneo.si>
To: 41365 <at> debbugs.gnu.org
Cc: Timotej Lazar <timotej.lazar <at> araneo.si>
Subject: [PATCH 1/5] gnu: godot: Enable release build.
Date: Sun, 17 May 2020 17:55:16 +0200
* gnu/packages/game-development.scm (godot)[arguments]: Set release_debug
target in #:scons-flags to enable optimized build.
---
 gnu/packages/game-development.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 26aa4f714b..dfa55b136f 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1585,7 +1585,7 @@ games.")
     (build-system scons-build-system)
     (arguments
      `(#:scons ,scons-python2
-       #:scons-flags (list "platform=x11"
+       #:scons-flags (list "platform=x11" "target=release_debug"
                            ,@(if (string-prefix? "aarch64" (or (%current-target-system)
                                                                (%current-system)))
                                `("CCFLAGS=-DNO_THREADS")
-- 
2.26.2





Information forwarded to guix-patches <at> gnu.org:
bug#41365; Package guix-patches. (Sun, 17 May 2020 15:56:03 GMT) Full text and rfc822 format available.

Message #14 received at 41365 <at> debbugs.gnu.org (full text, mbox):

From: Timotej Lazar <timotej.lazar <at> araneo.si>
To: 41365 <at> debbugs.gnu.org
Cc: Timotej Lazar <timotej.lazar <at> araneo.si>
Subject: [PATCH 3/5] gnu: godot: Build and install the headless version.
Date: Sun, 17 May 2020 17:55:18 +0200
* gnu/packages/game-development.scm (godot): Build the headless (server)
binary. This is needed to package games using Godot without depending on X.
[outputs]: Add "headless".
[arguments]<#:phases>[build-headless]: New phase.
[arguments]<#:phases>[install]: Install headless version to separate output.
---
 gnu/packages/game-development.scm | 32 ++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index d84b3fb24a..2ed3055cfc 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1617,20 +1617,29 @@ games.")
                  "env_base = Environment(tools=custom_tools)\n"
                  "env_base = Environment(ENV=os.environ)")))
              #t))
+         ;; Build headless tools, used for packaging games without depending on X.
+         (add-after 'build 'build-headless
+           (lambda* (#:key scons-flags #:allow-other-keys)
+             (apply invoke "scons"
+                    `(,(string-append "-j" (number->string (parallel-job-count)))
+                      "platform=server" ,@(delete "platform=x11" scons-flags)))))
          (replace 'install
-           (lambda* (#:key outputs #:allow-other-keys)
+           (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
-                    (bin (string-append out "/bin")))
+                    (headless (assoc-ref outputs "headless"))
+                    (zenity (assoc-ref inputs "zenity")))
+               ;; Strip build info from filenames.
                (with-directory-excursion "bin"
-                 (if (file-exists? "godot.x11.tools.64")
-                     (rename-file "godot.x11.tools.64" "godot")
-                     (rename-file "godot.x11.tools.32" "godot"))
-                 (install-file "godot" bin))
-               ;; Tell Godot where to find zenity for OS.alert().
-               (wrap-program (string-append bin "/godot")
-                 `("PATH" ":" prefix
-                   (,(string-append (assoc-ref %build-inputs "zenity") "/bin"))))
-               #t)))
+                 (for-each (lambda (file)
+                             (let ((dest (car (string-split (basename file) #\.))))
+                               (rename-file file dest)))
+                           (find-files "." "godot.*\\.x11\\.opt\\.tools.*"))
+                 (install-file "godot" (string-append out "/bin"))
+                 (install-file "godot_server" (string-append headless "/bin")))
+               ;; Tell the editor where to find zenity for OS.alert().
+               (wrap-program (string-append out "/bin/godot")
+                 `("PATH" ":" prefix (,(string-append zenity "/bin")))))
+             #t))
          (add-after 'install 'install-godot-desktop
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
@@ -1652,6 +1661,7 @@ games.")
                            Type=Application~%"
                            out)))
                #t))))))
+    (outputs '("out" "headless"))
     (native-inputs `(("pkg-config" ,pkg-config)))
     (inputs `(("alsa-lib" ,alsa-lib)
               ("bullet" ,bullet)
-- 
2.26.2





Information forwarded to guix-patches <at> gnu.org:
bug#41365; Package guix-patches. (Sun, 17 May 2020 15:56:03 GMT) Full text and rfc822 format available.

Message #17 received at 41365 <at> debbugs.gnu.org (full text, mbox):

From: Timotej Lazar <timotej.lazar <at> araneo.si>
To: 41365 <at> debbugs.gnu.org
Cc: Timotej Lazar <timotej.lazar <at> araneo.si>
Subject: [PATCH 5/5] gnu: Add superstarfighter.
Date: Sun, 17 May 2020 17:55:20 +0200
* gnu/packages/games.scm (superstarfighter): New variable.
---
 gnu/packages/games.scm | 75 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 177436e6ec..b893ba8cc4 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -1733,6 +1733,81 @@ can be explored and changed freely.")
                    license:gpl3+
                    license:silofl1.1))))
 
+(define-public superstarfighter
+  (package
+    (name "superstarfighter")
+    (version "0.6.4")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/notapixelstudio/superstarfighter.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1fly63yf5ls1xwm15if4lxwy67wi84k4gvjllljpykrl18vw2y0y"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; There are no tests.
+       #: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 _
+             (let* ((out (assoc-ref %outputs "out"))
+                    (bin (string-append out "/bin"))
+                    (share (string-append out "/share/superstarfighter"))
+                    (icons (string-append out "/share/icons/hicolor/256x256/apps")))
+               (install-file "superstarfighter.pck" share)
+               (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 %build-inputs "godot")
+                           share)
+                   (chmod port #o755)))
+               (mkdir-p icons)
+               (copy-file "icon.png" (string-append icons "/" ,name ".png"))
+               (make-desktop-entry-file
+                (string-append out "/share/applications/" ,name ".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)))
+    (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
+2D arena with fast-moving ships and missiles.  Different game types are
+available, as well as a single-player mode with AI-controlled ships.")
+    (license (list license:expat ; game
+                   license:silofl1.1)))) ; fonts
+
 (define-public xshogi
   (package
     (name "xshogi")
-- 
2.26.2





Information forwarded to guix-patches <at> gnu.org:
bug#41365; Package guix-patches. (Sun, 17 May 2020 15:57:02 GMT) Full text and rfc822 format available.

Message #20 received at 41365 <at> debbugs.gnu.org (full text, mbox):

From: Nicolò Balzarotti <anothersms <at> gmail.com>
To: Timotej Lazar <timotej.lazar <at> araneo.si>, 41365 <at> debbugs.gnu.org
Subject: Re: [bug#41365] [PATCH 0/5] Add superstarfighter
Date: Sun, 17 May 2020 17:55:43 +0200
Hi! This is nice to have.

If other godot games can be built this way, does it make sense to create
a godot-build-system?

Thanks, Nicolò

Timotej Lazar <timotej.lazar <at> araneo.si> writes:

> Hi,
>
> this series adds SuperStarfighter¹, a small game built with the Godot
> engine. I’m submitting it together with patches for godot needed to
> build the game, and some other improvements. I built the game for x86,
> x86_64 and aarch64 (can’t run it there due to missing 3D acceleration).
>
> The main change to godot is building the headless binary, which is used
> to compile game assets without requiring X. I put this into a separate
> output because it doubles the install size. Compile time is also nearly
> doubled, since most files get compiled twice.
>
> If the longer compile time (in total ~20 minutes on an old i7, and
> ~80 minutes on an even older core duo) is problematic, this can be split
> in two packages. The game depends on both versions to build and run
> though. Thoughts?
>
> I also enabled release build for Godot, removed an old workaround for
> aarch64 (disabling threads caused an infinite loop when building the
> game), and installed the icons to the correct location to be used with
> the .desktop file.
>
> Thanks!
>
> ¹ https://notapixel.itch.io/superstarfighter
>
> Timotej Lazar (5):
>   gnu: godot: Enable release build.
>   gnu: godot: Remove obsolete workaround for aarch64.
>   gnu: godot: Build and install the headless version.
>   gnu: godot: Install provided .desktop file and icons.
>   gnu: Add superstarfighter.
>
>  gnu/packages/game-development.scm | 68 ++++++++++++++--------------
>  gnu/packages/games.scm            | 75 +++++++++++++++++++++++++++++++
>  2 files changed, 109 insertions(+), 34 deletions(-)
>
> -- 
> 2.26.2




Information forwarded to guix-patches <at> gnu.org:
bug#41365; Package guix-patches. (Sun, 17 May 2020 15:57:02 GMT) Full text and rfc822 format available.

Message #23 received at 41365 <at> debbugs.gnu.org (full text, mbox):

From: Timotej Lazar <timotej.lazar <at> araneo.si>
To: 41365 <at> debbugs.gnu.org
Cc: Timotej Lazar <timotej.lazar <at> araneo.si>
Subject: [PATCH 4/5] gnu: godot: Install provided .desktop file and icons.
Date: Sun, 17 May 2020 17:55:19 +0200
* gnu/packages/game-development.scm (godot)[arguments]: Install the provided
godot.desktop instead of creating a new one.  Copy icons to the correct
location in share/icons/hicolor as per XDG.
---
 gnu/packages/game-development.scm | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/game-development.scm b/gnu/packages/game-development.scm
index 2ed3055cfc..1cbe0e4f0d 100644
--- a/gnu/packages/game-development.scm
+++ b/gnu/packages/game-development.scm
@@ -1643,24 +1643,18 @@ games.")
          (add-after 'install 'install-godot-desktop
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((out (assoc-ref outputs "out"))
-                    (desktop (string-append out "/share/applications"))
-                    (icon-dir (string-append out "/share/pixmaps")))
-               (rename-file "icon.png" "godot.png")
-               (install-file "godot.png" icon-dir)
-               (mkdir-p desktop)
-               (with-output-to-file
-                   (string-append desktop "/godot.desktop")
-                 (lambda _
-                   (format #t
-                           "[Desktop Entry]~@
-                           Name=godot~@
-                           Comment=The godot game engine~@
-                           Exec=~a/bin/godot~@
-                           TryExec=~@*~a/bin/godot~@
-                           Icon=godot~@
-                           Type=Application~%"
-                           out)))
-               #t))))))
+                    (applications (string-append out "/share/applications"))
+                    (icons (string-append out "/share/icons/hicolor")))
+               (mkdir-p applications)
+               (copy-file "misc/dist/linux/org.godotengine.Godot.desktop"
+                          (string-append applications "/godot.desktop"))
+               (for-each (lambda (icon dest)
+                           (mkdir-p (dirname dest))
+                           (copy-file icon dest))
+                         '("icon.png" "icon.svg")
+                         `(,(string-append icons "/256x256/apps/godot.png")
+                           ,(string-append icons "/scalable/apps/godot.svg"))))
+             #t)))))
     (outputs '("out" "headless"))
     (native-inputs `(("pkg-config" ,pkg-config)))
     (inputs `(("alsa-lib" ,alsa-lib)
-- 
2.26.2





Information forwarded to guix-patches <at> gnu.org:
bug#41365; Package guix-patches. (Sun, 17 May 2020 16:04:01 GMT) Full text and rfc822 format available.

Message #26 received at 41365 <at> debbugs.gnu.org (full text, mbox):

From: Timotej Lazar <timotej.lazar <at> araneo.si>
To: 41365 <at> debbugs.gnu.org
Cc: Nicolò Balzarotti <anothersms <at> gmail.com>
Subject: Re: [bug#41365] [PATCH 0/5] Add superstarfighter
Date: Sun, 17 May 2020 18:03:34 +0200
Nicolò Balzarotti <anothersms <at> gmail.com> [2020-05-17 17:55:43+0200]:
> If other godot games can be built this way, does it make sense to create
> a godot-build-system?

I think so. At least the configure and build phases should be mostly the
same. I figured I’d submit this to see if anything can be improved, then
try to package a couple more games and see what can be factored out.




Reply sent to Nicolas Goaziou <mail <at> nicolasgoaziou.fr>:
You have taken responsibility. (Mon, 18 May 2020 18:55:01 GMT) Full text and rfc822 format available.

Notification sent to Timotej Lazar <timotej.lazar <at> araneo.si>:
bug acknowledged by developer. (Mon, 18 May 2020 18:55:02 GMT) Full text and rfc822 format available.

Message #31 received at 41365-done <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
To: Timotej Lazar <timotej.lazar <at> araneo.si>
Cc: 41365-done <at> debbugs.gnu.org
Subject: Re: [bug#41365] [PATCH 0/5] Add superstarfighter
Date: Mon, 18 May 2020 20:53:51 +0200
Hello,

Timotej Lazar <timotej.lazar <at> araneo.si> writes:

> this series adds SuperStarfighter¹, a small game built with the Godot
> engine. I’m submitting it together with patches for godot needed to
> build the game, and some other improvements. I built the game for x86,
> x86_64 and aarch64 (can’t run it there due to missing 3D
> acceleration).

Great. Thank you.

> The main change to godot is building the headless binary, which is used
> to compile game assets without requiring X. I put this into a separate
> output because it doubles the install size. Compile time is also nearly
> doubled, since most files get compiled twice.
>
> If the longer compile time (in total ~20 minutes on an old i7, and
> ~80 minutes on an even older core duo) is problematic, this can be split
> in two packages. The game depends on both versions to build and run
> though. Thoughts?

I think 80 minutes is not that bad. We can reconsider later.

> I also enabled release build for Godot, removed an old workaround for
> aarch64 (disabling threads caused an infinite loop when building the
> game), and installed the icons to the correct location to be used with
> the .desktop file.

Perfect.

I applied your patches with minor tweaks.

Regards,

-- 
Nicolas Goaziou




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 16 Jun 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 4 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.