summary refs log tree commit diff
path: root/gnu/packages/wine.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/wine.scm')
-rw-r--r--gnu/packages/wine.scm88
1 files changed, 85 insertions, 3 deletions
diff --git a/gnu/packages/wine.scm b/gnu/packages/wine.scm
index 42bec5cca5..83625914db 100644
--- a/gnu/packages/wine.scm
+++ b/gnu/packages/wine.scm
@@ -66,7 +66,8 @@
   #:use-module (gnu packages vulkan)
   #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
-  #:use-module (ice-9 match))
+  #:use-module (ice-9 match)
+  #:use-module (srfi srfi-1))
 
 (define-public wine
   (package
@@ -125,6 +126,7 @@
        ("sdl2" ,sdl2)
        ("unixodbc" ,unixodbc)
        ("v4l-utils" ,v4l-utils)
+       ("vkd3d" ,vkd3d)
        ("vulkan-loader" ,vulkan-loader)
        ("zlib" ,zlib)))
     (arguments
@@ -149,6 +151,27 @@
 
        #:phases
        (modify-phases %standard-phases
+         ;; Explicitely set the 32-bit version of vulkan-loader when installing
+         ;; to i686-linux or x86_64-linux.
+         ;; TODO: Add more JSON files as they become available in Mesa.
+         ,@(match (%current-system)
+             ((or "i686-linux" "x86_64-linux")
+              `((add-after 'install 'wrap-executable
+                  (lambda* (#:key inputs outputs #:allow-other-keys)
+                    (let* ((out (assoc-ref outputs "out"))
+                           (icd (string-append out "/share/vulkan/icd.d")))
+                      (mkdir-p icd)
+                      (copy-file (string-append (assoc-ref inputs "mesa")
+                                 "/share/vulkan/icd.d/radeon_icd.i686.json")
+                                 (string-append icd "/radeon_icd.i686.json"))
+                      (wrap-program (string-append out "/bin/wine-preloader")
+                                    `("VK_ICD_FILENAMES" ":" =
+                                      (,(string-append icd
+                                        "/radeon_icd.i686.json"))))
+                      #t)))))
+             (_
+              `())
+             )
          (add-after 'configure 'patch-dlopen-paths
            ;; Hardcode dlopened sonames to absolute paths.
            (lambda _
@@ -186,6 +209,34 @@ integrate Windows applications into your desktop.")
              (string-append "libdir=" %output "/lib/wine64"))
        #:phases
        (modify-phases %standard-phases
+         ;; Explicitely set both the 64-bit and 32-bit versions of vulkan-loader
+         ;; when installing to x86_64-linux so both are available.
+         ;; TODO: Add more JSON files as they become available in Mesa.
+         ,@(match (%current-system)
+           ((or "x86_64-linux")
+             `((add-after 'copy-wine32-binaries 'wrap-executable
+               (lambda* (#:key inputs outputs #:allow-other-keys)
+                 (let* ((out (assoc-ref outputs "out")))
+                   (wrap-program (string-append out "/bin/wine-preloader")
+                                 `("VK_ICD_FILENAMES" ":" =
+                                   (,(string-append (assoc-ref inputs "mesa")
+                                     "/share/vulkan/icd.d/radeon_icd.x86_64.json" ":"
+                                     (assoc-ref inputs "mesa")
+                                     "/share/vulkan/icd.d/intel_icd.x86_64.json" ":"
+                                     (assoc-ref inputs "wine")
+                                     "/share/vulkan/icd.d/radeon_icd.i686.json"))))
+                   (wrap-program (string-append out "/bin/wine64-preloader")
+                                 `("VK_ICD_FILENAMES" ":" =
+                                   (,(string-append (assoc-ref inputs "mesa")
+                                     "/share/vulkan/icd.d/radeon_icd.x86_64.json"
+                                     ":" (assoc-ref inputs "mesa")
+                                     "/share/vulkan/icd.d/intel_icd.x86_64.json"
+                                     ":" (assoc-ref inputs "wine")
+                                     "/share/vulkan/icd.d/radeon_icd.i686.json"))))
+                   #t)))))
+           (_
+            `())
+           )
          (add-after 'install 'copy-wine32-binaries
            (lambda* (#:key outputs #:allow-other-keys)
              (let* ((wine32 (assoc-ref %build-inputs "wine"))
@@ -193,7 +244,9 @@ integrate Windows applications into your desktop.")
                ;; Copy the 32-bit binaries needed for WoW64.
                (copy-file (string-append wine32 "/bin/wine")
                           (string-append out "/bin/wine"))
-               (copy-file (string-append wine32 "/bin/wine-preloader")
+               ;; Copy the real 32-bit wine-preloader instead of the wrapped
+               ;; version.
+               (copy-file (string-append wine32 "/bin/.wine-preloader-real")
                           (string-append out "/bin/wine-preloader"))
                #t)))
          (add-after 'compress-documentation 'copy-wine32-manpage
@@ -224,6 +277,36 @@ integrate Windows applications into your desktop.")
     (synopsis "Implementation of the Windows API (WoW64 version)")
     (supported-systems '("x86_64-linux" "aarch64-linux"))))
 
+;; This minimal build of Wine is needed to prevent a circular dependency with
+;; vkd3d.
+(define-public wine-minimal
+  (package
+    (inherit wine)
+    (name "wine-minimal")
+    (native-inputs (fold alist-delete (package-native-inputs wine)
+               '("gettext" "perl" "pkg-config")))
+    (inputs `())
+    (arguments
+     `(#:validate-runpath? #f
+       #:phases
+       (modify-phases %standard-phases
+         (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))))
+               #t))))
+       #:configure-flags
+       (list "--without-freetype"
+             "--without-x")
+       ,@(strip-keyword-arguments '(#:configure-flags #:phases)
+                                  (package-arguments wine))))))
+
 (define-public wine-staging-patchset-data
   (package
     (name "wine-staging-patchset-data")
@@ -291,7 +374,6 @@ integrate Windows applications into your desktop.")
               ("mesa" ,mesa)
               ("python" ,python)
               ("util-linux" ,util-linux) ; for hexdump
-              ("vkd3d" ,vkd3d)
               ("wine-staging-patchset-data" ,wine-staging-patchset-data)
               ,@(package-inputs wine)))
     (arguments