gnu: wine: Add FAudio input.
[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")
ee42e9f9 326 (version "4.18")
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
ee42e9f9 335 (base32 "03z0haf47mpm2aj9cji3wma4jy6j12wz10kkbgmbgrkkrc5lcqc2"))))
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))
7866d8c8
NG
372 (source (origin
373 (method url-fetch)
374 (uri (string-append
732a1489 375 "https://dl.winehq.org/wine/source/"
a10050e2 376 (version-major version) ".x"
732a1489 377 "/wine-" version ".tar.xz"))
b53b9c8d 378 (file-name (string-append name "-" version ".tar.xz"))
7866d8c8
NG
379 (sha256
380 (base32
ee42e9f9 381 "0chf6vdy41kg75liibkb862442zwi8dbjzf6l5arcy2z4580a2yi"))))
b53b9c8d 382 (inputs `(("autoconf" ,autoconf) ; for autoreconf
0fa3d705 383 ("faudio" ,faudio)
a51ac7af 384 ("ffmpeg" ,ffmpeg)
c695fb76
TGR
385 ("gtk+" ,gtk+)
386 ("libva" ,libva)
cb2ad4f5 387 ("mesa" ,mesa)
b53b9c8d
RH
388 ("python" ,python)
389 ("util-linux" ,util-linux) ; for hexdump
b53b9c8d 390 ("wine-staging-patchset-data" ,wine-staging-patchset-data)
141708ed 391 ,@(package-inputs wine)))
39b4744a
RH
392 (arguments
393 `(#:phases
394 (modify-phases %standard-phases
2f7bdf53 395 ;; Explicitly set the 32-bit version of vulkan-loader when installing
cb2ad4f5
RH
396 ;; to i686-linux or x86_64-linux.
397 ;; TODO: Add more JSON files as they become available in Mesa.
398 ,@(match (%current-system)
399 ((or "i686-linux" "x86_64-linux")
400 `((add-after 'install 'wrap-executable
401 (lambda* (#:key inputs outputs #:allow-other-keys)
402 (let* ((out (assoc-ref outputs "out"))
403 (icd (string-append out "/share/vulkan/icd.d")))
404 (mkdir-p icd)
405 (copy-file (string-append (assoc-ref inputs "mesa")
406 "/share/vulkan/icd.d/radeon_icd.i686.json")
407 (string-append icd "/radeon_icd.i686.json"))
c94884bc
RH
408 (copy-file (string-append (assoc-ref inputs "mesa")
409 "/share/vulkan/icd.d/intel_icd.i686.json")
410 (string-append icd "/intel_icd.i686.json"))
cb2ad4f5
RH
411 (wrap-program (string-append out "/bin/wine-preloader")
412 `("VK_ICD_FILENAMES" ":" =
413 (,(string-append icd
c94884bc
RH
414 "/radeon_icd.i686.json" ":"
415 icd "/intel_icd.i686.json"))))
cb2ad4f5
RH
416 #t)))))
417 (_
418 `())
419 )
b53b9c8d 420 (add-before 'configure 'patch-source-wine-staging
39b4744a 421 (lambda* (#:key outputs #:allow-other-keys)
b53b9c8d
RH
422 (let* ((source (assoc-ref %build-inputs "source"))
423 (script (string-append (assoc-ref %build-inputs
424 "wine-staging-patchset-data")
425 "/share/wine-staging/patches/patchinstall.sh")))
09fd82ce 426 (invoke script (string-append "DESTDIR=" ".") "--all")
39b4744a
RH
427 #t)))
428 (add-after 'configure 'patch-dlopen-paths
429 ;; Hardcode dlopened sonames to absolute paths.
430 (lambda _
431 (let* ((library-path (search-path-as-string->list
432 (getenv "LIBRARY_PATH")))
433 (find-so (lambda (soname)
434 (search-path library-path soname))))
435 (substitute* "include/config.h"
436 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
437 (format #f "~a\"~a\"" defso (find-so soname))))
438 #t))))
439 ,@(strip-keyword-arguments '(#:phases)
440 (package-arguments wine))))
95c45e53 441 (synopsis "Implementation of the Windows API (staging branch, 32-bit only)")
7866d8c8
NG
442 (description "Wine-Staging is the testing area of Wine. It
443contains bug fixes and features, which have not been integrated into
444the development branch yet. The idea of Wine-Staging is to provide
445experimental features faster to end users and to give developers the
446possibility to discuss and improve their patches before they are
447integrated into the main branch.")
b53b9c8d 448 (home-page "https://github.com/wine-staging")
7866d8c8
NG
449 ;; In addition to the regular Wine license (lgpl2.1+), Wine-Staging
450 ;; provides Liberation and WenQuanYi Micro Hei fonts. Those use
451 ;; different licenses. In particular, the latter is licensed under
452 ;; both GPL3+ and Apache 2 License.
453 (license
454 (list license:lgpl2.1+ license:silofl1.1 license:gpl3+ license:asl2.0))))
6cd46747
RH
455
456(define-public wine64-staging
457 (package
458 (inherit wine-staging)
459 (name "wine64-staging")
c41fb54f
RH
460 (inputs `(("wine-staging" ,wine-staging)
461 ,@(package-inputs wine-staging)))
6cd46747
RH
462 (arguments
463 `(#:make-flags
464 (list "SHELL=bash"
c41fb54f
RH
465 (string-append "libdir=" %output "/lib/wine64"))
466 #:phases
467 (modify-phases %standard-phases
2f7bdf53 468 ;; Explicitly set both the 64-bit and 32-bit versions of vulkan-loader
cb2ad4f5
RH
469 ;; when installing to x86_64-linux so both are available.
470 ;; TODO: Add more JSON files as they become available in Mesa.
471 ,@(match (%current-system)
472 ((or "x86_64-linux")
473 `((add-after 'copy-wine32-binaries 'wrap-executable
474 (lambda* (#:key inputs outputs #:allow-other-keys)
475 (let* ((out (assoc-ref outputs "out")))
476 (wrap-program (string-append out "/bin/wine-preloader")
477 `("VK_ICD_FILENAMES" ":" =
478 (,(string-append (assoc-ref inputs "mesa")
479 "/share/vulkan/icd.d/radeon_icd.x86_64.json" ":"
480 (assoc-ref inputs "mesa")
481 "/share/vulkan/icd.d/intel_icd.x86_64.json" ":"
482 (assoc-ref inputs "wine-staging")
c94884bc
RH
483 "/share/vulkan/icd.d/radeon_icd.i686.json" ":"
484 (assoc-ref inputs "wine-staging")
485 "/share/vulkan/icd.d/intel_icd.i686.json"))))
cb2ad4f5
RH
486 (wrap-program (string-append out "/bin/wine64-preloader")
487 `("VK_ICD_FILENAMES" ":" =
488 (,(string-append (assoc-ref inputs "mesa")
489 "/share/vulkan/icd.d/radeon_icd.x86_64.json"
490 ":" (assoc-ref inputs "mesa")
491 "/share/vulkan/icd.d/intel_icd.x86_64.json"
492 ":" (assoc-ref inputs "wine-staging")
c94884bc
RH
493 "/share/vulkan/icd.d/radeon_icd.i686.json"
494 ":" (assoc-ref inputs "wine-staging")
495 "/share/vulkan/icd.d/intel_icd.i686.json"))))
cb2ad4f5
RH
496 #t)))))
497 (_
498 `())
499 )
3139f185 500 (add-before 'configure 'patch-source-wine-staging
ee5402bf 501 (lambda* (#:key outputs #:allow-other-keys)
3139f185
RH
502 (let* ((source (assoc-ref %build-inputs "source"))
503 (script (string-append (assoc-ref %build-inputs
504 "wine-staging-patchset-data")
505 "/share/wine-staging/patches/patchinstall.sh")))
036feaf9 506 (invoke script (string-append "DESTDIR=" ".") "--all")
ee5402bf 507 #t)))
e6b94a02
RH
508 (add-after 'install 'copy-wine32-binaries
509 (lambda* (#:key outputs #:allow-other-keys)
417903c6 510 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
e6b94a02
RH
511 (out (assoc-ref %outputs "out")))
512 ;; Copy the 32-bit binaries needed for WoW64.
513 (copy-file (string-append wine32 "/bin/wine")
514 (string-append out "/bin/wine"))
cb2ad4f5
RH
515 ;; Copy the real 32-bit wine-preloader instead of the wrapped
516 ;; version.
517 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
e6b94a02
RH
518 (string-append out "/bin/wine-preloader"))
519 #t)))
520 (add-after 'compress-documentation 'copy-wine32-manpage
c41fb54f 521 (lambda* (#:key outputs #:allow-other-keys)
417903c6 522 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
e6b94a02
RH
523 (out (assoc-ref %outputs "out")))
524 ;; Copy the missing man file for the wine binary from
525 ;; wine-staging.
526 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
527 (string-append out "/share/man/man1/wine.1.gz"))
528 #t)))
c41fb54f
RH
529 (add-after 'configure 'patch-dlopen-paths
530 ;; Hardcode dlopened sonames to absolute paths.
531 (lambda _
532 (let* ((library-path (search-path-as-string->list
533 (getenv "LIBRARY_PATH")))
534 (find-so (lambda (soname)
535 (search-path library-path soname))))
536 (substitute* "include/config.h"
537 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
538 (format #f "~a\"~a\"" defso (find-so soname))))
539 #t))))
6cd46747
RH
540 #:configure-flags
541 (list "--enable-win64"
c41fb54f
RH
542 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
543 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
544 #:system)
6cd46747 545 (package-arguments wine-staging))))
1adc6013 546 (synopsis "Implementation of the Windows API (staging branch, WoW64
6cd46747
RH
547version)")
548 (supported-systems '("x86_64-linux" "aarch64-linux"))))
76dbadac
PN
549
550(define dxvk32
551 ;; This package provides 32-bit dxvk libraries on 64-bit systems.
552 (package
553 (name "dxvk32")
f2c71f62 554 (version "1.5")
76dbadac
PN
555 (home-page "https://github.com/doitsujin/dxvk/")
556 (source (origin
557 (method git-fetch)
558 (uri (git-reference
559 (url home-page)
560 (commit (string-append "v" version))))
561 (file-name (git-file-name name version))
562 (sha256
563 (base32
f2c71f62 564 "009p99jkskrmy186gsqrf0p3v9z3lskw51r4vdp35af057q26a6x"))))
76dbadac
PN
565 (build-system meson-build-system)
566 (arguments
567 `(#:system "i686-linux"
568 #:configure-flags (list "--cross-file"
569 (string-append (assoc-ref %build-inputs "source")
570 "/build-wine32.txt"))))
571 (native-inputs
f2c71f62
PN
572 ;; Since 1.5 dxvk needs gcc-8.1. See
573 ;; https://github.com/doitsujin/dxvk/issues/1292#issuecomment-567067373.
574 `(("gcc" ,gcc-9)
575 ("glslang" ,glslang)))
576 (inputs
577 `(("wine" ,wine-staging)))
578 (synopsis "Vulkan-based D3D9, D3D10 and D3D11 implementation for Wine")
579 (description "A Vulkan-based translation layer for Direct3D 9/10/11 which
76dbadac
PN
580allows running complex 3D applications with high performance using Wine.
581
582Use @command{setup_dxvk} to install the required libraries to a Wine prefix.")
583 (supported-systems '("x86_64-linux"))
584 (license license:zlib)))
585
586(define-public dxvk
587 (package
588 (inherit dxvk32)
589 (name "dxvk")
590 (arguments
591 `(#:configure-flags (list "--cross-file"
592 (string-append (assoc-ref %build-inputs "source")
593 "/build-wine"
223492f3
PN
594 ,(match (%current-system)
595 ("x86_64-linux" "64")
596 (_ "32"))
76dbadac
PN
597 ".txt"))
598 #:phases
599 (modify-phases %standard-phases
600 ,@(if (string=? (%current-system) "x86_64-linux")
601 `((add-after 'unpack 'install-32
602 (lambda* (#:key inputs outputs #:allow-other-keys)
603 (let* ((out (assoc-ref outputs "out"))
604 (dxvk32 (assoc-ref inputs "dxvk32")))
605 (mkdir-p (string-append out "/lib32"))
606 (copy-recursively (string-append dxvk32 "/lib")
607 (string-append out "/lib32"))))))
608 '())
609 (add-after 'install 'install-setup
610 (lambda* (#:key inputs outputs #:allow-other-keys)
611 (let* ((out (assoc-ref outputs "out"))
612 (bin (string-append out "/bin/setup_dxvk")))
613 (mkdir-p (string-append out "/bin"))
614 (copy-file "../source/setup_dxvk.sh"
615 bin)
616 (chmod bin #o755)
617 (substitute* bin
618 (("wine=\"wine\"")
619 (string-append "wine=" (assoc-ref inputs "wine") "/bin/wine"))
620 (("x32") ,(match (%current-system)
621 ("x86_64-linux" "../lib32")
622 (_ "../lib")))
623 (("x64") "../lib"))))))))
223492f3
PN
624 (inputs
625 `(("wine" ,(match (%current-system)
f2c71f62
PN
626 ;; ("x86_64-linux" wine64)
627 ("x86_64-linux" wine64-staging)
628 ;; ("x86_64-linux" mingw-w64-x86_64)
76dbadac
PN
629 (_ wine)))
630 ,@(match (%current-system)
631 ("x86_64-linux"
632 `(("dxvk32" ,dxvk32)))
f2c71f62
PN
633 (_ '()))
634 ))
76dbadac 635 (supported-systems '("i686-linux" "x86_64-linux"))))