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