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