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