gnu: webkitgtk: Enable WOFF2 support.
[jackhill/guix/guix.git] / gnu / packages / webkit.scm
CommitLineData
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>
7059f925 5;;; Copyright © 2015, 2016, 2017, 2018, 2019, 2020 Mark H Weaver <mhw@netris.org>
c22ef8dd 6;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
0ead0b4d 7;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
b037ea96 8;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
61c21ad3
SB
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages webkit)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (guix packages)
28 #:use-module (guix download)
844cc6f8 29 #:use-module (guix utils)
61c21ad3 30 #:use-module (guix build-system cmake)
7b05ba91
RW
31 #:use-module (guix build-system gnu)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages base)
61c21ad3 34 #:use-module (gnu packages bison)
f8a6cc22 35 #:use-module (gnu packages compression)
0ead0b4d 36 #:use-module (gnu packages docbook)
61c21ad3 37 #:use-module (gnu packages enchant)
7b05ba91 38 #:use-module (gnu packages flex)
f8a6cc22 39 #:use-module (gnu packages fontutils)
7970127f 40 #:use-module (gnu packages freedesktop)
844cc6f8 41 #:use-module (gnu packages gcc)
61c21ad3
SB
42 #:use-module (gnu packages gettext)
43 #:use-module (gnu packages gl)
44 #:use-module (gnu packages glib)
45 #:use-module (gnu packages gnome)
c3868552 46 #:use-module (gnu packages gnupg)
61c21ad3
SB
47 #:use-module (gnu packages gperf)
48 #:use-module (gnu packages gstreamer)
49 #:use-module (gnu packages gtk)
50 #:use-module (gnu packages icu4c)
51 #:use-module (gnu packages image)
19e5258d 52 #:use-module (gnu packages libreoffice)
689b44bc 53 #:use-module (gnu packages linux)
61c21ad3
SB
54 #:use-module (gnu packages perl)
55 #:use-module (gnu packages pkg-config)
56 #:use-module (gnu packages python)
57 #:use-module (gnu packages ruby)
cd0322a3 58 #:use-module (gnu packages sqlite)
a54bf725 59 #:use-module (gnu packages tls)
61c21ad3 60 #:use-module (gnu packages video)
689b44bc 61 #:use-module (gnu packages virtualization)
61c21ad3 62 #:use-module (gnu packages xml)
b037ea96 63 #:use-module (gnu packages xdisorg)
61c21ad3
SB
64 #:use-module (gnu packages xorg))
65
b037ea96
MB
66(define-public libwpe
67 (package
68 (name "libwpe")
63efc495 69 (version "1.6.0")
eaa147c4
RG
70 (source
71 (origin
72 (method url-fetch)
73 (uri
74 (string-append "https://wpewebkit.org/releases/libwpe-"
75 version ".tar.xz"))
76 (sha256
77 (base32 "141w35b488jjhanl3nrm0awrbcy6hb579fk8n9vbpx07m2wcd1rm"))))
b037ea96
MB
78 (build-system cmake-build-system)
79 (arguments
80 `(#:tests? #f)) ;no tests
81 (native-inputs
eaa147c4
RG
82 `(("pkg-config" ,pkg-config)
83 ("python" ,python-wrapper)))
b037ea96
MB
84 (inputs
85 `(("mesa" ,mesa)))
86 (propagated-inputs
eaa147c4
RG
87 `(("libxkbcommon" ,libxkbcommon)))
88 (synopsis "General-purpose library for WPE")
89 (description "LibWPE is general-purpose library specifically developed for
90the WPE-flavored port of WebKit.")
b037ea96 91 (home-page "https://wpewebkit.org/")
b037ea96
MB
92 (license license:bsd-2)))
93
7970127f
MB
94(define-public wpebackend-fdo
95 (package
96 (name "wpebackend-fdo")
8e9ccf7a 97 (version "1.6.1")
7970127f
MB
98 (source (origin
99 (method url-fetch)
100 (uri (string-append "https://wpewebkit.org/releases/"
101 "wpebackend-fdo-" version ".tar.xz"))
102 (sha256
103 (base32
8e9ccf7a 104 "1jdi43gciqjgvhnqxs160f3hmp1hkqhrllb0hhmldyxc4wryw3kl"))))
7970127f
MB
105 (build-system cmake-build-system)
106 (arguments
107 `(#:tests? #f)) ;no tests
108 (native-inputs
109 `(("pkg-config" ,pkg-config)))
110 (inputs
111 `(("glib" ,glib)
112 ("libwpe" ,libwpe)
113 ("mesa" ,mesa)
114 ("wayland" ,wayland)))
115 (home-page "https://wpewebkit.org/")
116 (synopsis "Wayland WPE backend")
117 (description
118 "This package provides a backend implementation for the WPE WebKit
119engine that uses Wayland for graphics output.")
120 (license license:bsd-2)))
121
f8a6cc22
RG
122(define-public wpewebkit
123 (package
124 (name "wpewebkit")
37b5e791 125 (version "2.30.5")
f8a6cc22
RG
126 (source
127 (origin
128 (method url-fetch)
129 (uri
130 (string-append "https://wpewebkit.org/releases/"
131 name "-" version ".tar.xz"))
132 (sha256
37b5e791 133 (base32 "16imr0kmzhs7dz6jva9750xbsdz9v50playnagabajy30x7pymsb"))))
f8a6cc22
RG
134 (build-system cmake-build-system)
135 (outputs '("out" "doc"))
136 (arguments
137 `(#:tests? #f ; XXX: To be enabled
138 #:configure-flags
139 (list
140 "-DPORT=WPE"
141 ;; XXX: To be enabled.
142 ;; "-DENABLE_ACCELERATED_2D_CANVAS=ON"
37b5e791
LLB
143 "-DUSE_SYSTEMD=OFF"
144 "-DENABLE_ENCRYPTED_MEDIA=OFF"
145 "-DENABLE_GTKDOC=ON"
146 "-DUSE_GSTREAMER_GL=OFF")
f8a6cc22
RG
147 #:phases
148 (modify-phases %standard-phases
149 (add-after 'unpack 'setenv
150 (lambda _
151 (setenv "HOME" "/tmp")
152 #t))
153 (add-after 'unpack 'patch-docbook-xml
154 (lambda* (#:key inputs #:allow-other-keys)
155 (for-each
156 (lambda (file)
157 (substitute* file
158 (("http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd")
159 (string-append (assoc-ref inputs "docbook-xml")
160 "/xml/dtd/docbook/docbookx.dtd"))))
161 (find-files "Source" "\\.sgml$"))
162 #t))
163 (add-after 'install 'move-doc-files
164 (lambda* (#:key outputs #:allow-other-keys)
165 (let* ((out (assoc-ref outputs "out"))
166 (doc (assoc-ref outputs "doc")))
167 (mkdir-p (string-append doc "/share"))
168 (rename-file
169 (string-append out "/share/gtk-doc")
170 (string-append doc "/share/gtk-doc"))
171 #t))))))
172 (native-inputs
173 `(("docbook-xml" ,docbook-xml-4.1.2)
174 ("docbook-xsl" ,docbook-xsl)
175 ("glib:bin" ,glib "bin")
176 ("gobject-introspection" ,gobject-introspection)
177 ("gtk-doc" ,gtk-doc)
178 ("perl" ,perl)
179 ("pkg-config" ,pkg-config)
180 ("python" ,python-wrapper)
181 ("python2" ,python-2.7)
182 ("ruby" ,ruby)))
183 (inputs
184 `(("atk" ,atk)
185 ("atk-bridge" ,at-spi2-atk)
186 ("bubblewrap" ,bubblewrap)
187 ("cairo" ,cairo)
188 ("fontconfig" ,fontconfig)
189 ("freetype" ,freetype)
190 ("gperf" ,gperf)
191 ("gstreamer" ,gstreamer)
192 ("gst-plugins-base" ,gst-plugins-base)
193 ("harfbuzz" ,harfbuzz)
194 ("icu" ,icu4c)
195 ("libepoxy" ,libepoxy)
196 ("libgcrypt" ,libgcrypt)
197 ("libjpeg" ,libjpeg-turbo)
198 ("libpng" ,libpng)
199 ("libseccomp" ,libseccomp)
200 ("libtasn1" ,libtasn1)
201 ("libxml2" ,libxml2)
202 ("libxslt" ,libxslt)
203 ("mesa" ,mesa)
204 ("openjpeg" ,openjpeg)
205 ("sqlite" ,sqlite)
206 ("webp" ,libwebp)
207 ("woff2" ,woff2)
208 ("xdg-dbus-proxy" ,xdg-dbus-proxy)
209 ("zlib" ,zlib)))
210 (propagated-inputs
211 `(("glib" ,glib)
212 ("libsoup" ,libsoup)
213 ("wpe" ,libwpe)))
214 (synopsis "WebKit port optimized for embedded devices")
215 (description "WPE WebKit allows embedders to create simple and performant
216systems based on Web platform technologies. It is designed with hardware
217acceleration in mind, leveraging common 3D graphics APIs for best performance.")
218 (home-page "https://wpewebkit.org/")
219 (license
220 (list
221 ;; Rendering and JavaScript Engines.
222 license:lgpl2.1+
223 ;; Others
224 license:bsd-2))))
225
61c21ad3
SB
226(define-public webkitgtk
227 (package
228 (name "webkitgtk")
8fc36d82 229 (version "2.30.5")
61c21ad3
SB
230 (source (origin
231 (method url-fetch)
3bd716c0 232 (uri (string-append "https://www.webkitgtk.org/releases/"
256ab7cf 233 "webkitgtk-" version ".tar.xz"))
61c21ad3
SB
234 (sha256
235 (base32
8fc36d82 236 "07vzbbnvz69rn9pciji4axfpclp98bpj4a0br2z0gbn5wc4an3bx"))
bc549a27
LP
237 (patches (search-patches "webkitgtk-share-store.patch"
238 "webkitgtk-bind-all-fonts.patch"))))
61c21ad3 239 (build-system cmake-build-system)
0ead0b4d 240 (outputs '("out" "doc"))
61c21ad3
SB
241 (arguments
242 '(#:tests? #f ; no tests
243 #:build-type "Release" ; turn off debugging symbols to save space
9ca33236
DH
244 #:configure-flags (list
245 "-DPORT=GTK"
0ead0b4d 246 "-DENABLE_GTKDOC=ON" ; No doc by default
e6b6e834 247 "-DUSE_SYSTEMD=OFF"
9ca33236
DH
248 (string-append ; uses lib64 by default
249 "-DLIB_INSTALL_DIR="
a54bf725
MW
250 (assoc-ref %outputs "out") "/lib")
251
252 ;; XXX Adding GStreamer GL support would apparently
253 ;; require adding gst-plugins-bad to the inputs,
254 ;; which might entail a security risk as a result of
255 ;; the plugins of dubious code quality that are
256 ;; included. More investigation is needed. For
257 ;; now, we explicitly disable it to prevent an error
258 ;; at configuration time.
92d0949a 259 "-DUSE_GSTREAMER_GL=OFF")
0ead0b4d
PN
260 #:phases
261 (modify-phases %standard-phases
a6919866
JH
262 (add-after 'unpack 'configure-bubblewrap-store-directory
263 (lambda _
264 ;; This phase is a corollary to 'webkitgtk-share-store.patch' to
265 ;; avoid hard coding /gnu/store, for users with other prefixes.
266 (let ((store-directory (%store-directory)))
267 (substitute*
268 "Source/WebKit/UIProcess/Launcher/glib/BubblewrapLauncher.cpp"
269 (("@storedir@") store-directory))
270 #t)))
0ead0b4d
PN
271 (add-after 'unpack 'patch-gtk-doc-scan
272 (lambda* (#:key inputs #:allow-other-keys)
a509b180
MB
273 (for-each (lambda (file)
274 (substitute* file
275 (("http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd")
276 (string-append (assoc-ref inputs "docbook-xml")
277 "/xml/dtd/docbook/docbookx.dtd"))))
278 (find-files "Source" "\\.sgml$"))
0ead0b4d 279 #t))
1714edc3
MB
280 (add-after 'unpack 'embed-absolute-wpebackend-reference
281 (lambda* (#:key inputs #:allow-other-keys)
282 (let ((wpebackend-fdo (assoc-ref inputs "wpebackend-fdo")))
283 (substitute* "Source/WebKit/UIProcess/glib/WebProcessPoolGLib.cpp"
284 (("libWPEBackend-fdo-([\\.0-9]+)\\.so" all version)
285 (string-append wpebackend-fdo "/lib/" all)))
286 #t)))
0ead0b4d
PN
287 (add-after 'install 'move-doc-files
288 (lambda* (#:key outputs #:allow-other-keys)
289 (let ((out (assoc-ref outputs "out"))
290 (doc (assoc-ref outputs "doc")))
291 (mkdir-p (string-append doc "/share"))
292 (rename-file (string-append out "/share/gtk-doc")
293 (string-append doc "/share/gtk-doc"))
294 #t))))))
61c21ad3
SB
295 (native-inputs
296 `(("bison" ,bison)
b94a6ca0 297 ("gettext" ,gettext-minimal)
61c21ad3
SB
298 ("glib:bin" ,glib "bin") ; for glib-mkenums, etc.
299 ("gobject-introspection" ,gobject-introspection)
300 ("gperf" ,gperf)
301 ("perl" ,perl)
302 ("pkg-config" ,pkg-config)
625801f5 303 ("python" ,python-wrapper)
0ead0b4d
PN
304 ("gtk-doc" ,gtk-doc) ; For documentation generation
305 ("docbook-xml" ,docbook-xml) ; For documentation generation
61c21ad3
SB
306 ("ruby" ,ruby)))
307 (propagated-inputs
308 `(("gtk+" ,gtk+)
309 ("libsoup" ,libsoup)))
310 (inputs
311 `(("at-spi2-core" ,at-spi2-core)
e7f62a41 312 ("bubblewrap" ,bubblewrap)
61c21ad3
SB
313 ("enchant" ,enchant)
314 ("geoclue" ,geoclue)
61c21ad3
SB
315 ("gst-plugins-base" ,gst-plugins-base)
316 ("gtk+-2" ,gtk+-2)
317 ("harfbuzz" ,harfbuzz)
19e5258d 318 ("hyphen" ,hyphen)
61c21ad3 319 ("icu4c" ,icu4c)
c3868552 320 ("libgcrypt" ,libgcrypt)
4bd428a7 321 ("libjpeg" ,libjpeg-turbo)
61c21ad3
SB
322 ("libnotify" ,libnotify)
323 ("libpng" ,libpng)
e7f62a41 324 ("libseccomp" ,libseccomp)
61c21ad3 325 ("libsecret" ,libsecret)
a54bf725 326 ("libtasn1" ,libtasn1)
61c21ad3 327 ("libwebp" ,libwebp)
e7f62a41 328 ("libwpe" ,libwpe)
61c21ad3
SB
329 ("libxcomposite" ,libxcomposite)
330 ("libxml2" ,libxml2)
331 ("libxslt" ,libxslt)
332 ("libxt" ,libxt)
333 ("mesa" ,mesa)
19008a22 334 ("openjpeg" ,openjpeg)
e7f62a41 335 ("sqlite" ,sqlite)
92d0949a 336 ("woff2" ,woff2)
e7f62a41
MB
337 ("wpebackend-fdo" ,wpebackend-fdo)
338 ("xdg-dbus-proxy" ,xdg-dbus-proxy)))
36b2cb02 339 (home-page "https://www.webkitgtk.org/")
61c21ad3
SB
340 (synopsis "Web content engine for GTK+")
341 (description
342 "WebKitGTK+ is a full-featured port of the WebKit rendering engine,
343suitable for projects requiring any kind of web integration, from hybrid
344HTML/CSS applications to full-fledged web browsers.")
345 ;; WebKit's JavaScriptCore and WebCore components are available under
346 ;; the GNU LGPL, while the rest is available under a BSD-style license.
347 (license (list license:lgpl2.0
348 license:lgpl2.1+
349 license:bsd-2
350 license:bsd-3))))