gnu: hyperrogue: Update to 12.1a.

* gnu/packages/games.scm (hyperrogue): Update to 12.1a.
[source]<origin>: Set upstream to GitHub.
[arguments]: Use G-expressions.
<phases>: Remove INSTALL-DATA phase. Remove trailing #T.
[home-page]: Fix URL.
This commit is contained in:
Nicolas Goaziou 2022-09-18 19:56:20 +02:00
parent 1066a424dc
commit 31a56967e2
No known key found for this signature in database
GPG key ID: DA00B4F048E92F2D

View file

@ -5892,101 +5892,63 @@ (define-public mrrescue
(define-public hyperrogue
(package
(name "hyperrogue")
(version "11.3a")
;; When updating this package, be sure to update the "hyperrogue-data"
;; origin in native-inputs.
(source (origin
(method url-fetch)
(uri (string-append
"https://www.roguetemple.com/z/hyper/hyperrogue"
(string-join (string-split version #\.) "")
"-src.tgz"))
(sha256
(base32
"1yxabbswq02fc5frigvs43f83m5vlxybc7n5mynkwzj2c70lfp2k"))))
(version "12.1a")
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/zenorogue/hyperrogue")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"1l09d1r3jdwp54zq071fk09hpggif5phjn0gsapzrjy3i289jran"))))
(build-system gnu-build-system)
(arguments
`(#:tests? #f ; no check target
#:make-flags '("HYPERROGUE_USE_GLEW=1"
"HYPERROGUE_USE_PNG=1")
#:phases
(modify-phases %standard-phases
(add-after 'set-paths 'set-sdl-paths
(lambda* (#:key inputs #:allow-other-keys)
(setenv "CPATH"
(string-append (or (getenv "CPATH") "") ":"
(assoc-ref inputs "sdl-union")
"/include/SDL"))))
(replace 'configure
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(share-dir (string-append out "/share/hyperrogue"))
(dejavu-dir (string-append
(assoc-ref inputs "font-dejavu")
"/share/fonts/truetype"))
(dejavu-font "DejaVuSans-Bold.ttf")
(music-file "hyperrogue-music.txt"))
;; Fix font and music paths.
(substitute* "basegraph.cpp"
((dejavu-font)
(string-append dejavu-dir "/" dejavu-font)))
(substitute* music-file
(("\\*/")
(string-append share-dir "/sounds/")))
(substitute* "sound.cpp"
(("musicfile = \"\"")
(string-append "musicfile = \""
share-dir "/" music-file "\"")))
;; Disable build machine CPU optimizations and warnings treated
;; as errors.
(substitute* "Makefile"
(("-march=native") "")
(("-Werror") "")))
#t))
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
(bin (string-append out "/bin"))
(share-dir (string-append out "/share/hyperrogue")))
(mkdir-p bin)
(install-file "hyperrogue" bin)
(install-file "hyperrogue-music.txt" share-dir))
#t))
(add-after 'install 'install-data
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((data (assoc-ref inputs "hyperrogue-data"))
(out (assoc-ref outputs "out"))
(sounds (string-append out "/share/hyperrogue/sounds"))
(unzip (search-input-file inputs "/bin/unzip")))
;; Extract media license information into sounds directory.
(invoke unzip "-j" data
(string-append
"hyperrogue"
(string-join (string-split ,version #\.) "")
"/sounds/credits.txt") "-d" sounds)
;; Extract sounds and music into sounds directory.
(invoke "unzip" "-j" data
(string-append
"hyperrogue"
(string-join (string-split ,version #\.) "")
"/*.ogg") "-d" sounds)))))))
(native-inputs
`(("hyperrogue-data"
,(origin
(method url-fetch)
(uri
(string-append
"https://www.roguetemple.com/z/hyper/hyperrogue"
(string-join (string-split version #\.) "")
"-win.zip"))
(sha256
(base32
"11yhbia45f1w9z0j67h9nynwjqmvakr9l6rnrmdrdkzin6lvzzj4"))))
("unzip" ,unzip)))
(list
#:tests? #f ; no check target
#:make-flags #~(list "HYPERROGUE_USE_GLEW=1"
"HYPERROGUE_USE_PNG=1")
#:phases
#~(modify-phases %standard-phases
(add-after 'set-paths 'set-sdl-paths
(lambda* (#:key inputs #:allow-other-keys)
(setenv "CPATH"
(string-append (or (getenv "CPATH") "") ":"
(search-input-directory inputs
"/include/SDL")))))
(replace 'configure
(lambda* (#:key inputs #:allow-other-keys)
(let ((share-dir (string-append #$output "/share/hyperrogue/"))
(fonts-dir (dirname
(search-input-file inputs
"DejaVuSans-Bold.ttf"))))
;; Set fonts and music path.
(substitute* "sysconfig.h"
(("(#define HYPERPATH ).*" _ lead)
(string-append lead "\"" share-dir "\"\n"))
(("(#define HYPERFONTPATH ).*" _ lead)
(string-append lead "\"" fonts-dir "/\"\n")))
;; Disable build machine CPU optimizations and warnings treated
;; as errors.
(substitute* "Makefile"
(("-march=native") "")
(("-Werror") "")))))
(replace 'install
(lambda _
(install-file "hyperrogue" (string-append #$output "/bin"))
(let ((share-dir (string-append #$output "/share/hyperrogue/")))
(install-file "hyperrogue-music.txt" share-dir)
(for-each (lambda (dir)
(copy-recursively dir
(string-append share-dir dir)))
'("music" "sounds"))))))))
(inputs
(list font-dejavu glew libpng
(list font-dejavu
glew
libpng
(sdl-union (list sdl sdl-gfx sdl-mixer sdl-ttf))))
(home-page "https://www.roguetemple.com/z/hyper/")
(home-page "https://roguetemple.com/z/hyper")
(synopsis "Non-euclidean graphical rogue-like game")
(description
"HyperRogue is a game in which the player collects treasures and fights
@ -5999,9 +5961,9 @@ (define-public hyperrogue
While the game can use ASCII characters to display the the classical rogue
symbols, it still needs graphics to render the non-euclidean world.")
(license (list license:bsd-3 ; glew.c, mtrand.*
license:cc-by-sa3.0 ; music
license:cc-by-sa4.0 ; sounds
(license (list license:bsd-3 ; glew.c, mtrand.*
license:cc-by-sa3.0 ; music
license:cc-by-sa4.0 ; sounds
license:cc0
license:public-domain ; direntx.*, some sounds
license:zlib ; savepng.*