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