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>
10 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
83 (uri (let ((dir (string-append
84 (version-major version)
85 (if (string-suffix? ".0" (version-major+minor version))
88 (string-append "https://dl.winehq.org/wine/source/" dir
89 "wine-" version ".tar.xz")))
91 (base32 "0bl4ii4h1w4z8kb6dpdc1pgwk0wrhm61c2q2nzpcckkrqra75wc7"))))
92 (build-system gnu-build-system)
96 ("gettext" ,gettext-minimal)
98 ("pkg-config" ,pkg-config)))
100 `(("alsa-lib" ,alsa-lib)
105 ("fontconfig" ,fontconfig)
106 ("freetype" ,freetype)
109 ("gst-plugins-base" ,gst-plugins-base)
113 ("libgphoto2" ,libgphoto2)
114 ("libmpg123" ,mpg123)
115 ("libldap" ,openldap)
117 ("libsane" ,sane-backends)
120 ("libjpeg" ,libjpeg-turbo)
126 ("libXcursor" ,libxcursor)
127 ("libXrender" ,libxrender)
128 ("libXrandr" ,libxrandr)
129 ("libXinerama" ,libxinerama)
130 ("libXxf86vm" ,libxxf86vm)
131 ("libXcomposite" ,libxcomposite)
132 ("mit-krb5" ,mit-krb5)
135 ("pulseaudio" ,pulseaudio)
137 ("unixodbc" ,unixodbc)
138 ("v4l-utils" ,v4l-utils)
140 ("vulkan-loader" ,vulkan-loader)
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")
151 ;; XXX: There's a test suite, but it's unclear whether it's supposed to
156 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine32"))
160 (string-append "libdir=" %output "/lib/wine32"))
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")))
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" ":" =
183 "/radeon_icd.i686.json" ":"
184 icd "/intel_icd.i686.json"))))
189 (add-after 'configure 'patch-dlopen-paths
190 ;; Hardcode dlopened sonames to absolute paths.
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))))
200 (home-page "https://www.winehq.org/")
201 (synopsis "Implementation of the Windows API (32-bit only)")
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+)))
214 (define-public wine64
218 (inputs `(("wine" ,wine)
219 ,@(package-inputs wine)))
223 (string-append "libdir=" %output "/lib/wine64"))
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)
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"))))
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
267 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
268 (string-append out "/bin/wine-preloader"))
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"))
278 (add-after 'configure 'patch-dlopen-paths
279 ;; Hardcode dlopened sonames to absolute paths.
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))))
290 (list "--enable-win64"
291 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
292 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
294 (package-arguments wine))))
295 (synopsis "Implementation of the Windows API (WoW64 version)")
296 (supported-systems '("x86_64-linux" "aarch64-linux"))))
298 ;; This minimal build of Wine is needed to prevent a circular dependency with
300 (define-public wine-minimal
303 (name "wine-minimal")
304 (native-inputs (fold alist-delete (package-native-inputs wine)
305 '("gettext" "perl" "pkg-config")))
308 `(#:validate-runpath? #f
310 (modify-phases %standard-phases
311 (add-after 'configure 'patch-dlopen-paths
312 ;; Hardcode dlopened sonames to absolute paths.
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))))
323 (list "--without-freetype"
325 ,@(strip-keyword-arguments '(#:configure-flags #:phases)
326 (package-arguments wine))))))
328 (define-public wine-staging-patchset-data
330 (name "wine-staging-patchset-data")
336 (url "https://github.com/wine-staging/wine-staging")
337 (commit (string-append "v" version))))
338 (file-name (git-file-name name version))
340 (base32 "0sw7790gsi3h08xgc8i1y282rk8xrdhqjlwpvbpvyw5zi0i95cvq"))))
341 (build-system trivial-build-system)
344 ("coreutils" ,coreutils)))
346 `(#:modules ((guix build utils))
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"
360 (string-append bash "/bin/sh")))
361 (substitute* "patches/gitapply.sh"
363 (string-append coreutils "/bin/env"))))
364 (copy-recursively build-directory wine-staging)
366 (home-page "https://github.com/wine-staging")
367 (synopsis "Patchset for Wine")
369 "wine-staging-patchset-data contains the patchset to build Wine-Staging.")
370 (license license:lgpl2.1+)))
372 (define-public wine-staging
375 (name "wine-staging")
376 (version (package-version wine-staging-patchset-data))
378 (let* ((wine-version (version-major+minor version))
379 (subdirectory (string-append
380 (version-major version)
381 (if (string-suffix? ".0" wine-version)
386 (uri (string-append "https://dl.winehq.org/wine/source/"
388 "wine-" wine-version ".tar.xz"))
389 (file-name (string-append name "-" wine-version ".tar.xz"))
391 (base32 "0lh1bqr8xq1acz5d0cb50rvhw3h6h1vqprx5wlyrjhdg58f5qsn4")))))
392 (inputs `(("autoconf" ,autoconf) ; for autoreconf
398 ("util-linux" ,util-linux) ; for hexdump
399 ("wine-staging-patchset-data" ,wine-staging-patchset-data)
400 ,@(package-inputs wine)))
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")))
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" ":" =
423 "/radeon_icd.i686.json" ":"
424 icd "/intel_icd.i686.json"))))
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")
437 (add-after 'configure 'patch-dlopen-paths
438 ;; Hardcode dlopened sonames to absolute paths.
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))))
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.
463 (list license:lgpl2.1+ license:silofl1.1 license:gpl3+ license:asl2.0))))
465 (define-public wine64-staging
467 (inherit wine-staging)
468 (name "wine64-staging")
469 (inputs `(("wine-staging" ,wine-staging)
470 ,@(package-inputs wine-staging)))
474 (string-append "libdir=" %output "/lib/wine64"))
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)
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"))))
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")
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
526 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
527 (string-append out "/bin/wine-preloader"))
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
535 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
536 (string-append out "/share/man/man1/wine.1.gz"))
538 (add-after 'configure 'patch-dlopen-paths
539 ;; Hardcode dlopened sonames to absolute paths.
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))))
550 (list "--enable-win64"
551 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
552 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
554 (package-arguments wine-staging))))
555 (synopsis "Implementation of the Windows API (staging branch, WoW64
557 (supported-systems '("x86_64-linux" "aarch64-linux"))))
560 ;; This package provides 32-bit dxvk libraries on 64-bit systems.
564 (home-page "https://github.com/doitsujin/dxvk/")
569 (commit (string-append "v" version))))
570 (file-name (git-file-name name version))
573 "1inl0qswgvbp0fs76md86ilqf9mbshkpjm8ga81khn9zd6v3fvan"))))
574 (build-system meson-build-system)
576 `(#:system "i686-linux"
577 #:configure-flags (list "--cross-file"
578 (string-append (assoc-ref %build-inputs "source")
579 "/build-wine32.txt"))))
581 ;; Since 1.5 dxvk needs gcc-8.1. See
582 ;; https://github.com/doitsujin/dxvk/issues/1292#issuecomment-567067373.
584 ("glslang" ,glslang)))
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.
591 Use @command{setup_dxvk} to install the required libraries to a Wine prefix.")
592 (supported-systems '("x86_64-linux"))
593 (license license:zlib)))
600 `(#:configure-flags (list "--cross-file"
601 (string-append (assoc-ref %build-inputs "source")
603 ,(match (%current-system)
604 ("x86_64-linux" "64")
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"))
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"
629 (string-append "wine=" (assoc-ref inputs "wine") "/bin/wine"))
630 (("x32") ,(match (%current-system)
631 ("x86_64-linux" "../lib32")
633 (("x64") "../lib"))))))))
635 `(("wine" ,(match (%current-system)
636 ;; ("x86_64-linux" wine64)
637 ("x86_64-linux" wine64-staging)
638 ;; ("x86_64-linux" mingw-w64-x86_64)
640 ,@(match (%current-system)
642 `(("dxvk32" ,dxvk32)))
644 (supported-systems '("i686-linux" "x86_64-linux"))))