gnu: wine64: Share phases with parent wine package.

* gnu/packages/wine.scm (wine64): Share phases with parent wine package.

Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
This commit is contained in:
Kaelyn Takata 2023-02-02 21:24:08 +00:00 committed by Liliana Marie Prikler
parent 6bfd48ff72
commit d9a7bc96ae
No known key found for this signature in database
GPG key ID: 442A84B8C70E2F87

View file

@ -236,84 +236,62 @@ integrate Windows applications into your desktop.")
(inputs (modify-inputs (package-inputs wine) (inputs (modify-inputs (package-inputs wine)
(prepend wine))) (prepend wine)))
(arguments (arguments
(cons* (substitute-keyword-arguments
#:make-flags (strip-keyword-arguments '(#:system) (package-arguments wine))
#~(list "SHELL=bash" ((#:make-flags _)
(string-append "libdir=" #$output "/lib/wine64")) #~(list "SHELL=bash"
#:phases (string-append "libdir=" #$output "/lib/wine64"))
#~(modify-phases %standard-phases )
;; Explicitly set both the 64-bit and 32-bit versions of vulkan-loader ((#:phases phases)
;; when installing to x86_64-linux so both are available. #~(modify-phases #$phases
;; TODO: Add more JSON files as they become available in Mesa. ;; Explicitly set both the 64-bit and 32-bit versions of vulkan-loader
#$@(match (%current-system) ;; when installing to x86_64-linux so both are available.
((or "x86_64-linux") ;; TODO: Add more JSON files as they become available in Mesa.
`((add-after 'copy-wine32-binaries 'wrap-executable #$@(match (%current-system)
(lambda* (#:key inputs outputs #:allow-other-keys) ((or "x86_64-linux")
(let* ((out (assoc-ref outputs "out")) `((delete 'wrap-executable)
(icd-files (map (add-after 'copy-wine32-binaries 'wrap-executable
(lambda (basename) (lambda* (#:key inputs outputs #:allow-other-keys)
(search-input-file (let* ((out (assoc-ref outputs "out"))
inputs (icd-files (map
(string-append "/share/vulkan/icd.d/" (lambda (basename)
basename))) (search-input-file
'("radeon_icd.x86_64.json" inputs
"intel_icd.x86_64.json" (string-append "/share/vulkan/icd.d/"
"radeon_icd.i686.json" basename)))
"intel_icd.i686.json")))) '("radeon_icd.x86_64.json"
(wrap-program (string-append out "/bin/wine-preloader") "intel_icd.x86_64.json"
`("VK_ICD_FILENAMES" ":" = ,icd-files)) "radeon_icd.i686.json"
(wrap-program (string-append out "/bin/wine64-preloader") "intel_icd.i686.json"))))
`("VK_ICD_FILENAMES" ":" = ,icd-files))))))) (wrap-program (string-append out "/bin/wine-preloader")
(_ `("VK_ICD_FILENAMES" ":" = ,icd-files))
`())) (wrap-program (string-append out "/bin/wine64-preloader")
(add-after 'unpack 'patch-SHELL `("VK_ICD_FILENAMES" ":" = ,icd-files)))))))
(lambda _ (_
(substitute* "configure" `()))
;; configure first respects CONFIG_SHELL, clobbers SHELL later. (add-after 'install 'copy-wine32-binaries
(("/bin/sh") (lambda* (#:key inputs outputs #:allow-other-keys)
(which "bash"))))) (let ((out (assoc-ref %outputs "out")))
(add-after 'patch-generated-file-shebangs 'patch-makedep ;; Copy the 32-bit binaries needed for WoW64.
(lambda* (#:key outputs #:allow-other-keys) (copy-file (search-input-file inputs "/bin/wine")
(substitute* "tools/makedep.c" (string-append out "/bin/wine"))
(("output_filenames\\( unix_libs \\);" all) ;; Copy the real 32-bit wine-preloader instead of the wrapped
(string-append all ;; version.
"output ( \" -Wl,-rpath=%s \", arch_install_dirs[arch] );"))))) (copy-file (search-input-file inputs "/bin/.wine-preloader-real")
(add-after 'install 'copy-wine32-binaries (string-append out "/bin/wine-preloader")))))
(lambda* (#:key inputs outputs #:allow-other-keys) (add-after 'install 'copy-wine32-libraries
(let ((out (assoc-ref %outputs "out"))) (lambda* (#:key inputs outputs #:allow-other-keys)
;; Copy the 32-bit binaries needed for WoW64. (let* ((out (assoc-ref %outputs "out")))
(copy-file (search-input-file inputs "/bin/wine") (copy-recursively (search-input-directory inputs "/lib/wine32")
(string-append out "/bin/wine")) (string-append out "/lib/wine32")))))
;; Copy the real 32-bit wine-preloader instead of the wrapped (add-after 'compress-documentation 'copy-wine32-manpage
;; version. (lambda* (#:key inputs outputs #:allow-other-keys)
(copy-file (search-input-file inputs "/bin/.wine-preloader-real") (let* ((out (assoc-ref %outputs "out")))
(string-append out "/bin/wine-preloader"))))) ;; Copy the missing man file for the wine binary from wine.
(add-after 'install 'copy-wine32-libraries (copy-file (search-input-file inputs "/share/man/man1/wine.1.gz")
(lambda* (#:key inputs outputs #:allow-other-keys) (string-append out "/share/man/man1/wine.1.gz")))))))
(let* ((out (assoc-ref %outputs "out"))) ((#:configure-flags configure-flags '())
(copy-recursively (search-input-directory inputs "/lib/wine32") #~(cons "--enable-win64" #$configure-flags))))
(string-append out "/lib/wine32")))))
(add-after 'compress-documentation 'copy-wine32-manpage
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref %outputs "out")))
;; Copy the missing man file for the wine binary from wine.
(copy-file (search-input-file inputs "/share/man/man1/wine.1.gz")
(string-append out "/share/man/man1/wine.1.gz")))))
(add-after 'configure 'patch-dlopen-paths
;; Hardcode dlopened sonames to absolute paths.
(lambda _
(let* ((library-path (search-path-as-string->list
(getenv "LIBRARY_PATH")))
(find-so (lambda (soname)
(search-path library-path soname))))
(substitute* "include/config.h"
(("(#define SONAME_.* )\"(.*)\"" _ defso soname)
(format #f "~a\"~a\"" defso (find-so soname))))))))
#:configure-flags
#~(list "--enable-win64")
(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
#:system)
(package-arguments wine))))
(synopsis "Implementation of the Windows API (WoW64 version)") (synopsis "Implementation of the Windows API (WoW64 version)")
(supported-systems '("x86_64-linux" "aarch64-linux")))) (supported-systems '("x86_64-linux" "aarch64-linux"))))