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