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