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