2eca5147fea987e3d06be6cc3e9186c5f09436d8
[jackhill/guix/guix.git] / gnu / packages / webkit.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
3 ;;; Copyright © 2015 David Hashe <david.hashe@dhashe.com>
4 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
5 ;;; Copyright © 2015, 2016, 2017, 2018, 2019 Mark H Weaver <mhw@netris.org>
6 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
15 ;;;
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
20 ;;;
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24 (define-module (gnu packages webkit)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix utils)
29 #:use-module (guix build-system cmake)
30 #:use-module (guix build-system gnu)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages bison)
34 #:use-module (gnu packages docbook)
35 #:use-module (gnu packages enchant)
36 #:use-module (gnu packages flex)
37 #:use-module (gnu packages gcc)
38 #:use-module (gnu packages gettext)
39 #:use-module (gnu packages gl)
40 #:use-module (gnu packages glib)
41 #:use-module (gnu packages gnome)
42 #:use-module (gnu packages gnupg)
43 #:use-module (gnu packages gperf)
44 #:use-module (gnu packages gstreamer)
45 #:use-module (gnu packages gtk)
46 #:use-module (gnu packages icu4c)
47 #:use-module (gnu packages image)
48 #:use-module (gnu packages libreoffice)
49 #:use-module (gnu packages perl)
50 #:use-module (gnu packages pkg-config)
51 #:use-module (gnu packages python)
52 #:use-module (gnu packages ruby)
53 #:use-module (gnu packages sqlite)
54 #:use-module (gnu packages tls)
55 #:use-module (gnu packages video)
56 #:use-module (gnu packages xml)
57 #:use-module (gnu packages xorg))
58
59 (define-public webkitgtk
60 (package
61 (name "webkitgtk")
62 (version "2.20.5")
63 (source (origin
64 (method url-fetch)
65 (uri (string-append "https://www.webkitgtk.org/releases/"
66 name "-" version ".tar.xz"))
67 (sha256
68 (base32
69 "147r7an41920zl4x9srdva7fxvw2znjin5ldjkhay1cndv9gih0m"))))
70 (build-system cmake-build-system)
71 (outputs '("out" "doc"))
72 (arguments
73 '(#:tests? #f ; no tests
74 #:build-type "Release" ; turn off debugging symbols to save space
75 #:configure-flags (list
76 "-DPORT=GTK"
77 "-DENABLE_GTKDOC=ON" ; No doc by default
78 (string-append ; uses lib64 by default
79 "-DLIB_INSTALL_DIR="
80 (assoc-ref %outputs "out") "/lib")
81
82 ;; XXX Adding GStreamer GL support would apparently
83 ;; require adding gst-plugins-bad to the inputs,
84 ;; which might entail a security risk as a result of
85 ;; the plugins of dubious code quality that are
86 ;; included. More investigation is needed. For
87 ;; now, we explicitly disable it to prevent an error
88 ;; at configuration time.
89 "-DUSE_GSTREAMER_GL=OFF"
90
91 ;; XXX Disable WOFF2 ‘web fonts’. These were never
92 ;; supported in our previous builds. Enabling them
93 ;; requires building libwoff2 and possibly woff2dec.
94 "-DUSE_WOFF2=OFF")
95 #:phases
96 (modify-phases %standard-phases
97 (add-after 'unpack 'patch-gtk-doc-scan
98 (lambda* (#:key inputs #:allow-other-keys)
99 (for-each (lambda (file)
100 (substitute* file
101 (("http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd")
102 (string-append (assoc-ref inputs "docbook-xml")
103 "/xml/dtd/docbook/docbookx.dtd"))))
104 (find-files "Source" "\\.sgml$"))
105 #t))
106 (add-after 'install 'move-doc-files
107 (lambda* (#:key outputs #:allow-other-keys)
108 (let ((out (assoc-ref outputs "out"))
109 (doc (assoc-ref outputs "doc")))
110 (mkdir-p (string-append doc "/share"))
111 (rename-file (string-append out "/share/gtk-doc")
112 (string-append doc "/share/gtk-doc"))
113 #t))))))
114 (native-inputs
115 `(("bison" ,bison)
116 ("gettext" ,gettext-minimal)
117 ("glib:bin" ,glib "bin") ; for glib-mkenums, etc.
118 ("gobject-introspection" ,gobject-introspection)
119 ("gperf" ,gperf)
120 ("perl" ,perl)
121 ("pkg-config" ,pkg-config)
122 ("python" ,python-2) ; incompatible with Python 3 (print syntax)
123 ("gtk-doc" ,gtk-doc) ; For documentation generation
124 ("docbook-xml" ,docbook-xml) ; For documentation generation
125 ("ruby" ,ruby)))
126 (propagated-inputs
127 `(("gtk+" ,gtk+)
128 ("libsoup" ,libsoup)))
129 (inputs
130 `(("at-spi2-core" ,at-spi2-core)
131 ("enchant" ,enchant)
132 ("geoclue" ,geoclue)
133 ("gst-plugins-base" ,gst-plugins-base)
134 ("gtk+-2" ,gtk+-2)
135 ("harfbuzz" ,harfbuzz)
136 ("hyphen" ,hyphen)
137 ("icu4c" ,icu4c)
138 ("libgcrypt" ,libgcrypt)
139 ("libjpeg" ,libjpeg)
140 ("libnotify" ,libnotify)
141 ("libpng" ,libpng)
142 ("libsecret" ,libsecret)
143 ("libtasn1" ,libtasn1)
144 ("libwebp" ,libwebp)
145 ("libxcomposite" ,libxcomposite)
146 ("libxml2" ,libxml2)
147 ("libxslt" ,libxslt)
148 ("libxt" ,libxt)
149 ("mesa" ,mesa)
150 ("sqlite" ,sqlite)))
151 (home-page "https://www.webkitgtk.org/")
152 (synopsis "Web content engine for GTK+")
153 (description
154 "WebKitGTK+ is a full-featured port of the WebKit rendering engine,
155 suitable for projects requiring any kind of web integration, from hybrid
156 HTML/CSS applications to full-fledged web browsers.")
157 ;; WebKit's JavaScriptCore and WebCore components are available under
158 ;; the GNU LGPL, while the rest is available under a BSD-style license.
159 (license (list license:lgpl2.0
160 license:lgpl2.1+
161 license:bsd-2
162 license:bsd-3))))
163
164 ;; This version of webkitgtk needs to be kept separate, because it requires a
165 ;; newer version of GCC than our default compiler, and this causes problems
166 ;; when linked with C++ libraries built using our default compiler. For now,
167 ;; we use this newer webkitgtk only for selected packages, e.g. epiphany.
168 (define-public webkitgtk-2.24
169 (package/inherit webkitgtk
170 (name "webkitgtk")
171 (version "2.24.4")
172 (source (origin
173 (method url-fetch)
174 (uri (string-append "https://www.webkitgtk.org/releases/"
175 name "-" version ".tar.xz"))
176 (sha256
177 (base32
178 "1n3x5g1z6rg9n1ssna7wi0z6zlprjm4wzk544v14wqi6q0lv2s46"))))
179 (native-inputs
180 `(("gcc" ,gcc-7) ; webkitgtk-2.22 requires gcc-6 or newer
181 ,@(package-native-inputs webkitgtk)))
182 (inputs
183 `(("openjpeg" ,openjpeg)
184 ,@(package-inputs webkitgtk)))
185 (arguments
186 (substitute-keyword-arguments (package-arguments webkitgtk)
187 ((#:phases phases)
188 `(modify-phases ,phases
189 (add-before 'configure 'work-around-gcc-7-include-path-issue
190 ;; FIXME: Work around a problem with gcc-7 includes (see
191 ;; <https://bugs.gnu.org/30756>).
192 (lambda _
193 (unsetenv "C_INCLUDE_PATH")
194 (unsetenv "CPLUS_INCLUDE_PATH")
195 #t))))))))