gnu: widelands: Improve package style.

* gnu/packages/games.scm (widelands): Use new package style.
[snippet]: Simplify and drop trailing #t.
[arguments]: Use gexps. Tweak #:configure-flags to install the binary in bin/
instead of bin/games/ and data under share/ instead of bin/share/. Modify
'unbundle-fonts phase to not depend on input labels.
[inputs, native-inputs]: Drop input labels.
[home-page]: Drop trailing slash.

Change-Id: I75c535005ad1325ad170205b6e80b1039125619a
Signed-off-by: Christopher Baines <mail@cbaines.net>
This commit is contained in:
Timotej Lazar 2024-04-06 10:44:03 +02:00 committed by Christopher Baines
parent 27f4896a18
commit 84a88f5ed9
No known key found for this signature in database
GPG key ID: 5E28A33B0B84F577

View file

@ -5791,58 +5791,57 @@ (define-public widelands
(origin (origin
(method git-fetch) (method git-fetch)
(uri (git-reference (uri (git-reference
(url "https://github.com/widelands/widelands") (url "https://github.com/widelands/widelands")
(commit (string-append "v" version)))) (commit (string-append "v" version))))
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 "1m9hn1sh1siggribzsq79k7p0lggdw41ji7zdl6h648cjak9mdsp")) (base32 "1m9hn1sh1siggribzsq79k7p0lggdw41ji7zdl6h648cjak9mdsp"))
(modules '((guix build utils))) (modules '((guix build utils)))
(snippet (snippet
'(begin #~(delete-file-recursively "src/third_party/minizip"))))
(delete-file-recursively "src/third_party/minizip")
#t))))
(build-system cmake-build-system) (build-system cmake-build-system)
(arguments (arguments
`(#:configure-flags (list
(let* ((out (assoc-ref %outputs "out")) #:configure-flags
(share (string-append out "/share"))) #~(let ((share (string-append #$output "/share/widelands")))
(list (string-append "-DCMAKE_INSTALL_PREFIX=" out "/bin") (list (string-append "-DCMAKE_INSTALL_PREFIX=" #$output)
(string-append "-DWL_INSTALL_BASEDIR=" share "/widelands") (string-append "-DWL_INSTALL_BINDIR=" #$output "/bin")
(string-append "-DWL_INSTALL_DATADIR=" share "/widelands") (string-append "-DWL_INSTALL_BASEDIR=" share)
"-DOPTION_BUILD_WEBSITE_TOOLS=OFF" (string-append "-DWL_INSTALL_DATADIR=" share)
;; CMakeLists.txt does not handle properly RelWithDebInfo build "-DOPTION_BUILD_WEBSITE_TOOLS=OFF"
;; type. When used, no game data is installed! ;; CMakeLists.txt does not handle properly RelWithDebInfo build
"-DCMAKE_BUILD_TYPE=Release")) ;; type. When used, no game data is installed!
#:phases "-DCMAKE_BUILD_TYPE=Release"))
(modify-phases %standard-phases #:phases
(add-after 'unpack 'unbundle-fonts #~(modify-phases %standard-phases
;; Unbundle fonts already packaged in Guix. XXX: missing fonts are (add-after 'unpack 'unbundle-fonts
;; amiri, Culmus, mmrCensus, Nakula, and Sinhala. ;; Unbundle fonts already packaged in Guix. XXX: missing fonts are
(lambda* (#:key inputs #:allow-other-keys) ;; amiri, Culmus, mmrCensus, Nakula, and Sinhala.
(with-directory-excursion "data/i18n/fonts" (lambda* (#:key inputs #:allow-other-keys)
(for-each (lambda (font) (for-each
(delete-file-recursively font) (lambda (font)
(symlink (string-append (assoc-ref inputs font) (let* ((path (string-append "share/fonts/truetype/" (basename font)))
"/share/fonts/truetype") (target (false-if-exception (search-input-file inputs path))))
font)) (when target
'("DejaVu" "MicroHei"))) (delete-file font)
#t))))) (symlink target font))))
(find-files "data/i18n/fonts" "\\.tt[cf]$")))))))
(native-inputs (native-inputs
`(("gettext" ,gettext-minimal) (list gettext-minimal pkg-config python))
("pkg-config" ,pkg-config)
("python" ,python)))
(inputs (inputs
`(("asio" ,asio) (list asio
("glew" ,glew) font-dejavu
("icu4c" ,icu4c) font-wqy-microhei
("libpng" ,libpng) glew
("minizip" ,minizip) icu4c
("sdl" ,(sdl-union (list sdl2 sdl2-image sdl2-mixer sdl2-ttf))) libpng
("zlib" ,zlib) minizip
;; Fonts for the unbundle-fonts phase. Case matters in name! sdl2
("DejaVu" ,font-dejavu) sdl2-image
("MicroHei" ,font-wqy-microhei))) sdl2-mixer
(home-page "https://www.widelands.org/") sdl2-ttf
zlib))
(home-page "https://www.widelands.org")
(synopsis "Fantasy real-time strategy game") (synopsis "Fantasy real-time strategy game")
(description (description
"In Widelands, you are the regent of a small clan. You start out with "In Widelands, you are the regent of a small clan. You start out with