unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#53235] [PATCH] gnu: Add brogue-ce.
@ 2022-01-13 19:02 Aurélien Coussat
  2022-01-14 12:48 ` Maxime Devos
  0 siblings, 1 reply; 2+ messages in thread
From: Aurélien Coussat @ 2022-01-13 19:02 UTC (permalink / raw)
  To: 53235

[-- Attachment #1: Type: text/plain, Size: 314 bytes --]

Hello Guix,

Before anything else, sorry if I made obvious mistakes: this is my first package ever, and my very first Guix contribution.

This patch adds BrogueCE to games.scm. BrogueCE is the community edition of Brogue, a minimalist roguelike game released under the AGPL-3.0 license.

Thank you very much!

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-brogue-ce.patch --]
[-- Type: text/x-diff; name="0001-gnu-Add-brogue-ce.patch", Size: 5776 bytes --]

From cc67e0e0d482ab9c88cbfd8d509329ff98ec5670 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Aur=C3=A9lien=20Coussat?= <acoussat@mail.fr>
Date: Thu, 13 Jan 2022 17:33:55 +0100
Subject: [PATCH] gnu: Add brogue-ce.

---
 gnu/packages/games.scm | 92 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 92 insertions(+)

diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index bfd566aac0..497d8e6002 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -68,6 +68,7 @@
 ;;; Copyright © 2021 Brendan Tildesley <mail@brendan.scot>
 ;;; Copyright © 2021 Christopher Baines <mail@cbaines.net>
 ;;; Copyright © 2021 Foo Chuan Wei <chuanwei.foo@hotmail.com>
+;;; Copyright © 2022 Aurélien Coussat <acoussat@mail.fr>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -12588,3 +12589,94 @@ (define-public fheroes2
 Magic II (aka HOMM2) game engine.  It requires assets and game resources to
 play; it will look for them at @file{~/.local/share/fheroes2} folder.")
     (license license:gpl2)))
+
+(define-public brogue-ce
+  (package
+    (name "brogue-ce")
+    (version "1.10.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/tmewett/BrogueCE.git")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "0hgqr6gf0sxi9fv6ahd4rh3dgysbxm2i9yx998mdmw6my7h2756p"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f
+       #:phases (modify-phases %standard-phases
+                  (delete 'configure)
+                  (add-before 'build 'prepare-build
+                    ;; Set correct environment for SDL.
+                    (lambda* (#:key inputs #:allow-other-keys)
+                      (setenv "CPATH"
+                              (string-append (assoc-ref inputs "sdl")
+                                             "/include/SDL2:"
+                                             (or (getenv "CPATH") "")))))
+                  (add-before 'build 'setenv-cc
+                    (lambda _ (setenv "CC" "gcc")))
+                  (add-before 'build 'fix-datadir
+                    ;; Set path to reach the correct asset directory.
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (substitute* "src/platform/tiles.c"
+                        (("(\"%s/assets/[^\"]+\"), dataDirectory" all filepath)
+                         (string-append filepath ", \""
+                           (assoc-ref outputs "out") "/bin\"")))))
+                  (replace 'install
+                    ;; Upstream provides no install phase.
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let* ((out (assoc-ref outputs "out"))
+                             (bin (string-append out "/bin"))
+                             (executable ,name)
+                             (real-executable
+                               (string-append "." executable "-real"))
+                             (userdir (string-append "." ,name))
+                             (share (string-append out "/share"))
+                             (apps (string-append share "/applications")))
+                        (copy-recursively "bin" bin)
+                        ;; Create a "fake" executable that calls the actual
+                        ;; executable from a good location.
+                        (with-directory-excursion bin
+                          (rename-file "brogue" real-executable)
+                          (call-with-output-file executable
+                            (lambda (p)
+                              (format p
+                                      "#!~a~@
+                              cd $HOME~@
+                              mkdir -p ~a~@
+                              cd ~a~@
+                              exec ~a/~a $*"
+                                      (which "bash")
+                                      userdir
+                                      userdir
+                                      bin
+                                      real-executable)))
+                          (chmod executable #o555))
+                        ;; Create desktop file.
+                        (mkdir-p apps)
+                        (make-desktop-entry-file
+                         (string-append apps "/" ,name ".desktop")
+                         #:name "Brogue"
+                         #:exec ,name
+                         #:categories '("RolePlaying" "Game")
+                         #:keywords
+                         '("adventure" "singleplayer")
+                         #:comment
+                         '((#f "Brave the Dungeons of Doom!")))
+                        #t))))))
+    (inputs
+     `(("sdl" ,(sdl-union (list sdl2 sdl2-image)))))
+    (home-page "https://github.com/tmewett/BrogueCE")
+    (synopsis "Community-lead fork of the much-loved minimalist roguelike game")
+    (description "Brogue is a single-player strategy game set in the halls of a
+mysterious and randomly-generated dungeon.  The objective is simple enough --
+retrieve the fabled Amulet of Yendor from the 26th level -- but the dungeon is
+riddled with danger.  Horrifying creatures and devious, trap-ridden terrain
+await.  Yet it is also riddled with weapons, potions, and artifacts of forgotten
+power.  Survival demands strength and cunning in equal measure as you descend,
+making the most of what the dungeon gives you.  You will make sacrifices, narrow
+escapes, and maybe even some friends along the way -- but will you be one of the
+lucky few to return alive?")
+    (license license:agpl3)))
-- 
2.34.0


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

end of thread, other threads:[~2022-01-14 12:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 19:02 [bug#53235] [PATCH] gnu: Add brogue-ce Aurélien Coussat
2022-01-14 12:48 ` Maxime Devos

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).