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 (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))
68 (uri (string-append "https://dl.winehq.org/wine/source/"
69 (version-major+minor version)
70 "/wine-" version ".tar.xz"))
73 "1v7vq9iinkscbq6wg85fb0d2137660fg2nk5iabxkl2wr850asil"))))
74 (build-system gnu-build-system)
75 (native-inputs `(("pkg-config" ,pkg-config)
76 ("gettext" ,gettext-minimal)
81 `(("alsa-lib" ,alsa-lib)
85 ("fontconfig" ,fontconfig)
86 ("freetype" ,freetype)
89 ("gst-plugins-base" ,gst-plugins-base)
93 ("libgphoto2" ,libgphoto2)
97 ("libsane" ,sane-backends)
106 ("libXcursor" ,libxcursor)
107 ("libXrender" ,libxrender)
108 ("libXrandr" ,libxrandr)
109 ("libXinerama" ,libxinerama)
110 ("libXxf86vm" ,libxxf86vm)
111 ("libXcomposite" ,libxcomposite)
114 ("pulseaudio" ,pulseaudio)
115 ("unixodbc" ,unixodbc)
116 ("v4l-utils" ,v4l-utils)
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")
127 ;; XXX: There's a test suite, but it's unclear whether it's supposed to
132 (list (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine32"))
136 (string-append "libdir=" %output "/lib/wine32"))
139 (modify-phases %standard-phases
140 (add-after 'configure 'patch-dlopen-paths
141 ;; Hardcode dlopened sonames to absolute paths.
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))))
151 (home-page "https://www.winehq.org/")
152 (synopsis "Implementation of the Windows API (32-bit only)")
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+)))
165 (define-public wine64
169 (inputs `(("wine" ,wine)
170 ,@(package-inputs wine)))
174 (string-append "libdir=" %output "/lib/wine64"))
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"))
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"))
195 (add-after 'configure 'patch-dlopen-paths
196 ;; Hardcode dlopened sonames to absolute paths.
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))))
207 (list "--enable-win64"
208 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
209 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
211 (package-arguments wine))))
212 (synopsis "Implementation of the Windows API (WoW64 version)")
213 (supported-systems '("x86_64-linux" "aarch64-linux"))))
215 (define-public wine-staging
218 (name "wine-staging")
223 "https://github.com/wine-compholio/wine-patched/archive/"
224 "staging-" version ".tar.gz"))
225 (file-name (string-append name "-" version ".tar.gz"))
228 "1pjaxj7h3q6y356np908fvsx0bf7yx5crqvgl4hza6gfssdmsr5r"))))
229 (inputs `(("gtk+", gtk+)
231 ("vulkan-icd-loader" ,vulkan-icd-loader)
232 ,@(package-inputs wine)))
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")
244 (add-after 'configure 'patch-dlopen-paths
245 ;; Hardcode dlopened sonames to absolute paths.
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))))
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.
270 (list license:lgpl2.1+ license:silofl1.1 license:gpl3+ license:asl2.0))))
272 (define-public wine64-staging
274 (inherit wine-staging)
275 (name "wine64-staging")
276 (inputs `(("wine-staging" ,wine-staging)
277 ,@(package-inputs wine-staging)))
281 (string-append "libdir=" %output "/lib/wine64"))
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")
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"))
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
308 (copy-file (string-append wine32 "/share/man/man1/wine.1.gz")
309 (string-append out "/share/man/man1/wine.1.gz"))
311 (add-after 'configure 'patch-dlopen-paths
312 ;; Hardcode dlopened sonames to absolute paths.
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))))
323 (list "--enable-win64"
324 (string-append "LDFLAGS=-Wl,-rpath=" %output "/lib/wine64"))
325 ,@(strip-keyword-arguments '(#:configure-flags #:make-flags #:phases
327 (package-arguments wine-staging))))
328 (synopsis "Implementation of the Windows API (staging branch, WoW64
330 (supported-systems '("x86_64-linux" "aarch64-linux"))))