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>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages wine)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix git-download)
29 #:use-module (guix utils)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system trivial)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages admin)
34 #:use-module (gnu packages audio)
35 #:use-module (gnu packages autotools)
36 #:use-module (gnu packages base)
37 #:use-module (gnu packages bash)
38 #:use-module (gnu packages bison)
39 #:use-module (gnu packages compression)
40 #:use-module (gnu packages cups)
41 #:use-module (gnu packages databases)
42 #:use-module (gnu packages fontutils)
43 #:use-module (gnu packages flex)
44 #:use-module (gnu packages image)
45 #:use-module (gnu packages gettext)
46 #:use-module (gnu packages ghostscript)
47 #:use-module (gnu packages gl)
48 #:use-module (gnu packages glib)
49 #:use-module (gnu packages gstreamer)
50 #:use-module (gnu packages gtk)
51 #:use-module (gnu packages kerberos)
52 #:use-module (gnu packages linux)
53 #:use-module (gnu packages openldap)
54 #:use-module (gnu packages perl)
55 #:use-module (gnu packages pulseaudio)
56 #:use-module (gnu packages pkg-config)
57 #:use-module (gnu packages python)
58 #:use-module (gnu packages mp3)
59 #:use-module (gnu packages ncurses)
60 #:use-module (gnu packages photo)
61 #:use-module (gnu packages samba)
62 #:use-module (gnu packages scanner)
63 #:use-module (gnu packages sdl)
64 #:use-module (gnu packages tls)
65 #:use-module (gnu packages video)
66 #:use-module (gnu packages vulkan)
67 #:use-module (gnu packages xml)
68 #:use-module (gnu packages xorg)
69 #:use-module (ice-9 match)
70 #:use-module (srfi srfi-1))
78 (uri (string-append "https://dl.winehq.org/wine/source/"
79 (version-major+minor version)
80 "/wine-" version ".tar.xz"))
83 "0x5x9pvhryzhq1m7i8gx5wwwj341zz05zymadlhfw5w45xlm0h4r"))))
84 (build-system gnu-build-system)
85 (native-inputs `(("pkg-config" ,pkg-config)
86 ("gettext" ,gettext-minimal)
91 `(("alsa-lib" ,alsa-lib)
95 ("fontconfig" ,fontconfig)
96 ("freetype" ,freetype)
99 ("gst-plugins-base" ,gst-plugins-base)
103 ("libgphoto2" ,libgphoto2)
104 ("libmpg123" ,mpg123)
105 ("libldap" ,openldap)
107 ("libsane" ,sane-backends)
116 ("libXcursor" ,libxcursor)
117 ("libXrender" ,libxrender)
118 ("libXrandr" ,libxrandr)
119 ("libXinerama" ,libxinerama)
120 ("libXxf86vm" ,libxxf86vm)
121 ("libXcomposite" ,libxcomposite)
122 ("mit-krb5" ,mit-krb5)
125 ("pulseaudio" ,pulseaudio)
127 ("unixodbc" ,unixodbc)
128 ("v4l-utils" ,v4l-utils)
130 ("vulkan-loader" ,vulkan-loader)
133 `(;; Force a 32-bit build targeting a similar architecture, i.e.:
134 ;; armhf for armhf/aarch64, i686 for i686/x86_64.
135 #:system ,@(match (%current-system)
136 ((or "armhf-linux" "aarch64-linux")
141 ;; XXX: There's a test suite, but it's unclear whether it's supposed to
146 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine32"))
150 (string-append "libdir=" %output "/lib/wine32"))
153 (modify-phases %standard-phases
154 ;; Explicitely set the 32-bit version of vulkan-loader when installing
155 ;; to i686-linux or x86_64-linux.
156 ;; TODO: Add more JSON files as they become available in Mesa.
157 ,@(match (%current-system)
158 ((or "i686-linux" "x86_64-linux")
159 `((add-after 'install 'wrap-executable
160 (lambda* (#:key inputs outputs #:allow-other-keys)
161 (let* ((out (assoc-ref outputs "out"))
162 (icd (string-append out "/share/vulkan/icd.d")))
164 (copy-file (string-append (assoc-ref inputs "mesa")
165 "/share/vulkan/icd.d/radeon_icd.i686.json")
166 (string-append icd "/radeon_icd.i686.json"))
167 (copy-file (string-append (assoc-ref inputs "mesa")
168 "/share/vulkan/icd.d/intel_icd.i686.json")
169 (string-append icd "/intel_icd.i686.json"))
170 (wrap-program (string-append out "/bin/wine-preloader")
171 `("VK_ICD_FILENAMES" ":" =
173 "/radeon_icd.i686.json" ":"
174 icd "/intel_icd.i686.json"))))
179 (add-after 'configure 'patch-dlopen-paths
180 ;; Hardcode dlopened sonames to absolute paths.
182 (let* ((library-path (search-path-as-string->list
183 (getenv "LIBRARY_PATH")))
184 (find-so (lambda (soname)
185 (search-path library-path soname))))
186 (substitute* "include/config.h"
187 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
188 (format #f "~a\"~a\"" defso (find-so soname))))
190 (home-page "https://www.winehq.org/")
191 (synopsis "Implementation of the Windows API (32-bit only)")
193 "Wine (originally an acronym for \"Wine Is Not an Emulator\") is a
194 compatibility layer capable of running Windows applications. Instead of
195 simulating internal Windows logic like a virtual machine or emulator, Wine
196 translates Windows API calls into POSIX calls on-the-fly, eliminating the
197 performance and memory penalties of other methods and allowing you to cleanly
198 integrate Windows applications into your desktop.")
199 ;; Any platform should be able to build wine, but based on '#:system' these
200 ;; are thr ones we currently support.
201 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
202 (license license:lgpl2.1+)))
204 (define-public wine64
208 (inputs `(("wine" ,wine)
209 ,@(package-inputs wine)))
213 (string-append "libdir=" %output "/lib/wine64"))
215 (modify-phases %standard-phases
216 ;; Explicitely set both the 64-bit and 32-bit versions of vulkan-loader
217 ;; when installing to x86_64-linux so both are available.
218 ;; TODO: Add more JSON files as they become available in Mesa.
219 ,@(match (%current-system)
221 `((add-after 'copy-wine32-binaries 'wrap-executable
222 (lambda* (#:key inputs outputs #:allow-other-keys)
223 (let* ((out (assoc-ref outputs "out")))
224 (wrap-program (string-append out "/bin/wine-preloader")
225 `("VK_ICD_FILENAMES" ":" =
226 (,(string-append (assoc-ref inputs "mesa")
227 "/share/vulkan/icd.d/radeon_icd.x86_64.json" ":"
228 (assoc-ref inputs "mesa")
229 "/share/vulkan/icd.d/intel_icd.x86_64.json" ":"
230 (assoc-ref inputs "wine")
231 "/share/vulkan/icd.d/radeon_icd.i686.json" ":"
232 (assoc-ref inputs "wine")
233 "/share/vulkan/icd.d/intel_icd.i686.json"))))
234 (wrap-program (string-append out "/bin/wine64-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"))))
248 (add-after 'install 'copy-wine32-binaries
249 (lambda* (#:key outputs #:allow-other-keys)
250 (let* ((wine32 (assoc-ref %build-inputs "wine"))
251 (out (assoc-ref %outputs "out")))
252 ;; Copy the 32-bit binaries needed for WoW64.
253 (copy-file (string-append wine32 "/bin/wine")
254 (string-append out "/bin/wine"))
255 ;; Copy the real 32-bit wine-preloader instead of the wrapped
257 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
258 (string-append out "/bin/wine-preloader"))
260 (add-after 'compress-documentation 'copy-wine32-manpage
261 (lambda* (#:key outputs #:allow-other-keys)
262 (let* ((wine32 (assoc-ref %build-inputs "wine"))
263 (out (assoc-ref %outputs "out")))
264 ;; Copy the missing man file for the wine binary from wine.
265 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
266 (string-append out "/share/man/man1/wine.1.gz"))
268 (add-after 'configure 'patch-dlopen-paths
269 ;; Hardcode dlopened sonames to absolute paths.
271 (let* ((library-path (search-path-as-string->list
272 (getenv "LIBRARY_PATH")))
273 (find-so (lambda (soname)
274 (search-path library-path soname))))
275 (substitute* "include/config.h"
276 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
277 (format #f "~a\"~a\"" defso (find-so soname))))
280 (list "--enable-win64"
281 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
282 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
284 (package-arguments wine))))
285 (synopsis "Implementation of the Windows API (WoW64 version)")
286 (supported-systems '("x86_64-linux" "aarch64-linux"))))
288 ;; This minimal build of Wine is needed to prevent a circular dependency with
290 (define-public wine-minimal
293 (name "wine-minimal")
294 (native-inputs (fold alist-delete (package-native-inputs wine)
295 '("gettext" "perl" "pkg-config")))
298 `(#:validate-runpath? #f
300 (modify-phases %standard-phases
301 (add-after 'configure 'patch-dlopen-paths
302 ;; Hardcode dlopened sonames to absolute paths.
304 (let* ((library-path (search-path-as-string->list
305 (getenv "LIBRARY_PATH")))
306 (find-so (lambda (soname)
307 (search-path library-path soname))))
308 (substitute* "include/config.h"
309 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
310 (format #f "~a\"~a\"" defso (find-so soname))))
313 (list "--without-freetype"
315 ,@(strip-keyword-arguments '(#:configure-flags #:phases)
316 (package-arguments wine))))))
318 (define-public wine-staging-patchset-data
320 (name "wine-staging-patchset-data")
326 (url "https://github.com/wine-staging/wine-staging")
327 (commit (string-append "v" version))))
328 (file-name (git-file-name name version))
331 "0zkvwl6rxr6xcqk4a3h43cak67w6bcyqqnajz6azif07ir3z1c61"))))
332 (build-system trivial-build-system)
335 ("coreutils" ,coreutils)))
337 `(#:modules ((guix build utils))
340 (use-modules (guix build utils))
341 (let* ((build-directory ,(string-append name "-" version))
342 (source (assoc-ref %build-inputs "source"))
343 (bash (assoc-ref %build-inputs "bash"))
344 (coreutils (assoc-ref %build-inputs "coreutils"))
345 (out (assoc-ref %outputs "out"))
346 (wine-staging (string-append out "/share/wine-staging")))
347 (copy-recursively source build-directory)
348 (with-directory-excursion build-directory
349 (substitute* "patches/patchinstall.sh"
351 (string-append bash "/bin/sh")))
352 (substitute* "patches/gitapply.sh"
354 (string-append coreutils "/bin/env"))))
355 (copy-recursively build-directory wine-staging)
357 (home-page "https://github.com/wine-staging")
358 (synopsis "Patchset for Wine")
360 "wine-staging-patchset-data contains the patchset to build Wine-Staging.")
361 (license license:lgpl2.1+)))
363 (define-public wine-staging
366 (name "wine-staging")
367 (version (package-version wine-staging-patchset-data))
371 "https://dl.winehq.org/wine/source/"
372 (version-major version) ".x"
373 "/wine-" version ".tar.xz"))
374 (file-name (string-append name "-" version ".tar.xz"))
377 "17qxbddv23ibbayw1ai984m0dlq63cgplms2jhsc09incjhafywd"))))
378 (inputs `(("autoconf" ,autoconf) ; for autoreconf
385 ("util-linux" ,util-linux) ; for hexdump
386 ("wine-staging-patchset-data" ,wine-staging-patchset-data)
387 ,@(package-inputs wine)))
390 (modify-phases %standard-phases
391 ;; Explicitely set the 32-bit version of vulkan-loader when installing
392 ;; to i686-linux or x86_64-linux.
393 ;; TODO: Add more JSON files as they become available in Mesa.
394 ,@(match (%current-system)
395 ((or "i686-linux" "x86_64-linux")
396 `((add-after 'install 'wrap-executable
397 (lambda* (#:key inputs outputs #:allow-other-keys)
398 (let* ((out (assoc-ref outputs "out"))
399 (icd (string-append out "/share/vulkan/icd.d")))
401 (copy-file (string-append (assoc-ref inputs "mesa")
402 "/share/vulkan/icd.d/radeon_icd.i686.json")
403 (string-append icd "/radeon_icd.i686.json"))
404 (copy-file (string-append (assoc-ref inputs "mesa")
405 "/share/vulkan/icd.d/intel_icd.i686.json")
406 (string-append icd "/intel_icd.i686.json"))
407 (wrap-program (string-append out "/bin/wine-preloader")
408 `("VK_ICD_FILENAMES" ":" =
410 "/radeon_icd.i686.json" ":"
411 icd "/intel_icd.i686.json"))))
416 (add-before 'configure 'patch-source-wine-staging
417 (lambda* (#:key outputs #:allow-other-keys)
418 (let* ((source (assoc-ref %build-inputs "source"))
419 (script (string-append (assoc-ref %build-inputs
420 "wine-staging-patchset-data")
421 "/share/wine-staging/patches/patchinstall.sh")))
422 (invoke script (string-append "DESTDIR=" ".") "--all")
424 (add-after 'configure 'patch-dlopen-paths
425 ;; Hardcode dlopened sonames to absolute paths.
427 (let* ((library-path (search-path-as-string->list
428 (getenv "LIBRARY_PATH")))
429 (find-so (lambda (soname)
430 (search-path library-path soname))))
431 (substitute* "include/config.h"
432 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
433 (format #f "~a\"~a\"" defso (find-so soname))))
435 ,@(strip-keyword-arguments '(#:phases)
436 (package-arguments wine))))
437 (synopsis "Implementation of the Windows API (staging branch, 32-bit only)")
438 (description "Wine-Staging is the testing area of Wine. It
439 contains bug fixes and features, which have not been integrated into
440 the development branch yet. The idea of Wine-Staging is to provide
441 experimental features faster to end users and to give developers the
442 possibility to discuss and improve their patches before they are
443 integrated into the main branch.")
444 (home-page "https://github.com/wine-staging")
445 ;; In addition to the regular Wine license (lgpl2.1+), Wine-Staging
446 ;; provides Liberation and WenQuanYi Micro Hei fonts. Those use
447 ;; different licenses. In particular, the latter is licensed under
448 ;; both GPL3+ and Apache 2 License.
450 (list license:lgpl2.1+ license:silofl1.1 license:gpl3+ license:asl2.0))))
452 (define-public wine64-staging
454 (inherit wine-staging)
455 (name "wine64-staging")
456 (inputs `(("wine-staging" ,wine-staging)
457 ,@(package-inputs wine-staging)))
461 (string-append "libdir=" %output "/lib/wine64"))
463 (modify-phases %standard-phases
464 ;; Explicitely set both the 64-bit and 32-bit versions of vulkan-loader
465 ;; when installing to x86_64-linux so both are available.
466 ;; TODO: Add more JSON files as they become available in Mesa.
467 ,@(match (%current-system)
469 `((add-after 'copy-wine32-binaries 'wrap-executable
470 (lambda* (#:key inputs outputs #:allow-other-keys)
471 (let* ((out (assoc-ref outputs "out")))
472 (wrap-program (string-append out "/bin/wine-preloader")
473 `("VK_ICD_FILENAMES" ":" =
474 (,(string-append (assoc-ref inputs "mesa")
475 "/share/vulkan/icd.d/radeon_icd.x86_64.json" ":"
476 (assoc-ref inputs "mesa")
477 "/share/vulkan/icd.d/intel_icd.x86_64.json" ":"
478 (assoc-ref inputs "wine-staging")
479 "/share/vulkan/icd.d/radeon_icd.i686.json" ":"
480 (assoc-ref inputs "wine-staging")
481 "/share/vulkan/icd.d/intel_icd.i686.json"))))
482 (wrap-program (string-append out "/bin/wine64-preloader")
483 `("VK_ICD_FILENAMES" ":" =
484 (,(string-append (assoc-ref inputs "mesa")
485 "/share/vulkan/icd.d/radeon_icd.x86_64.json"
486 ":" (assoc-ref inputs "mesa")
487 "/share/vulkan/icd.d/intel_icd.x86_64.json"
488 ":" (assoc-ref inputs "wine-staging")
489 "/share/vulkan/icd.d/radeon_icd.i686.json"
490 ":" (assoc-ref inputs "wine-staging")
491 "/share/vulkan/icd.d/intel_icd.i686.json"))))
496 (add-before 'configure 'patch-source-wine-staging
497 (lambda* (#:key outputs #:allow-other-keys)
498 (let* ((source (assoc-ref %build-inputs "source"))
499 (script (string-append (assoc-ref %build-inputs
500 "wine-staging-patchset-data")
501 "/share/wine-staging/patches/patchinstall.sh")))
502 (invoke script (string-append "DESTDIR=" ".") "--all")
504 (add-after 'install 'copy-wine32-binaries
505 (lambda* (#:key outputs #:allow-other-keys)
506 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
507 (out (assoc-ref %outputs "out")))
508 ;; Copy the 32-bit binaries needed for WoW64.
509 (copy-file (string-append wine32 "/bin/wine")
510 (string-append out "/bin/wine"))
511 ;; Copy the real 32-bit wine-preloader instead of the wrapped
513 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
514 (string-append out "/bin/wine-preloader"))
516 (add-after 'compress-documentation 'copy-wine32-manpage
517 (lambda* (#:key outputs #:allow-other-keys)
518 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
519 (out (assoc-ref %outputs "out")))
520 ;; Copy the missing man file for the wine binary from
522 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
523 (string-append out "/share/man/man1/wine.1.gz"))
525 (add-after 'configure 'patch-dlopen-paths
526 ;; Hardcode dlopened sonames to absolute paths.
528 (let* ((library-path (search-path-as-string->list
529 (getenv "LIBRARY_PATH")))
530 (find-so (lambda (soname)
531 (search-path library-path soname))))
532 (substitute* "include/config.h"
533 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
534 (format #f "~a\"~a\"" defso (find-so soname))))
537 (list "--enable-win64"
538 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
539 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
541 (package-arguments wine-staging))))
542 (synopsis "Implementation of the Windows API (staging branch, WoW64
544 (supported-systems '("x86_64-linux" "aarch64-linux"))))