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