gnu: icecat: Update to 78.10.0-guix0-preview1 [security fixes].
[jackhill/guix/guix.git] / gnu / packages / browser-extensions.scm
CommitLineData
cb9a58ae 1;;; GNU Guix --- Functional package management for GNU
229f944b 2;;; Copyright © 2020, 2021 Marius Bakke <marius@gnu.org>
cb9a58ae
MB
3;;;
4;;; This file is part of GNU Guix.
5;;;
6;;; GNU Guix is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; GNU Guix is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of the GNU General Public License
17;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (gnu packages browser-extensions)
20 #:use-module (guix packages)
21 #:use-module (guix git-download)
dfe03a92 22 #:use-module (guix build-system copy)
cb9a58ae
MB
23 #:use-module (guix build-system gnu)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (gnu build chromium-extension)
26 #:use-module (gnu packages compression)
27 #:use-module (gnu packages python))
28
dfe03a92
MB
29(define play-to-kodi
30 (package
31 (name "play-to-kodi")
32 (version "1.9.1")
33 (home-page "https://github.com/khloke/play-to-xbmc-chrome")
34 (source (origin
35 (method git-fetch)
36 (uri (git-reference (url home-page) (commit version)))
37 (file-name (git-file-name name version))
38 (sha256
39 (base32
40 "01rmcpbkn9vhcd8mrah2jmd2801k2r5fz7aqvp22hbwmh2z5f1ch"))))
41 (build-system copy-build-system)
42 (synopsis "Send website contents to Kodi")
43 (description
44 "Play to Kodi is a browser add-on that can send video, audio, and other
45supported content to the Kodi media center.")
46 (license license:expat)))
47
48(define-public play-to-kodi/chromium
49 (make-chromium-extension play-to-kodi))
50
cb9a58ae 51(define uassets
d3ec50ec 52 (let ((commit "61b43044fbe7be0cf4e9c636fe96236dc52e44cf"))
cb9a58ae
MB
53 (origin
54 (method git-fetch)
55 (uri (git-reference
8ed4c468 56 (url "https://github.com/uBlockOrigin/uAssets")
cb9a58ae
MB
57 (commit commit)))
58 (file-name (git-file-name "uAssets" (string-take commit 9)))
59 (sha256
60 (base32
d3ec50ec 61 "03ikia0prmzsc34qa3418dc49ss8ari9hj6g3s6nvxrgyd127idi")))))
cb9a58ae
MB
62
63(define ublock-origin
64 (package
65 (name "ublock-origin")
d3ec50ec 66 (version "1.33.2")
cb9a58ae
MB
67 (home-page "https://github.com/gorhill/uBlock")
68 (source (origin
69 (method git-fetch)
70 (uri (git-reference (url home-page) (commit version)))
71 (file-name (git-file-name name version))
72 (sha256
73 (base32
d3ec50ec 74 "1pdf3fzc7ld65gr87s1cdy2sb84jbqnyq9lvwg1mgzi9dg8x7639"))))
cb9a58ae
MB
75 (build-system gnu-build-system)
76 (outputs '("xpi" "firefox" "chromium"))
77 (arguments
78 '(#:tests? #f ;no tests
79 #:allowed-references ()
80 #:phases
81 (modify-phases (map (lambda (phase)
82 (assq phase %standard-phases))
83 '(set-paths unpack patch-source-shebangs))
84 (add-after 'unpack 'link-uassets
85 (lambda* (#:key native-inputs inputs #:allow-other-keys)
86 (symlink (string-append (assoc-ref (or native-inputs inputs)
87 "uassets"))
88 "../uAssets")
89 #t))
90 (add-after 'unpack 'make-files-writable
91 (lambda _
92 ;; The build system copies some files and later tries
93 ;; modifying them.
94 (for-each make-file-writable (find-files "."))
95 #t))
96 (add-after 'patch-source-shebangs 'build-xpi
97 (lambda _
98 (invoke "./tools/make-firefox.sh" "all")))
99 (add-after 'build-xpi 'build-chromium
100 (lambda _
101 (invoke "./tools/make-chromium.sh")))
102 (add-after 'build-chromium 'install
103 (lambda* (#:key outputs #:allow-other-keys)
104 (let ((firefox (assoc-ref outputs "firefox"))
105 (xpi (assoc-ref outputs "xpi"))
106 (chromium (assoc-ref outputs "chromium")))
107 (install-file "dist/build/uBlock0.firefox.xpi"
108 (string-append xpi "/lib/mozilla/extensions"))
109 (copy-recursively "dist/build/uBlock0.firefox" firefox)
110 (copy-recursively "dist/build/uBlock0.chromium" chromium)
111 #t))))))
112 (native-inputs
113 `(("python" ,python-wrapper)
114 ("uassets" ,uassets)
115 ("zip" ,zip)))
116 (synopsis "Block unwanted content from web sites")
117 (description
118 "uBlock Origin is a @dfn{wide spectrum blocker} for IceCat and
119ungoogled-chromium.")
120 (license license:gpl3+)))
121
122(define-public ublock-origin/chromium
123 (make-chromium-extension ublock-origin "chromium"))