gnu: winetricks: Fix GUI support and Perl dependency.

* nongnu/packages/wine.scm (winetricks)[inputs]: Add perl.
[arguments]: Replace patch-zenity-path phase with wrap-program phase
which sets PATH to include all required dependencies.
Add phase to patch embedded Perl shabang.
This commit is contained in:
Pierre Neidhardt 2021-04-02 09:23:37 +02:00
parent 829eda38b6
commit a8c9d24a29
No known key found for this signature in database
GPG key ID: 9BDCF497A4BBCC7F

View file

@ -27,6 +27,7 @@
#: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)
#:use-module (gnu packages perl)
#:use-module (gnu packages wget) #:use-module (gnu packages wget)
#:use-module (gnu packages compression) #:use-module (gnu packages compression)
#:use-module (gnu packages gnome) #:use-module (gnu packages gnome)
@ -47,11 +48,12 @@
"0x2ykd6krk0fric45yl4gcc8cdv6j206l62rc9klw0rxfv12hz5n")))) "0x2ykd6krk0fric45yl4gcc8cdv6j206l62rc9klw0rxfv12hz5n"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(inputs (inputs
`(("wget" ,wget) `(("cabextract" ,cabextract)
("cabextract" ,cabextract)
("p7zip" ,p7zip) ("p7zip" ,p7zip)
("unzip" ,unzip) ("perl" ,perl)
;; ("unrar" ,unrar) ; TODO: Include unrar? It is referenced in the source. ;; ("unrar" ,unrar) ; TODO: Include unrar? It is referenced in the source.
("unzip" ,unzip)
("wget" ,wget)
("zenity" ,zenity))) ("zenity" ,zenity)))
(arguments (arguments
`(#:tests? #f `(#:tests? #f
@ -61,16 +63,30 @@
#:phases #:phases
(modify-phases %standard-phases (modify-phases %standard-phases
(delete 'configure) (delete 'configure)
(add-after 'unpack 'patch-zenity-path (add-after 'install 'wrap-program
(lambda* (#:key inputs #:allow-other-keys) ;; The script relies on WINETRICKS_GUI being exactly "zenity", so
(let* ((zenity (assoc-ref inputs "zenity")) ;; we can't patch the path directly. Probably same for other dependencies.
(zenity-bin (string-append zenity "/bin/zenity"))) (lambda* (#:key inputs outputs #:allow-other-keys)
(substitute* "src/winetricks" (let* ((zenity-bin (string-append (assoc-ref inputs "zenity") "/bin/"))
;; TODO: There might need more command substitution needed, e.g. wget, 7z, etc. (perl-bin (string-append (assoc-ref inputs "perl") "/bin/"))
;; TODO: Add coreutils to the input? (winetricks (string-append (assoc-ref outputs "out")
(("command -v zenity") (string-append "command -v " zenity-bin)) "/bin/winetricks")))
(("WINETRICKS_GUI=zenity") (string-append "WINETRICKS_GUI=" zenity-bin)) (wrap-program winetricks
(("WINETRICKS_GUI_VERSION=\"\\$\\(zenity") (string-append "WINETRICKS_GUI_VERSION=\"$(" zenity-bin))))))))) `("PATH" prefix (,@(map (lambda (in)
(string-append (assoc-ref inputs in) "/bin/"))
'("cabextract"
"p7zip"
"perl"
"unzip"
"wget"
"zenity"))))))))
(add-after 'install 'patch-perl-path
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((perl (string-append (assoc-ref inputs "perl") "/bin/perl"))
(winetricks (string-append (assoc-ref outputs "out")
"/bin/winetricks")))
(substitute* winetricks
(("#!/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.