webkit.scm 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  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, 2020 Mark H Weaver <mhw@netris.org>
  6. ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  7. ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
  8. ;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
  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. (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 compression)
  35. #:use-module (gnu packages docbook)
  36. #:use-module (gnu packages enchant)
  37. #:use-module (gnu packages flex)
  38. #:use-module (gnu packages fontutils)
  39. #:use-module (gnu packages freedesktop)
  40. #:use-module (gnu packages gcc)
  41. #:use-module (gnu packages gettext)
  42. #:use-module (gnu packages gl)
  43. #:use-module (gnu packages glib)
  44. #:use-module (gnu packages gnome)
  45. #:use-module (gnu packages gnupg)
  46. #:use-module (gnu packages gperf)
  47. #:use-module (gnu packages gstreamer)
  48. #:use-module (gnu packages gtk)
  49. #:use-module (gnu packages icu4c)
  50. #:use-module (gnu packages image)
  51. #:use-module (gnu packages libreoffice)
  52. #:use-module (gnu packages linux)
  53. #:use-module (gnu packages perl)
  54. #:use-module (gnu packages pkg-config)
  55. #:use-module (gnu packages python)
  56. #:use-module (gnu packages ruby)
  57. #:use-module (gnu packages sqlite)
  58. #:use-module (gnu packages tls)
  59. #:use-module (gnu packages video)
  60. #:use-module (gnu packages virtualization)
  61. #:use-module (gnu packages xml)
  62. #:use-module (gnu packages xdisorg)
  63. #:use-module (gnu packages xorg))
  64. (define-public libwpe
  65. (package
  66. (name "libwpe")
  67. (version "1.6.0")
  68. (source
  69. (origin
  70. (method url-fetch)
  71. (uri
  72. (string-append "https://wpewebkit.org/releases/libwpe-"
  73. version ".tar.xz"))
  74. (sha256
  75. (base32 "141w35b488jjhanl3nrm0awrbcy6hb579fk8n9vbpx07m2wcd1rm"))))
  76. (build-system cmake-build-system)
  77. (arguments
  78. `(#:tests? #f)) ;no tests
  79. (native-inputs
  80. `(("pkg-config" ,pkg-config)
  81. ("python" ,python-wrapper)))
  82. (inputs
  83. `(("mesa" ,mesa)))
  84. (propagated-inputs
  85. `(("libxkbcommon" ,libxkbcommon)))
  86. (synopsis "General-purpose library for WPE")
  87. (description "LibWPE is general-purpose library specifically developed for
  88. the WPE-flavored port of WebKit.")
  89. (home-page "https://wpewebkit.org/")
  90. (license license:bsd-2)))
  91. (define-public wpebackend-fdo
  92. (package
  93. (name "wpebackend-fdo")
  94. (version "1.6.1")
  95. (source (origin
  96. (method url-fetch)
  97. (uri (string-append "https://wpewebkit.org/releases/"
  98. "wpebackend-fdo-" version ".tar.xz"))
  99. (sha256
  100. (base32
  101. "1jdi43gciqjgvhnqxs160f3hmp1hkqhrllb0hhmldyxc4wryw3kl"))))
  102. (build-system cmake-build-system)
  103. (arguments
  104. `(#:tests? #f)) ;no tests
  105. (native-inputs
  106. `(("pkg-config" ,pkg-config)))
  107. (inputs
  108. `(("glib" ,glib)
  109. ("libwpe" ,libwpe)
  110. ("mesa" ,mesa)
  111. ("wayland" ,wayland)))
  112. (home-page "https://wpewebkit.org/")
  113. (synopsis "Wayland WPE backend")
  114. (description
  115. "This package provides a backend implementation for the WPE WebKit
  116. engine that uses Wayland for graphics output.")
  117. (license license:bsd-2)))
  118. (define-public wpewebkit
  119. (package
  120. (name "wpewebkit")
  121. (version "2.30.5")
  122. (source
  123. (origin
  124. (method url-fetch)
  125. (uri
  126. (string-append "https://wpewebkit.org/releases/"
  127. name "-" version ".tar.xz"))
  128. (sha256
  129. (base32 "16imr0kmzhs7dz6jva9750xbsdz9v50playnagabajy30x7pymsb"))))
  130. (build-system cmake-build-system)
  131. (outputs '("out" "doc"))
  132. (arguments
  133. `(#:tests? #f ; XXX: To be enabled
  134. #:configure-flags
  135. (list
  136. "-DPORT=WPE"
  137. ;; XXX: To be enabled.
  138. ;; "-DENABLE_ACCELERATED_2D_CANVAS=ON"
  139. "-DUSE_SYSTEMD=OFF"
  140. "-DENABLE_ENCRYPTED_MEDIA=OFF"
  141. "-DENABLE_GTKDOC=ON"
  142. "-DUSE_GSTREAMER_GL=OFF")
  143. #:phases
  144. (modify-phases %standard-phases
  145. (add-after 'unpack 'setenv
  146. (lambda _
  147. (setenv "HOME" "/tmp")
  148. #t))
  149. (add-after 'unpack 'patch-docbook-xml
  150. (lambda* (#:key inputs #:allow-other-keys)
  151. (for-each
  152. (lambda (file)
  153. (substitute* file
  154. (("http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd")
  155. (string-append (assoc-ref inputs "docbook-xml")
  156. "/xml/dtd/docbook/docbookx.dtd"))))
  157. (find-files "Source" "\\.sgml$"))
  158. #t))
  159. (add-after 'install 'move-doc-files
  160. (lambda* (#:key outputs #:allow-other-keys)
  161. (let* ((out (assoc-ref outputs "out"))
  162. (doc (assoc-ref outputs "doc")))
  163. (mkdir-p (string-append doc "/share"))
  164. (rename-file
  165. (string-append out "/share/gtk-doc")
  166. (string-append doc "/share/gtk-doc"))
  167. #t))))))
  168. (native-inputs
  169. `(("docbook-xml" ,docbook-xml-4.1.2)
  170. ("docbook-xsl" ,docbook-xsl)
  171. ("glib:bin" ,glib "bin")
  172. ("gobject-introspection" ,gobject-introspection)
  173. ("gtk-doc" ,gtk-doc/stable)
  174. ("perl" ,perl)
  175. ("pkg-config" ,pkg-config)
  176. ("python" ,python-wrapper)
  177. ("python2" ,python-2.7)
  178. ("ruby" ,ruby)))
  179. (inputs
  180. `(("atk" ,atk)
  181. ("atk-bridge" ,at-spi2-atk)
  182. ("bubblewrap" ,bubblewrap)
  183. ("cairo" ,cairo)
  184. ("fontconfig" ,fontconfig)
  185. ("freetype" ,freetype)
  186. ("gperf" ,gperf)
  187. ("gstreamer" ,gstreamer)
  188. ("gst-plugins-base" ,gst-plugins-base)
  189. ("harfbuzz" ,harfbuzz)
  190. ("icu" ,icu4c)
  191. ("libepoxy" ,libepoxy)
  192. ("libgcrypt" ,libgcrypt)
  193. ("libjpeg" ,libjpeg-turbo)
  194. ("libpng" ,libpng)
  195. ("libseccomp" ,libseccomp)
  196. ("libtasn1" ,libtasn1)
  197. ("libxml2" ,libxml2)
  198. ("libxslt" ,libxslt)
  199. ("mesa" ,mesa)
  200. ("openjpeg" ,openjpeg)
  201. ("sqlite" ,sqlite)
  202. ("webp" ,libwebp)
  203. ("woff2" ,woff2)
  204. ("xdg-dbus-proxy" ,xdg-dbus-proxy)
  205. ("zlib" ,zlib)))
  206. (propagated-inputs
  207. `(("glib" ,glib)
  208. ("libsoup" ,libsoup)
  209. ("wpe" ,libwpe)))
  210. (synopsis "WebKit port optimized for embedded devices")
  211. (description "WPE WebKit allows embedders to create simple and performant
  212. systems based on Web platform technologies. It is designed with hardware
  213. acceleration in mind, leveraging common 3D graphics APIs for best performance.")
  214. (home-page "https://wpewebkit.org/")
  215. (license
  216. (list
  217. ;; Rendering and JavaScript Engines.
  218. license:lgpl2.1+
  219. ;; Others
  220. license:bsd-2))))
  221. (define-public webkitgtk
  222. (package
  223. (name "webkitgtk")
  224. (version "2.32.3")
  225. (source (origin
  226. (method url-fetch)
  227. (uri (string-append "https://www.webkitgtk.org/releases/"
  228. "webkitgtk-" version ".tar.xz"))
  229. (sha256
  230. (base32
  231. "1g1clppby019bng43ry50xd2dvzfzgrd9yv2xx6gwkk5mksrdx61"))
  232. (patches (search-patches "webkitgtk-share-store.patch"
  233. "webkitgtk-bind-all-fonts.patch"))))
  234. (build-system cmake-build-system)
  235. (outputs '("out" "doc"))
  236. (arguments
  237. '(#:tests? #f ; no tests
  238. #:build-type "Release" ; turn off debugging symbols to save space
  239. #:configure-flags (list
  240. "-DPORT=GTK"
  241. "-DENABLE_GTKDOC=ON" ; No doc by default
  242. ;; Requires libmanette, new dependency added in 2.32.0.
  243. ;; TODO Decide if we should enable this
  244. "-DENABLE_GAMEPAD=OFF"
  245. "-DUSE_SYSTEMD=OFF"
  246. (string-append ; uses lib64 by default
  247. "-DLIB_INSTALL_DIR="
  248. (assoc-ref %outputs "out") "/lib")
  249. ;; XXX Adding GStreamer GL support would apparently
  250. ;; require adding gst-plugins-bad to the inputs,
  251. ;; which might entail a security risk as a result of
  252. ;; the plugins of dubious code quality that are
  253. ;; included. More investigation is needed. For
  254. ;; now, we explicitly disable it to prevent an error
  255. ;; at configuration time.
  256. "-DUSE_GSTREAMER_GL=OFF")
  257. #:make-flags
  258. ;; Never build with unsupported -j1: https://issues.guix.gnu.org/47964#5
  259. (list "-j" (number->string (max 2 (parallel-job-count))))
  260. #:phases
  261. (modify-phases %standard-phases
  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)))
  271. (add-after 'unpack 'patch-gtk-doc-scan
  272. (lambda* (#:key inputs #:allow-other-keys)
  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$"))
  279. #t))
  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)))
  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))))))
  295. (native-inputs
  296. `(("bison" ,bison)
  297. ("gettext" ,gettext-minimal)
  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)
  303. ("python" ,python-wrapper)
  304. ("gtk-doc" ,gtk-doc/stable) ; For documentation generation
  305. ("docbook-xml" ,docbook-xml) ; For documentation generation
  306. ("ruby" ,ruby)))
  307. (propagated-inputs
  308. `(("gtk+" ,gtk+)
  309. ("libsoup" ,libsoup)))
  310. (inputs
  311. `(("at-spi2-core" ,at-spi2-core)
  312. ("bubblewrap" ,bubblewrap)
  313. ("enchant" ,enchant)
  314. ("geoclue" ,geoclue)
  315. ("gst-plugins-base" ,gst-plugins-base)
  316. ("gtk+-2" ,gtk+-2)
  317. ("harfbuzz" ,harfbuzz)
  318. ("hyphen" ,hyphen)
  319. ("icu4c" ,icu4c)
  320. ("libgcrypt" ,libgcrypt)
  321. ("libjpeg" ,libjpeg-turbo)
  322. ("libnotify" ,libnotify)
  323. ("libpng" ,libpng)
  324. ("libseccomp" ,libseccomp)
  325. ("libsecret" ,libsecret)
  326. ("libtasn1" ,libtasn1)
  327. ("libwebp" ,libwebp)
  328. ("libwpe" ,libwpe)
  329. ("libxcomposite" ,libxcomposite)
  330. ("libxml2" ,libxml2)
  331. ("libxslt" ,libxslt)
  332. ("libxt" ,libxt)
  333. ("mesa" ,mesa)
  334. ("openjpeg" ,openjpeg)
  335. ("sqlite" ,sqlite)
  336. ("woff2" ,woff2)
  337. ("wpebackend-fdo" ,wpebackend-fdo)
  338. ("xdg-dbus-proxy" ,xdg-dbus-proxy)))
  339. (home-page "https://www.webkitgtk.org/")
  340. (synopsis "Web content engine for GTK+")
  341. (description
  342. "WebKitGTK+ is a full-featured port of the WebKit rendering engine,
  343. suitable for projects requiring any kind of web integration, from hybrid
  344. HTML/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))))