gnu: Fix common unquote typos.
[jackhill/guix/guix.git] / gnu / packages / wine.scm
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 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
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.
14 ;;;
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.
19 ;;;
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/>.
22
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 linux)
50 #:use-module (gnu packages openldap)
51 #:use-module (gnu packages perl)
52 #:use-module (gnu packages pulseaudio)
53 #:use-module (gnu packages pkg-config)
54 #:use-module (gnu packages python)
55 #:use-module (gnu packages mp3)
56 #:use-module (gnu packages ncurses)
57 #:use-module (gnu packages photo)
58 #:use-module (gnu packages samba)
59 #:use-module (gnu packages scanner)
60 #:use-module (gnu packages sdl)
61 #:use-module (gnu packages tls)
62 #:use-module (gnu packages video)
63 #:use-module (gnu packages vulkan)
64 #:use-module (gnu packages xml)
65 #:use-module (gnu packages xorg)
66 #:use-module (ice-9 match))
67
68 (define-public wine
69 (package
70 (name "wine")
71 (version "3.0")
72 (source (origin
73 (method url-fetch)
74 (uri (string-append "https://dl.winehq.org/wine/source/"
75 (version-major+minor version)
76 "/wine-" version ".tar.xz"))
77 (sha256
78 (base32
79 "1v7vq9iinkscbq6wg85fb0d2137660fg2nk5iabxkl2wr850asil"))))
80 (build-system gnu-build-system)
81 (native-inputs `(("pkg-config" ,pkg-config)
82 ("gettext" ,gettext-minimal)
83 ("flex" ,flex)
84 ("bison" ,bison)
85 ("perl" ,perl)))
86 (inputs
87 `(("alsa-lib" ,alsa-lib)
88 ("dbus" ,dbus)
89 ("cups" ,cups)
90 ("eudev" ,eudev)
91 ("fontconfig" ,fontconfig)
92 ("freetype" ,freetype)
93 ("glu" ,glu)
94 ("gnutls" ,gnutls)
95 ("gst-plugins-base" ,gst-plugins-base)
96 ("lcms" ,lcms)
97 ("libxml2" ,libxml2)
98 ("libxslt" ,libxslt)
99 ("libgphoto2" ,libgphoto2)
100 ("libmpg123" ,mpg123)
101 ("libldap" ,openldap)
102 ("libnetapi" ,samba)
103 ("libsane" ,sane-backends)
104 ("libpcap" ,libpcap)
105 ("libpng" ,libpng)
106 ("libjpeg" ,libjpeg)
107 ("libtiff" ,libtiff)
108 ("libICE" ,libice)
109 ("libX11" ,libx11)
110 ("libXi" ,libxi)
111 ("libXext" ,libxext)
112 ("libXcursor" ,libxcursor)
113 ("libXrender" ,libxrender)
114 ("libXrandr" ,libxrandr)
115 ("libXinerama" ,libxinerama)
116 ("libXxf86vm" ,libxxf86vm)
117 ("libXcomposite" ,libxcomposite)
118 ("ncurses" ,ncurses)
119 ("openal" ,openal)
120 ("pulseaudio" ,pulseaudio)
121 ("unixodbc" ,unixodbc)
122 ("v4l-utils" ,v4l-utils)
123 ("zlib" ,zlib)))
124 (arguments
125 `(;; Force a 32-bit build targeting a similar architecture, i.e.:
126 ;; armhf for armhf/aarch64, i686 for i686/x86_64.
127 #:system ,@(match (%current-system)
128 ((or "armhf-linux" "aarch64-linux")
129 `("armhf-linux"))
130 (_
131 `("i686-linux")))
132
133 ;; XXX: There's a test suite, but it's unclear whether it's supposed to
134 ;; pass.
135 #:tests? #f
136
137 #:configure-flags
138 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine32"))
139
140 #:make-flags
141 (list "SHELL=bash"
142 (string-append "libdir=" %output "/lib/wine32"))
143
144 #:phases
145 (modify-phases %standard-phases
146 (add-after 'configure 'patch-dlopen-paths
147 ;; Hardcode dlopened sonames to absolute paths.
148 (lambda _
149 (let* ((library-path (search-path-as-string->list
150 (getenv "LIBRARY_PATH")))
151 (find-so (lambda (soname)
152 (search-path library-path soname))))
153 (substitute* "include/config.h"
154 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
155 (format #f "~a\"~a\"" defso (find-so soname))))
156 #t))))))
157 (home-page "https://www.winehq.org/")
158 (synopsis "Implementation of the Windows API (32-bit only)")
159 (description
160 "Wine (originally an acronym for \"Wine Is Not an Emulator\") is a
161 compatibility layer capable of running Windows applications. Instead of
162 simulating internal Windows logic like a virtual machine or emulator, Wine
163 translates Windows API calls into POSIX calls on-the-fly, eliminating the
164 performance and memory penalties of other methods and allowing you to cleanly
165 integrate Windows applications into your desktop.")
166 ;; Any platform should be able to build wine, but based on '#:system' these
167 ;; are thr ones we currently support.
168 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
169 (license license:lgpl2.1+)))
170
171 (define-public wine64
172 (package
173 (inherit wine)
174 (name "wine64")
175 (inputs `(("wine" ,wine)
176 ,@(package-inputs wine)))
177 (arguments
178 `(#:make-flags
179 (list "SHELL=bash"
180 (string-append "libdir=" %output "/lib/wine64"))
181 #:phases
182 (modify-phases %standard-phases
183 (add-after 'install 'copy-wine32-binaries
184 (lambda* (#:key outputs #:allow-other-keys)
185 (let* ((wine32 (assoc-ref %build-inputs "wine"))
186 (out (assoc-ref %outputs "out")))
187 ;; Copy the 32-bit binaries needed for WoW64.
188 (copy-file (string-append wine32 "/bin/wine")
189 (string-append out "/bin/wine"))
190 (copy-file (string-append wine32 "/bin/wine-preloader")
191 (string-append out "/bin/wine-preloader"))
192 #t)))
193 (add-after 'compress-documentation 'copy-wine32-manpage
194 (lambda* (#:key outputs #:allow-other-keys)
195 (let* ((wine32 (assoc-ref %build-inputs "wine"))
196 (out (assoc-ref %outputs "out")))
197 ;; Copy the missing man file for the wine binary from wine.
198 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
199 (string-append out "/share/man/man1/wine.1.gz"))
200 #t)))
201 (add-after 'configure 'patch-dlopen-paths
202 ;; Hardcode dlopened sonames to absolute paths.
203 (lambda _
204 (let* ((library-path (search-path-as-string->list
205 (getenv "LIBRARY_PATH")))
206 (find-so (lambda (soname)
207 (search-path library-path soname))))
208 (substitute* "include/config.h"
209 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
210 (format #f "~a\"~a\"" defso (find-so soname))))
211 #t))))
212 #:configure-flags
213 (list "--enable-win64"
214 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
215 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
216 #:system)
217 (package-arguments wine))))
218 (synopsis "Implementation of the Windows API (WoW64 version)")
219 (supported-systems '("x86_64-linux" "aarch64-linux"))))
220
221 (define-public wine-staging-patchset-data
222 (package
223 (name "wine-staging-patchset-data")
224 (version "3.4")
225 (source
226 (origin
227 (method url-fetch)
228 (uri (string-append "https://github.com/wine-staging/wine-staging/archive/v"
229 version ".zip"))
230 (file-name (string-append name "-" version ".zip"))
231 (sha256
232 (base32
233 "00yzh9bqs2rjgvk78xv3gfkbv4f2bkch9vb1ii4xh883f7wvkz93"))))
234 (build-system trivial-build-system)
235 (native-inputs
236 `(("bash" ,bash)
237 ("coreutils" ,coreutils)
238 ("unzip" ,unzip)))
239 (arguments
240 `(#:modules ((guix build utils))
241 #:builder
242 (begin
243 (use-modules (guix build utils))
244 (let* ((out (assoc-ref %outputs "out"))
245 (wine-staging (string-append out "/share/wine-staging"))
246 (source (assoc-ref %build-inputs "source"))
247 (sh (string-append (assoc-ref %build-inputs "bash") "/bin/bash"))
248 (env (string-append (assoc-ref %build-inputs "coreutils") "/bin/env"))
249 (unzip (string-append (assoc-ref %build-inputs "unzip") "/bin/unzip")))
250 (copy-file source (string-append ,name "-" ,version ".zip"))
251 (invoke unzip (string-append ,name "-" ,version ".zip"))
252 (substitute* (string-append "wine-staging-" ,version
253 "/patches/patchinstall.sh") (("/bin/sh") sh))
254 (substitute* (string-append "wine-staging-" ,version
255 "/patches/gitapply.sh") (("/usr/bin/env") env))
256 (mkdir-p wine-staging)
257 (copy-recursively (string-append "wine-staging-" ,version)
258 wine-staging)))))
259 (home-page "https://github.com/wine-staging")
260 (synopsis "Patchset for Wine")
261 (description
262 "wine-staging-patchset-data contains the patchset to build Wine-Staging.")
263 (license license:lgpl2.1+)))
264
265 (define-public wine-staging
266 (package
267 (inherit wine)
268 (name "wine-staging")
269 (version (package-version wine-staging-patchset-data))
270 (source (origin
271 (method url-fetch)
272 (uri (string-append
273 "https://dl.winehq.org/wine/source/"
274 (version-major version) ".x"
275 "/wine-" version ".tar.xz"))
276 (file-name (string-append name "-" version ".tar.xz"))
277 (sha256
278 (base32
279 "14wf7536rkmhav9ibbvhqqkfqmbk1dckhd2679i5scizr5x290x4"))))
280 (inputs `(("autoconf" ,autoconf) ; for autoreconf
281 ("gtk+" ,gtk+)
282 ("libva" ,libva)
283 ("python" ,python)
284 ("sdl2" ,sdl2)
285 ("util-linux" ,util-linux) ; for hexdump
286 ("vulkan-icd-loader" ,vulkan-icd-loader)
287 ("wine-staging-patchset-data" ,wine-staging-patchset-data)
288 ,@(package-inputs wine)))
289 (arguments
290 `(#:phases
291 (modify-phases %standard-phases
292 (add-before 'configure 'patch-source-wine-staging
293 (lambda* (#:key outputs #:allow-other-keys)
294 (let* ((source (assoc-ref %build-inputs "source"))
295 (script (string-append (assoc-ref %build-inputs
296 "wine-staging-patchset-data")
297 "/share/wine-staging/patches/patchinstall.sh")))
298 (invoke script (string-append "DESTDIR=" ".") "--all")
299 #t)))
300 (add-after 'configure 'patch-dlopen-paths
301 ;; Hardcode dlopened sonames to absolute paths.
302 (lambda _
303 (let* ((library-path (search-path-as-string->list
304 (getenv "LIBRARY_PATH")))
305 (find-so (lambda (soname)
306 (search-path library-path soname))))
307 (substitute* "include/config.h"
308 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
309 (format #f "~a\"~a\"" defso (find-so soname))))
310 #t))))
311 ,@(strip-keyword-arguments '(#:phases)
312 (package-arguments wine))))
313 (synopsis "Implementation of the Windows API (staging branch, 32-bit only)")
314 (description "Wine-Staging is the testing area of Wine. It
315 contains bug fixes and features, which have not been integrated into
316 the development branch yet. The idea of Wine-Staging is to provide
317 experimental features faster to end users and to give developers the
318 possibility to discuss and improve their patches before they are
319 integrated into the main branch.")
320 (home-page "https://github.com/wine-staging")
321 ;; In addition to the regular Wine license (lgpl2.1+), Wine-Staging
322 ;; provides Liberation and WenQuanYi Micro Hei fonts. Those use
323 ;; different licenses. In particular, the latter is licensed under
324 ;; both GPL3+ and Apache 2 License.
325 (license
326 (list license:lgpl2.1+ license:silofl1.1 license:gpl3+ license:asl2.0))))
327
328 (define-public wine64-staging
329 (package
330 (inherit wine-staging)
331 (name "wine64-staging")
332 (inputs `(("wine-staging" ,wine-staging)
333 ,@(package-inputs wine-staging)))
334 (arguments
335 `(#:make-flags
336 (list "SHELL=bash"
337 (string-append "libdir=" %output "/lib/wine64"))
338 #:phases
339 (modify-phases %standard-phases
340 (add-before 'configure 'patch-source-wine-staging
341 (lambda* (#:key outputs #:allow-other-keys)
342 (let* ((source (assoc-ref %build-inputs "source"))
343 (script (string-append (assoc-ref %build-inputs
344 "wine-staging-patchset-data")
345 "/share/wine-staging/patches/patchinstall.sh")))
346 (invoke script (string-append "DESTDIR=" ".") "--all")
347 #t)))
348 (add-after 'install 'copy-wine32-binaries
349 (lambda* (#:key outputs #:allow-other-keys)
350 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
351 (out (assoc-ref %outputs "out")))
352 ;; Copy the 32-bit binaries needed for WoW64.
353 (copy-file (string-append wine32 "/bin/wine")
354 (string-append out "/bin/wine"))
355 (copy-file (string-append wine32 "/bin/wine-preloader")
356 (string-append out "/bin/wine-preloader"))
357 #t)))
358 (add-after 'compress-documentation 'copy-wine32-manpage
359 (lambda* (#:key outputs #:allow-other-keys)
360 (let* ((wine32 (assoc-ref %build-inputs "wine-staging"))
361 (out (assoc-ref %outputs "out")))
362 ;; Copy the missing man file for the wine binary from
363 ;; wine-staging.
364 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
365 (string-append out "/share/man/man1/wine.1.gz"))
366 #t)))
367 (add-after 'configure 'patch-dlopen-paths
368 ;; Hardcode dlopened sonames to absolute paths.
369 (lambda _
370 (let* ((library-path (search-path-as-string->list
371 (getenv "LIBRARY_PATH")))
372 (find-so (lambda (soname)
373 (search-path library-path soname))))
374 (substitute* "include/config.h"
375 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
376 (format #f "~a\"~a\"" defso (find-so soname))))
377 #t))))
378 #:configure-flags
379 (list "--enable-win64"
380 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
381 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
382 #:system)
383 (package-arguments wine-staging))))
384 (synopsis "Implementation of the Windows API (staging branch, WoW64
385 version)")
386 (supported-systems '("x86_64-linux" "aarch64-linux"))))