gnu: wine: Update to 5.3.
[jackhill/guix/guix.git] / gnu / packages / wine.scm
CommitLineData
8f9580ca 1;;; GNU Guix --- Functional package management for GNU
d43ba6f8 2;;; Copyright © 2014, 2015 Sou Bunnbu <iyzsong@gmail.com>
eeabe5a1 3;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net>
7ba2a1af 4;;; Copyright © 2016, 2017, 2018 Efraim Flashner <efraim@flashner.co.il>
a51ac7af 5;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
4b506a3f 6;;; Copyright © 2017, 2020 Nicolas Goaziou <mail@nicolasgoaziou.fr>
ac12a013 7;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
76dbadac 8;;; Copyright © 2019 Pierre Neidhardt <mail@ambrevar.xyz>
8f9580ca
SB
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)
f868276b 29 #:use-module (guix git-download)
eeabe5a1 30 #:use-module (guix utils)
8f9580ca 31 #:use-module (guix build-system gnu)
76dbadac 32 #:use-module (guix build-system meson)
f6246195 33 #:use-module (guix build-system trivial)
8f9580ca 34 #:use-module (gnu packages)
1aa6582e 35 #:use-module (gnu packages admin)
025cc9a1 36 #:use-module (gnu packages audio)
b53b9c8d 37 #:use-module (gnu packages autotools)
f6246195
RH
38 #:use-module (gnu packages base)
39 #:use-module (gnu packages bash)
8f9580ca
SB
40 #:use-module (gnu packages bison)
41 #:use-module (gnu packages compression)
025cc9a1 42 #:use-module (gnu packages cups)
8f9580ca
SB
43 #:use-module (gnu packages databases)
44 #:use-module (gnu packages fontutils)
45 #:use-module (gnu packages flex)
46 #:use-module (gnu packages image)
f2c71f62 47 #:use-module (gnu packages gcc)
8f9580ca
SB
48 #:use-module (gnu packages gettext)
49 #:use-module (gnu packages ghostscript)
50 #:use-module (gnu packages gl)
51 #:use-module (gnu packages glib)
1aa6582e 52 #:use-module (gnu packages gstreamer)
141708ed 53 #:use-module (gnu packages gtk)
d95e4864 54 #:use-module (gnu packages kerberos)
8f9580ca 55 #:use-module (gnu packages linux)
76dbadac 56 #:use-module (gnu packages mingw)
8f9580ca
SB
57 #:use-module (gnu packages openldap)
58 #:use-module (gnu packages perl)
05740895 59 #:use-module (gnu packages pulseaudio)
8f9580ca 60 #:use-module (gnu packages pkg-config)
b53b9c8d 61 #:use-module (gnu packages python)
8f9580ca
SB
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)
51158d83 67 #:use-module (gnu packages sdl)
a7fd7b68 68 #:use-module (gnu packages tls)
1aa6582e 69 #:use-module (gnu packages video)
39b4744a 70 #:use-module (gnu packages vulkan)
8f9580ca 71 #:use-module (gnu packages xml)
b4a330ac 72 #:use-module (gnu packages xorg)
a5466f38
RH
73 #:use-module (ice-9 match)
74 #:use-module (srfi srfi-1))
8f9580ca
SB
75
76(define-public wine
77 (package
78 (name "wine")
d8104034 79 (version "5.3")
4b506a3f
NG
80 (source
81 (origin
82 (method url-fetch)
d8104034
NG
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"))
4b506a3f 90 (sha256
d8104034 91 (base32 "1pkzj3656ad0vmc7ciwfzn45lb2kxwbyymfwnqaa105dicicf6wv"))))
8f9580ca 92 (build-system gnu-build-system)
d8104034
NG
93 (native-inputs
94 `(("bison" ,bison)
95 ("flex" ,flex)
96 ("gettext" ,gettext-minimal)
97 ("perl" ,perl)
98 ("pkg-config" ,pkg-config)))
8f9580ca
SB
99 (inputs
100 `(("alsa-lib" ,alsa-lib)
101 ("dbus" ,dbus)
025cc9a1 102 ("cups" ,cups)
1aa6582e 103 ("eudev" ,eudev)
ffa37422 104 ("faudio" ,faudio)
8f9580ca
SB
105 ("fontconfig" ,fontconfig)
106 ("freetype" ,freetype)
025cc9a1 107 ("glu" ,glu)
8f9580ca 108 ("gnutls" ,gnutls)
1aa6582e 109 ("gst-plugins-base" ,gst-plugins-base)
8f9580ca
SB
110 ("lcms" ,lcms)
111 ("libxml2" ,libxml2)
112 ("libxslt" ,libxslt)
113 ("libgphoto2" ,libgphoto2)
114 ("libmpg123" ,mpg123)
115 ("libldap" ,openldap)
116 ("libnetapi" ,samba)
4c928743 117 ("libsane" ,sane-backends)
1aa6582e 118 ("libpcap" ,libpcap)
8f9580ca
SB
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)
d95e4864 132 ("mit-krb5" ,mit-krb5)
8f9580ca 133 ("ncurses" ,ncurses)
025cc9a1 134 ("openal" ,openal)
05740895 135 ("pulseaudio" ,pulseaudio)
0e41f95e 136 ("sdl2" ,sdl2)
8f9580ca 137 ("unixodbc" ,unixodbc)
1aa6582e 138 ("v4l-utils" ,v4l-utils)
e3b1d4ea 139 ("vkd3d" ,vkd3d)
0e41f95e 140 ("vulkan-loader" ,vulkan-loader)
8f9580ca
SB
141 ("zlib" ,zlib)))
142 (arguments
b4a330ac
EF
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")))
8f9580ca
SB
150
151 ;; XXX: There's a test suite, but it's unclear whether it's supposed to
152 ;; pass.
153 #:tests? #f
154
6c0dfb19 155 #:configure-flags
5cead945 156 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine32"))
6c0dfb19 157
eeabe5a1 158 #:make-flags
5cead945
RH
159 (list "SHELL=bash"
160 (string-append "libdir=" %output "/lib/wine32"))
eeabe5a1 161
8f9580ca 162 #:phases
07cda02c 163 (modify-phases %standard-phases
2f7bdf53 164 ;; Explicitly set the 32-bit version of vulkan-loader when installing
d39a54ff
RH
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"))
c94884bc
RH
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"))
d39a54ff
RH
180 (wrap-program (string-append out "/bin/wine-preloader")
181 `("VK_ICD_FILENAMES" ":" =
182 (,(string-append icd
c94884bc
RH
183 "/radeon_icd.i686.json" ":"
184 icd "/intel_icd.i686.json"))))
d39a54ff
RH
185 #t)))))
186 (_
187 `())
188 )
07cda02c
EF
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))))))
658c987f 200 (home-page "https://www.winehq.org/")
06e57331 201 (synopsis "Implementation of the Windows API (32-bit only)")
8f9580ca
SB
202 (description
203 "Wine (originally an acronym for \"Wine Is Not an Emulator\") is a
204compatibility layer capable of running Windows applications. Instead of
205simulating internal Windows logic like a virtual machine or emulator, Wine
206translates Windows API calls into POSIX calls on-the-fly, eliminating the
207performance and memory penalties of other methods and allowing you to cleanly
208integrate Windows applications into your desktop.")
7ba2a1af
EF
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"))
cac274aa 212 (license license:lgpl2.1+)))
b3ebd241
RH
213
214(define-public wine64
215 (package
216 (inherit wine)
217 (name "wine64")
58cbcb02
RH
218 (inputs `(("wine" ,wine)
219 ,@(package-inputs wine)))
b3ebd241 220 (arguments
e02693a3
RH
221 `(#:make-flags
222 (list "SHELL=bash"
58cbcb02
RH
223 (string-append "libdir=" %output "/lib/wine64"))
224 #:phases
225 (modify-phases %standard-phases
2f7bdf53 226 ;; Explicitly set both the 64-bit and 32-bit versions of vulkan-loader
d39a54ff
RH
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")
c94884bc
RH
241 "/share/vulkan/icd.d/radeon_icd.i686.json" ":"
242 (assoc-ref inputs "wine")
243 "/share/vulkan/icd.d/intel_icd.i686.json"))))
d39a54ff
RH
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")
c94884bc
RH
251 "/share/vulkan/icd.d/radeon_icd.i686.json"
252 ":" (assoc-ref inputs "wine")
253 "/share/vulkan/icd.d/intel_icd.i686.json"))))
d39a54ff
RH
254 #t)))))
255 (_
256 `())
257 )
036f3577 258 (add-after 'install 'copy-wine32-binaries
58cbcb02 259 (lambda* (#:key outputs #:allow-other-keys)
036f3577
RH
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"))
d39a54ff
RH
265 ;; Copy the real 32-bit wine-preloader instead of the wrapped
266 ;; version.
267 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
036f3577
RH
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)))
58cbcb02
RH
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))))
e02693a3 289 #:configure-flags
b3ebd241 290 (list "--enable-win64"
58cbcb02
RH
291 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
292 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
293 #:system)
b3ebd241 294 (package-arguments wine))))
68e49211 295 (synopsis "Implementation of the Windows API (WoW64 version)")
5010d0e3 296 (supported-systems '("x86_64-linux" "aarch64-linux"))))
f6444059 297
a5466f38
RH
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
d39a54ff
RH
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))))
a5466f38
RH
322 #:configure-flags
323 (list "--without-freetype"
324 "--without-x")
d39a54ff 325 ,@(strip-keyword-arguments '(#:configure-flags #:phases)
a5466f38
RH
326 (package-arguments wine))))))
327
f6246195
RH
328(define-public wine-staging-patchset-data
329 (package
cb2ad4f5 330 (name "wine-staging-patchset-data")
b8088be0 331 (version "5.0")
cb2ad4f5
RH
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
b8088be0 340 (base32 "054m2glvav29qnlgr3p36kahyv3kbxzba82djzqpc7cmsrin0d3f"))))
cb2ad4f5
RH
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+)))
f6246195 371
7866d8c8
NG
372(define-public wine-staging
373 (package
374 (inherit wine)
375 (name "wine-staging")
b53b9c8d 376 (version (package-version wine-staging-patchset-data))
b8088be0
NG
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 "1d0kcy338radq07hrnzcpc9lc9j2fvzjh37q673002x8d6x5058q"))))
391 (inputs `(("autoconf" ,autoconf) ; for autoreconf
a51ac7af 392 ("ffmpeg" ,ffmpeg)
c695fb76
TGR
393 ("gtk+" ,gtk+)
394 ("libva" ,libva)
cb2ad4f5 395 ("mesa" ,mesa)
b53b9c8d
RH
396 ("python" ,python)
397 ("util-linux" ,util-linux) ; for hexdump
b53b9c8d 398 ("wine-staging-patchset-data" ,wine-staging-patchset-data)
141708ed 399 ,@(package-inputs wine)))
39b4744a
RH
400 (arguments
401 `(#:phases
402 (modify-phases %standard-phases
2f7bdf53 403 ;; Explicitly set the 32-bit version of vulkan-loader when installing
cb2ad4f5
RH
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"))
c94884bc
RH
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"))
cb2ad4f5
RH
419 (wrap-program (string-append out "/bin/wine-preloader")
420 `("VK_ICD_FILENAMES" ":" =
421 (,(string-append icd
c94884bc
RH
422 "/radeon_icd.i686.json" ":"
423 icd "/intel_icd.i686.json"))))
cb2ad4f5
RH
424 #t)))))
425 (_
426 `())
427 )
b53b9c8d 428 (add-before 'configure 'patch-source-wine-staging
39b4744a 429 (lambda* (#:key outputs #:allow-other-keys)
b53b9c8d
RH
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")))
09fd82ce 434 (invoke script (string-append "DESTDIR=" ".") "--all")
39b4744a
RH
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))))
95c45e53 449 (synopsis "Implementation of the Windows API (staging branch, 32-bit only)")
7866d8c8
NG
450 (description "Wine-Staging is the testing area of Wine. It
451contains bug fixes and features, which have not been integrated into
452the development branch yet. The idea of Wine-Staging is to provide
453experimental features faster to end users and to give developers the
454possibility to discuss and improve their patches before they are
455integrated into the main branch.")
b53b9c8d 456 (home-page "https://github.com/wine-staging")
7866d8c8
NG
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))))
6cd46747
RH
463
464(define-public wine64-staging
465 (package
466 (inherit wine-staging)
467 (name "wine64-staging")
c41fb54f
RH
468 (inputs `(("wine-staging" ,wine-staging)
469 ,@(package-inputs wine-staging)))
6cd46747
RH
470 (arguments
471 `(#:make-flags
472 (list "SHELL=bash"
c41fb54f
RH
473 (string-append "libdir=" %output "/lib/wine64"))
474 #:phases
475 (modify-phases %standard-phases
2f7bdf53 476 ;; Explicitly set both the 64-bit and 32-bit versions of vulkan-loader
cb2ad4f5
RH
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")
c94884bc
RH
491 "/share/vulkan/icd.d/radeon_icd.i686.json" ":"
492 (assoc-ref inputs "wine-staging")
493 "/share/vulkan/icd.d/intel_icd.i686.json"))))
cb2ad4f5
RH
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")
c94884bc
RH
501 "/share/vulkan/icd.d/radeon_icd.i686.json"
502 ":" (assoc-ref inputs "wine-staging")
503 "/share/vulkan/icd.d/intel_icd.i686.json"))))
cb2ad4f5
RH
504 #t)))))
505 (_
506 `())
507 )
3139f185 508 (add-before 'configure 'patch-source-wine-staging
ee5402bf 509 (lambda* (#:key outputs #:allow-other-keys)
3139f185
RH
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")))
036feaf9 514 (invoke script (string-append "DESTDIR=" ".") "--all")
ee5402bf 515 #t)))
e6b94a02
RH
516 (add-after 'install 'copy-wine32-binaries
517 (lambda* (#:key outputs #:allow-other-keys)
417903c6 518 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
e6b94a02
RH
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"))
cb2ad4f5
RH
523 ;; Copy the real 32-bit wine-preloader instead of the wrapped
524 ;; version.
525 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
e6b94a02
RH
526 (string-append out "/bin/wine-preloader"))
527 #t)))
528 (add-after 'compress-documentation 'copy-wine32-manpage
c41fb54f 529 (lambda* (#:key outputs #:allow-other-keys)
417903c6 530 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
e6b94a02
RH
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)))
c41fb54f
RH
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))))
6cd46747
RH
548 #:configure-flags
549 (list "--enable-win64"
c41fb54f
RH
550 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
551 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
552 #:system)
6cd46747 553 (package-arguments wine-staging))))
1adc6013 554 (synopsis "Implementation of the Windows API (staging branch, WoW64
6cd46747
RH
555version)")
556 (supported-systems '("x86_64-linux" "aarch64-linux"))))
76dbadac
PN
557
558(define dxvk32
559 ;; This package provides 32-bit dxvk libraries on 64-bit systems.
560 (package
561 (name "dxvk32")
adb1e3b6 562 (version "1.5.5")
76dbadac
PN
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
adb1e3b6 572 "1inl0qswgvbp0fs76md86ilqf9mbshkpjm8ga81khn9zd6v3fvan"))))
76dbadac
PN
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
f2c71f62
PN
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
76dbadac
PN
588allows running complex 3D applications with high performance using Wine.
589
590Use @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"
223492f3
PN
602 ,(match (%current-system)
603 ("x86_64-linux" "64")
604 (_ "32"))
76dbadac
PN
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")
3842baa0
PN
615 (string-append out "/lib32"))
616 #t))))
76dbadac
PN
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"))))))))
223492f3
PN
633 (inputs
634 `(("wine" ,(match (%current-system)
f2c71f62
PN
635 ;; ("x86_64-linux" wine64)
636 ("x86_64-linux" wine64-staging)
637 ;; ("x86_64-linux" mingw-w64-x86_64)
76dbadac
PN
638 (_ wine)))
639 ,@(match (%current-system)
640 ("x86_64-linux"
641 `(("dxvk32" ,dxvk32)))
98e3953e 642 (_ '()))))
76dbadac 643 (supported-systems '("i686-linux" "x86_64-linux"))))