gnu: ruby-pandoc-ruby: Use pandoc instead of ghc-pandoc.
[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
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")
065a5ed6 79 (version "5.12")
4b506a3f
NG
80 (source
81 (origin
82 (method url-fetch)
d8104034
NG
83 (uri (let ((dir (string-append
84 (version-major version)
85 (if (string-suffix? ".0" (version-major+minor version))
86 ".0/"
53b48447
NG
87 ".x/"))))
88 (string-append "https://dl.winehq.org/wine/source/" dir
89 "wine-" version ".tar.xz")))
4b506a3f 90 (sha256
065a5ed6 91 (base32 "0bl4ii4h1w4z8kb6dpdc1pgwk0wrhm61c2q2nzpcckkrqra75wc7"))))
8f9580ca 92 (build-system gnu-build-system)
d8104034
NG
93 (native-inputs
94 `(("bison" ,bison)
95 ("flex" ,flex)
96 ("gettext" ,gettext-minimal)
97 ("perl" ,perl)
98 ("pkg-config" ,pkg-config)))
8f9580ca
SB
99 (inputs
100 `(("alsa-lib" ,alsa-lib)
101 ("dbus" ,dbus)
025cc9a1 102 ("cups" ,cups)
1aa6582e 103 ("eudev" ,eudev)
ffa37422 104 ("faudio" ,faudio)
8f9580ca
SB
105 ("fontconfig" ,fontconfig)
106 ("freetype" ,freetype)
025cc9a1 107 ("glu" ,glu)
8f9580ca 108 ("gnutls" ,gnutls)
1aa6582e 109 ("gst-plugins-base" ,gst-plugins-base)
8f9580ca
SB
110 ("lcms" ,lcms)
111 ("libxml2" ,libxml2)
112 ("libxslt" ,libxslt)
113 ("libgphoto2" ,libgphoto2)
114 ("libmpg123" ,mpg123)
115 ("libldap" ,openldap)
116 ("libnetapi" ,samba)
4c928743 117 ("libsane" ,sane-backends)
1aa6582e 118 ("libpcap" ,libpcap)
8f9580ca 119 ("libpng" ,libpng)
4bd428a7 120 ("libjpeg" ,libjpeg-turbo)
8f9580ca
SB
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)
d95e4864 132 ("mit-krb5" ,mit-krb5)
8f9580ca 133 ("ncurses" ,ncurses)
025cc9a1 134 ("openal" ,openal)
05740895 135 ("pulseaudio" ,pulseaudio)
0e41f95e 136 ("sdl2" ,sdl2)
8f9580ca 137 ("unixodbc" ,unixodbc)
1aa6582e 138 ("v4l-utils" ,v4l-utils)
e3b1d4ea 139 ("vkd3d" ,vkd3d)
0e41f95e 140 ("vulkan-loader" ,vulkan-loader)
8f9580ca
SB
141 ("zlib" ,zlib)))
142 (arguments
b4a330ac
EF
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")))
8f9580ca
SB
150
151 ;; XXX: There's a test suite, but it's unclear whether it's supposed to
152 ;; pass.
153 #:tests? #f
154
6c0dfb19 155 #:configure-flags
5cead945 156 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine32"))
6c0dfb19 157
eeabe5a1 158 #:make-flags
5cead945
RH
159 (list "SHELL=bash"
160 (string-append "libdir=" %output "/lib/wine32"))
eeabe5a1 161
8f9580ca 162 #:phases
07cda02c 163 (modify-phases %standard-phases
2f7bdf53 164 ;; Explicitly set the 32-bit version of vulkan-loader when installing
d39a54ff
RH
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"))
c94884bc
RH
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"))
d39a54ff
RH
180 (wrap-program (string-append out "/bin/wine-preloader")
181 `("VK_ICD_FILENAMES" ":" =
182 (,(string-append icd
c94884bc
RH
183 "/radeon_icd.i686.json" ":"
184 icd "/intel_icd.i686.json"))))
d39a54ff
RH
185 #t)))))
186 (_
187 `())
188 )
07cda02c
EF
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))))))
658c987f 200 (home-page "https://www.winehq.org/")
06e57331 201 (synopsis "Implementation of the Windows API (32-bit only)")
8f9580ca
SB
202 (description
203 "Wine (originally an acronym for \"Wine Is Not an Emulator\") is a
204compatibility layer capable of running Windows applications. Instead of
205simulating internal Windows logic like a virtual machine or emulator, Wine
206translates Windows API calls into POSIX calls on-the-fly, eliminating the
207performance and memory penalties of other methods and allowing you to cleanly
208integrate Windows applications into your desktop.")
7ba2a1af
EF
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"))
cac274aa 212 (license license:lgpl2.1+)))
b3ebd241
RH
213
214(define-public wine64
215 (package
216 (inherit wine)
217 (name "wine64")
58cbcb02
RH
218 (inputs `(("wine" ,wine)
219 ,@(package-inputs wine)))
b3ebd241 220 (arguments
e02693a3
RH
221 `(#:make-flags
222 (list "SHELL=bash"
58cbcb02
RH
223 (string-append "libdir=" %output "/lib/wine64"))
224 #:phases
225 (modify-phases %standard-phases
2f7bdf53 226 ;; Explicitly set both the 64-bit and 32-bit versions of vulkan-loader
d39a54ff
RH
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")
c94884bc
RH
241 "/share/vulkan/icd.d/radeon_icd.i686.json" ":"
242 (assoc-ref inputs "wine")
243 "/share/vulkan/icd.d/intel_icd.i686.json"))))
d39a54ff
RH
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")
c94884bc
RH
251 "/share/vulkan/icd.d/radeon_icd.i686.json"
252 ":" (assoc-ref inputs "wine")
253 "/share/vulkan/icd.d/intel_icd.i686.json"))))
d39a54ff
RH
254 #t)))))
255 (_
256 `())
257 )
036f3577 258 (add-after 'install 'copy-wine32-binaries
58cbcb02 259 (lambda* (#:key outputs #:allow-other-keys)
036f3577
RH
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"))
d39a54ff
RH
265 ;; Copy the real 32-bit wine-preloader instead of the wrapped
266 ;; version.
267 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
036f3577
RH
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)))
58cbcb02
RH
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))))
e02693a3 289 #:configure-flags
b3ebd241 290 (list "--enable-win64"
58cbcb02
RH
291 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
292 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
293 #:system)
b3ebd241 294 (package-arguments wine))))
68e49211 295 (synopsis "Implementation of the Windows API (WoW64 version)")
5010d0e3 296 (supported-systems '("x86_64-linux" "aarch64-linux"))))
f6444059 297
a5466f38
RH
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
d39a54ff
RH
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))))
a5466f38
RH
322 #:configure-flags
323 (list "--without-freetype"
324 "--without-x")
d39a54ff 325 ,@(strip-keyword-arguments '(#:configure-flags #:phases)
a5466f38
RH
326 (package-arguments wine))))))
327
f6246195
RH
328(define-public wine-staging-patchset-data
329 (package
cb2ad4f5 330 (name "wine-staging-patchset-data")
db80caa8 331 (version "5.13")
cb2ad4f5
RH
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
db80caa8 340 (base32 "0sw7790gsi3h08xgc8i1y282rk8xrdhqjlwpvbpvyw5zi0i95cvq"))))
cb2ad4f5
RH
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+)))
f6246195 371
7866d8c8
NG
372(define-public wine-staging
373 (package
374 (inherit wine)
375 (name "wine-staging")
b53b9c8d 376 (version (package-version wine-staging-patchset-data))
b8088be0 377 (source
8252d77f
TGR
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
db80caa8 391 (base32 "0lh1bqr8xq1acz5d0cb50rvhw3h6h1vqprx5wlyrjhdg58f5qsn4")))))
b8088be0 392 (inputs `(("autoconf" ,autoconf) ; for autoreconf
a51ac7af 393 ("ffmpeg" ,ffmpeg)
c695fb76
TGR
394 ("gtk+" ,gtk+)
395 ("libva" ,libva)
cb2ad4f5 396 ("mesa" ,mesa)
b53b9c8d
RH
397 ("python" ,python)
398 ("util-linux" ,util-linux) ; for hexdump
b53b9c8d 399 ("wine-staging-patchset-data" ,wine-staging-patchset-data)
141708ed 400 ,@(package-inputs wine)))
39b4744a
RH
401 (arguments
402 `(#:phases
403 (modify-phases %standard-phases
2f7bdf53 404 ;; Explicitly set the 32-bit version of vulkan-loader when installing
cb2ad4f5
RH
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"))
c94884bc
RH
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"))
cb2ad4f5
RH
420 (wrap-program (string-append out "/bin/wine-preloader")
421 `("VK_ICD_FILENAMES" ":" =
422 (,(string-append icd
c94884bc
RH
423 "/radeon_icd.i686.json" ":"
424 icd "/intel_icd.i686.json"))))
cb2ad4f5
RH
425 #t)))))
426 (_
427 `())
428 )
b53b9c8d 429 (add-before 'configure 'patch-source-wine-staging
39b4744a 430 (lambda* (#:key outputs #:allow-other-keys)
b53b9c8d
RH
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")))
09fd82ce 435 (invoke script (string-append "DESTDIR=" ".") "--all")
39b4744a
RH
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))))
95c45e53 450 (synopsis "Implementation of the Windows API (staging branch, 32-bit only)")
7866d8c8
NG
451 (description "Wine-Staging is the testing area of Wine. It
452contains bug fixes and features, which have not been integrated into
453the development branch yet. The idea of Wine-Staging is to provide
454experimental features faster to end users and to give developers the
455possibility to discuss and improve their patches before they are
456integrated into the main branch.")
b53b9c8d 457 (home-page "https://github.com/wine-staging")
7866d8c8
NG
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))))
6cd46747
RH
464
465(define-public wine64-staging
466 (package
467 (inherit wine-staging)
468 (name "wine64-staging")
c41fb54f
RH
469 (inputs `(("wine-staging" ,wine-staging)
470 ,@(package-inputs wine-staging)))
6cd46747
RH
471 (arguments
472 `(#:make-flags
473 (list "SHELL=bash"
c41fb54f
RH
474 (string-append "libdir=" %output "/lib/wine64"))
475 #:phases
476 (modify-phases %standard-phases
2f7bdf53 477 ;; Explicitly set both the 64-bit and 32-bit versions of vulkan-loader
cb2ad4f5
RH
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")
c94884bc
RH
492 "/share/vulkan/icd.d/radeon_icd.i686.json" ":"
493 (assoc-ref inputs "wine-staging")
494 "/share/vulkan/icd.d/intel_icd.i686.json"))))
cb2ad4f5
RH
495 (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")
c94884bc
RH
502 "/share/vulkan/icd.d/radeon_icd.i686.json"
503 ":" (assoc-ref inputs "wine-staging")
504 "/share/vulkan/icd.d/intel_icd.i686.json"))))
cb2ad4f5
RH
505 #t)))))
506 (_
507 `())
508 )
3139f185 509 (add-before 'configure 'patch-source-wine-staging
ee5402bf 510 (lambda* (#:key outputs #:allow-other-keys)
3139f185
RH
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")))
036feaf9 515 (invoke script (string-append "DESTDIR=" ".") "--all")
ee5402bf 516 #t)))
e6b94a02
RH
517 (add-after 'install 'copy-wine32-binaries
518 (lambda* (#:key outputs #:allow-other-keys)
417903c6 519 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
e6b94a02
RH
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"))
cb2ad4f5
RH
524 ;; Copy the real 32-bit wine-preloader instead of the wrapped
525 ;; version.
526 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
e6b94a02
RH
527 (string-append out "/bin/wine-preloader"))
528 #t)))
529 (add-after 'compress-documentation 'copy-wine32-manpage
c41fb54f 530 (lambda* (#:key outputs #:allow-other-keys)
417903c6 531 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
e6b94a02
RH
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)))
c41fb54f
RH
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))))
6cd46747
RH
549 #:configure-flags
550 (list "--enable-win64"
c41fb54f
RH
551 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
552 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
553 #:system)
6cd46747 554 (package-arguments wine-staging))))
1adc6013 555 (synopsis "Implementation of the Windows API (staging branch, WoW64
6cd46747
RH
556version)")
557 (supported-systems '("x86_64-linux" "aarch64-linux"))))
76dbadac
PN
558
559(define dxvk32
560 ;; This package provides 32-bit dxvk libraries on 64-bit systems.
561 (package
562 (name "dxvk32")
adb1e3b6 563 (version "1.5.5")
76dbadac
PN
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
adb1e3b6 573 "1inl0qswgvbp0fs76md86ilqf9mbshkpjm8ga81khn9zd6v3fvan"))))
76dbadac
PN
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
f2c71f62
PN
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
76dbadac
PN
589allows running complex 3D applications with high performance using Wine.
590
591Use @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"
223492f3
PN
603 ,(match (%current-system)
604 ("x86_64-linux" "64")
605 (_ "32"))
76dbadac
PN
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")
3842baa0
PN
616 (string-append out "/lib32"))
617 #t))))
76dbadac
PN
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"))))))))
223492f3
PN
634 (inputs
635 `(("wine" ,(match (%current-system)
f2c71f62
PN
636 ;; ("x86_64-linux" wine64)
637 ("x86_64-linux" wine64-staging)
638 ;; ("x86_64-linux" mingw-w64-x86_64)
76dbadac
PN
639 (_ wine)))
640 ,@(match (%current-system)
641 ("x86_64-linux"
642 `(("dxvk32" ,dxvk32)))
98e3953e 643 (_ '()))))
76dbadac 644 (supported-systems '("i686-linux" "x86_64-linux"))))