Merge branch 'master' into staging
[jackhill/guix/guix.git] / gnu / packages / wine.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015 Sou Bunnbu <iyzsong@gmail.com>
3 ;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
4 ;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
6 ;;; Copyright © 2017, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
7 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
8 ;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
9 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
16 ;;;
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
21 ;;;
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25 (define-module (gnu packages wine)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix utils)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system meson)
33 #:use-module (guix build-system trivial)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages admin)
36 #:use-module (gnu packages audio)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages base)
39 #:use-module (gnu packages bash)
40 #:use-module (gnu packages bison)
41 #:use-module (gnu packages compression)
42 #:use-module (gnu packages cups)
43 #:use-module (gnu packages databases)
44 #:use-module (gnu packages fontutils)
45 #:use-module (gnu packages flex)
46 #:use-module (gnu packages image)
47 #:use-module (gnu packages gcc)
48 #:use-module (gnu packages gettext)
49 #:use-module (gnu packages ghostscript)
50 #:use-module (gnu packages gl)
51 #:use-module (gnu packages glib)
52 #:use-module (gnu packages gstreamer)
53 #:use-module (gnu packages gtk)
54 #:use-module (gnu packages kerberos)
55 #:use-module (gnu packages linux)
56 #:use-module (gnu packages mingw)
57 #:use-module (gnu packages openldap)
58 #:use-module (gnu packages perl)
59 #:use-module (gnu packages pulseaudio)
60 #:use-module (gnu packages pkg-config)
61 #:use-module (gnu packages python)
62 #:use-module (gnu packages mp3)
63 #:use-module (gnu packages ncurses)
64 #:use-module (gnu packages photo)
65 #:use-module (gnu packages samba)
66 #:use-module (gnu packages scanner)
67 #:use-module (gnu packages sdl)
68 #:use-module (gnu packages tls)
69 #:use-module (gnu packages video)
70 #:use-module (gnu packages vulkan)
71 #:use-module (gnu packages xml)
72 #:use-module (gnu packages xorg)
73 #:use-module (ice-9 match)
74 #:use-module (srfi srfi-1))
75
76 (define-public wine
77 (package
78 (name "wine")
79 (version "5.0")
80 (source
81 (origin
82 (method url-fetch)
83 (uri (string-append "https://dl.winehq.org/wine/source/"
84 (version-major+minor version)
85 "/wine-" version ".tar.xz"))
86 (sha256
87 (base32 "1d0kcy338radq07hrnzcpc9lc9j2fvzjh37q673002x8d6x5058q"))))
88 (build-system gnu-build-system)
89 (native-inputs `(("pkg-config" ,pkg-config)
90 ("gettext" ,gettext-minimal)
91 ("flex" ,flex)
92 ("bison" ,bison)
93 ("perl" ,perl)))
94 (inputs
95 `(("alsa-lib" ,alsa-lib)
96 ("dbus" ,dbus)
97 ("cups" ,cups)
98 ("eudev" ,eudev)
99 ("faudio" ,faudio)
100 ("fontconfig" ,fontconfig)
101 ("freetype" ,freetype)
102 ("glu" ,glu)
103 ("gnutls" ,gnutls)
104 ("gst-plugins-base" ,gst-plugins-base)
105 ("lcms" ,lcms)
106 ("libxml2" ,libxml2)
107 ("libxslt" ,libxslt)
108 ("libgphoto2" ,libgphoto2)
109 ("libmpg123" ,mpg123)
110 ("libldap" ,openldap)
111 ("libnetapi" ,samba)
112 ("libsane" ,sane-backends)
113 ("libpcap" ,libpcap)
114 ("libpng" ,libpng)
115 ("libjpeg" ,libjpeg)
116 ("libtiff" ,libtiff)
117 ("libICE" ,libice)
118 ("libX11" ,libx11)
119 ("libXi" ,libxi)
120 ("libXext" ,libxext)
121 ("libXcursor" ,libxcursor)
122 ("libXrender" ,libxrender)
123 ("libXrandr" ,libxrandr)
124 ("libXinerama" ,libxinerama)
125 ("libXxf86vm" ,libxxf86vm)
126 ("libXcomposite" ,libxcomposite)
127 ("mit-krb5" ,mit-krb5)
128 ("ncurses" ,ncurses)
129 ("openal" ,openal)
130 ("pulseaudio" ,pulseaudio)
131 ("sdl2" ,sdl2)
132 ("unixodbc" ,unixodbc)
133 ("v4l-utils" ,v4l-utils)
134 ("vkd3d" ,vkd3d)
135 ("vulkan-loader" ,vulkan-loader)
136 ("zlib" ,zlib)))
137 (arguments
138 `(;; Force a 32-bit build targeting a similar architecture, i.e.:
139 ;; armhf for armhf/aarch64, i686 for i686/x86_64.
140 #:system ,@(match (%current-system)
141 ((or "armhf-linux" "aarch64-linux")
142 `("armhf-linux"))
143 (_
144 `("i686-linux")))
145
146 ;; XXX: There's a test suite, but it's unclear whether it's supposed to
147 ;; pass.
148 #:tests? #f
149
150 #:configure-flags
151 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine32"))
152
153 #:make-flags
154 (list "SHELL=bash"
155 (string-append "libdir=" %output "/lib/wine32"))
156
157 #:phases
158 (modify-phases %standard-phases
159 ;; Explicitly set the 32-bit version of vulkan-loader when installing
160 ;; to i686-linux or x86_64-linux.
161 ;; TODO: Add more JSON files as they become available in Mesa.
162 ,@(match (%current-system)
163 ((or "i686-linux" "x86_64-linux")
164 `((add-after 'install 'wrap-executable
165 (lambda* (#:key inputs outputs #:allow-other-keys)
166 (let* ((out (assoc-ref outputs "out"))
167 (icd (string-append out "/share/vulkan/icd.d")))
168 (mkdir-p icd)
169 (copy-file (string-append (assoc-ref inputs "mesa")
170 "/share/vulkan/icd.d/radeon_icd.i686.json")
171 (string-append icd "/radeon_icd.i686.json"))
172 (copy-file (string-append (assoc-ref inputs "mesa")
173 "/share/vulkan/icd.d/intel_icd.i686.json")
174 (string-append icd "/intel_icd.i686.json"))
175 (wrap-program (string-append out "/bin/wine-preloader")
176 `("VK_ICD_FILENAMES" ":" =
177 (,(string-append icd
178 "/radeon_icd.i686.json" ":"
179 icd "/intel_icd.i686.json"))))
180 #t)))))
181 (_
182 `())
183 )
184 (add-after 'configure 'patch-dlopen-paths
185 ;; Hardcode dlopened sonames to absolute paths.
186 (lambda _
187 (let* ((library-path (search-path-as-string->list
188 (getenv "LIBRARY_PATH")))
189 (find-so (lambda (soname)
190 (search-path library-path soname))))
191 (substitute* "include/config.h"
192 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
193 (format #f "~a\"~a\"" defso (find-so soname))))
194 #t))))))
195 (home-page "https://www.winehq.org/")
196 (synopsis "Implementation of the Windows API (32-bit only)")
197 (description
198 "Wine (originally an acronym for \"Wine Is Not an Emulator\") is a
199 compatibility layer capable of running Windows applications. Instead of
200 simulating internal Windows logic like a virtual machine or emulator, Wine
201 translates Windows API calls into POSIX calls on-the-fly, eliminating the
202 performance and memory penalties of other methods and allowing you to cleanly
203 integrate Windows applications into your desktop.")
204 ;; Any platform should be able to build wine, but based on '#:system' these
205 ;; are thr ones we currently support.
206 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
207 (license license:lgpl2.1+)))
208
209 (define-public wine64
210 (package
211 (inherit wine)
212 (name "wine64")
213 (inputs `(("wine" ,wine)
214 ,@(package-inputs wine)))
215 (arguments
216 `(#:make-flags
217 (list "SHELL=bash"
218 (string-append "libdir=" %output "/lib/wine64"))
219 #:phases
220 (modify-phases %standard-phases
221 ;; Explicitly set both the 64-bit and 32-bit versions of vulkan-loader
222 ;; when installing to x86_64-linux so both are available.
223 ;; TODO: Add more JSON files as they become available in Mesa.
224 ,@(match (%current-system)
225 ((or "x86_64-linux")
226 `((add-after 'copy-wine32-binaries 'wrap-executable
227 (lambda* (#:key inputs outputs #:allow-other-keys)
228 (let* ((out (assoc-ref outputs "out")))
229 (wrap-program (string-append out "/bin/wine-preloader")
230 `("VK_ICD_FILENAMES" ":" =
231 (,(string-append (assoc-ref inputs "mesa")
232 "/share/vulkan/icd.d/radeon_icd.x86_64.json" ":"
233 (assoc-ref inputs "mesa")
234 "/share/vulkan/icd.d/intel_icd.x86_64.json" ":"
235 (assoc-ref inputs "wine")
236 "/share/vulkan/icd.d/radeon_icd.i686.json" ":"
237 (assoc-ref inputs "wine")
238 "/share/vulkan/icd.d/intel_icd.i686.json"))))
239 (wrap-program (string-append out "/bin/wine64-preloader")
240 `("VK_ICD_FILENAMES" ":" =
241 (,(string-append (assoc-ref inputs "mesa")
242 "/share/vulkan/icd.d/radeon_icd.x86_64.json"
243 ":" (assoc-ref inputs "mesa")
244 "/share/vulkan/icd.d/intel_icd.x86_64.json"
245 ":" (assoc-ref inputs "wine")
246 "/share/vulkan/icd.d/radeon_icd.i686.json"
247 ":" (assoc-ref inputs "wine")
248 "/share/vulkan/icd.d/intel_icd.i686.json"))))
249 #t)))))
250 (_
251 `())
252 )
253 (add-after 'install 'copy-wine32-binaries
254 (lambda* (#:key outputs #:allow-other-keys)
255 (let* ((wine32 (assoc-ref %build-inputs "wine"))
256 (out (assoc-ref %outputs "out")))
257 ;; Copy the 32-bit binaries needed for WoW64.
258 (copy-file (string-append wine32 "/bin/wine")
259 (string-append out "/bin/wine"))
260 ;; Copy the real 32-bit wine-preloader instead of the wrapped
261 ;; version.
262 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
263 (string-append out "/bin/wine-preloader"))
264 #t)))
265 (add-after 'compress-documentation 'copy-wine32-manpage
266 (lambda* (#:key outputs #:allow-other-keys)
267 (let* ((wine32 (assoc-ref %build-inputs "wine"))
268 (out (assoc-ref %outputs "out")))
269 ;; Copy the missing man file for the wine binary from wine.
270 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
271 (string-append out "/share/man/man1/wine.1.gz"))
272 #t)))
273 (add-after 'configure 'patch-dlopen-paths
274 ;; Hardcode dlopened sonames to absolute paths.
275 (lambda _
276 (let* ((library-path (search-path-as-string->list
277 (getenv "LIBRARY_PATH")))
278 (find-so (lambda (soname)
279 (search-path library-path soname))))
280 (substitute* "include/config.h"
281 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
282 (format #f "~a\"~a\"" defso (find-so soname))))
283 #t))))
284 #:configure-flags
285 (list "--enable-win64"
286 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
287 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
288 #:system)
289 (package-arguments wine))))
290 (synopsis "Implementation of the Windows API (WoW64 version)")
291 (supported-systems '("x86_64-linux" "aarch64-linux"))))
292
293 ;; This minimal build of Wine is needed to prevent a circular dependency with
294 ;; vkd3d.
295 (define-public wine-minimal
296 (package
297 (inherit wine)
298 (name "wine-minimal")
299 (native-inputs (fold alist-delete (package-native-inputs wine)
300 '("gettext" "perl" "pkg-config")))
301 (inputs `())
302 (arguments
303 `(#:validate-runpath? #f
304 #:phases
305 (modify-phases %standard-phases
306 (add-after 'configure 'patch-dlopen-paths
307 ;; Hardcode dlopened sonames to absolute paths.
308 (lambda _
309 (let* ((library-path (search-path-as-string->list
310 (getenv "LIBRARY_PATH")))
311 (find-so (lambda (soname)
312 (search-path library-path soname))))
313 (substitute* "include/config.h"
314 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
315 (format #f "~a\"~a\"" defso (find-so soname))))
316 #t))))
317 #:configure-flags
318 (list "--without-freetype"
319 "--without-x")
320 ,@(strip-keyword-arguments '(#:configure-flags #:phases)
321 (package-arguments wine))))))
322
323 (define-public wine-staging-patchset-data
324 (package
325 (name "wine-staging-patchset-data")
326 (version "5.0")
327 (source
328 (origin
329 (method git-fetch)
330 (uri (git-reference
331 (url "https://github.com/wine-staging/wine-staging")
332 (commit (string-append "v" version))))
333 (file-name (git-file-name name version))
334 (sha256
335 (base32 "054m2glvav29qnlgr3p36kahyv3kbxzba82djzqpc7cmsrin0d3f"))))
336 (build-system trivial-build-system)
337 (native-inputs
338 `(("bash" ,bash)
339 ("coreutils" ,coreutils)))
340 (arguments
341 `(#:modules ((guix build utils))
342 #:builder
343 (begin
344 (use-modules (guix build utils))
345 (let* ((build-directory ,(string-append name "-" version))
346 (source (assoc-ref %build-inputs "source"))
347 (bash (assoc-ref %build-inputs "bash"))
348 (coreutils (assoc-ref %build-inputs "coreutils"))
349 (out (assoc-ref %outputs "out"))
350 (wine-staging (string-append out "/share/wine-staging")))
351 (copy-recursively source build-directory)
352 (with-directory-excursion build-directory
353 (substitute* "patches/patchinstall.sh"
354 (("/bin/sh")
355 (string-append bash "/bin/sh")))
356 (substitute* "patches/gitapply.sh"
357 (("/usr/bin/env")
358 (string-append coreutils "/bin/env"))))
359 (copy-recursively build-directory wine-staging)
360 #t))))
361 (home-page "https://github.com/wine-staging")
362 (synopsis "Patchset for Wine")
363 (description
364 "wine-staging-patchset-data contains the patchset to build Wine-Staging.")
365 (license license:lgpl2.1+)))
366
367 (define-public wine-staging
368 (package
369 (inherit wine)
370 (name "wine-staging")
371 (version (package-version wine-staging-patchset-data))
372 (source
373 (origin
374 (method url-fetch)
375 (uri (let ((dir (string-append
376 (version-major version)
377 (if (string-suffix? ".0" (version-major+minor version))
378 ".0"
379 ".x"))))
380 (string-append
381 "https://dl.winehq.org/wine/source/" dir
382 "/wine-" version ".tar.xz")))
383 (file-name (string-append name "-" version ".tar.xz"))
384 (sha256
385 (base32 "1d0kcy338radq07hrnzcpc9lc9j2fvzjh37q673002x8d6x5058q"))))
386 (inputs `(("autoconf" ,autoconf) ; for autoreconf
387 ("ffmpeg" ,ffmpeg)
388 ("gtk+" ,gtk+)
389 ("libva" ,libva)
390 ("mesa" ,mesa)
391 ("python" ,python)
392 ("util-linux" ,util-linux) ; for hexdump
393 ("wine-staging-patchset-data" ,wine-staging-patchset-data)
394 ,@(package-inputs wine)))
395 (arguments
396 `(#:phases
397 (modify-phases %standard-phases
398 ;; Explicitly set the 32-bit version of vulkan-loader when installing
399 ;; to i686-linux or x86_64-linux.
400 ;; TODO: Add more JSON files as they become available in Mesa.
401 ,@(match (%current-system)
402 ((or "i686-linux" "x86_64-linux")
403 `((add-after 'install 'wrap-executable
404 (lambda* (#:key inputs outputs #:allow-other-keys)
405 (let* ((out (assoc-ref outputs "out"))
406 (icd (string-append out "/share/vulkan/icd.d")))
407 (mkdir-p icd)
408 (copy-file (string-append (assoc-ref inputs "mesa")
409 "/share/vulkan/icd.d/radeon_icd.i686.json")
410 (string-append icd "/radeon_icd.i686.json"))
411 (copy-file (string-append (assoc-ref inputs "mesa")
412 "/share/vulkan/icd.d/intel_icd.i686.json")
413 (string-append icd "/intel_icd.i686.json"))
414 (wrap-program (string-append out "/bin/wine-preloader")
415 `("VK_ICD_FILENAMES" ":" =
416 (,(string-append icd
417 "/radeon_icd.i686.json" ":"
418 icd "/intel_icd.i686.json"))))
419 #t)))))
420 (_
421 `())
422 )
423 (add-before 'configure 'patch-source-wine-staging
424 (lambda* (#:key outputs #:allow-other-keys)
425 (let* ((source (assoc-ref %build-inputs "source"))
426 (script (string-append (assoc-ref %build-inputs
427 "wine-staging-patchset-data")
428 "/share/wine-staging/patches/patchinstall.sh")))
429 (invoke script (string-append "DESTDIR=" ".") "--all")
430 #t)))
431 (add-after 'configure 'patch-dlopen-paths
432 ;; Hardcode dlopened sonames to absolute paths.
433 (lambda _
434 (let* ((library-path (search-path-as-string->list
435 (getenv "LIBRARY_PATH")))
436 (find-so (lambda (soname)
437 (search-path library-path soname))))
438 (substitute* "include/config.h"
439 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
440 (format #f "~a\"~a\"" defso (find-so soname))))
441 #t))))
442 ,@(strip-keyword-arguments '(#:phases)
443 (package-arguments wine))))
444 (synopsis "Implementation of the Windows API (staging branch, 32-bit only)")
445 (description "Wine-Staging is the testing area of Wine. It
446 contains bug fixes and features, which have not been integrated into
447 the development branch yet. The idea of Wine-Staging is to provide
448 experimental features faster to end users and to give developers the
449 possibility to discuss and improve their patches before they are
450 integrated into the main branch.")
451 (home-page "https://github.com/wine-staging")
452 ;; In addition to the regular Wine license (lgpl2.1+), Wine-Staging
453 ;; provides Liberation and WenQuanYi Micro Hei fonts. Those use
454 ;; different licenses. In particular, the latter is licensed under
455 ;; both GPL3+ and Apache 2 License.
456 (license
457 (list license:lgpl2.1+ license:silofl1.1 license:gpl3+ license:asl2.0))))
458
459 (define-public wine64-staging
460 (package
461 (inherit wine-staging)
462 (name "wine64-staging")
463 (inputs `(("wine-staging" ,wine-staging)
464 ,@(package-inputs wine-staging)))
465 (arguments
466 `(#:make-flags
467 (list "SHELL=bash"
468 (string-append "libdir=" %output "/lib/wine64"))
469 #:phases
470 (modify-phases %standard-phases
471 ;; Explicitly set both the 64-bit and 32-bit versions of vulkan-loader
472 ;; when installing to x86_64-linux so both are available.
473 ;; TODO: Add more JSON files as they become available in Mesa.
474 ,@(match (%current-system)
475 ((or "x86_64-linux")
476 `((add-after 'copy-wine32-binaries 'wrap-executable
477 (lambda* (#:key inputs outputs #:allow-other-keys)
478 (let* ((out (assoc-ref outputs "out")))
479 (wrap-program (string-append out "/bin/wine-preloader")
480 `("VK_ICD_FILENAMES" ":" =
481 (,(string-append (assoc-ref inputs "mesa")
482 "/share/vulkan/icd.d/radeon_icd.x86_64.json" ":"
483 (assoc-ref inputs "mesa")
484 "/share/vulkan/icd.d/intel_icd.x86_64.json" ":"
485 (assoc-ref inputs "wine-staging")
486 "/share/vulkan/icd.d/radeon_icd.i686.json" ":"
487 (assoc-ref inputs "wine-staging")
488 "/share/vulkan/icd.d/intel_icd.i686.json"))))
489 (wrap-program (string-append out "/bin/wine64-preloader")
490 `("VK_ICD_FILENAMES" ":" =
491 (,(string-append (assoc-ref inputs "mesa")
492 "/share/vulkan/icd.d/radeon_icd.x86_64.json"
493 ":" (assoc-ref inputs "mesa")
494 "/share/vulkan/icd.d/intel_icd.x86_64.json"
495 ":" (assoc-ref inputs "wine-staging")
496 "/share/vulkan/icd.d/radeon_icd.i686.json"
497 ":" (assoc-ref inputs "wine-staging")
498 "/share/vulkan/icd.d/intel_icd.i686.json"))))
499 #t)))))
500 (_
501 `())
502 )
503 (add-before 'configure 'patch-source-wine-staging
504 (lambda* (#:key outputs #:allow-other-keys)
505 (let* ((source (assoc-ref %build-inputs "source"))
506 (script (string-append (assoc-ref %build-inputs
507 "wine-staging-patchset-data")
508 "/share/wine-staging/patches/patchinstall.sh")))
509 (invoke script (string-append "DESTDIR=" ".") "--all")
510 #t)))
511 (add-after 'install 'copy-wine32-binaries
512 (lambda* (#:key outputs #:allow-other-keys)
513 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
514 (out (assoc-ref %outputs "out")))
515 ;; Copy the 32-bit binaries needed for WoW64.
516 (copy-file (string-append wine32 "/bin/wine")
517 (string-append out "/bin/wine"))
518 ;; Copy the real 32-bit wine-preloader instead of the wrapped
519 ;; version.
520 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
521 (string-append out "/bin/wine-preloader"))
522 #t)))
523 (add-after 'compress-documentation 'copy-wine32-manpage
524 (lambda* (#:key outputs #:allow-other-keys)
525 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
526 (out (assoc-ref %outputs "out")))
527 ;; Copy the missing man file for the wine binary from
528 ;; wine-staging.
529 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
530 (string-append out "/share/man/man1/wine.1.gz"))
531 #t)))
532 (add-after 'configure 'patch-dlopen-paths
533 ;; Hardcode dlopened sonames to absolute paths.
534 (lambda _
535 (let* ((library-path (search-path-as-string->list
536 (getenv "LIBRARY_PATH")))
537 (find-so (lambda (soname)
538 (search-path library-path soname))))
539 (substitute* "include/config.h"
540 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
541 (format #f "~a\"~a\"" defso (find-so soname))))
542 #t))))
543 #:configure-flags
544 (list "--enable-win64"
545 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
546 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
547 #:system)
548 (package-arguments wine-staging))))
549 (synopsis "Implementation of the Windows API (staging branch, WoW64
550 version)")
551 (supported-systems '("x86_64-linux" "aarch64-linux"))))
552
553 (define dxvk32
554 ;; This package provides 32-bit dxvk libraries on 64-bit systems.
555 (package
556 (name "dxvk32")
557 (version "1.5")
558 (home-page "https://github.com/doitsujin/dxvk/")
559 (source (origin
560 (method git-fetch)
561 (uri (git-reference
562 (url home-page)
563 (commit (string-append "v" version))))
564 (file-name (git-file-name name version))
565 (sha256
566 (base32
567 "009p99jkskrmy186gsqrf0p3v9z3lskw51r4vdp35af057q26a6x"))))
568 (build-system meson-build-system)
569 (arguments
570 `(#:system "i686-linux"
571 #:configure-flags (list "--cross-file"
572 (string-append (assoc-ref %build-inputs "source")
573 "/build-wine32.txt"))))
574 (native-inputs
575 ;; Since 1.5 dxvk needs gcc-8.1. See
576 ;; https://github.com/doitsujin/dxvk/issues/1292#issuecomment-567067373.
577 `(("gcc" ,gcc-9)
578 ("glslang" ,glslang)))
579 (inputs
580 `(("wine" ,wine-staging)))
581 (synopsis "Vulkan-based D3D9, D3D10 and D3D11 implementation for Wine")
582 (description "A Vulkan-based translation layer for Direct3D 9/10/11 which
583 allows running complex 3D applications with high performance using Wine.
584
585 Use @command{setup_dxvk} to install the required libraries to a Wine prefix.")
586 (supported-systems '("x86_64-linux"))
587 (license license:zlib)))
588
589 (define-public dxvk
590 (package
591 (inherit dxvk32)
592 (name "dxvk")
593 (arguments
594 `(#:configure-flags (list "--cross-file"
595 (string-append (assoc-ref %build-inputs "source")
596 "/build-wine"
597 ,(match (%current-system)
598 ("x86_64-linux" "64")
599 (_ "32"))
600 ".txt"))
601 #:phases
602 (modify-phases %standard-phases
603 ,@(if (string=? (%current-system) "x86_64-linux")
604 `((add-after 'unpack 'install-32
605 (lambda* (#:key inputs outputs #:allow-other-keys)
606 (let* ((out (assoc-ref outputs "out"))
607 (dxvk32 (assoc-ref inputs "dxvk32")))
608 (mkdir-p (string-append out "/lib32"))
609 (copy-recursively (string-append dxvk32 "/lib")
610 (string-append out "/lib32"))))))
611 '())
612 (add-after 'install 'install-setup
613 (lambda* (#:key inputs outputs #:allow-other-keys)
614 (let* ((out (assoc-ref outputs "out"))
615 (bin (string-append out "/bin/setup_dxvk")))
616 (mkdir-p (string-append out "/bin"))
617 (copy-file "../source/setup_dxvk.sh"
618 bin)
619 (chmod bin #o755)
620 (substitute* bin
621 (("wine=\"wine\"")
622 (string-append "wine=" (assoc-ref inputs "wine") "/bin/wine"))
623 (("x32") ,(match (%current-system)
624 ("x86_64-linux" "../lib32")
625 (_ "../lib")))
626 (("x64") "../lib"))))))))
627 (inputs
628 `(("wine" ,(match (%current-system)
629 ;; ("x86_64-linux" wine64)
630 ("x86_64-linux" wine64-staging)
631 ;; ("x86_64-linux" mingw-w64-x86_64)
632 (_ wine)))
633 ,@(match (%current-system)
634 ("x86_64-linux"
635 `(("dxvk32" ,dxvk32)))
636 (_ '()))
637 ))
638 (supported-systems '("i686-linux" "x86_64-linux"))))