projects/guix·blob javascript-team · refs

384 lines · 15.2 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014, 2015 Sou Bunnbu <[email protected]>
3;;; Copyright © 2016 Ricardo Wurmus <[email protected]>
4;;; Copyright © 2016, 2017, 2018 Efraim Flashner <[email protected]>
5;;; Copyright © 2017, 2018, 2019 Rutger Helling <[email protected]>
6;;; Copyright © 2017, 2020 Nicolas Goaziou <[email protected]>
7;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <[email protected]>
8;;; Copyright © 2019 Pierre Neidhardt <[email protected]>
9;;; Copyright © 2022 Liliana Marie Prikler <[email protected]>
10;;; Copyright © 2023, 2024 Kaelyn Takata <[email protected]>
11;;;
12;;; This file is part of GNU Guix.
13;;;
14;;; GNU Guix is free software; you can redistribute it and/or modify it
15;;; under the terms of the GNU General Public License as published by
16;;; the Free Software Foundation; either version 3 of the License, or (at
17;;; your option) any later version.
18;;;
19;;; GNU Guix is distributed in the hope that it will be useful, but
20;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22;;; GNU General Public License for more details.
23;;;
24;;; You should have received a copy of the GNU General Public License
25;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27(define-module (gnu packages wine)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix packages)
30 #:use-module (guix gexp)
31 #:use-module (guix download)
32 #:use-module (guix git-download)
33 #:use-module (guix utils)
34 #:use-module (guix build-system gnu)
35 #:use-module (guix build-system meson)
36 #:use-module (guix build-system trivial)
37 #:use-module (gnu packages)
38 #:use-module (gnu packages admin)
39 #:use-module (gnu packages audio)
40 #:use-module (gnu packages autotools)
41 #:use-module (gnu packages base)
42 #:use-module (gnu packages bash)
43 #:use-module (gnu packages bison)
44 #:use-module (gnu packages cups)
45 #:use-module (gnu packages databases)
46 #:use-module (gnu packages fontutils)
47 #:use-module (gnu packages freedesktop)
48 #:use-module (gnu packages compiler-tools)
49 #:use-module (gnu packages image)
50 #:use-module (gnu packages gettext)
51 #:use-module (gnu packages ghostscript)
52 #:use-module (gnu packages gl)
53 #:use-module (gnu packages glib)
54 #:use-module (gnu packages gstreamer)
55 #:use-module (gnu packages gtk)
56 #:use-module (gnu packages kerberos)
57 #:use-module (gnu packages libusb)
58 #:use-module (gnu packages linux)
59 #:use-module (gnu packages mingw)
60 #:use-module (gnu packages openldap)
61 #:use-module (gnu packages perl)
62 #:use-module (gnu packages pulseaudio)
63 #:use-module (gnu packages pkg-config)
64 #:use-module (gnu packages python)
65 #:use-module (gnu packages mp3)
66 #:use-module (gnu packages photo)
67 #:use-module (gnu packages samba)
68 #:use-module (gnu packages scanner)
69 #:use-module (gnu packages sdl)
70 #:use-module (gnu packages tls)
71 #:use-module (gnu packages video)
72 #:use-module (gnu packages vulkan)
73 #:use-module (gnu packages xdisorg)
74 #:use-module (gnu packages xml)
75 #:use-module (gnu packages xorg)
76 #:use-module (ice-9 match)
77 #:use-module (srfi srfi-1))
78
79;; This minimal build of Wine is needed to prevent a circular dependency with
80;; vkd3d.
81(define-public wine-minimal
82 (package
83 (name "wine-minimal")
84 (version "11.0")
85 (source
86 (origin
87 (method url-fetch)
88 (uri (let ((dir (string-append
89 (version-major version)
90 (if (string-suffix? ".0" (version-major+minor version))
91 ".0/"
92 ".x/"))))
93 (string-append "https://dl.winehq.org/wine/source/" dir
94 "wine-" version ".tar.xz")))
95 (sha256
96 (base32 "0087dr25h0wxvclacnnvx70q296976gxfj2lzw6wc7rwjdbnhyn0"))))
97 (properties '((upstream-name . "wine")))
98 (build-system gnu-build-system)
99 (native-inputs (list bison flex))
100 (inputs `())
101 (arguments
102 (list
103 ;; Force a 32-bit build targeting a similar architecture, i.e.:
104 ;; armhf for armhf/aarch64, i686 for i686/x86_64.
105 #:system (match (%current-system)
106 ((or "armhf-linux" "aarch64-linux") "armhf-linux")
107 (_ "i686-linux"))
108
109 ;; XXX: There's a test suite, but it's unclear whether it's supposed to
110 ;; pass.
111 #:tests? #f
112
113 #:make-flags
114 #~(list "SHELL=bash")
115
116 #:phases
117 #~(modify-phases %standard-phases
118 (add-after 'unpack 'patch-SHELL
119 (lambda _
120 (substitute* "configure"
121 ;; configure first respects CONFIG_SHELL, clobbers SHELL later.
122 (("/bin/sh")
123 (which "bash")))))
124 (add-after 'configure 'patch-dlopen-paths
125 ;; Hardcode dlopened sonames to absolute paths.
126 (lambda _
127 (let* ((library-path (search-path-as-string->list
128 (getenv "LIBRARY_PATH")))
129 (find-so (lambda (soname)
130 (search-path library-path soname))))
131 (substitute* "include/config.h"
132 (("(#define SONAME_.* )\"(.*)\"" _ defso soname)
133 (format #f "~a\"~a\"" defso (find-so soname)))))))
134 (add-after 'patch-generated-file-shebangs 'patch-makedep
135 (lambda* (#:key outputs #:allow-other-keys)
136 (substitute* "tools/makedep.c"
137 (("output_filenames\\( unix_libs \\);" all)
138 (string-append all
139 "output ( \" -Wl,-rpath=%s \", arch_install_dirs[arch] );")))))
140 (add-before 'build 'set-widl-time-override
141 ;; Set WIDL_TIME_OVERRIDE to avoid embedding the current date in
142 ;; files generated by WIDL.
143 (lambda _
144 (setenv "WIDL_TIME_OVERRIDE" "315532800"))))
145 #:configure-flags
146 #~(list "--without-freetype"
147 "--without-x")))
148 (home-page "https://www.winehq.org/")
149 (synopsis "Implementation of the Windows API (32-bit only)")
150 (description
151 "Wine (originally an acronym for \"Wine Is Not an Emulator\") is a
152compatibility layer capable of running Windows applications. Instead of
153simulating internal Windows logic like a virtual machine or emulator, Wine
154translates Windows API calls into POSIX calls on-the-fly, eliminating the
155performance and memory penalties of other methods and allowing you to cleanly
156integrate Windows applications into your desktop.")
157 ;; Any platform should be able to build wine, but based on '#:system' these
158 ;; are the ones we currently support.
159 (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))
160 (license license:lgpl2.1+)))
161
162(define-public wine
163 (package
164 (inherit wine-minimal)
165 (name "wine")
166 (native-inputs
167 (modify-inputs native-inputs
168 (prepend gettext-minimal perl pkg-config)))
169 (inputs
170 ;; Some libraries like libjpeg are now compiled into native PE objects.
171 ;; The ELF objects provided by Guix packages are of no use. Whilst this
172 ;; is technically bundling, it's quite defensible. It might be possible
173 ;; to build some of these from Guix PACKAGE-SOURCE but attempts were not
174 ;; fruitful so far. See <https://www.winehq.org/announce/7.0>.
175 (list alsa-lib
176 bash-minimal
177 cups
178 dbus
179 eudev
180 fontconfig
181 freetype
182 gnutls
183 gst-plugins-base
184 libgphoto2
185 openldap
186 samba
187 sane
188 libpcap
189 libusb
190 libice
191 libx11
192 libxi
193 libxext
194 libxcursor
195 libxkbcommon
196 libxrender
197 libxrandr
198 libxinerama
199 libxxf86vm
200 libxcomposite
201 mesa
202 mit-krb5
203 openal
204 pulseaudio
205 sdl2
206 unixodbc
207 v4l-utils
208 vkd3d
209 vulkan-loader
210 wayland
211 wayland-protocols))
212 (arguments
213 (substitute-keyword-arguments arguments
214 ((#:configure-flags _ '()) #~'())))))
215
216(define-public wine64
217 (package
218 (inherit wine)
219 (name "wine64")
220 (inputs (modify-inputs inputs
221 (prepend wine)))
222 (arguments
223 (substitute-keyword-arguments
224 (strip-keyword-arguments '(#:system) (package-arguments wine))
225 ((#:phases phases)
226 #~(modify-phases #$phases
227 (add-after 'install 'copy-wine32-libraries
228 (lambda* (#:key inputs outputs #:allow-other-keys)
229 (let* ((out (assoc-ref %outputs "out")))
230 (copy-recursively (search-input-directory inputs "/lib/wine")
231 (string-append out "/lib/wine")))))
232 (add-after 'compress-documentation 'copy-wine32-manpage
233 (lambda* (#:key inputs outputs #:allow-other-keys)
234 (let* ((out (assoc-ref %outputs "out")))
235 ;; Copy the missing man file for the wine binary from wine.
236 (copy-file (search-input-file inputs "/share/man/man1/wine.1.zst")
237 (string-append out "/share/man/man1/wine.1.zst")))))))
238 ((#:configure-flags configure-flags '())
239 #~(cons "--enable-win64" #$configure-flags))))
240 (synopsis "Implementation of the Windows API (WoW64 version)")
241 (supported-systems '("x86_64-linux" "aarch64-linux"))))
242
243(define-public wine-staging-patchset-data
244 (package
245 (name "wine-staging-patchset-data")
246 (version "11.0")
247 (source
248 (origin
249 (method git-fetch)
250 (uri (git-reference
251 (url "https://github.com/wine-staging/wine-staging")
252 (commit (string-append "v" version))))
253 (file-name (git-file-name name version))
254 (sha256
255 (base32 "0nvsh08piczxb9i6dz21g33jrz52lapsqqwd04zilazb6wgg85v2"))))
256 (build-system trivial-build-system)
257 (native-inputs
258 (list coreutils))
259 (arguments
260 `(#:modules ((guix build utils))
261 #:builder
262 (begin
263 (use-modules (guix build utils))
264 (let* ((build-directory ,(string-append name "-" version))
265 (source (assoc-ref %build-inputs "source"))
266 (coreutils (assoc-ref %build-inputs "coreutils"))
267 (out (assoc-ref %outputs "out"))
268 (wine-staging (string-append out "/share/wine-staging")))
269 (copy-recursively source build-directory)
270 (with-directory-excursion build-directory
271 (substitute* '("patches/gitapply.sh" "staging/patchinstall.py")
272 (("/usr/bin/env")
273 (string-append coreutils "/bin/env"))))
274 (copy-recursively build-directory wine-staging)
275 #t))))
276 (home-page "https://github.com/wine-staging")
277 (synopsis "Patchset for Wine")
278 (description
279 "wine-staging-patchset-data contains the patchset to build Wine-Staging.")
280 (license license:lgpl2.1+)))
281
282(define-public wine-staging
283 (package
284 (inherit wine)
285 (name "wine-staging")
286 (version (package-version wine-staging-patchset-data))
287 (source
288 (let* ((wine-version (version-major+minor version))
289 (subdirectory (string-append
290 (version-major version)
291 (if (string-suffix? ".0" wine-version)
292 ".0"
293 ".x"))))
294 (origin
295 (method url-fetch)
296 (uri (string-append "https://dl.winehq.org/wine/source/"
297 subdirectory "/"
298 "wine-" wine-version ".tar.xz"))
299 (file-name (string-append name "-" wine-version ".tar.xz"))
300 (sha256
301 (base32 "0087dr25h0wxvclacnnvx70q296976gxfj2lzw6wc7rwjdbnhyn0")))))
302 (inputs (modify-inputs inputs
303 (prepend autoconf ; for autoreconf
304 ffmpeg
305 gtk+
306 libva
307 mesa
308 python
309 util-linux ; for hexdump
310 wine-staging-patchset-data)))
311 (native-inputs
312 (modify-inputs native-inputs
313 (prepend python-3)))
314 (arguments
315 (substitute-keyword-arguments arguments
316 ((#:phases phases)
317 #~(modify-phases #$phases
318 (delete 'patch-SHELL)
319 (add-before 'configure 'apply-wine-staging-patches
320 (lambda* (#:key inputs #:allow-other-keys)
321 (invoke (search-input-file
322 inputs
323 "/share/wine-staging/staging/patchinstall.py")
324 "DESTDIR=."
325 ;; Broken upstream, does not apply.
326 ;; TODO: Remove once fixed.
327 "-W" "server-Stored_ACLs"
328 "--all")))
329 (add-after 'apply-wine-staging-patches 'patch-SHELL
330 (assoc-ref #$phases 'patch-SHELL))))))
331 (synopsis "Implementation of the Windows API (staging branch, 32-bit only)")
332 (description "Wine-Staging is the testing area of Wine. It
333contains bug fixes and features, which have not been integrated into
334the development branch yet. The idea of Wine-Staging is to provide
335experimental features faster to end users and to give developers the
336possibility to discuss and improve their patches before they are
337integrated into the main branch.")
338 (home-page "https://github.com/wine-staging")
339 ;; In addition to the regular Wine license (lgpl2.1+), Wine-Staging
340 ;; provides Liberation and WenQuanYi Micro Hei fonts. Those use
341 ;; different licenses. In particular, the latter is licensed under
342 ;; both GPL3+ and Apache 2 License.
343 (license
344 (list license:lgpl2.1+ license:silofl1.1 license:gpl3+ license:asl2.0))))
345
346(define-public wine64-staging
347 (package
348 (inherit wine-staging)
349 (name "wine64-staging")
350 (inputs (modify-inputs inputs
351 (prepend wine-staging)))
352 (arguments
353 (substitute-keyword-arguments (package-arguments wine64)
354 ((#:phases phases)
355 #~(modify-phases #$phases
356 (delete 'patch-SHELL)
357 (add-before 'configure 'apply-wine-staging-patches
358 (lambda* (#:key inputs #:allow-other-keys)
359 (invoke (search-input-file
360 inputs
361 "/share/wine-staging/staging/patchinstall.py")
362 "DESTDIR=."
363 ;; Note: Keep in sync with wine-staging.
364 "-W" "server-Stored_ACLs"
365 "--all")))
366 (add-after 'apply-wine-staging-patches 'patch-SHELL
367 (assoc-ref #$phases 'patch-SHELL))))))
368 (synopsis "Implementation of the Windows API (staging branch, WoW64
369version)")
370 (supported-systems '("x86_64-linux" "aarch64-linux"))))
371
372(define* (wine-for-system #:optional
373 (system (or (%current-target-system)
374 (%current-system))))
375 (if (supported-package? wine64) wine64 wine))
376
377(export wine-for-system)
378
379(define* (wine-staging-for-system #:optional
380 (system (or (%current-target-system)
381 (%current-system))))
382 (if (supported-package? wine64-staging) wine64 wine-staging))
383
384(export wine-staging-for-system)