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 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))
77 (uri (string-append "https://dl.winehq.org/wine/source/"
78 (version-major+minor version)
79 "/wine-" version ".tar.xz"))
82 "1zv3nk31s758ghp4795ym3w8l5868c2dllmjx9245qh9ahvp3mya"))))
83 (build-system gnu-build-system)
84 (native-inputs `(("pkg-config" ,pkg-config)
85 ("gettext" ,gettext-minimal)
90 `(("alsa-lib" ,alsa-lib)
94 ("fontconfig" ,fontconfig)
95 ("freetype" ,freetype)
98 ("gst-plugins-base" ,gst-plugins-base)
102 ("libgphoto2" ,libgphoto2)
103 ("libmpg123" ,mpg123)
104 ("libldap" ,openldap)
106 ("libsane" ,sane-backends)
115 ("libXcursor" ,libxcursor)
116 ("libXrender" ,libxrender)
117 ("libXrandr" ,libxrandr)
118 ("libXinerama" ,libxinerama)
119 ("libXxf86vm" ,libxxf86vm)
120 ("libXcomposite" ,libxcomposite)
121 ("mit-krb5" ,mit-krb5)
124 ("pulseaudio" ,pulseaudio)
125 ("unixodbc" ,unixodbc)
126 ("v4l-utils" ,v4l-utils)
129 `(;; Force a 32-bit build targeting a similar architecture, i.e.:
130 ;; armhf for armhf/aarch64, i686 for i686/x86_64.
131 #:system ,@(match (%current-system)
132 ((or "armhf-linux" "aarch64-linux")
137 ;; XXX: There's a test suite, but it's unclear whether it's supposed to
142 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine32"))
146 (string-append "libdir=" %output "/lib/wine32"))
149 (modify-phases %standard-phases
150 (add-after 'configure 'patch-dlopen-paths
151 ;; Hardcode dlopened sonames to absolute paths.
153 (let* ((library-path (search-path-as-string->list
154 (getenv "LIBRARY_PATH")))
155 (find-so (lambda (soname)
156 (search-path library-path soname))))
157 (substitute* "include/config.h"
158 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
159 (format #f "~a\"~a\"" defso (find-so soname))))
161 (home-page "https://www.winehq.org/")
162 (synopsis "Implementation of the Windows API (32-bit only)")
164 "Wine (originally an acronym for \"Wine Is Not an Emulator\") is a
165 compatibility layer capable of running Windows applications. Instead of
166 simulating internal Windows logic like a virtual machine or emulator, Wine
167 translates Windows API calls into POSIX calls on-the-fly, eliminating the
168 performance and memory penalties of other methods and allowing you to cleanly
169 integrate Windows applications into your desktop.")
170 ;; Any platform should be able to build wine, but based on '#:system' these
171 ;; are thr ones we currently support.
172 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
173 (license license:lgpl2.1+)))
175 (define-public wine64
179 (inputs `(("wine" ,wine)
180 ,@(package-inputs wine)))
184 (string-append "libdir=" %output "/lib/wine64"))
186 (modify-phases %standard-phases
187 (add-after 'install 'copy-wine32-binaries
188 (lambda* (#:key outputs #:allow-other-keys)
189 (let* ((wine32 (assoc-ref %build-inputs "wine"))
190 (out (assoc-ref %outputs "out")))
191 ;; Copy the 32-bit binaries needed for WoW64.
192 (copy-file (string-append wine32 "/bin/wine")
193 (string-append out "/bin/wine"))
194 (copy-file (string-append wine32 "/bin/wine-preloader")
195 (string-append out "/bin/wine-preloader"))
197 (add-after 'compress-documentation 'copy-wine32-manpage
198 (lambda* (#:key outputs #:allow-other-keys)
199 (let* ((wine32 (assoc-ref %build-inputs "wine"))
200 (out (assoc-ref %outputs "out")))
201 ;; Copy the missing man file for the wine binary from wine.
202 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
203 (string-append out "/share/man/man1/wine.1.gz"))
205 (add-after 'configure 'patch-dlopen-paths
206 ;; Hardcode dlopened sonames to absolute paths.
208 (let* ((library-path (search-path-as-string->list
209 (getenv "LIBRARY_PATH")))
210 (find-so (lambda (soname)
211 (search-path library-path soname))))
212 (substitute* "include/config.h"
213 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
214 (format #f "~a\"~a\"" defso (find-so soname))))
217 (list "--enable-win64"
218 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
219 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
221 (package-arguments wine))))
222 (synopsis "Implementation of the Windows API (WoW64 version)")
223 (supported-systems '("x86_64-linux" "aarch64-linux"))))
225 (define-public wine-staging-patchset-data
227 (name "wine-staging-patchset-data")
233 (url "https://github.com/wine-staging/wine-staging")
234 (commit (string-append "v" version))))
235 (file-name (git-file-name name version))
238 "0h6gck0p92hin0m13q1hnlfnqs4vy474w66ppinvqms2zn3vibgi"))))
239 (build-system trivial-build-system)
242 ("coreutils" ,coreutils)))
244 `(#:modules ((guix build utils))
247 (use-modules (guix build utils))
248 (let* ((build-directory ,(string-append name "-" version))
249 (source (assoc-ref %build-inputs "source"))
250 (bash (assoc-ref %build-inputs "bash"))
251 (coreutils (assoc-ref %build-inputs "coreutils"))
252 (out (assoc-ref %outputs "out"))
253 (wine-staging (string-append out "/share/wine-staging")))
254 (copy-recursively source build-directory)
255 (with-directory-excursion build-directory
256 (substitute* "patches/patchinstall.sh"
258 (string-append bash "/bin/sh")))
259 (substitute* "patches/gitapply.sh"
261 (string-append coreutils "/bin/env"))))
262 (copy-recursively build-directory wine-staging)
264 (home-page "https://github.com/wine-staging")
265 (synopsis "Patchset for Wine")
267 "wine-staging-patchset-data contains the patchset to build Wine-Staging.")
268 (license license:lgpl2.1+)))
270 (define-public wine-staging
273 (name "wine-staging")
274 (version (package-version wine-staging-patchset-data))
278 "https://dl.winehq.org/wine/source/"
279 (version-major version) ".x"
280 "/wine-" version ".tar.xz"))
281 (file-name (string-append name "-" version ".tar.xz"))
284 "01dhn3a6k3dwnrbz4bxvszhh5sxwy6s89y459g805hjmq8s6d2a7"))))
285 (inputs `(("autoconf" ,autoconf) ; for autoreconf
290 ("util-linux" ,util-linux) ; for hexdump
292 ("vulkan-loader" ,vulkan-loader)
293 ("wine-staging-patchset-data" ,wine-staging-patchset-data)
294 ,@(package-inputs wine)))
297 (modify-phases %standard-phases
298 (add-before 'configure 'patch-source-wine-staging
299 (lambda* (#:key outputs #:allow-other-keys)
300 (let* ((source (assoc-ref %build-inputs "source"))
301 (script (string-append (assoc-ref %build-inputs
302 "wine-staging-patchset-data")
303 "/share/wine-staging/patches/patchinstall.sh")))
304 (invoke script (string-append "DESTDIR=" ".") "--all")
306 (add-after 'configure 'patch-dlopen-paths
307 ;; Hardcode dlopened sonames to absolute paths.
309 (let* ((library-path (search-path-as-string->list
310 (getenv "LIBRARY_PATH")))
311 (find-so (lambda (soname)
312 (search-path library-path soname))))
313 (substitute* "include/config.h"
314 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
315 (format #f "~a\"~a\"" defso (find-so soname))))
317 ,@(strip-keyword-arguments '(#:phases)
318 (package-arguments wine))))
319 (synopsis "Implementation of the Windows API (staging branch, 32-bit only)")
320 (description "Wine-Staging is the testing area of Wine. It
321 contains bug fixes and features, which have not been integrated into
322 the development branch yet. The idea of Wine-Staging is to provide
323 experimental features faster to end users and to give developers the
324 possibility to discuss and improve their patches before they are
325 integrated into the main branch.")
326 (home-page "https://github.com/wine-staging")
327 ;; In addition to the regular Wine license (lgpl2.1+), Wine-Staging
328 ;; provides Liberation and WenQuanYi Micro Hei fonts. Those use
329 ;; different licenses. In particular, the latter is licensed under
330 ;; both GPL3+ and Apache 2 License.
332 (list license:lgpl2.1+ license:silofl1.1 license:gpl3+ license:asl2.0))))
334 (define-public wine64-staging
336 (inherit wine-staging)
337 (name "wine64-staging")
338 (inputs `(("wine-staging" ,wine-staging)
339 ,@(package-inputs wine-staging)))
343 (string-append "libdir=" %output "/lib/wine64"))
345 (modify-phases %standard-phases
346 (add-before 'configure 'patch-source-wine-staging
347 (lambda* (#:key outputs #:allow-other-keys)
348 (let* ((source (assoc-ref %build-inputs "source"))
349 (script (string-append (assoc-ref %build-inputs
350 "wine-staging-patchset-data")
351 "/share/wine-staging/patches/patchinstall.sh")))
352 (invoke script (string-append "DESTDIR=" ".") "--all")
354 (add-after 'install 'copy-wine32-binaries
355 (lambda* (#:key outputs #:allow-other-keys)
356 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
357 (out (assoc-ref %outputs "out")))
358 ;; Copy the 32-bit binaries needed for WoW64.
359 (copy-file (string-append wine32 "/bin/wine")
360 (string-append out "/bin/wine"))
361 (copy-file (string-append wine32 "/bin/wine-preloader")
362 (string-append out "/bin/wine-preloader"))
364 (add-after 'compress-documentation 'copy-wine32-manpage
365 (lambda* (#:key outputs #:allow-other-keys)
366 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
367 (out (assoc-ref %outputs "out")))
368 ;; Copy the missing man file for the wine binary from
370 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
371 (string-append out "/share/man/man1/wine.1.gz"))
373 (add-after 'configure 'patch-dlopen-paths
374 ;; Hardcode dlopened sonames to absolute paths.
376 (let* ((library-path (search-path-as-string->list
377 (getenv "LIBRARY_PATH")))
378 (find-so (lambda (soname)
379 (search-path library-path soname))))
380 (substitute* "include/config.h"
381 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
382 (format #f "~a\"~a\"" defso (find-so soname))))
385 (list "--enable-win64"
386 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
387 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
389 (package-arguments wine-staging))))
390 (synopsis "Implementation of the Windows API (staging branch, WoW64
392 (supported-systems '("x86_64-linux" "aarch64-linux"))))