browser-extensions.scm 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2020, 2021 Marius Bakke <marius@gnu.org>
  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. (define-module (gnu packages browser-extensions)
  19. #:use-module (guix packages)
  20. #:use-module (guix git-download)
  21. #:use-module (guix build-system copy)
  22. #:use-module (guix build-system gnu)
  23. #:use-module ((guix licenses) #:prefix license:)
  24. #:use-module (gnu build chromium-extension)
  25. #:use-module (gnu packages compression)
  26. #:use-module (gnu packages python))
  27. (define play-to-kodi
  28. (package
  29. (name "play-to-kodi")
  30. (version "1.9.1")
  31. (home-page "https://github.com/khloke/play-to-xbmc-chrome")
  32. (source (origin
  33. (method git-fetch)
  34. (uri (git-reference (url home-page) (commit version)))
  35. (file-name (git-file-name name version))
  36. (sha256
  37. (base32
  38. "01rmcpbkn9vhcd8mrah2jmd2801k2r5fz7aqvp22hbwmh2z5f1ch"))))
  39. (build-system copy-build-system)
  40. (synopsis "Send website contents to Kodi")
  41. (description
  42. "Play to Kodi is a browser add-on that can send video, audio, and other
  43. supported content to the Kodi media center.")
  44. (license license:expat)))
  45. (define-public play-to-kodi/chromium
  46. (make-chromium-extension play-to-kodi))
  47. (define uassets
  48. (let ((commit "54e217d9051831d0d8856286a877962e0f592d45"))
  49. (origin
  50. (method git-fetch)
  51. (uri (git-reference
  52. (url "https://github.com/uBlockOrigin/uAssets")
  53. (commit commit)))
  54. (file-name (git-file-name "uAssets" (string-take commit 9)))
  55. (sha256
  56. (base32
  57. "1xhxadm6qyph6kkq3gxg1rar1psb586mniwp7bkyj5zpzzj31wmj")))))
  58. (define ublock-origin
  59. (package
  60. (name "ublock-origin")
  61. (version "1.37.2")
  62. (home-page "https://github.com/gorhill/uBlock")
  63. (source (origin
  64. (method git-fetch)
  65. (uri (git-reference (url home-page) (commit version)))
  66. (file-name (git-file-name name version))
  67. (sha256
  68. (base32
  69. "1c1dh9kkimvahs9yw1hv67290h8xvmbl10film7g1wamdxydj97y"))))
  70. (build-system gnu-build-system)
  71. (outputs '("xpi" "firefox" "chromium"))
  72. (arguments
  73. '(#:tests? #f ;no tests
  74. #:allowed-references ()
  75. #:phases
  76. (modify-phases (map (lambda (phase)
  77. (assq phase %standard-phases))
  78. '(set-paths unpack patch-source-shebangs))
  79. (add-after 'unpack 'link-uassets
  80. (lambda* (#:key native-inputs inputs #:allow-other-keys)
  81. (symlink (string-append (assoc-ref (or native-inputs inputs)
  82. "uassets"))
  83. "../uAssets")
  84. #t))
  85. (add-after 'unpack 'make-files-writable
  86. (lambda _
  87. ;; The build system copies some files and later tries
  88. ;; modifying them.
  89. (for-each make-file-writable (find-files "."))
  90. #t))
  91. (add-after 'patch-source-shebangs 'build-xpi
  92. (lambda _
  93. (invoke "./tools/make-firefox.sh" "all")))
  94. (add-after 'build-xpi 'build-chromium
  95. (lambda _
  96. (invoke "./tools/make-chromium.sh")))
  97. (add-after 'build-chromium 'install
  98. (lambda* (#:key outputs #:allow-other-keys)
  99. (let ((firefox (assoc-ref outputs "firefox"))
  100. (xpi (assoc-ref outputs "xpi"))
  101. (chromium (assoc-ref outputs "chromium")))
  102. (install-file "dist/build/uBlock0.firefox.xpi"
  103. (string-append xpi "/lib/mozilla/extensions"))
  104. (copy-recursively "dist/build/uBlock0.firefox" firefox)
  105. (copy-recursively "dist/build/uBlock0.chromium" chromium)
  106. #t))))))
  107. (native-inputs
  108. `(("python" ,python-wrapper)
  109. ("uassets" ,uassets)
  110. ("zip" ,zip)))
  111. (synopsis "Block unwanted content from web sites")
  112. (description
  113. "uBlock Origin is a @dfn{wide spectrum blocker} for IceCat and
  114. ungoogled-chromium.")
  115. (license license:gpl3+)))
  116. (define-public ublock-origin/chromium
  117. (make-chromium-extension ublock-origin "chromium"))