gnu: vulkan-loader: Update URL and change name.
[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 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))
68
69 (define-public wine
70 (package
71 (name "wine")
72 (version "3.0.1")
73 (source (origin
74 (method url-fetch)
75 (uri (string-append "https://dl.winehq.org/wine/source/"
76 (version-major+minor version)
77 "/wine-" version ".tar.xz"))
78 (sha256
79 (base32
80 "1wr63n70pli83p3rmclr2j4lxzs4ll1cwlpdlaajfrf6v9yhvl5s"))))
81 (build-system gnu-build-system)
82 (native-inputs `(("pkg-config" ,pkg-config)
83 ("gettext" ,gettext-minimal)
84 ("flex" ,flex)
85 ("bison" ,bison)
86 ("perl" ,perl)))
87 (inputs
88 `(("alsa-lib" ,alsa-lib)
89 ("dbus" ,dbus)
90 ("cups" ,cups)
91 ("eudev" ,eudev)
92 ("fontconfig" ,fontconfig)
93 ("freetype" ,freetype)
94 ("glu" ,glu)
95 ("gnutls" ,gnutls)
96 ("gst-plugins-base" ,gst-plugins-base)
97 ("lcms" ,lcms)
98 ("libxml2" ,libxml2)
99 ("libxslt" ,libxslt)
100 ("libgphoto2" ,libgphoto2)
101 ("libmpg123" ,mpg123)
102 ("libldap" ,openldap)
103 ("libnetapi" ,samba)
104 ("libsane" ,sane-backends)
105 ("libpcap" ,libpcap)
106 ("libpng" ,libpng)
107 ("libjpeg" ,libjpeg)
108 ("libtiff" ,libtiff)
109 ("libICE" ,libice)
110 ("libX11" ,libx11)
111 ("libXi" ,libxi)
112 ("libXext" ,libxext)
113 ("libXcursor" ,libxcursor)
114 ("libXrender" ,libxrender)
115 ("libXrandr" ,libxrandr)
116 ("libXinerama" ,libxinerama)
117 ("libXxf86vm" ,libxxf86vm)
118 ("libXcomposite" ,libxcomposite)
119 ("mit-krb5" ,mit-krb5)
120 ("ncurses" ,ncurses)
121 ("openal" ,openal)
122 ("pulseaudio" ,pulseaudio)
123 ("unixodbc" ,unixodbc)
124 ("v4l-utils" ,v4l-utils)
125 ("zlib" ,zlib)))
126 (arguments
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")
131 `("armhf-linux"))
132 (_
133 `("i686-linux")))
134
135 ;; XXX: There's a test suite, but it's unclear whether it's supposed to
136 ;; pass.
137 #:tests? #f
138
139 #:configure-flags
140 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine32"))
141
142 #:make-flags
143 (list "SHELL=bash"
144 (string-append "libdir=" %output "/lib/wine32"))
145
146 #:phases
147 (modify-phases %standard-phases
148 (add-after 'configure 'patch-dlopen-paths
149 ;; Hardcode dlopened sonames to absolute paths.
150 (lambda _
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))))
158 #t))))))
159 (home-page "https://www.winehq.org/")
160 (synopsis "Implementation of the Windows API (32-bit only)")
161 (description
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+)))
172
173 (define-public wine64
174 (package
175 (inherit wine)
176 (name "wine64")
177 (inputs `(("wine" ,wine)
178 ,@(package-inputs wine)))
179 (arguments
180 `(#:make-flags
181 (list "SHELL=bash"
182 (string-append "libdir=" %output "/lib/wine64"))
183 #:phases
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"))
194 #t)))
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"))
202 #t)))
203 (add-after 'configure 'patch-dlopen-paths
204 ;; Hardcode dlopened sonames to absolute paths.
205 (lambda _
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))))
213 #t))))
214 #:configure-flags
215 (list "--enable-win64"
216 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
217 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
218 #:system)
219 (package-arguments wine))))
220 (synopsis "Implementation of the Windows API (WoW64 version)")
221 (supported-systems '("x86_64-linux" "aarch64-linux"))))
222
223 (define-public wine-staging-patchset-data
224 (package
225 (name "wine-staging-patchset-data")
226 (version "3.9")
227 (source
228 (origin
229 (method url-fetch)
230 (uri (string-append "https://github.com/wine-staging/wine-staging/archive/v"
231 version ".zip"))
232 (file-name (string-append name "-" version ".zip"))
233 (sha256
234 (base32
235 "0akccqrp1ymjrra2c99f6hxlaa77jyihfs3q8x93vkgb9c0lq5xx"))))
236 (build-system trivial-build-system)
237 (native-inputs
238 `(("bash" ,bash)
239 ("coreutils" ,coreutils)
240 ("unzip" ,unzip)))
241 (arguments
242 `(#:modules ((guix build utils))
243 #:builder
244 (begin
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)
260 wine-staging)))))
261 (home-page "https://github.com/wine-staging")
262 (synopsis "Patchset for Wine")
263 (description
264 "wine-staging-patchset-data contains the patchset to build Wine-Staging.")
265 (license license:lgpl2.1+)))
266
267 (define-public wine-staging
268 (package
269 (inherit wine)
270 (name "wine-staging")
271 (version (package-version wine-staging-patchset-data))
272 (source (origin
273 (method url-fetch)
274 (uri (string-append
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"))
279 (sha256
280 (base32
281 "0ddphvlp9lsjyqc6zckinc36bggpkg925v0x2vqr8nkdjs0w5bfc"))))
282 (inputs `(("autoconf" ,autoconf) ; for autoreconf
283 ("gtk+" ,gtk+)
284 ("libva" ,libva)
285 ("python" ,python)
286 ("sdl2" ,sdl2)
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)))
291 (arguments
292 `(#:phases
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")
301 #t)))
302 (add-after 'configure 'patch-dlopen-paths
303 ;; Hardcode dlopened sonames to absolute paths.
304 (lambda _
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))))
312 #t))))
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.
327 (license
328 (list license:lgpl2.1+ license:silofl1.1 license:gpl3+ license:asl2.0))))
329
330 (define-public wine64-staging
331 (package
332 (inherit wine-staging)
333 (name "wine64-staging")
334 (inputs `(("wine-staging" ,wine-staging)
335 ,@(package-inputs wine-staging)))
336 (arguments
337 `(#:make-flags
338 (list "SHELL=bash"
339 (string-append "libdir=" %output "/lib/wine64"))
340 #:phases
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")
349 #t)))
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"))
359 #t)))
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
365 ;; wine-staging.
366 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
367 (string-append out "/share/man/man1/wine.1.gz"))
368 #t)))
369 (add-after 'configure 'patch-dlopen-paths
370 ;; Hardcode dlopened sonames to absolute paths.
371 (lambda _
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))))
379 #t))))
380 #:configure-flags
381 (list "--enable-win64"
382 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
383 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
384 #:system)
385 (package-arguments wine-staging))))
386 (synopsis "Implementation of the Windows API (staging branch, WoW64
387 version)")
388 (supported-systems '("x86_64-linux" "aarch64-linux"))))