gnu: deutex: Update to 5.2.1.
[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>
51f01907 6;;; Copyright © 2017 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")
2f7bdf53 79 (version "4.0.3")
8f9580ca
SB
80 (source (origin
81 (method url-fetch)
6f10e74f
EF
82 (uri (string-append "https://dl.winehq.org/wine/source/"
83 (version-major+minor version)
5a717a95 84 "/wine-" version ".tar.xz"))
8f9580ca
SB
85 (sha256
86 (base32
2f7bdf53 87 "1nhgw1wm613ln9dhjm0d03zs5adcmnqr2b50p21jbmm5k2gns0i5"))))
8f9580ca
SB
88 (build-system gnu-build-system)
89 (native-inputs `(("pkg-config" ,pkg-config)
b94a6ca0 90 ("gettext" ,gettext-minimal)
5e54f4ad 91 ("flex" ,flex)
8f9580ca
SB
92 ("bison" ,bison)
93 ("perl" ,perl)))
94 (inputs
95 `(("alsa-lib" ,alsa-lib)
96 ("dbus" ,dbus)
025cc9a1 97 ("cups" ,cups)
1aa6582e 98 ("eudev" ,eudev)
8f9580ca
SB
99 ("fontconfig" ,fontconfig)
100 ("freetype" ,freetype)
025cc9a1 101 ("glu" ,glu)
8f9580ca 102 ("gnutls" ,gnutls)
1aa6582e 103 ("gst-plugins-base" ,gst-plugins-base)
8f9580ca
SB
104 ("lcms" ,lcms)
105 ("libxml2" ,libxml2)
106 ("libxslt" ,libxslt)
107 ("libgphoto2" ,libgphoto2)
108 ("libmpg123" ,mpg123)
109 ("libldap" ,openldap)
110 ("libnetapi" ,samba)
4c928743 111 ("libsane" ,sane-backends)
1aa6582e 112 ("libpcap" ,libpcap)
8f9580ca
SB
113 ("libpng" ,libpng)
114 ("libjpeg" ,libjpeg)
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)
d95e4864 126 ("mit-krb5" ,mit-krb5)
8f9580ca 127 ("ncurses" ,ncurses)
025cc9a1 128 ("openal" ,openal)
05740895 129 ("pulseaudio" ,pulseaudio)
0e41f95e 130 ("sdl2" ,sdl2)
8f9580ca 131 ("unixodbc" ,unixodbc)
1aa6582e 132 ("v4l-utils" ,v4l-utils)
e3b1d4ea 133 ("vkd3d" ,vkd3d)
0e41f95e 134 ("vulkan-loader" ,vulkan-loader)
8f9580ca
SB
135 ("zlib" ,zlib)))
136 (arguments
b4a330ac
EF
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")))
8f9580ca
SB
144
145 ;; XXX: There's a test suite, but it's unclear whether it's supposed to
146 ;; pass.
147 #:tests? #f
148
6c0dfb19 149 #:configure-flags
5cead945 150 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine32"))
6c0dfb19 151
eeabe5a1 152 #:make-flags
5cead945
RH
153 (list "SHELL=bash"
154 (string-append "libdir=" %output "/lib/wine32"))
eeabe5a1 155
8f9580ca 156 #:phases
07cda02c 157 (modify-phases %standard-phases
2f7bdf53 158 ;; Explicitly set the 32-bit version of vulkan-loader when installing
d39a54ff
RH
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"))
c94884bc
RH
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"))
d39a54ff
RH
174 (wrap-program (string-append out "/bin/wine-preloader")
175 `("VK_ICD_FILENAMES" ":" =
176 (,(string-append icd
c94884bc
RH
177 "/radeon_icd.i686.json" ":"
178 icd "/intel_icd.i686.json"))))
d39a54ff
RH
179 #t)))))
180 (_
181 `())
182 )
07cda02c
EF
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))))))
658c987f 194 (home-page "https://www.winehq.org/")
06e57331 195 (synopsis "Implementation of the Windows API (32-bit only)")
8f9580ca
SB
196 (description
197 "Wine (originally an acronym for \"Wine Is Not an Emulator\") is a
198compatibility layer capable of running Windows applications. Instead of
199simulating internal Windows logic like a virtual machine or emulator, Wine
200translates Windows API calls into POSIX calls on-the-fly, eliminating the
201performance and memory penalties of other methods and allowing you to cleanly
202integrate Windows applications into your desktop.")
7ba2a1af
EF
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"))
cac274aa 206 (license license:lgpl2.1+)))
b3ebd241
RH
207
208(define-public wine64
209 (package
210 (inherit wine)
211 (name "wine64")
58cbcb02
RH
212 (inputs `(("wine" ,wine)
213 ,@(package-inputs wine)))
b3ebd241 214 (arguments
e02693a3
RH
215 `(#:make-flags
216 (list "SHELL=bash"
58cbcb02
RH
217 (string-append "libdir=" %output "/lib/wine64"))
218 #:phases
219 (modify-phases %standard-phases
2f7bdf53 220 ;; Explicitly set both the 64-bit and 32-bit versions of vulkan-loader
d39a54ff
RH
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")
c94884bc
RH
235 "/share/vulkan/icd.d/radeon_icd.i686.json" ":"
236 (assoc-ref inputs "wine")
237 "/share/vulkan/icd.d/intel_icd.i686.json"))))
d39a54ff
RH
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")
c94884bc
RH
245 "/share/vulkan/icd.d/radeon_icd.i686.json"
246 ":" (assoc-ref inputs "wine")
247 "/share/vulkan/icd.d/intel_icd.i686.json"))))
d39a54ff
RH
248 #t)))))
249 (_
250 `())
251 )
036f3577 252 (add-after 'install 'copy-wine32-binaries
58cbcb02 253 (lambda* (#:key outputs #:allow-other-keys)
036f3577
RH
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"))
d39a54ff
RH
259 ;; Copy the real 32-bit wine-preloader instead of the wrapped
260 ;; version.
261 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
036f3577
RH
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)))
58cbcb02
RH
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))))
e02693a3 283 #:configure-flags
b3ebd241 284 (list "--enable-win64"
58cbcb02
RH
285 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
286 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
287 #:system)
b3ebd241 288 (package-arguments wine))))
68e49211 289 (synopsis "Implementation of the Windows API (WoW64 version)")
5010d0e3 290 (supported-systems '("x86_64-linux" "aarch64-linux"))))
f6444059 291
a5466f38
RH
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
d39a54ff
RH
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))))
a5466f38
RH
316 #:configure-flags
317 (list "--without-freetype"
318 "--without-x")
d39a54ff 319 ,@(strip-keyword-arguments '(#:configure-flags #:phases)
a5466f38
RH
320 (package-arguments wine))))))
321
f6246195
RH
322(define-public wine-staging-patchset-data
323 (package
cb2ad4f5 324 (name "wine-staging-patchset-data")
ee42e9f9 325 (version "4.18")
cb2ad4f5
RH
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
ee42e9f9 334 (base32 "03z0haf47mpm2aj9cji3wma4jy6j12wz10kkbgmbgrkkrc5lcqc2"))))
cb2ad4f5
RH
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+)))
f6246195 365
7866d8c8
NG
366(define-public wine-staging
367 (package
368 (inherit wine)
369 (name "wine-staging")
b53b9c8d 370 (version (package-version wine-staging-patchset-data))
7866d8c8
NG
371 (source (origin
372 (method url-fetch)
373 (uri (string-append
732a1489 374 "https://dl.winehq.org/wine/source/"
a10050e2 375 (version-major version) ".x"
732a1489 376 "/wine-" version ".tar.xz"))
b53b9c8d 377 (file-name (string-append name "-" version ".tar.xz"))
7866d8c8
NG
378 (sha256
379 (base32
ee42e9f9 380 "0chf6vdy41kg75liibkb862442zwi8dbjzf6l5arcy2z4580a2yi"))))
b53b9c8d 381 (inputs `(("autoconf" ,autoconf) ; for autoreconf
0fa3d705 382 ("faudio" ,faudio)
a51ac7af 383 ("ffmpeg" ,ffmpeg)
c695fb76
TGR
384 ("gtk+" ,gtk+)
385 ("libva" ,libva)
cb2ad4f5 386 ("mesa" ,mesa)
b53b9c8d
RH
387 ("python" ,python)
388 ("util-linux" ,util-linux) ; for hexdump
b53b9c8d 389 ("wine-staging-patchset-data" ,wine-staging-patchset-data)
141708ed 390 ,@(package-inputs wine)))
39b4744a
RH
391 (arguments
392 `(#:phases
393 (modify-phases %standard-phases
2f7bdf53 394 ;; Explicitly set the 32-bit version of vulkan-loader when installing
cb2ad4f5
RH
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"))
c94884bc
RH
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"))
cb2ad4f5
RH
410 (wrap-program (string-append out "/bin/wine-preloader")
411 `("VK_ICD_FILENAMES" ":" =
412 (,(string-append icd
c94884bc
RH
413 "/radeon_icd.i686.json" ":"
414 icd "/intel_icd.i686.json"))))
cb2ad4f5
RH
415 #t)))))
416 (_
417 `())
418 )
b53b9c8d 419 (add-before 'configure 'patch-source-wine-staging
39b4744a 420 (lambda* (#:key outputs #:allow-other-keys)
b53b9c8d
RH
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")))
09fd82ce 425 (invoke script (string-append "DESTDIR=" ".") "--all")
39b4744a
RH
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))))
95c45e53 440 (synopsis "Implementation of the Windows API (staging branch, 32-bit only)")
7866d8c8
NG
441 (description "Wine-Staging is the testing area of Wine. It
442contains bug fixes and features, which have not been integrated into
443the development branch yet. The idea of Wine-Staging is to provide
444experimental features faster to end users and to give developers the
445possibility to discuss and improve their patches before they are
446integrated into the main branch.")
b53b9c8d 447 (home-page "https://github.com/wine-staging")
7866d8c8
NG
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))))
6cd46747
RH
454
455(define-public wine64-staging
456 (package
457 (inherit wine-staging)
458 (name "wine64-staging")
c41fb54f
RH
459 (inputs `(("wine-staging" ,wine-staging)
460 ,@(package-inputs wine-staging)))
6cd46747
RH
461 (arguments
462 `(#:make-flags
463 (list "SHELL=bash"
c41fb54f
RH
464 (string-append "libdir=" %output "/lib/wine64"))
465 #:phases
466 (modify-phases %standard-phases
2f7bdf53 467 ;; Explicitly set both the 64-bit and 32-bit versions of vulkan-loader
cb2ad4f5
RH
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")
c94884bc
RH
482 "/share/vulkan/icd.d/radeon_icd.i686.json" ":"
483 (assoc-ref inputs "wine-staging")
484 "/share/vulkan/icd.d/intel_icd.i686.json"))))
cb2ad4f5
RH
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")
c94884bc
RH
492 "/share/vulkan/icd.d/radeon_icd.i686.json"
493 ":" (assoc-ref inputs "wine-staging")
494 "/share/vulkan/icd.d/intel_icd.i686.json"))))
cb2ad4f5
RH
495 #t)))))
496 (_
497 `())
498 )
3139f185 499 (add-before 'configure 'patch-source-wine-staging
ee5402bf 500 (lambda* (#:key outputs #:allow-other-keys)
3139f185
RH
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")))
036feaf9 505 (invoke script (string-append "DESTDIR=" ".") "--all")
ee5402bf 506 #t)))
e6b94a02
RH
507 (add-after 'install 'copy-wine32-binaries
508 (lambda* (#:key outputs #:allow-other-keys)
417903c6 509 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
e6b94a02
RH
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"))
cb2ad4f5
RH
514 ;; Copy the real 32-bit wine-preloader instead of the wrapped
515 ;; version.
516 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
e6b94a02
RH
517 (string-append out "/bin/wine-preloader"))
518 #t)))
519 (add-after 'compress-documentation 'copy-wine32-manpage
c41fb54f 520 (lambda* (#:key outputs #:allow-other-keys)
417903c6 521 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
e6b94a02
RH
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)))
c41fb54f
RH
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))))
6cd46747
RH
539 #:configure-flags
540 (list "--enable-win64"
c41fb54f
RH
541 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
542 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
543 #:system)
6cd46747 544 (package-arguments wine-staging))))
1adc6013 545 (synopsis "Implementation of the Windows API (staging branch, WoW64
6cd46747
RH
546version)")
547 (supported-systems '("x86_64-linux" "aarch64-linux"))))
76dbadac
PN
548
549(define dxvk32
550 ;; This package provides 32-bit dxvk libraries on 64-bit systems.
551 (package
552 (name "dxvk32")
f2c71f62 553 (version "1.5")
76dbadac
PN
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
f2c71f62 563 "009p99jkskrmy186gsqrf0p3v9z3lskw51r4vdp35af057q26a6x"))))
76dbadac
PN
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
f2c71f62
PN
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
76dbadac
PN
579allows running complex 3D applications with high performance using Wine.
580
581Use @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"
223492f3
PN
593 ,(match (%current-system)
594 ("x86_64-linux" "64")
595 (_ "32"))
76dbadac
PN
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"))))))))
223492f3
PN
623 (inputs
624 `(("wine" ,(match (%current-system)
f2c71f62
PN
625 ;; ("x86_64-linux" wine64)
626 ("x86_64-linux" wine64-staging)
627 ;; ("x86_64-linux" mingw-w64-x86_64)
76dbadac
PN
628 (_ wine)))
629 ,@(match (%current-system)
630 ("x86_64-linux"
631 `(("dxvk32" ,dxvk32)))
f2c71f62
PN
632 (_ '()))
633 ))
76dbadac 634 (supported-systems '("i686-linux" "x86_64-linux"))))