gnu: flare-game: Improve package style.

* gnu/packages/games.scm (flare-game)[arguments]: Use G-expressions.  Use
SEARCH-INPUT-DIRECTORY and SEARCH-INPUT-FILE.
This commit is contained in:
Nicolas Goaziou 2022-02-07 12:02:11 +01:00
parent 644be96305
commit 7047ca22e6
No known key found for this signature in database
GPG key ID: DA00B4F048E92F2D

View file

@ -8951,37 +8951,35 @@ (define-public flare-game
"0l0d4j2l1szdwrk8casaiskdk16wkbmms7cid4y751d42czg4ffw")))) "0l0d4j2l1szdwrk8casaiskdk16wkbmms7cid4y751d42czg4ffw"))))
(build-system cmake-build-system) (build-system cmake-build-system)
(arguments (arguments
`(#:tests? #f ;no test (list
#:configure-flags '("-DDATADIR=share/flare") #:tests? #f ;no test
#:configure-flags #~(list "-DDATADIR=share/flare")
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
;; Flare expects the mods to be located in the same folder. ;; Flare expects the mods to be located in the same folder.
;; Yet, "default" mod is in the engine, whereas the others ;; Yet, "default" mod is in the engine, whereas the others
;; are in the current package. Merge everything here with ;; are in the current package. Merge everything here with
;; a symlink. ;; a symlink.
(add-after 'install 'add-default-mod (add-after 'install 'add-default-mod
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let ((mods (string-append #$output "/share/flare/mods")))
(mods (string-append out "/share/flare/mods")))
(with-directory-excursion mods (with-directory-excursion mods
(symlink (string-append (assoc-ref inputs "flare-engine") (symlink (search-input-directory inputs
"/share/flare/mods/default") "/share/flare/mods/default")
"default") "default")
(symlink (string-append (assoc-ref inputs "flare-engine") (symlink (search-input-file inputs
"/share/flare/mods/mods.txt") "/share/flare/mods/mods.txt")
"mods.txt"))) "mods.txt")))))
#t))
(add-after 'install 'install-executable (add-after 'install 'install-executable
;; The package only provides assets for the game, the ;; The package only provides assets for the game, the
;; executable coming from "flare-engine". Since more than ;; executable coming from "flare-engine". Since more than
;; one game may use the engine, we create a new executable, ;; one game may use the engine, we create a new executable,
;; "flare-game", which launches the engine with appropriate ;; "flare-game", which launches the engine with appropriate
;; parameters. ;; parameters.
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out")) (let ((bash (search-input-file inputs "/bin/bash"))
(bash (search-input-file inputs "/bin/bash"))
(flare (search-input-file inputs "/bin/flare")) (flare (search-input-file inputs "/bin/flare"))
(script (string-append out "/bin/flare-game"))) (script (string-append #$output "/bin/flare-game")))
(mkdir-p (dirname script)) (mkdir-p (dirname script))
(call-with-output-file script (call-with-output-file script
(lambda (port) (lambda (port)
@ -8990,9 +8988,8 @@ (define-public flare-game
exec ~a --data-path=~a/share/flare --mods=empyrean_campaign~%" exec ~a --data-path=~a/share/flare --mods=empyrean_campaign~%"
bash bash
flare flare
out))) #$output)))
(chmod script #o755)) (chmod script #o755)))))))
#t)))))
(inputs (inputs
(list flare-engine)) (list flare-engine))
(home-page "http://www.flarerpg.org/") (home-page "http://www.flarerpg.org/")