nongnu: winetricks: Improve package style.

* nongnu/packages/wine.scm (winetricks)[inputs]: Use label-less style.
[arguments]: Use G-expressions.
<#:make-flags>: Replace '(assoc-ref %outputs "out")' with '#$output'.
<#:phases>: In 'wrap-program' and 'patch-perl-path', Replace
'(assoc-ref inputs ...)' with 'this-package-input'.

Signed-off-by: John Kehayias <john.kehayias@protonmail.com>
This commit is contained in:
Zhu Zihao 2023-08-12 00:50:56 +08:00 committed by John Kehayias
parent 8cffc6b168
commit 14c3e1fdc8
No known key found for this signature in database
GPG key ID: 499097AE5EA815D9

View file

@ -9,6 +9,7 @@
#:use-module (guix build-system trivial) #:use-module (guix build-system trivial)
#:use-module (guix build-system copy) #:use-module (guix build-system copy)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix gexp)
#:use-module (guix git-download) #:use-module (guix git-download)
#:use-module (gnu packages base) #:use-module (gnu packages base)
#:use-module (gnu packages bash) #:use-module (gnu packages bash)
@ -33,45 +34,44 @@
"15glm6ws0zihcks93l39mli8wf5b5vkijb0vaid9cqra6x0zppd5")))) "15glm6ws0zihcks93l39mli8wf5b5vkijb0vaid9cqra6x0zppd5"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(inputs (inputs
`(("cabextract" ,cabextract) (list cabextract
("p7zip" ,p7zip) p7zip
("perl" ,perl) perl
;; ("unrar" ,unrar) ; TODO: Include unrar? It is referenced in the source. ;; unrar ; TODO: Include unrar? It is referenced in the source.
("unzip" ,unzip) unzip
("wget" ,wget) wget
("zenity" ,zenity))) zenity))
(arguments (arguments
`(#:tests? #f (list
;; TODO: Checks need bashate, shellcheck (in Guix), and checkbashisms. #:tests? #f
#:make-flags (list (string-append "DESTDIR=" (assoc-ref %outputs "out")) ;; TODO: Checks need bashate, shellcheck (in Guix), and checkbashisms.
"PREFIX=") #:make-flags #~(list (string-append "DESTDIR=" #$output)
#:phases "PREFIX=")
(modify-phases %standard-phases #:phases
(delete 'configure) #~(modify-phases %standard-phases
(add-after 'install 'wrap-program (delete 'configure)
;; The script relies on WINETRICKS_GUI being exactly "zenity", so (add-after 'install 'wrap-program
;; we can't patch the path directly. Probably same for other dependencies. ;; The script relies on WINETRICKS_GUI being exactly "zenity", so
(lambda* (#:key inputs outputs #:allow-other-keys) ;; we can't patch the path directly. Probably same for other dependencies.
(let* ((zenity-bin (string-append (assoc-ref inputs "zenity") "/bin/")) (lambda _
(perl-bin (string-append (assoc-ref inputs "perl") "/bin/")) (let* ((winetricks (string-append #$output "/bin/winetricks"))
(winetricks (string-append (assoc-ref outputs "out") (paths (map
"/bin/winetricks"))) (lambda (p) (string-append p "/bin"))
(wrap-program winetricks (list #$(this-package-input "cabextract")
`("PATH" prefix (,@(map (lambda (in) #$(this-package-input "p7zip")
(string-append (assoc-ref inputs in) "/bin/")) #$(this-package-input "perl")
'("cabextract" #$(this-package-input "unzip")
"p7zip" #$(this-package-input "wget")
"perl" #$(this-package-input "zenity")))))
"unzip" (wrap-program winetricks
"wget" `("PATH" prefix ,paths)))))
"zenity")))))))) (add-after 'install 'patch-perl-path
(add-after 'install 'patch-perl-path (lambda _
(lambda* (#:key inputs outputs #:allow-other-keys) (let* ((perl (string-append #$(this-package-input "perl")
(let* ((perl (string-append (assoc-ref inputs "perl") "/bin/perl")) "/bin/perl"))
(winetricks (string-append (assoc-ref outputs "out") (winetricks (string-append #$output "/bin/winetricks")))
"/bin/winetricks"))) (substitute* winetricks
(substitute* winetricks (("#!/usr/bin/env perl") (string-append "#!" perl)))))))))
(("#!/usr/bin/env perl") (string-append "#!" perl)))))))))
(home-page "https://github.com/Winetricks/winetricks") (home-page "https://github.com/Winetricks/winetricks")
(synopsis "Easy way to work around problems in Wine") (synopsis "Easy way to work around problems in Wine")
(description "Winetricks is an easy way to work around problems in Wine. (description "Winetricks is an easy way to work around problems in Wine.