all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#41365] [PATCH 0/5] Add superstarfighter
@ 2020-05-17 15:52 Timotej Lazar
  2020-05-17 15:55 ` [bug#41365] [PATCH 1/5] gnu: godot: Enable release build Timotej Lazar
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Timotej Lazar @ 2020-05-17 15:52 UTC (permalink / raw)
  To: 41365

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




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#41365] [PATCH 1/5] gnu: godot: Enable release build.
  2020-05-17 15:52 [bug#41365] [PATCH 0/5] Add superstarfighter Timotej Lazar
@ 2020-05-17 15:55 ` Timotej Lazar
  2020-05-17 15:55   ` [bug#41365] [PATCH 2/5] gnu: godot: Remove obsolete workaround for aarch64 Timotej Lazar
                     ` (3 more replies)
  2020-05-17 15:55 ` [bug#41365] [PATCH 0/5] " Nicolò Balzarotti
  2020-05-18 18:53 ` bug#41365: " Nicolas Goaziou
  2 siblings, 4 replies; 9+ messages in thread
From: Timotej Lazar @ 2020-05-17 15:55 UTC (permalink / raw)
  To: 41365; +Cc: Timotej Lazar

* 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





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#41365] [PATCH 2/5] gnu: godot: Remove obsolete workaround for aarch64.
  2020-05-17 15:55 ` [bug#41365] [PATCH 1/5] gnu: godot: Enable release build Timotej Lazar
@ 2020-05-17 15:55   ` Timotej Lazar
  2020-05-17 15:55   ` [bug#41365] [PATCH 3/5] gnu: godot: Build and install the headless version Timotej Lazar
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Timotej Lazar @ 2020-05-17 15:55 UTC (permalink / raw)
  To: 41365; +Cc: Timotej Lazar

* 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





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#41365] [PATCH 3/5] gnu: godot: Build and install the headless version.
  2020-05-17 15:55 ` [bug#41365] [PATCH 1/5] gnu: godot: Enable release build Timotej Lazar
  2020-05-17 15:55   ` [bug#41365] [PATCH 2/5] gnu: godot: Remove obsolete workaround for aarch64 Timotej Lazar
@ 2020-05-17 15:55   ` Timotej Lazar
  2020-05-17 15:55   ` [bug#41365] [PATCH 4/5] gnu: godot: Install provided .desktop file and icons Timotej Lazar
  2020-05-17 15:55   ` [bug#41365] [PATCH 5/5] gnu: Add superstarfighter Timotej Lazar
  3 siblings, 0 replies; 9+ messages in thread
From: Timotej Lazar @ 2020-05-17 15:55 UTC (permalink / raw)
  To: 41365; +Cc: Timotej Lazar

* 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





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#41365] [PATCH 4/5] gnu: godot: Install provided .desktop file and icons.
  2020-05-17 15:55 ` [bug#41365] [PATCH 1/5] gnu: godot: Enable release build Timotej Lazar
  2020-05-17 15:55   ` [bug#41365] [PATCH 2/5] gnu: godot: Remove obsolete workaround for aarch64 Timotej Lazar
  2020-05-17 15:55   ` [bug#41365] [PATCH 3/5] gnu: godot: Build and install the headless version Timotej Lazar
@ 2020-05-17 15:55   ` Timotej Lazar
  2020-05-17 15:55   ` [bug#41365] [PATCH 5/5] gnu: Add superstarfighter Timotej Lazar
  3 siblings, 0 replies; 9+ messages in thread
From: Timotej Lazar @ 2020-05-17 15:55 UTC (permalink / raw)
  To: 41365; +Cc: Timotej Lazar

* 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





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#41365] [PATCH 5/5] gnu: Add superstarfighter.
  2020-05-17 15:55 ` [bug#41365] [PATCH 1/5] gnu: godot: Enable release build Timotej Lazar
                     ` (2 preceding siblings ...)
  2020-05-17 15:55   ` [bug#41365] [PATCH 4/5] gnu: godot: Install provided .desktop file and icons Timotej Lazar
@ 2020-05-17 15:55   ` Timotej Lazar
  3 siblings, 0 replies; 9+ messages in thread
From: Timotej Lazar @ 2020-05-17 15:55 UTC (permalink / raw)
  To: 41365; +Cc: Timotej Lazar

* 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





^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [bug#41365] [PATCH 0/5] Add superstarfighter
  2020-05-17 15:52 [bug#41365] [PATCH 0/5] Add superstarfighter Timotej Lazar
  2020-05-17 15:55 ` [bug#41365] [PATCH 1/5] gnu: godot: Enable release build Timotej Lazar
@ 2020-05-17 15:55 ` Nicolò Balzarotti
  2020-05-17 16:03   ` Timotej Lazar
  2020-05-18 18:53 ` bug#41365: " Nicolas Goaziou
  2 siblings, 1 reply; 9+ messages in thread
From: Nicolò Balzarotti @ 2020-05-17 15:55 UTC (permalink / raw)
  To: Timotej Lazar, 41365

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@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




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#41365] [PATCH 0/5] Add superstarfighter
  2020-05-17 15:55 ` [bug#41365] [PATCH 0/5] " Nicolò Balzarotti
@ 2020-05-17 16:03   ` Timotej Lazar
  0 siblings, 0 replies; 9+ messages in thread
From: Timotej Lazar @ 2020-05-17 16:03 UTC (permalink / raw)
  To: 41365; +Cc: Nicolò Balzarotti

Nicolò Balzarotti <anothersms@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.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#41365: [PATCH 0/5] Add superstarfighter
  2020-05-17 15:52 [bug#41365] [PATCH 0/5] Add superstarfighter Timotej Lazar
  2020-05-17 15:55 ` [bug#41365] [PATCH 1/5] gnu: godot: Enable release build Timotej Lazar
  2020-05-17 15:55 ` [bug#41365] [PATCH 0/5] " Nicolò Balzarotti
@ 2020-05-18 18:53 ` Nicolas Goaziou
  2 siblings, 0 replies; 9+ messages in thread
From: Nicolas Goaziou @ 2020-05-18 18:53 UTC (permalink / raw)
  To: Timotej Lazar; +Cc: 41365-done

Hello,

Timotej Lazar <timotej.lazar@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




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2020-05-18 18:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-17 15:52 [bug#41365] [PATCH 0/5] Add superstarfighter Timotej Lazar
2020-05-17 15:55 ` [bug#41365] [PATCH 1/5] gnu: godot: Enable release build Timotej Lazar
2020-05-17 15:55   ` [bug#41365] [PATCH 2/5] gnu: godot: Remove obsolete workaround for aarch64 Timotej Lazar
2020-05-17 15:55   ` [bug#41365] [PATCH 3/5] gnu: godot: Build and install the headless version Timotej Lazar
2020-05-17 15:55   ` [bug#41365] [PATCH 4/5] gnu: godot: Install provided .desktop file and icons Timotej Lazar
2020-05-17 15:55   ` [bug#41365] [PATCH 5/5] gnu: Add superstarfighter Timotej Lazar
2020-05-17 15:55 ` [bug#41365] [PATCH 0/5] " Nicolò Balzarotti
2020-05-17 16:03   ` Timotej Lazar
2020-05-18 18:53 ` bug#41365: " Nicolas Goaziou

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.