From cc67e0e0d482ab9c88cbfd8d509329ff98ec5670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Coussat?= 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 ;;; Copyright © 2021 Christopher Baines ;;; Copyright © 2021 Foo Chuan Wei +;;; Copyright © 2022 Aurélien Coussat ;;; ;;; 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