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