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 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 "0k8d90mgjzv8vjspmnxzr3i5mbccxnbr9hf03q1bpf5jjppcsdk7"))))
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 (wrap-program (string-append out "/bin/wine-preloader")
168 `("VK_ICD_FILENAMES" ":" =
170 "/radeon_icd.i686.json"))))
175 (add-after 'configure 'patch-dlopen-paths
176 ;; Hardcode dlopened sonames to absolute paths.
178 (let* ((library-path (search-path-as-string->list
179 (getenv "LIBRARY_PATH")))
180 (find-so (lambda (soname)
181 (search-path library-path soname))))
182 (substitute* "include/config.h"
183 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
184 (format #f "~a\"~a\"" defso (find-so soname))))
186 (home-page "https://www.winehq.org/")
187 (synopsis "Implementation of the Windows API (32-bit only)")
189 "Wine (originally an acronym for \"Wine Is Not an Emulator\") is a
190 compatibility layer capable of running Windows applications. Instead of
191 simulating internal Windows logic like a virtual machine or emulator, Wine
192 translates Windows API calls into POSIX calls on-the-fly, eliminating the
193 performance and memory penalties of other methods and allowing you to cleanly
194 integrate Windows applications into your desktop.")
195 ;; Any platform should be able to build wine, but based on '#:system' these
196 ;; are thr ones we currently support.
197 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
198 (license license:lgpl2.1+)))
200 (define-public wine64
204 (inputs `(("wine" ,wine)
205 ,@(package-inputs wine)))
209 (string-append "libdir=" %output "/lib/wine64"))
211 (modify-phases %standard-phases
212 ;; Explicitely set both the 64-bit and 32-bit versions of vulkan-loader
213 ;; when installing to x86_64-linux so both are available.
214 ;; TODO: Add more JSON files as they become available in Mesa.
215 ,@(match (%current-system)
217 `((add-after 'copy-wine32-binaries 'wrap-executable
218 (lambda* (#:key inputs outputs #:allow-other-keys)
219 (let* ((out (assoc-ref outputs "out")))
220 (wrap-program (string-append out "/bin/wine-preloader")
221 `("VK_ICD_FILENAMES" ":" =
222 (,(string-append (assoc-ref inputs "mesa")
223 "/share/vulkan/icd.d/radeon_icd.x86_64.json" ":"
224 (assoc-ref inputs "mesa")
225 "/share/vulkan/icd.d/intel_icd.x86_64.json" ":"
226 (assoc-ref inputs "wine")
227 "/share/vulkan/icd.d/radeon_icd.i686.json"))))
228 (wrap-program (string-append out "/bin/wine64-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"))))
240 (add-after 'install 'copy-wine32-binaries
241 (lambda* (#:key outputs #:allow-other-keys)
242 (let* ((wine32 (assoc-ref %build-inputs "wine"))
243 (out (assoc-ref %outputs "out")))
244 ;; Copy the 32-bit binaries needed for WoW64.
245 (copy-file (string-append wine32 "/bin/wine")
246 (string-append out "/bin/wine"))
247 ;; Copy the real 32-bit wine-preloader instead of the wrapped
249 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
250 (string-append out "/bin/wine-preloader"))
252 (add-after 'compress-documentation 'copy-wine32-manpage
253 (lambda* (#:key outputs #:allow-other-keys)
254 (let* ((wine32 (assoc-ref %build-inputs "wine"))
255 (out (assoc-ref %outputs "out")))
256 ;; Copy the missing man file for the wine binary from wine.
257 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
258 (string-append out "/share/man/man1/wine.1.gz"))
260 (add-after 'configure 'patch-dlopen-paths
261 ;; Hardcode dlopened sonames to absolute paths.
263 (let* ((library-path (search-path-as-string->list
264 (getenv "LIBRARY_PATH")))
265 (find-so (lambda (soname)
266 (search-path library-path soname))))
267 (substitute* "include/config.h"
268 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
269 (format #f "~a\"~a\"" defso (find-so soname))))
272 (list "--enable-win64"
273 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
274 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
276 (package-arguments wine))))
277 (synopsis "Implementation of the Windows API (WoW64 version)")
278 (supported-systems '("x86_64-linux" "aarch64-linux"))))
280 ;; This minimal build of Wine is needed to prevent a circular dependency with
282 (define-public wine-minimal
285 (name "wine-minimal")
286 (native-inputs (fold alist-delete (package-native-inputs wine)
287 '("gettext" "perl" "pkg-config")))
290 `(#:validate-runpath? #f
292 (modify-phases %standard-phases
293 (add-after 'configure 'patch-dlopen-paths
294 ;; Hardcode dlopened sonames to absolute paths.
296 (let* ((library-path (search-path-as-string->list
297 (getenv "LIBRARY_PATH")))
298 (find-so (lambda (soname)
299 (search-path library-path soname))))
300 (substitute* "include/config.h"
301 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
302 (format #f "~a\"~a\"" defso (find-so soname))))
305 (list "--without-freetype"
307 ,@(strip-keyword-arguments '(#:configure-flags #:phases)
308 (package-arguments wine))))))
310 (define-public wine-staging-patchset-data
312 (name "wine-staging-patchset-data")
318 (url "https://github.com/wine-staging/wine-staging")
319 (commit (string-append "v" version))))
320 (file-name (git-file-name name version))
323 "1jp5s4k3cwiw6jy8lih25n0c7nyrddr6dm7vlyfdfrl2gkah94z0"))))
324 (build-system trivial-build-system)
327 ("coreutils" ,coreutils)))
329 `(#:modules ((guix build utils))
332 (use-modules (guix build utils))
333 (let* ((build-directory ,(string-append name "-" version))
334 (source (assoc-ref %build-inputs "source"))
335 (bash (assoc-ref %build-inputs "bash"))
336 (coreutils (assoc-ref %build-inputs "coreutils"))
337 (out (assoc-ref %outputs "out"))
338 (wine-staging (string-append out "/share/wine-staging")))
339 (copy-recursively source build-directory)
340 (with-directory-excursion build-directory
341 (substitute* "patches/patchinstall.sh"
343 (string-append bash "/bin/sh")))
344 (substitute* "patches/gitapply.sh"
346 (string-append coreutils "/bin/env"))))
347 (copy-recursively build-directory wine-staging)
349 (home-page "https://github.com/wine-staging")
350 (synopsis "Patchset for Wine")
352 "wine-staging-patchset-data contains the patchset to build Wine-Staging.")
353 (license license:lgpl2.1+)))
355 (define-public wine-staging
358 (name "wine-staging")
359 (version (package-version wine-staging-patchset-data))
363 "https://dl.winehq.org/wine/source/"
364 (version-major version) ".x"
365 "/wine-" version ".tar.xz"))
366 (file-name (string-append name "-" version ".tar.xz"))
369 "1b8vwid8wsy1ss2q27bqkd9sdl67qqh0kmazi87vspi40nz7bxyf"))))
370 (inputs `(("autoconf" ,autoconf) ; for autoreconf
376 ("util-linux" ,util-linux) ; for hexdump
377 ("wine-staging-patchset-data" ,wine-staging-patchset-data)
378 ,@(package-inputs wine)))
381 (modify-phases %standard-phases
382 ;; Explicitely set the 32-bit version of vulkan-loader when installing
383 ;; to i686-linux or x86_64-linux.
384 ;; TODO: Add more JSON files as they become available in Mesa.
385 ,@(match (%current-system)
386 ((or "i686-linux" "x86_64-linux")
387 `((add-after 'install 'wrap-executable
388 (lambda* (#:key inputs outputs #:allow-other-keys)
389 (let* ((out (assoc-ref outputs "out"))
390 (icd (string-append out "/share/vulkan/icd.d")))
392 (copy-file (string-append (assoc-ref inputs "mesa")
393 "/share/vulkan/icd.d/radeon_icd.i686.json")
394 (string-append icd "/radeon_icd.i686.json"))
395 (wrap-program (string-append out "/bin/wine-preloader")
396 `("VK_ICD_FILENAMES" ":" =
398 "/radeon_icd.i686.json"))))
403 (add-before 'configure 'patch-source-wine-staging
404 (lambda* (#:key outputs #:allow-other-keys)
405 (let* ((source (assoc-ref %build-inputs "source"))
406 (script (string-append (assoc-ref %build-inputs
407 "wine-staging-patchset-data")
408 "/share/wine-staging/patches/patchinstall.sh")))
409 (invoke script (string-append "DESTDIR=" ".") "--all")
411 (add-after 'configure 'patch-dlopen-paths
412 ;; Hardcode dlopened sonames to absolute paths.
414 (let* ((library-path (search-path-as-string->list
415 (getenv "LIBRARY_PATH")))
416 (find-so (lambda (soname)
417 (search-path library-path soname))))
418 (substitute* "include/config.h"
419 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
420 (format #f "~a\"~a\"" defso (find-so soname))))
422 ,@(strip-keyword-arguments '(#:phases)
423 (package-arguments wine))))
424 (synopsis "Implementation of the Windows API (staging branch, 32-bit only)")
425 (description "Wine-Staging is the testing area of Wine. It
426 contains bug fixes and features, which have not been integrated into
427 the development branch yet. The idea of Wine-Staging is to provide
428 experimental features faster to end users and to give developers the
429 possibility to discuss and improve their patches before they are
430 integrated into the main branch.")
431 (home-page "https://github.com/wine-staging")
432 ;; In addition to the regular Wine license (lgpl2.1+), Wine-Staging
433 ;; provides Liberation and WenQuanYi Micro Hei fonts. Those use
434 ;; different licenses. In particular, the latter is licensed under
435 ;; both GPL3+ and Apache 2 License.
437 (list license:lgpl2.1+ license:silofl1.1 license:gpl3+ license:asl2.0))))
439 (define-public wine64-staging
441 (inherit wine-staging)
442 (name "wine64-staging")
443 (inputs `(("wine-staging" ,wine-staging)
444 ,@(package-inputs wine-staging)))
448 (string-append "libdir=" %output "/lib/wine64"))
450 (modify-phases %standard-phases
451 ;; Explicitely set both the 64-bit and 32-bit versions of vulkan-loader
452 ;; when installing to x86_64-linux so both are available.
453 ;; TODO: Add more JSON files as they become available in Mesa.
454 ,@(match (%current-system)
456 `((add-after 'copy-wine32-binaries 'wrap-executable
457 (lambda* (#:key inputs outputs #:allow-other-keys)
458 (let* ((out (assoc-ref outputs "out")))
459 (wrap-program (string-append out "/bin/wine-preloader")
460 `("VK_ICD_FILENAMES" ":" =
461 (,(string-append (assoc-ref inputs "mesa")
462 "/share/vulkan/icd.d/radeon_icd.x86_64.json" ":"
463 (assoc-ref inputs "mesa")
464 "/share/vulkan/icd.d/intel_icd.x86_64.json" ":"
465 (assoc-ref inputs "wine-staging")
466 "/share/vulkan/icd.d/radeon_icd.i686.json"))))
467 (wrap-program (string-append out "/bin/wine64-preloader")
468 `("VK_ICD_FILENAMES" ":" =
469 (,(string-append (assoc-ref inputs "mesa")
470 "/share/vulkan/icd.d/radeon_icd.x86_64.json"
471 ":" (assoc-ref inputs "mesa")
472 "/share/vulkan/icd.d/intel_icd.x86_64.json"
473 ":" (assoc-ref inputs "wine-staging")
474 "/share/vulkan/icd.d/radeon_icd.i686.json"))))
479 (add-before 'configure 'patch-source-wine-staging
480 (lambda* (#:key outputs #:allow-other-keys)
481 (let* ((source (assoc-ref %build-inputs "source"))
482 (script (string-append (assoc-ref %build-inputs
483 "wine-staging-patchset-data")
484 "/share/wine-staging/patches/patchinstall.sh")))
485 (invoke script (string-append "DESTDIR=" ".") "--all")
487 (add-after 'install 'copy-wine32-binaries
488 (lambda* (#:key outputs #:allow-other-keys)
489 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
490 (out (assoc-ref %outputs "out")))
491 ;; Copy the 32-bit binaries needed for WoW64.
492 (copy-file (string-append wine32 "/bin/wine")
493 (string-append out "/bin/wine"))
494 ;; Copy the real 32-bit wine-preloader instead of the wrapped
496 (copy-file (string-append wine32 "/bin/.wine-preloader-real")
497 (string-append out "/bin/wine-preloader"))
499 (add-after 'compress-documentation 'copy-wine32-manpage
500 (lambda* (#:key outputs #:allow-other-keys)
501 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
502 (out (assoc-ref %outputs "out")))
503 ;; Copy the missing man file for the wine binary from
505 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
506 (string-append out "/share/man/man1/wine.1.gz"))
508 (add-after 'configure 'patch-dlopen-paths
509 ;; Hardcode dlopened sonames to absolute paths.
511 (let* ((library-path (search-path-as-string->list
512 (getenv "LIBRARY_PATH")))
513 (find-so (lambda (soname)
514 (search-path library-path soname))))
515 (substitute* "include/config.h"
516 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
517 (format #f "~a\"~a\"" defso (find-so soname))))
520 (list "--enable-win64"
521 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
522 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
524 (package-arguments wine-staging))))
525 (synopsis "Implementation of the Windows API (staging branch, WoW64
527 (supported-systems '("x86_64-linux" "aarch64-linux"))))