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>
8 ;;; This file is part of GNU Guix.
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23 (define-module (gnu packages wine)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix utils)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system trivial)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages admin)
32 #:use-module (gnu packages audio)
33 #:use-module (gnu packages autotools)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages bash)
36 #:use-module (gnu packages bison)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages cups)
39 #:use-module (gnu packages databases)
40 #:use-module (gnu packages fontutils)
41 #:use-module (gnu packages flex)
42 #:use-module (gnu packages image)
43 #:use-module (gnu packages gettext)
44 #:use-module (gnu packages ghostscript)
45 #:use-module (gnu packages gl)
46 #:use-module (gnu packages glib)
47 #:use-module (gnu packages gstreamer)
48 #:use-module (gnu packages gtk)
49 #:use-module (gnu packages kerberos)
50 #:use-module (gnu packages linux)
51 #:use-module (gnu packages openldap)
52 #:use-module (gnu packages perl)
53 #:use-module (gnu packages pulseaudio)
54 #:use-module (gnu packages pkg-config)
55 #:use-module (gnu packages python)
56 #:use-module (gnu packages mp3)
57 #:use-module (gnu packages ncurses)
58 #:use-module (gnu packages photo)
59 #:use-module (gnu packages samba)
60 #:use-module (gnu packages scanner)
61 #:use-module (gnu packages sdl)
62 #:use-module (gnu packages tls)
63 #:use-module (gnu packages video)
64 #:use-module (gnu packages vulkan)
65 #:use-module (gnu packages xml)
66 #:use-module (gnu packages xorg)
67 #:use-module (ice-9 match))
75 (uri (string-append "https://dl.winehq.org/wine/source/"
76 (version-major+minor version)
77 "/wine-" version ".tar.xz"))
80 "1wr63n70pli83p3rmclr2j4lxzs4ll1cwlpdlaajfrf6v9yhvl5s"))))
81 (build-system gnu-build-system)
82 (native-inputs `(("pkg-config" ,pkg-config)
83 ("gettext" ,gettext-minimal)
88 `(("alsa-lib" ,alsa-lib)
92 ("fontconfig" ,fontconfig)
93 ("freetype" ,freetype)
96 ("gst-plugins-base" ,gst-plugins-base)
100 ("libgphoto2" ,libgphoto2)
101 ("libmpg123" ,mpg123)
102 ("libldap" ,openldap)
104 ("libsane" ,sane-backends)
113 ("libXcursor" ,libxcursor)
114 ("libXrender" ,libxrender)
115 ("libXrandr" ,libxrandr)
116 ("libXinerama" ,libxinerama)
117 ("libXxf86vm" ,libxxf86vm)
118 ("libXcomposite" ,libxcomposite)
119 ("mit-krb5" ,mit-krb5)
122 ("pulseaudio" ,pulseaudio)
123 ("unixodbc" ,unixodbc)
124 ("v4l-utils" ,v4l-utils)
127 `(;; Force a 32-bit build targeting a similar architecture, i.e.:
128 ;; armhf for armhf/aarch64, i686 for i686/x86_64.
129 #:system ,@(match (%current-system)
130 ((or "armhf-linux" "aarch64-linux")
135 ;; XXX: There's a test suite, but it's unclear whether it's supposed to
140 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine32"))
144 (string-append "libdir=" %output "/lib/wine32"))
147 (modify-phases %standard-phases
148 (add-after 'configure 'patch-dlopen-paths
149 ;; Hardcode dlopened sonames to absolute paths.
151 (let* ((library-path (search-path-as-string->list
152 (getenv "LIBRARY_PATH")))
153 (find-so (lambda (soname)
154 (search-path library-path soname))))
155 (substitute* "include/config.h"
156 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
157 (format #f "~a\"~a\"" defso (find-so soname))))
159 (home-page "https://www.winehq.org/")
160 (synopsis "Implementation of the Windows API (32-bit only)")
162 "Wine (originally an acronym for \"Wine Is Not an Emulator\") is a
163 compatibility layer capable of running Windows applications. Instead of
164 simulating internal Windows logic like a virtual machine or emulator, Wine
165 translates Windows API calls into POSIX calls on-the-fly, eliminating the
166 performance and memory penalties of other methods and allowing you to cleanly
167 integrate Windows applications into your desktop.")
168 ;; Any platform should be able to build wine, but based on '#:system' these
169 ;; are thr ones we currently support.
170 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
171 (license license:lgpl2.1+)))
173 (define-public wine64
177 (inputs `(("wine" ,wine)
178 ,@(package-inputs wine)))
182 (string-append "libdir=" %output "/lib/wine64"))
184 (modify-phases %standard-phases
185 (add-after 'install 'copy-wine32-binaries
186 (lambda* (#:key outputs #:allow-other-keys)
187 (let* ((wine32 (assoc-ref %build-inputs "wine"))
188 (out (assoc-ref %outputs "out")))
189 ;; Copy the 32-bit binaries needed for WoW64.
190 (copy-file (string-append wine32 "/bin/wine")
191 (string-append out "/bin/wine"))
192 (copy-file (string-append wine32 "/bin/wine-preloader")
193 (string-append out "/bin/wine-preloader"))
195 (add-after 'compress-documentation 'copy-wine32-manpage
196 (lambda* (#:key outputs #:allow-other-keys)
197 (let* ((wine32 (assoc-ref %build-inputs "wine"))
198 (out (assoc-ref %outputs "out")))
199 ;; Copy the missing man file for the wine binary from wine.
200 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
201 (string-append out "/share/man/man1/wine.1.gz"))
203 (add-after 'configure 'patch-dlopen-paths
204 ;; Hardcode dlopened sonames to absolute paths.
206 (let* ((library-path (search-path-as-string->list
207 (getenv "LIBRARY_PATH")))
208 (find-so (lambda (soname)
209 (search-path library-path soname))))
210 (substitute* "include/config.h"
211 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
212 (format #f "~a\"~a\"" defso (find-so soname))))
215 (list "--enable-win64"
216 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
217 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
219 (package-arguments wine))))
220 (synopsis "Implementation of the Windows API (WoW64 version)")
221 (supported-systems '("x86_64-linux" "aarch64-linux"))))
223 (define-public wine-staging-patchset-data
225 (name "wine-staging-patchset-data")
230 (uri (string-append "https://github.com/wine-staging/wine-staging/archive/v"
232 (file-name (string-append name "-" version ".zip"))
235 "0akccqrp1ymjrra2c99f6hxlaa77jyihfs3q8x93vkgb9c0lq5xx"))))
236 (build-system trivial-build-system)
239 ("coreutils" ,coreutils)
242 `(#:modules ((guix build utils))
245 (use-modules (guix build utils))
246 (let* ((out (assoc-ref %outputs "out"))
247 (wine-staging (string-append out "/share/wine-staging"))
248 (source (assoc-ref %build-inputs "source"))
249 (sh (string-append (assoc-ref %build-inputs "bash") "/bin/bash"))
250 (env (string-append (assoc-ref %build-inputs "coreutils") "/bin/env"))
251 (unzip (string-append (assoc-ref %build-inputs "unzip") "/bin/unzip")))
252 (copy-file source (string-append ,name "-" ,version ".zip"))
253 (invoke unzip (string-append ,name "-" ,version ".zip"))
254 (substitute* (string-append "wine-staging-" ,version
255 "/patches/patchinstall.sh") (("/bin/sh") sh))
256 (substitute* (string-append "wine-staging-" ,version
257 "/patches/gitapply.sh") (("/usr/bin/env") env))
258 (mkdir-p wine-staging)
259 (copy-recursively (string-append "wine-staging-" ,version)
261 (home-page "https://github.com/wine-staging")
262 (synopsis "Patchset for Wine")
264 "wine-staging-patchset-data contains the patchset to build Wine-Staging.")
265 (license license:lgpl2.1+)))
267 (define-public wine-staging
270 (name "wine-staging")
271 (version (package-version wine-staging-patchset-data))
275 "https://dl.winehq.org/wine/source/"
276 (version-major version) ".x"
277 "/wine-" version ".tar.xz"))
278 (file-name (string-append name "-" version ".tar.xz"))
281 "0ddphvlp9lsjyqc6zckinc36bggpkg925v0x2vqr8nkdjs0w5bfc"))))
282 (inputs `(("autoconf" ,autoconf) ; for autoreconf
287 ("util-linux" ,util-linux) ; for hexdump
288 ("vulkan-loader" ,vulkan-loader)
289 ("wine-staging-patchset-data" ,wine-staging-patchset-data)
290 ,@(package-inputs wine)))
293 (modify-phases %standard-phases
294 (add-before 'configure 'patch-source-wine-staging
295 (lambda* (#:key outputs #:allow-other-keys)
296 (let* ((source (assoc-ref %build-inputs "source"))
297 (script (string-append (assoc-ref %build-inputs
298 "wine-staging-patchset-data")
299 "/share/wine-staging/patches/patchinstall.sh")))
300 (invoke script (string-append "DESTDIR=" ".") "--all")
302 (add-after 'configure 'patch-dlopen-paths
303 ;; Hardcode dlopened sonames to absolute paths.
305 (let* ((library-path (search-path-as-string->list
306 (getenv "LIBRARY_PATH")))
307 (find-so (lambda (soname)
308 (search-path library-path soname))))
309 (substitute* "include/config.h"
310 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
311 (format #f "~a\"~a\"" defso (find-so soname))))
313 ,@(strip-keyword-arguments '(#:phases)
314 (package-arguments wine))))
315 (synopsis "Implementation of the Windows API (staging branch, 32-bit only)")
316 (description "Wine-Staging is the testing area of Wine. It
317 contains bug fixes and features, which have not been integrated into
318 the development branch yet. The idea of Wine-Staging is to provide
319 experimental features faster to end users and to give developers the
320 possibility to discuss and improve their patches before they are
321 integrated into the main branch.")
322 (home-page "https://github.com/wine-staging")
323 ;; In addition to the regular Wine license (lgpl2.1+), Wine-Staging
324 ;; provides Liberation and WenQuanYi Micro Hei fonts. Those use
325 ;; different licenses. In particular, the latter is licensed under
326 ;; both GPL3+ and Apache 2 License.
328 (list license:lgpl2.1+ license:silofl1.1 license:gpl3+ license:asl2.0))))
330 (define-public wine64-staging
332 (inherit wine-staging)
333 (name "wine64-staging")
334 (inputs `(("wine-staging" ,wine-staging)
335 ,@(package-inputs wine-staging)))
339 (string-append "libdir=" %output "/lib/wine64"))
341 (modify-phases %standard-phases
342 (add-before 'configure 'patch-source-wine-staging
343 (lambda* (#:key outputs #:allow-other-keys)
344 (let* ((source (assoc-ref %build-inputs "source"))
345 (script (string-append (assoc-ref %build-inputs
346 "wine-staging-patchset-data")
347 "/share/wine-staging/patches/patchinstall.sh")))
348 (invoke script (string-append "DESTDIR=" ".") "--all")
350 (add-after 'install 'copy-wine32-binaries
351 (lambda* (#:key outputs #:allow-other-keys)
352 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
353 (out (assoc-ref %outputs "out")))
354 ;; Copy the 32-bit binaries needed for WoW64.
355 (copy-file (string-append wine32 "/bin/wine")
356 (string-append out "/bin/wine"))
357 (copy-file (string-append wine32 "/bin/wine-preloader")
358 (string-append out "/bin/wine-preloader"))
360 (add-after 'compress-documentation 'copy-wine32-manpage
361 (lambda* (#:key outputs #:allow-other-keys)
362 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
363 (out (assoc-ref %outputs "out")))
364 ;; Copy the missing man file for the wine binary from
366 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
367 (string-append out "/share/man/man1/wine.1.gz"))
369 (add-after 'configure 'patch-dlopen-paths
370 ;; Hardcode dlopened sonames to absolute paths.
372 (let* ((library-path (search-path-as-string->list
373 (getenv "LIBRARY_PATH")))
374 (find-so (lambda (soname)
375 (search-path library-path soname))))
376 (substitute* "include/config.h"
377 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
378 (format #f "~a\"~a\"" defso (find-so soname))))
381 (list "--enable-win64"
382 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
383 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
385 (package-arguments wine-staging))))
386 (synopsis "Implementation of the Windows API (staging branch, WoW64
388 (supported-systems '("x86_64-linux" "aarch64-linux"))))