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 Nicolas Goaziou <mail@nicolasgoaziou.fr>
7 ;;; Copyright © 2018, 2019 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))
82 (uri (string-append "https://dl.winehq.org/wine/source/"
83 (version-major+minor version)
84 "/wine-" version ".tar.xz"))
87 "1nhgw1wm613ln9dhjm0d03zs5adcmnqr2b50p21jbmm5k2gns0i5"))))
88 (build-system gnu-build-system)
89 (native-inputs `(("pkg-config" ,pkg-config)
90 ("gettext" ,gettext-minimal)
95 `(("alsa-lib" ,alsa-lib)
99 ("fontconfig" ,fontconfig)
100 ("freetype" ,freetype)
103 ("gst-plugins-base" ,gst-plugins-base)
107 ("libgphoto2" ,libgphoto2)
108 ("libmpg123" ,mpg123)
109 ("libldap" ,openldap)
111 ("libsane" ,sane-backends)
114 ("libjpeg" ,libjpeg-turbo)
120 ("libXcursor" ,libxcursor)
121 ("libXrender" ,libxrender)
122 ("libXrandr" ,libxrandr)
123 ("libXinerama" ,libxinerama)
124 ("libXxf86vm" ,libxxf86vm)
125 ("libXcomposite" ,libxcomposite)
126 ("mit-krb5" ,mit-krb5)
129 ("pulseaudio" ,pulseaudio)
131 ("unixodbc" ,unixodbc)
132 ("v4l-utils" ,v4l-utils)
134 ("vulkan-loader" ,vulkan-loader)
137 `(;; Force a 32-bit build targeting a similar architecture, i.e.:
138 ;; armhf for armhf/aarch64, i686 for i686/x86_64.
139 #:system ,@(match (%current-system)
140 ((or "armhf-linux" "aarch64-linux")
145 ;; XXX: There's a test suite, but it's unclear whether it's supposed to
150 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine32"))
154 (string-append "libdir=" %output "/lib/wine32"))
157 (modify-phases %standard-phases
158 ;; Explicitly set the 32-bit version of vulkan-loader when installing
159 ;; to i686-linux or x86_64-linux.
160 ;; TODO: Add more JSON files as they become available in Mesa.
161 ,@(match (%current-system)
162 ((or "i686-linux" "x86_64-linux")
163 `((add-after 'install 'wrap-executable
164 (lambda* (#:key inputs outputs #:allow-other-keys)
165 (let* ((out (assoc-ref outputs "out"))
166 (icd (string-append out "/share/vulkan/icd.d")))
168 (copy-file (string-append (assoc-ref inputs "mesa")
169 "/share/vulkan/icd.d/radeon_icd.i686.json")
170 (string-append icd "/radeon_icd.i686.json"))
171 (copy-file (string-append (assoc-ref inputs "mesa")
172 "/share/vulkan/icd.d/intel_icd.i686.json")
173 (string-append icd "/intel_icd.i686.json"))
174 (wrap-program (string-append out "/bin/wine-preloader")
175 `("VK_ICD_FILENAMES" ":" =
177 "/radeon_icd.i686.json" ":"
178 icd "/intel_icd.i686.json"))))
183 (add-after 'configure 'patch-dlopen-paths
184 ;; Hardcode dlopened sonames to absolute paths.
186 (let* ((library-path (search-path-as-string->list
187 (getenv "LIBRARY_PATH")))
188 (find-so (lambda (soname)
189 (search-path library-path soname))))
190 (substitute* "include/config.h"
191 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
192 (format #f "~a\"~a\"" defso (find-so soname))))
194 (home-page "https://www.winehq.org/")
195 (synopsis "Implementation of the Windows API (32-bit only)")
197 "Wine (originally an acronym for \"Wine Is Not an Emulator\") is a
198 compatibility layer capable of running Windows applications. Instead of
199 simulating internal Windows logic like a virtual machine or emulator, Wine
200 translates Windows API calls into POSIX calls on-the-fly, eliminating the
201 performance and memory penalties of other methods and allowing you to cleanly
202 integrate Windows applications into your desktop.")
203 ;; Any platform should be able to build wine, but based on '#:system' these
204 ;; are thr ones we currently support.
205 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
206 (license license:lgpl2.1+)))
208 (define-public wine64
212 (inputs `(("wine" ,wine)
213 ,@(package-inputs wine)))
217 (string-append "libdir=" %output "/lib/wine64"))
219 (modify-phases %standard-phases
220 ;; Explicitly set both the 64-bit and 32-bit versions of vulkan-loader
221 ;; when installing to x86_64-linux so both are available.
222 ;; TODO: Add more JSON files as they become available in Mesa.
223 ,@(match (%current-system)
225 `((add-after 'copy-wine32-binaries 'wrap-executable
226 (lambda* (#:key inputs outputs #:allow-other-keys)
227 (let* ((out (assoc-ref outputs "out")))
228 (wrap-program (string-append out "/bin/wine-preloader")
229 `("VK_ICD_FILENAMES" ":" =
230 (,(string-append (assoc-ref inputs "mesa")
231 "/share/vulkan/icd.d/radeon_icd.x86_64.json" ":"
232 (assoc-ref inputs "mesa")
233 "/share/vulkan/icd.d/intel_icd.x86_64.json" ":"
234 (assoc-ref inputs "wine")
235 "/share/vulkan/icd.d/radeon_icd.i686.json" ":"
236 (assoc-ref inputs "wine")
237 "/share/vulkan/icd.d/intel_icd.i686.json"))))
238 (wrap-program (string-append out "/bin/wine64-preloader")
239 `("VK_ICD_FILENAMES" ":" =
240 (,(string-append (assoc-ref inputs "mesa")
241 "/share/vulkan/icd.d/radeon_icd.x86_64.json"
242 ":" (assoc-ref inputs "mesa")
243 "/share/vulkan/icd.d/intel_icd.x86_64.json"
244 ":" (assoc-ref inputs "wine")
245 "/share/vulkan/icd.d/radeon_icd.i686.json"
246 ":" (assoc-ref inputs "wine")
247 "/share/vulkan/icd.d/intel_icd.i686.json"))))
252 (add-after 'install 'copy-wine32-binaries
253 (lambda* (#:key outputs #:allow-other-keys)
254 (let* ((wine32 (assoc-ref %build-inputs "wine"))
255 (out (assoc-ref %outputs "out")))
256 ;; Copy the 32-bit binaries needed for WoW64.
257 (copy-file (string-append wine32 "/bin/wine")
258 (string-append out "/bin/wine"))
259 ;; Copy the real 32-bit wine-preloader instead of the wrapped
261 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
262 (string-append out "/bin/wine-preloader"))
264 (add-after 'compress-documentation 'copy-wine32-manpage
265 (lambda* (#:key outputs #:allow-other-keys)
266 (let* ((wine32 (assoc-ref %build-inputs "wine"))
267 (out (assoc-ref %outputs "out")))
268 ;; Copy the missing man file for the wine binary from wine.
269 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
270 (string-append out "/share/man/man1/wine.1.gz"))
272 (add-after 'configure 'patch-dlopen-paths
273 ;; Hardcode dlopened sonames to absolute paths.
275 (let* ((library-path (search-path-as-string->list
276 (getenv "LIBRARY_PATH")))
277 (find-so (lambda (soname)
278 (search-path library-path soname))))
279 (substitute* "include/config.h"
280 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
281 (format #f "~a\"~a\"" defso (find-so soname))))
284 (list "--enable-win64"
285 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
286 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
288 (package-arguments wine))))
289 (synopsis "Implementation of the Windows API (WoW64 version)")
290 (supported-systems '("x86_64-linux" "aarch64-linux"))))
292 ;; This minimal build of Wine is needed to prevent a circular dependency with
294 (define-public wine-minimal
297 (name "wine-minimal")
298 (native-inputs (fold alist-delete (package-native-inputs wine)
299 '("gettext" "perl" "pkg-config")))
302 `(#:validate-runpath? #f
304 (modify-phases %standard-phases
305 (add-after 'configure 'patch-dlopen-paths
306 ;; Hardcode dlopened sonames to absolute paths.
308 (let* ((library-path (search-path-as-string->list
309 (getenv "LIBRARY_PATH")))
310 (find-so (lambda (soname)
311 (search-path library-path soname))))
312 (substitute* "include/config.h"
313 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
314 (format #f "~a\"~a\"" defso (find-so soname))))
317 (list "--without-freetype"
319 ,@(strip-keyword-arguments '(#:configure-flags #:phases)
320 (package-arguments wine))))))
322 (define-public wine-staging-patchset-data
324 (name "wine-staging-patchset-data")
330 (url "https://github.com/wine-staging/wine-staging")
331 (commit (string-append "v" version))))
332 (file-name (git-file-name name version))
334 (base32 "03z0haf47mpm2aj9cji3wma4jy6j12wz10kkbgmbgrkkrc5lcqc2"))))
335 (build-system trivial-build-system)
338 ("coreutils" ,coreutils)))
340 `(#:modules ((guix build utils))
343 (use-modules (guix build utils))
344 (let* ((build-directory ,(string-append name "-" version))
345 (source (assoc-ref %build-inputs "source"))
346 (bash (assoc-ref %build-inputs "bash"))
347 (coreutils (assoc-ref %build-inputs "coreutils"))
348 (out (assoc-ref %outputs "out"))
349 (wine-staging (string-append out "/share/wine-staging")))
350 (copy-recursively source build-directory)
351 (with-directory-excursion build-directory
352 (substitute* "patches/patchinstall.sh"
354 (string-append bash "/bin/sh")))
355 (substitute* "patches/gitapply.sh"
357 (string-append coreutils "/bin/env"))))
358 (copy-recursively build-directory wine-staging)
360 (home-page "https://github.com/wine-staging")
361 (synopsis "Patchset for Wine")
363 "wine-staging-patchset-data contains the patchset to build Wine-Staging.")
364 (license license:lgpl2.1+)))
366 (define-public wine-staging
369 (name "wine-staging")
370 (version (package-version wine-staging-patchset-data))
374 "https://dl.winehq.org/wine/source/"
375 (version-major version) ".x"
376 "/wine-" version ".tar.xz"))
377 (file-name (string-append name "-" version ".tar.xz"))
380 "0chf6vdy41kg75liibkb862442zwi8dbjzf6l5arcy2z4580a2yi"))))
381 (inputs `(("autoconf" ,autoconf) ; for autoreconf
388 ("util-linux" ,util-linux) ; for hexdump
389 ("wine-staging-patchset-data" ,wine-staging-patchset-data)
390 ,@(package-inputs wine)))
393 (modify-phases %standard-phases
394 ;; Explicitly set the 32-bit version of vulkan-loader when installing
395 ;; to i686-linux or x86_64-linux.
396 ;; TODO: Add more JSON files as they become available in Mesa.
397 ,@(match (%current-system)
398 ((or "i686-linux" "x86_64-linux")
399 `((add-after 'install 'wrap-executable
400 (lambda* (#:key inputs outputs #:allow-other-keys)
401 (let* ((out (assoc-ref outputs "out"))
402 (icd (string-append out "/share/vulkan/icd.d")))
404 (copy-file (string-append (assoc-ref inputs "mesa")
405 "/share/vulkan/icd.d/radeon_icd.i686.json")
406 (string-append icd "/radeon_icd.i686.json"))
407 (copy-file (string-append (assoc-ref inputs "mesa")
408 "/share/vulkan/icd.d/intel_icd.i686.json")
409 (string-append icd "/intel_icd.i686.json"))
410 (wrap-program (string-append out "/bin/wine-preloader")
411 `("VK_ICD_FILENAMES" ":" =
413 "/radeon_icd.i686.json" ":"
414 icd "/intel_icd.i686.json"))))
419 (add-before 'configure 'patch-source-wine-staging
420 (lambda* (#:key outputs #:allow-other-keys)
421 (let* ((source (assoc-ref %build-inputs "source"))
422 (script (string-append (assoc-ref %build-inputs
423 "wine-staging-patchset-data")
424 "/share/wine-staging/patches/patchinstall.sh")))
425 (invoke script (string-append "DESTDIR=" ".") "--all")
427 (add-after 'configure 'patch-dlopen-paths
428 ;; Hardcode dlopened sonames to absolute paths.
430 (let* ((library-path (search-path-as-string->list
431 (getenv "LIBRARY_PATH")))
432 (find-so (lambda (soname)
433 (search-path library-path soname))))
434 (substitute* "include/config.h"
435 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
436 (format #f "~a\"~a\"" defso (find-so soname))))
438 ,@(strip-keyword-arguments '(#:phases)
439 (package-arguments wine))))
440 (synopsis "Implementation of the Windows API (staging branch, 32-bit only)")
441 (description "Wine-Staging is the testing area of Wine. It
442 contains bug fixes and features, which have not been integrated into
443 the development branch yet. The idea of Wine-Staging is to provide
444 experimental features faster to end users and to give developers the
445 possibility to discuss and improve their patches before they are
446 integrated into the main branch.")
447 (home-page "https://github.com/wine-staging")
448 ;; In addition to the regular Wine license (lgpl2.1+), Wine-Staging
449 ;; provides Liberation and WenQuanYi Micro Hei fonts. Those use
450 ;; different licenses. In particular, the latter is licensed under
451 ;; both GPL3+ and Apache 2 License.
453 (list license:lgpl2.1+ license:silofl1.1 license:gpl3+ license:asl2.0))))
455 (define-public wine64-staging
457 (inherit wine-staging)
458 (name "wine64-staging")
459 (inputs `(("wine-staging" ,wine-staging)
460 ,@(package-inputs wine-staging)))
464 (string-append "libdir=" %output "/lib/wine64"))
466 (modify-phases %standard-phases
467 ;; Explicitly set both the 64-bit and 32-bit versions of vulkan-loader
468 ;; when installing to x86_64-linux so both are available.
469 ;; TODO: Add more JSON files as they become available in Mesa.
470 ,@(match (%current-system)
472 `((add-after 'copy-wine32-binaries 'wrap-executable
473 (lambda* (#:key inputs outputs #:allow-other-keys)
474 (let* ((out (assoc-ref outputs "out")))
475 (wrap-program (string-append out "/bin/wine-preloader")
476 `("VK_ICD_FILENAMES" ":" =
477 (,(string-append (assoc-ref inputs "mesa")
478 "/share/vulkan/icd.d/radeon_icd.x86_64.json" ":"
479 (assoc-ref inputs "mesa")
480 "/share/vulkan/icd.d/intel_icd.x86_64.json" ":"
481 (assoc-ref inputs "wine-staging")
482 "/share/vulkan/icd.d/radeon_icd.i686.json" ":"
483 (assoc-ref inputs "wine-staging")
484 "/share/vulkan/icd.d/intel_icd.i686.json"))))
485 (wrap-program (string-append out "/bin/wine64-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"))))
499 (add-before 'configure 'patch-source-wine-staging
500 (lambda* (#:key outputs #:allow-other-keys)
501 (let* ((source (assoc-ref %build-inputs "source"))
502 (script (string-append (assoc-ref %build-inputs
503 "wine-staging-patchset-data")
504 "/share/wine-staging/patches/patchinstall.sh")))
505 (invoke script (string-append "DESTDIR=" ".") "--all")
507 (add-after 'install 'copy-wine32-binaries
508 (lambda* (#:key outputs #:allow-other-keys)
509 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
510 (out (assoc-ref %outputs "out")))
511 ;; Copy the 32-bit binaries needed for WoW64.
512 (copy-file (string-append wine32 "/bin/wine")
513 (string-append out "/bin/wine"))
514 ;; Copy the real 32-bit wine-preloader instead of the wrapped
516 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
517 (string-append out "/bin/wine-preloader"))
519 (add-after 'compress-documentation 'copy-wine32-manpage
520 (lambda* (#:key outputs #:allow-other-keys)
521 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
522 (out (assoc-ref %outputs "out")))
523 ;; Copy the missing man file for the wine binary from
525 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
526 (string-append out "/share/man/man1/wine.1.gz"))
528 (add-after 'configure 'patch-dlopen-paths
529 ;; Hardcode dlopened sonames to absolute paths.
531 (let* ((library-path (search-path-as-string->list
532 (getenv "LIBRARY_PATH")))
533 (find-so (lambda (soname)
534 (search-path library-path soname))))
535 (substitute* "include/config.h"
536 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
537 (format #f "~a\"~a\"" defso (find-so soname))))
540 (list "--enable-win64"
541 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
542 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
544 (package-arguments wine-staging))))
545 (synopsis "Implementation of the Windows API (staging branch, WoW64
547 (supported-systems '("x86_64-linux" "aarch64-linux"))))
550 ;; This package provides 32-bit dxvk libraries on 64-bit systems.
554 (home-page "https://github.com/doitsujin/dxvk/")
559 (commit (string-append "v" version))))
560 (file-name (git-file-name name version))
563 "009p99jkskrmy186gsqrf0p3v9z3lskw51r4vdp35af057q26a6x"))))
564 (build-system meson-build-system)
566 `(#:system "i686-linux"
567 #:configure-flags (list "--cross-file"
568 (string-append (assoc-ref %build-inputs "source")
569 "/build-wine32.txt"))))
571 ;; Since 1.5 dxvk needs gcc-8.1. See
572 ;; https://github.com/doitsujin/dxvk/issues/1292#issuecomment-567067373.
574 ("glslang" ,glslang)))
576 `(("wine" ,wine-staging)))
577 (synopsis "Vulkan-based D3D9, D3D10 and D3D11 implementation for Wine")
578 (description "A Vulkan-based translation layer for Direct3D 9/10/11 which
579 allows running complex 3D applications with high performance using Wine.
581 Use @command{setup_dxvk} to install the required libraries to a Wine prefix.")
582 (supported-systems '("x86_64-linux"))
583 (license license:zlib)))
590 `(#:configure-flags (list "--cross-file"
591 (string-append (assoc-ref %build-inputs "source")
593 ,(match (%current-system)
594 ("x86_64-linux" "64")
598 (modify-phases %standard-phases
599 ,@(if (string=? (%current-system) "x86_64-linux")
600 `((add-after 'unpack 'install-32
601 (lambda* (#:key inputs outputs #:allow-other-keys)
602 (let* ((out (assoc-ref outputs "out"))
603 (dxvk32 (assoc-ref inputs "dxvk32")))
604 (mkdir-p (string-append out "/lib32"))
605 (copy-recursively (string-append dxvk32 "/lib")
606 (string-append out "/lib32"))))))
608 (add-after 'install 'install-setup
609 (lambda* (#:key inputs outputs #:allow-other-keys)
610 (let* ((out (assoc-ref outputs "out"))
611 (bin (string-append out "/bin/setup_dxvk")))
612 (mkdir-p (string-append out "/bin"))
613 (copy-file "../source/setup_dxvk.sh"
618 (string-append "wine=" (assoc-ref inputs "wine") "/bin/wine"))
619 (("x32") ,(match (%current-system)
620 ("x86_64-linux" "../lib32")
622 (("x64") "../lib"))))))))
624 `(("wine" ,(match (%current-system)
625 ;; ("x86_64-linux" wine64)
626 ("x86_64-linux" wine64-staging)
627 ;; ("x86_64-linux" mingw-w64-x86_64)
629 ,@(match (%current-system)
631 `(("dxvk32" ,dxvk32)))
634 (supported-systems '("i686-linux" "x86_64-linux"))))