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