Commit | Line | Data |
---|---|---|
61c21ad3 SB |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com> | |
9ca33236 | 3 | ;;; Copyright © 2015 David Hashe <david.hashe@dhashe.com> |
7b05ba91 | 4 | ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net> |
9d3a5ddc | 5 | ;;; Copyright © 2015–2021 Mark H Weaver <mhw@netris.org> |
759e9acd | 6 | ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr> |
0ead0b4d | 7 | ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz> |
b037ea96 | 8 | ;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com> |
4ec7aac4 | 9 | ;;; Copyright © 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com> |
0aeedfb8 | 10 | ;;; Copyright © 2022 Efraim Flashner <efraim@flashner.co.il> |
61c21ad3 SB |
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 webkit) | |
28 | #:use-module ((guix licenses) #:prefix license:) | |
29 | #:use-module (guix packages) | |
30 | #:use-module (guix download) | |
4ec7aac4 | 31 | #:use-module (guix gexp) |
844cc6f8 | 32 | #:use-module (guix utils) |
62a83908 | 33 | #:use-module (guix build utils) |
61c21ad3 | 34 | #:use-module (guix build-system cmake) |
c97e07be | 35 | #:use-module (guix build-system meson) |
7b05ba91 RW |
36 | #:use-module (guix build-system gnu) |
37 | #:use-module (gnu packages) | |
38 | #:use-module (gnu packages base) | |
61c21ad3 | 39 | #:use-module (gnu packages bison) |
f8a6cc22 | 40 | #:use-module (gnu packages compression) |
0ead0b4d | 41 | #:use-module (gnu packages docbook) |
61c21ad3 | 42 | #:use-module (gnu packages enchant) |
7b05ba91 | 43 | #:use-module (gnu packages flex) |
f8a6cc22 | 44 | #:use-module (gnu packages fontutils) |
7970127f | 45 | #:use-module (gnu packages freedesktop) |
4ec7aac4 | 46 | #:use-module (gnu packages games) |
844cc6f8 | 47 | #:use-module (gnu packages gcc) |
61c21ad3 | 48 | #:use-module (gnu packages gettext) |
9d3a5ddc | 49 | #:use-module (gnu packages ghostscript) |
61c21ad3 SB |
50 | #:use-module (gnu packages gl) |
51 | #:use-module (gnu packages glib) | |
52 | #:use-module (gnu packages gnome) | |
c3868552 | 53 | #:use-module (gnu packages gnupg) |
61c21ad3 SB |
54 | #:use-module (gnu packages gperf) |
55 | #:use-module (gnu packages gstreamer) | |
56 | #:use-module (gnu packages gtk) | |
57 | #:use-module (gnu packages icu4c) | |
58 | #:use-module (gnu packages image) | |
19e5258d | 59 | #:use-module (gnu packages libreoffice) |
689b44bc | 60 | #:use-module (gnu packages linux) |
9d3a5ddc | 61 | #:use-module (gnu packages llvm) |
61c21ad3 SB |
62 | #:use-module (gnu packages perl) |
63 | #:use-module (gnu packages pkg-config) | |
64 | #:use-module (gnu packages python) | |
65 | #:use-module (gnu packages ruby) | |
cd0322a3 | 66 | #:use-module (gnu packages sqlite) |
a54bf725 | 67 | #:use-module (gnu packages tls) |
61c21ad3 | 68 | #:use-module (gnu packages video) |
689b44bc | 69 | #:use-module (gnu packages virtualization) |
61c21ad3 | 70 | #:use-module (gnu packages xml) |
b037ea96 | 71 | #:use-module (gnu packages xdisorg) |
61c21ad3 SB |
72 | #:use-module (gnu packages xorg)) |
73 | ||
b037ea96 MB |
74 | (define-public libwpe |
75 | (package | |
76 | (name "libwpe") | |
c97e07be | 77 | (version "1.12.0") |
eaa147c4 RG |
78 | (source |
79 | (origin | |
80 | (method url-fetch) | |
81 | (uri | |
82 | (string-append "https://wpewebkit.org/releases/libwpe-" | |
83 | version ".tar.xz")) | |
84 | (sha256 | |
c97e07be LMP |
85 | (base32 "13618imck69w7fbmljlh62j4gnlspb9zfqzv9hlkck3bi8icmvp8")))) |
86 | (build-system meson-build-system) | |
b037ea96 MB |
87 | (arguments |
88 | `(#:tests? #f)) ;no tests | |
89 | (native-inputs | |
eaa147c4 RG |
90 | `(("pkg-config" ,pkg-config) |
91 | ("python" ,python-wrapper))) | |
b037ea96 | 92 | (inputs |
8394619b | 93 | (list mesa)) |
b037ea96 | 94 | (propagated-inputs |
8394619b | 95 | (list libxkbcommon)) |
eaa147c4 RG |
96 | (synopsis "General-purpose library for WPE") |
97 | (description "LibWPE is general-purpose library specifically developed for | |
98 | the WPE-flavored port of WebKit.") | |
b037ea96 | 99 | (home-page "https://wpewebkit.org/") |
b037ea96 MB |
100 | (license license:bsd-2))) |
101 | ||
7970127f MB |
102 | (define-public wpebackend-fdo |
103 | (package | |
104 | (name "wpebackend-fdo") | |
f0bc429a | 105 | (version "1.12.0") |
7970127f MB |
106 | (source (origin |
107 | (method url-fetch) | |
108 | (uri (string-append "https://wpewebkit.org/releases/" | |
109 | "wpebackend-fdo-" version ".tar.xz")) | |
110 | (sha256 | |
111 | (base32 | |
f0bc429a LMP |
112 | "1b3l02dns1yxw3rq18cv00qan4hp95mxw5b3ssc0fh93ap0wjfb2")))) |
113 | (build-system meson-build-system) | |
7970127f MB |
114 | (arguments |
115 | `(#:tests? #f)) ;no tests | |
116 | (native-inputs | |
8394619b | 117 | (list pkg-config)) |
7970127f | 118 | (inputs |
f0bc429a | 119 | (list glib libepoxy libwpe mesa wayland)) |
7970127f MB |
120 | (home-page "https://wpewebkit.org/") |
121 | (synopsis "Wayland WPE backend") | |
122 | (description | |
123 | "This package provides a backend implementation for the WPE WebKit | |
124 | engine that uses Wayland for graphics output.") | |
125 | (license license:bsd-2))) | |
126 | ||
ad519b73 | 127 | (define %webkit-version "2.36.7") ;webkit2gtk4 |
f8a6cc22 | 128 | |
61c21ad3 SB |
129 | (define-public webkitgtk |
130 | (package | |
131 | (name "webkitgtk") | |
7bd5394b | 132 | (version %webkit-version) |
61c21ad3 SB |
133 | (source (origin |
134 | (method url-fetch) | |
3bd716c0 | 135 | (uri (string-append "https://www.webkitgtk.org/releases/" |
7bd5394b | 136 | name "-" version ".tar.xz")) |
61c21ad3 | 137 | (sha256 |
0aeedfb8 | 138 | (base32 "0hqpfgzbb7lzdih9aw86rmkljm8ynv8zw3b72z88211gngr0q9hc")) |
4ec7aac4 MC |
139 | (patches (search-patches |
140 | "webkitgtk-adjust-bubblewrap-paths.patch")))) | |
61c21ad3 | 141 | (build-system cmake-build-system) |
d2fffa79 | 142 | (outputs '("out" "doc" "debug")) |
61c21ad3 | 143 | (arguments |
4ec7aac4 MC |
144 | (list |
145 | ;; The release archive doesn't include the resources/sources needed to | |
146 | ;; run the various regression tests. | |
147 | #:tests? #f | |
148 | ;; When building using the default RelWithDebInfo build type, the final | |
149 | ;; binaries require 20 GiB of memory to link (even with ld.gold or lld) | |
150 | ;; and produce 4.6 GiB of debug symbols. | |
151 | #:build-type "Release" | |
152 | #:configure-flags #~(list | |
153 | "-DPORT=GTK" | |
154 | ;; GTKDOC will be removed upstream soon in favor of | |
155 | ;; gi-docgen; it is normally disabled because the | |
156 | ;; doc is rather expensive to build. | |
157 | "-DENABLE_GTKDOC=ON" | |
158 | ;; The minibrowser, not built by default, is a good | |
159 | ;; tool to validate the good operation of | |
160 | ;; webkitgtk. | |
161 | "-DENABLE_MINIBROWSER=ON" | |
162 | ;; The default lib installation prefix is lib64. | |
163 | (string-append "-DLIB_INSTALL_DIR=" #$output "/lib")) | |
164 | ;; The build may fail with -j1 (see: | |
165 | ;; https://bugs.webkit.org/show_bug.cgi?id=195251). | |
166 | #:make-flags #~(list "-j" (number->string (max 2 (parallel-job-count)))) | |
167 | #:phases | |
168 | #~(modify-phases %standard-phases | |
169 | (add-after 'unpack 'configure-bubblewrap-store-directory | |
170 | (lambda _ | |
171 | ;; This phase works in tandem with | |
172 | ;; webkitgtk-adjust-bubblewrap-paths.patch and avoids hard | |
173 | ;; coding /gnu/store, for users with other prefixes. | |
174 | (let ((store-directory (%store-directory))) | |
175 | (substitute* | |
176 | "Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp" | |
177 | (("@storedir@") store-directory))))) | |
178 | (add-after 'unpack 'do-not-disable-new-dtags | |
179 | ;; Ensure the linker uses new dynamic tags as this is what Guix | |
180 | ;; uses and validates in the validate-runpath phase. | |
181 | (lambda _ | |
182 | (substitute* "Source/cmake/OptionsCommon.cmake" | |
183 | (("if \\(LD_SUPPORTS_DISABLE_NEW_DTAGS\\)") | |
184 | "if (FALSE)")))) | |
185 | (add-after 'unpack 'help-cmake-find-elogind | |
186 | (lambda _ | |
187 | (substitute* "Source/cmake/FindJournald.cmake" | |
188 | ;; Otherwise, CMake would throw an error because it relies on | |
189 | ;; the pkg-config search to locate headers. | |
190 | (("pkg_check_modules\\(PC_SYSTEMD QUIET libsystemd") | |
191 | "pkg_check_modules(PC_SYSTEMD QUIET libelogind")))) | |
192 | (add-after 'unpack 'patch-gtk-doc-scan | |
193 | (lambda* (#:key native-inputs inputs #:allow-other-keys) | |
194 | (substitute* (find-files "Source" "\\.sgml$") | |
195 | (("http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd") | |
196 | (search-input-file (or native-inputs inputs) | |
197 | "xml/dtd/docbook/docbookx.dtd"))))) | |
198 | (add-after 'unpack 'embed-absolute-wpebackend-reference | |
199 | (lambda* (#:key inputs #:allow-other-keys) | |
200 | (let ((wpebackend-fdo (assoc-ref inputs "wpebackend-fdo"))) | |
201 | (substitute* "Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp" | |
202 | (("libWPEBackend-fdo-[\\.0-9]+\\.so" all) | |
203 | (search-input-file inputs (string-append "lib/" all))))))) | |
204 | #$@(if (target-x86-64?) | |
205 | '() | |
206 | '((add-after 'unpack 'disable-sse2 | |
207 | (lambda _ | |
208 | (substitute* "Source/cmake/WebKitCompilerFlags.cmake" | |
209 | (("WTF_CPU_X86 AND NOT CMAKE_CROSSCOMPILING") | |
210 | "FALSE")))))) | |
211 | (add-after 'install 'move-doc-files | |
212 | (lambda* (#:key outputs #:allow-other-keys) | |
213 | (let ((doc (assoc-ref outputs "doc"))) | |
214 | (mkdir-p (string-append doc "/share")) | |
215 | (rename-file (string-append #$output "/share/gtk-doc") | |
216 | (string-append doc "/share/gtk-doc")))))))) | |
61c21ad3 | 217 | (native-inputs |
4ec7aac4 MC |
218 | (list bison |
219 | gettext-minimal | |
220 | `(,glib "bin") ;for glib-mkenums, etc. | |
221 | gobject-introspection | |
222 | gperf | |
223 | perl | |
224 | pkg-config | |
225 | python-wrapper | |
226 | ;; These are required to build the documentation. | |
227 | gtk-doc/stable | |
228 | docbook-xml | |
229 | ruby)) | |
61c21ad3 | 230 | (propagated-inputs |
8394619b | 231 | (list gtk+ libsoup)) |
61c21ad3 | 232 | (inputs |
4ec7aac4 MC |
233 | (list at-spi2-core |
234 | bubblewrap | |
235 | elogind | |
236 | enchant | |
237 | geoclue | |
238 | gst-plugins-base | |
239 | gtk+-2 | |
240 | harfbuzz | |
241 | hyphen | |
242 | icu4c | |
243 | lcms | |
244 | libgcrypt | |
245 | libjpeg-turbo | |
246 | libmanette | |
247 | libnotify | |
248 | libpng | |
249 | libseccomp | |
250 | libsecret | |
251 | libtasn1 | |
252 | libwebp | |
253 | libwpe | |
254 | libxcomposite | |
255 | libxml2 | |
256 | libxslt | |
257 | libxt | |
258 | mesa | |
259 | openjpeg | |
260 | sqlite | |
261 | woff2 | |
262 | wpebackend-fdo | |
263 | xdg-dbus-proxy)) | |
13da331f | 264 | (properties '((timeout . 144000))) ; 40 hours, most notably for aarch64 |
36b2cb02 | 265 | (home-page "https://www.webkitgtk.org/") |
61c21ad3 | 266 | (synopsis "Web content engine for GTK+") |
4ec7aac4 | 267 | (description "WebKitGTK+ is a full-featured port of the WebKit rendering engine, |
61c21ad3 | 268 | suitable for projects requiring any kind of web integration, from hybrid |
00e4bd25 MC |
269 | HTML/CSS applications to full-fledged web browsers. WebKitGTK+ video playing |
270 | capabilities can be extended through the use of GStreamer plugins (not | |
271 | propagated by default) such as @code{gst-plugins-good} and | |
272 | @code{gst-plugins-bad}.") | |
61c21ad3 SB |
273 | ;; WebKit's JavaScriptCore and WebCore components are available under |
274 | ;; the GNU LGPL, while the rest is available under a BSD-style license. | |
275 | (license (list license:lgpl2.0 | |
276 | license:lgpl2.1+ | |
277 | license:bsd-2 | |
278 | license:bsd-3)))) | |
62a83908 | 279 | |
ad519b73 MC |
280 | (define-public webkitgtk-next |
281 | (package | |
282 | (inherit webkitgtk) | |
283 | (name "webkitgtk") | |
b3d3012f | 284 | (version "2.38.0") ;webkit2gtk5 |
ad519b73 MC |
285 | (source (origin |
286 | (inherit (package-source webkitgtk)) | |
287 | (method url-fetch) | |
288 | (uri (string-append "https://www.webkitgtk.org/releases/" | |
289 | name "-" version ".tar.xz")) | |
290 | (sha256 | |
b3d3012f | 291 | (base32 "1g8gpi1scbmbcywkfjr2srxdq9r63s94d7v01fdk5qdnldsn7kpr")))) |
ad519b73 MC |
292 | (build-system cmake-build-system) |
293 | (arguments | |
294 | (substitute-keyword-arguments (package-arguments webkitgtk) | |
295 | ((#:configure-flags flags) | |
296 | #~(cons* "-DENABLE_INTROSPECTION=ON" | |
297 | "-DUSE_GTK4=ON" | |
298 | (delete "-DENABLE_GTKDOC=ON" #$flags))) | |
299 | ((#:phases phases) | |
300 | #~(modify-phases #$phases | |
301 | (add-before 'build 'set-CC | |
302 | (lambda _ | |
303 | ;; Some Perl scripts check for the CC environment variable, else | |
304 | ;; use /usr/bin/gcc. | |
305 | (setenv "CC" "gcc"))))))) | |
306 | (native-inputs | |
307 | (modify-inputs (package-native-inputs webkitgtk) | |
308 | (delete "docbook-xml" "gtk-doc") | |
309 | (append gi-docgen))) | |
310 | (propagated-inputs | |
311 | (modify-inputs (package-propagated-inputs webkitgtk) | |
312 | (replace "gtk+" gtk))) | |
313 | (inputs | |
314 | (modify-inputs (package-inputs webkitgtk) | |
315 | (delete "gtk+-2" "libnotify") | |
316 | (append pango-next))))) ;TODO: remove after it's the default | |
317 | ||
69df14a0 MC |
318 | ;;; Required by e.g. emacs-next-pgtk, emacs-xwidgets, and some other GNOME |
319 | ;;; packages for webkit2gtk-4.0. See also the upstream tracker for libsoup 3: | |
320 | ;;; https://gitlab.gnome.org/GNOME/libsoup/-/issues/218. | |
62a83908 MC |
321 | (define-public webkitgtk-with-libsoup2 |
322 | (package/inherit webkitgtk | |
323 | (name "webkitgtk-with-libsoup2") | |
324 | (arguments (substitute-keyword-arguments (package-arguments webkitgtk) | |
325 | ((#:configure-flags flags) | |
4ec7aac4 | 326 | #~(cons "-DUSE_SOUP2=ON" #$flags)))) |
62a83908 | 327 | (propagated-inputs |
4ec7aac4 MC |
328 | (modify-inputs (package-propagated-inputs webkitgtk) |
329 | (replace "libsoup" libsoup-minimal-2))))) | |
7bd5394b MC |
330 | |
331 | (define-public wpewebkit | |
332 | (package | |
333 | (inherit webkitgtk) | |
334 | (name "wpewebkit") | |
335 | (version %webkit-version) | |
336 | (source (origin | |
337 | (inherit (package-source webkitgtk)) | |
338 | (uri (string-append "https://wpewebkit.org/releases/" | |
339 | name "-" version ".tar.xz")) | |
340 | (sha256 | |
0aeedfb8 | 341 | (base32 "1jcm5fjzn1k9l87qwqgmvd5qriwpv3vgs632zc6asqn5zxr7sx7k")))) |
7bd5394b MC |
342 | (arguments |
343 | (substitute-keyword-arguments (package-arguments webkitgtk) | |
344 | ((#:configure-flags flags) | |
345 | #~(cons "-DPORT=WPE" | |
346 | (delete "-DPORT=GTK" #$flags))))) | |
347 | (synopsis "WebKit port optimized for embedded devices") | |
348 | (description "WPE WebKit allows embedders to create simple and performant | |
349 | systems based on Web platform technologies. It is designed with hardware | |
350 | acceleration in mind, leveraging common 3D graphics APIs for best performance.") | |
351 | (home-page "https://wpewebkit.org/") | |
352 | (properties '((cpe-name . "wpe_webkit"))))) |