chromium.scm 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2019, 2020, 2021 Marius Bakke <mbakke@fastmail.com>
  3. ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
  4. ;;;
  5. ;;; This file is part of GNU Guix.
  6. ;;;
  7. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  8. ;;; under the terms of the GNU General Public License as published by
  9. ;;; the Free Software Foundation; either version 3 of the License, or (at
  10. ;;; your option) any later version.
  11. ;;;
  12. ;;; GNU Guix is distributed in the hope that it will be useful, but
  13. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;;; GNU General Public License for more details.
  16. ;;;
  17. ;;; You should have received a copy of the GNU General Public License
  18. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  19. (define-module (gnu packages chromium)
  20. #:use-module ((guix licenses) #:prefix license:)
  21. #:use-module (guix packages)
  22. #:use-module (guix gexp)
  23. #:use-module (guix download)
  24. #:use-module (guix git-download)
  25. #:use-module (guix utils)
  26. #:use-module (guix build-system gnu)
  27. #:use-module (guix build-system trivial)
  28. #:use-module (gnu packages)
  29. #:use-module (gnu packages assembly)
  30. #:use-module (gnu packages base)
  31. #:use-module (gnu packages bash)
  32. #:use-module (gnu packages bison)
  33. #:use-module (gnu packages build-tools)
  34. #:use-module (gnu packages compression)
  35. #:use-module (gnu packages cups)
  36. #:use-module (gnu packages curl)
  37. #:use-module (gnu packages fontutils)
  38. #:use-module (gnu packages freedesktop)
  39. #:use-module (gnu packages ghostscript)
  40. #:use-module (gnu packages gl)
  41. #:use-module (gnu packages glib)
  42. #:use-module (gnu packages gnome)
  43. #:use-module (gnu packages gperf)
  44. #:use-module (gnu packages gtk)
  45. #:use-module (gnu packages icu4c)
  46. #:use-module (gnu packages image)
  47. #:use-module (gnu packages libevent)
  48. #:use-module (gnu packages libffi)
  49. #:use-module (gnu packages linux)
  50. #:use-module (gnu packages llvm)
  51. #:use-module (gnu packages kerberos)
  52. #:use-module (gnu packages ninja)
  53. #:use-module (gnu packages node)
  54. #:use-module (gnu packages nss)
  55. #:use-module (gnu packages pciutils)
  56. #:use-module (gnu packages pkg-config)
  57. #:use-module (gnu packages protobuf)
  58. #:use-module (gnu packages pulseaudio)
  59. #:use-module (gnu packages python)
  60. #:use-module (gnu packages regex)
  61. #:use-module (gnu packages serialization)
  62. #:use-module (gnu packages speech)
  63. #:use-module (gnu packages valgrind)
  64. #:use-module (gnu packages vulkan)
  65. #:use-module (gnu packages video)
  66. #:use-module (gnu packages xiph)
  67. #:use-module (gnu packages xml)
  68. #:use-module (gnu packages xdisorg)
  69. #:use-module (gnu packages xorg)
  70. #:use-module (ice-9 match)
  71. #:use-module (srfi srfi-1))
  72. (define %preserved-third-party-files
  73. '("base/third_party/cityhash" ;Expat
  74. "base/third_party/double_conversion" ;BSD-3
  75. "base/third_party/dynamic_annotations" ;BSD-2
  76. "base/third_party/icu" ;Unicode, X11-style
  77. "base/third_party/superfasthash" ;BSD-3
  78. "base/third_party/symbolize" ;BSD-3
  79. "base/third_party/xdg_mime" ;LGPL2.0+ or Academic 2.0
  80. "base/third_party/xdg_user_dirs" ;Expat
  81. ;; XXX: Chromium requires a newer C++ standard library. Remove this when
  82. ;; the default GCC is 9 or later.
  83. "buildtools/third_party/libc++" ;ASL2.0, with LLVM exceptions
  84. "chrome/third_party/mozilla_security_manager" ;MPL-1.1/GPL2+/LGPL2.1+
  85. "courgette/third_party/bsdiff" ;BSD-2, BSD protection license
  86. "courgette/third_party/divsufsort" ;Expat
  87. "net/third_party/mozilla_security_manager" ;MPL-1.1/GPL2+/LGPL2.1+
  88. "net/third_party/nss" ;MPL-2.0
  89. "net/third_party/quiche" ;BSD-3
  90. "net/third_party/uri_template" ;ASL2.0
  91. "third_party/abseil-cpp" ;ASL2.0
  92. "third_party/angle" ;BSD-3
  93. "third_party/angle/src/common/third_party/base" ;BSD-3
  94. "third_party/angle/src/common/third_party/smhasher" ;Public domain
  95. "third_party/angle/src/common/third_party/xxhash" ;BSD-2
  96. "third_party/angle/src/third_party/compiler" ;BSD-2
  97. "third_party/angle/src/third_party/libXNVCtrl" ;Expat
  98. "third_party/angle/src/third_party/trace_event" ;BSD-3
  99. "third_party/angle/src/third_party/volk" ;Expat
  100. "third_party/apple_apsl" ;APSL2.0
  101. "third_party/axe-core" ;MPL2.0
  102. "third_party/blink" ;BSD-3, LGPL2+
  103. "third_party/boringssl" ;OpenSSL/ISC (Google additions are ISC)
  104. "third_party/boringssl/src/third_party/fiat" ;Expat
  105. "third_party/breakpad" ;BSD-3
  106. "third_party/brotli" ;Expat
  107. "third_party/catapult" ;BSD-3
  108. "third_party/catapult/common/py_vulcanize/third_party/rcssmin" ;ASL2.0
  109. "third_party/catapult/common/py_vulcanize/third_party/rjsmin" ;ASL2.0
  110. "third_party/catapult/third_party/beautifulsoup4" ;Expat
  111. "third_party/catapult/third_party/html5lib-python" ;Expat
  112. "third_party/catapult/third_party/polymer" ;BSD-3
  113. "third_party/catapult/third_party/six" ;Expat
  114. ;; XXX: This is a minified version of <https://d3js.org/>.
  115. "third_party/catapult/tracing/third_party/d3" ;BSD-3
  116. "third_party/catapult/tracing/third_party/gl-matrix" ;Expat
  117. "third_party/catapult/tracing/third_party/jpeg-js" ;ASL2.0
  118. ;; XXX: Minified version of <https://github.com/Stuk/jszip>.
  119. "third_party/catapult/tracing/third_party/jszip" ;Expat or GPL3
  120. "third_party/catapult/tracing/third_party/mannwhitneyu" ;Expat
  121. "third_party/catapult/tracing/third_party/oboe" ;BSD-2
  122. ;; XXX: Minified version of <https://github.com/nodeca/pako>.
  123. "third_party/catapult/tracing/third_party/pako" ;Expat
  124. "third_party/ced" ;BSD-3
  125. "third_party/cld_3" ;ASL2.0
  126. "third_party/closure_compiler" ;ASL2.0
  127. "third_party/crashpad" ;ASL2.0
  128. "third_party/crashpad/crashpad/third_party/lss" ;ASL2.0
  129. "third_party/crashpad/crashpad/third_party/zlib/zlib_crashpad.h" ;Zlib
  130. "third_party/crc32c" ;BSD-3
  131. "third_party/cros_system_api" ;BSD-3
  132. "third_party/dav1d" ;BSD-2
  133. "third_party/dawn" ;ASL2.0
  134. "third_party/depot_tools/owners.py" ;BSD-3
  135. "third_party/devtools-frontend" ;BSD-3
  136. "third_party/devtools-frontend/src/front_end/third_party/acorn" ;Expat
  137. "third_party/devtools-frontend/src/front_end/third_party/axe-core" ;MPL2.0
  138. "third_party/devtools-frontend/src/front_end/third_party/chromium" ;BSD-3
  139. "third_party/devtools-frontend/src/front_end/third_party/codemirror" ;Expat
  140. "third_party/devtools-frontend/src/front_end/third_party/diff" ;ASL2.0
  141. "third_party/devtools-frontend/src/front_end/third_party/i18n" ;ASL2.0
  142. "third_party/devtools-frontend/src/front_end/third_party/intl-messageformat" ;BSD-3
  143. "third_party/devtools-frontend/src/front_end/third_party/lighthouse" ;ASL2.0
  144. "third_party/devtools-frontend/src/front_end/third_party/lit-html" ;BSD-3
  145. "third_party/devtools-frontend/src/front_end/third_party/lodash-isequal" ;Expat
  146. "third_party/devtools-frontend/src/front_end/third_party/marked" ;Expat, BSD-3
  147. "third_party/devtools-frontend/src/front_end/third_party/puppeteer" ;ASL2.0
  148. "third_party/devtools-frontend/src/front_end/third_party/wasmparser" ;ASL2.0
  149. "third_party/devtools-frontend/src/third_party/pyjson5" ;ASL2.0
  150. "third_party/devtools-frontend/src/third_party/typescript" ;ASL2.0
  151. "third_party/dom_distiller_js" ;BSD-3
  152. "third_party/eigen3" ;MPL2.0
  153. "third_party/emoji-segmenter" ;ASL2.0
  154. "third_party/farmhash" ;Expat
  155. "third_party/fdlibm" ;non-copyleft
  156. "third_party/fft2d" ;non-copyleft
  157. "third_party/flatbuffers" ;ASL2.0
  158. "third_party/fusejs" ;ASL2.0
  159. "third_party/gemmlowp" ;ASL2.0
  160. "third_party/google_input_tools" ;ASL2.0
  161. "third_party/google_input_tools/third_party/closure_library" ;ASL2.0
  162. "third_party/google_input_tools/third_party/closure_library/third_party/closure" ;Expat
  163. "third_party/googletest" ;BSD-3
  164. "third_party/harfbuzz-ng" ;Expat
  165. "third_party/highway" ;ASL2.0
  166. "third_party/hunspell" ;MPL1.1/GPL2+/LGPL2.1+
  167. "third_party/iccjpeg" ;IJG
  168. "third_party/inspector_protocol" ;BSD-3
  169. "third_party/jinja2" ;BSD-3
  170. ;; XXX: Unbundle this when switching back to libstdc++.
  171. "third_party/jsoncpp" ;Public Domain or Expat
  172. "third_party/jstemplate" ;ASL2.0
  173. "third_party/khronos" ;Expat, SGI
  174. "third_party/leveldatabase" ;BSD-3
  175. "third_party/libavif" ;BSD-2
  176. "third_party/libXNVCtrl" ;Expat
  177. "third_party/libaddressinput" ;ASL2.0
  178. "third_party/libaom" ;BSD-2 or "Alliance for Open Media Patent License 1.0"
  179. "third_party/libaom/source/libaom/third_party/fastfeat" ;BSD-3
  180. "third_party/libaom/source/libaom/third_party/vector" ;Expat
  181. "third_party/libaom/source/libaom/third_party/x86inc" ;ISC
  182. "third_party/libjxl" ;ASL2.0
  183. "third_party/libgav1" ;ASL2.0
  184. "third_party/libgifcodec" ;MPL1.1/GPL2+/LGPL2.1+, BSD-3, BSD-2
  185. "third_party/libjingle_xmpp" ;BSD-3
  186. "third_party/libphonenumber" ;ASL2.0
  187. "third_party/libsecret" ;LGPL2.1+
  188. "third_party/libsrtp" ;BSD-3
  189. "third_party/libsync" ;ASL2.0
  190. "third_party/libudev" ;LGPL2.1+
  191. "third_party/liburlpattern" ;Expat
  192. "third_party/libva_protected_content" ;Expat
  193. ;; FIXME: build/linux/unbundle/libvpx.gn does not work for all users.
  194. "third_party/libvpx" ;BSD-3
  195. "third_party/libvpx/source/libvpx/third_party/x86inc" ;Expat
  196. "third_party/libwebm" ;BSD-3
  197. "third_party/libxml/chromium" ;BSD-3
  198. "third_party/libyuv" ;BSD-3
  199. "third_party/libzip" ;BSD-3
  200. "third_party/lottie" ;Expat
  201. "third_party/lss" ;BSD-3
  202. "third_party/mako" ;Expat
  203. "third_party/markupsafe" ;BSD-3
  204. "third_party/mesa_headers" ;Expat, SGI
  205. "third_party/metrics_proto" ;BSD-3
  206. "third_party/minigbm" ;BSD-3
  207. "third_party/modp_b64" ;BSD-3
  208. "third_party/nasm" ;BSD-2
  209. "third_party/nearby" ;ASL2.0
  210. "third_party/node" ;Expat
  211. "third_party/node/node_modules/polymer-bundler/lib/third_party/UglifyJS2" ;BSD-2
  212. "third_party/one_euro_filter" ;BSD-3
  213. "third_party/openscreen" ;BSD-3
  214. "third_party/openscreen/src/third_party/tinycbor" ;Expat
  215. "third_party/openscreen/src/third_party/mozilla" ;MPL1.1/GPL2+/LGPL2.1+, BSD-3
  216. "third_party/ots" ;BSD-3
  217. "third_party/pdfium" ;BSD-3
  218. "third_party/pdfium/third_party/agg23" ;Expat
  219. "third_party/pdfium/third_party/base" ;BSD-3
  220. "third_party/pdfium/third_party/bigint" ;Public domain, BSD-3
  221. "third_party/pdfium/third_party/libtiff" ;non-copyleft
  222. "third_party/pdfium/third_party/skia_shared" ;BSD-3
  223. "third_party/pdfium/third_party/freetype/include/pstables.h" ;FreeType
  224. "third_party/perfetto" ;ASL2.0
  225. "third_party/perfetto/protos/third_party/chromium" ;BSD-3
  226. "third_party/pffft" ;the "FFTPACK" license
  227. "third_party/ply" ;BSD-3
  228. "third_party/polymer" ;BSD-3
  229. "third_party/private_membership" ;ASL2.0
  230. "third_party/private-join-and-compute" ;ASL2.0
  231. "third_party/protobuf" ;BSD-3
  232. "third_party/protobuf/third_party/six" ;Expat
  233. "third_party/pyjson5" ;ASL2.0
  234. "third_party/qcms" ;Expat
  235. ;; XXX: System re2 cannot be used when Chromium uses libc++ because the re2
  236. ;; ABI relies on libstdc++ internals. See build/linux/unbundle/re2.gn.
  237. "third_party/re2" ;BSD-3
  238. "third_party/rnnoise" ;BSD-3
  239. "third_party/ruy" ;ASL2.0
  240. "third_party/s2cellid" ;ASL2.0
  241. "third_party/securemessage" ;ASL2.0
  242. "third_party/shell-encryption" ;ASL2.0
  243. "third_party/skia" ;BSD-3
  244. "third_party/skia/include/third_party/skcms" ;BSD-3
  245. "third_party/skia/third_party/skcms" ;BSD-3
  246. "third_party/skia/third_party/vulkanmemoryallocator" ;BSD-3, Expat
  247. "third_party/smhasher" ;Expat, public domain
  248. "third_party/speech-dispatcher" ;GPL2+
  249. "third_party/sqlite" ;Public domain
  250. "third_party/swiftshader" ;ASL2.0
  251. "third_party/swiftshader/third_party/astc-encoder" ;ASL2.0
  252. "third_party/swiftshader/third_party/llvm-10.0" ;ASL2.0, with LLVM exception
  253. "third_party/swiftshader/third_party/llvm-subzero" ;NCSA
  254. "third_party/swiftshader/third_party/marl" ;ASL2.0
  255. "third_party/swiftshader/third_party/subzero" ;NCSA
  256. "third_party/swiftshader/third_party/SPIRV-Headers" ;X11-style
  257. "third_party/tcmalloc/chromium" ;BSD-3
  258. "third_party/tensorflow-text" ;ASL2.0
  259. "third_party/tflite" ;ASL2.0
  260. "third_party/tflite/src/third_party/eigen3" ;MPL2.0
  261. "third_party/tflite/src/third_party/fft2d" ;ASL2.0
  262. "third_party/tflite-support" ;ASL2.0
  263. "third_party/ukey2" ;ASL2.0
  264. "third_party/usb_ids" ;BSD-3
  265. "third_party/usrsctp" ;BSD-2
  266. "third_party/utf" ;Expat
  267. "third_party/vulkan-deps" ;ASL2.0, BSD-3, Expat
  268. "third_party/vulkan_memory_allocator" ;Expat
  269. "third_party/wayland/protocol" ;Expat
  270. "third_party/wayland/stubs" ;BSD-3, Expat
  271. "third_party/wayland/wayland_scanner_wrapper.py" ;BSD-3
  272. "third_party/wayland-protocols" ;Expat
  273. "third_party/web-animations-js" ;ASL2.0
  274. "third_party/webdriver" ;ASL2.0
  275. "third_party/webgpu-cts" ;BSD-3
  276. "third_party/webrtc" ;BSD-3
  277. "third_party/webrtc/common_audio/third_party/ooura" ;Non-copyleft
  278. "third_party/webrtc/common_audio/third_party/spl_sqrt_floor" ;Public domain
  279. "third_party/webrtc/modules/third_party/fft" ;Non-copyleft
  280. "third_party/webrtc/modules/third_party/g711" ;Public domain
  281. "third_party/webrtc/modules/third_party/g722" ;Public domain
  282. "third_party/webrtc/rtc_base/third_party/base64" ;Non-copyleft
  283. "third_party/webrtc/rtc_base/third_party/sigslot" ;Public domain
  284. "third_party/widevine/cdm/widevine_cdm_version.h" ;BSD-3
  285. "third_party/widevine/cdm/widevine_cdm_common.h" ;BSD-3
  286. "third_party/woff2" ;ASL2.0
  287. "third_party/wuffs" ;ASL2.0
  288. "third_party/xcbproto" ;X11
  289. "third_party/xdg-utils" ;Expat
  290. ;; These are forked components of the X11 keybinding code.
  291. "third_party/libxcb-keysyms" ;X11
  292. "third_party/libx11/src/KeyBind.c" ;X11
  293. "third_party/libx11/src/xkb/XKBBind.c" ;X11
  294. "third_party/x11proto/keysymdef.h" ;X11
  295. "third_party/zlib/google" ;BSD-3
  296. "third_party/zxcvbn-cpp" ;Expat
  297. "tools/grit/third_party/six" ;Expat
  298. "url/third_party/mozilla" ;BSD-3, MPL1.1/GPL2+/LGPL2.1+
  299. "v8/src/third_party/siphash" ;Public domain
  300. "v8/src/third_party/utf8-decoder" ;Expat
  301. "v8/src/third_party/valgrind" ;BSD-4
  302. "v8/third_party/inspector_protocol" ;BSD-3
  303. "v8/third_party/v8/builtins")) ;PSFL
  304. (define %blacklisted-files
  305. ;; 'third_party/blink/perf_tests/resources/svg/HarveyRayner.svg' carries a
  306. ;; nonfree license according to LICENSES in the same directory. As we don't
  307. ;; run the Blink performance tests, just remove everything to save ~70MiB.
  308. '("third_party/blink/perf_tests"))
  309. (define* (debian-patch name hash #:optional (revision %debian-revision))
  310. (origin
  311. (method url-fetch)
  312. (uri (string-append "https://salsa.debian.org/chromium-team/chromium/-/raw/"
  313. revision "/debian/patches/" name))
  314. (file-name (match (string-split name #\/)
  315. ((category name)
  316. (string-append "ungoogled-chromium-" category "-" name))))
  317. (sha256 (base32 hash))))
  318. (define %chromium-version "92.0.4515.159")
  319. (define %debian-revision "debian/90.0.4430.85-1")
  320. ;; Note: use 'git describe --long' even for exact tags to placate the
  321. ;; custom version format for ungoogled-chromium.
  322. (define %ungoogled-revision "92.0.4515.159-1-8-g8164c91")
  323. (define %debian-patches
  324. (list (debian-patch "fixes/nomerge.patch"
  325. "0lybs2b5gk08j8cr6vjrs9d3drd7qfw013z2r0y00by8dnpm74i3")
  326. (debian-patch "system/nspr.patch"
  327. "1gdirn1k1i841l8zp8xgr95kl16b5nx827am9rcxj8sfkm8hgkn3")
  328. (debian-patch "system/zlib.patch"
  329. "0j313bd3q8qc065j60x97dckrfgbwl4qxc8jhz33iihvv4lwziwv")
  330. (debian-patch "system/openjpeg.patch"
  331. "048405xh84pys0kky81vlqhaxjyxvcql4py217z01qxiv991zxaj")))
  332. (define %ungoogled-origin
  333. (origin
  334. (method git-fetch)
  335. (uri (git-reference (url "https://github.com/Eloston/ungoogled-chromium")
  336. (commit %ungoogled-revision)))
  337. (file-name (git-file-name "ungoogled-chromium" %ungoogled-revision))
  338. (sha256
  339. (base32
  340. "0wbcbjzh5ak4nciahqw4yvxc4x8ik4x0iz9h4kfy0m011sxzy174"))))
  341. (define %guix-patches
  342. (list (local-file
  343. (assume-valid-file-name
  344. (search-patch "ungoogled-chromium-extension-search-path.patch")))))
  345. ;; This is a source 'snippet' that does the following:
  346. ;; *) Applies various patches for unbundling purposes and libstdc++ compatibility.
  347. ;; *) Runs the ungoogled patch-, domain substitution-, and scrubbing scripts.
  348. ;; *) Prunes all third_party directories that are not explicitly preserved.
  349. ;; *) Adjusts "GN" build files such that system libraries are preferred.
  350. (define ungoogled-chromium-snippet
  351. ;; Note: delay to cope with cyclic module imports at the top level.
  352. (delay
  353. #~(begin
  354. (let ((chromium-dir (getcwd)))
  355. (set-path-environment-variable
  356. "PATH" '("bin")
  357. (list #+patch #+python-wrapper #+xz))
  358. ;; Apply patches before running the ungoogled scripts because
  359. ;; domain substitution may break some of the patches.
  360. (format #t "Applying assorted build fixes...~%")
  361. (force-output)
  362. (for-each (lambda (patch)
  363. (invoke "patch" "-p1" "--force" "--input"
  364. patch "--no-backup-if-mismatch"))
  365. (append '#+%debian-patches '#+%guix-patches))
  366. (with-directory-excursion #+%ungoogled-origin
  367. (format #t "Ungooglifying...~%")
  368. (force-output)
  369. (invoke "python" "utils/prune_binaries.py" chromium-dir
  370. "pruning.list")
  371. (invoke "python" "utils/patches.py" "apply" chromium-dir
  372. "patches")
  373. (invoke "python" "utils/domain_substitution.py" "apply" "-r"
  374. "domain_regex.list" "-f" "domain_substitution.list"
  375. "-c" "/tmp/domainscache.tar.gz" chromium-dir))
  376. ;; Run after the ungoogled scripts to avoid interfering with
  377. ;; patches or file lists.
  378. (format #t "Removing blacklisted files...~%")
  379. (force-output)
  380. (for-each delete-file-recursively '#$%blacklisted-files)
  381. (format #t "Pruning third party files...~%")
  382. (force-output)
  383. (apply invoke (string-append #+python-2 "/bin/python")
  384. "build/linux/unbundle/remove_bundled_libraries.py"
  385. "--do-remove" '#$%preserved-third-party-files)
  386. (format #t "Replacing GN files...~%")
  387. (force-output)
  388. (substitute* "tools/generate_shim_headers/generate_shim_headers.py"
  389. ;; The "is_official_build" configure option enables certain
  390. ;; release optimizations like those used in the commercial
  391. ;; Chrome browser. Unfortunately it also requires using the
  392. ;; bundled libraries: lose that restriction.
  393. (("#if defined\\(OFFICIAL_BUILD\\)")
  394. "#if 0"))
  395. (invoke "python" "build/linux/unbundle/replace_gn_files.py"
  396. "--system-libraries" "ffmpeg" "flac" "fontconfig"
  397. "freetype" "harfbuzz-ng" "icu" "libdrm" "libevent"
  398. "libjpeg" "libpng" "libwebp" "libxml" "libxslt"
  399. "openh264" "opus" "snappy" "zlib")))))
  400. (define opus+custom
  401. (package/inherit opus
  402. (name "opus+custom")
  403. (arguments
  404. (substitute-keyword-arguments (package-arguments opus)
  405. ((#:configure-flags flags ''())
  406. ;; Opus Custom is an optional extension of the Opus
  407. ;; specification that allows for unsupported frame
  408. ;; sizes. Chromium requires that this is enabled.
  409. `(cons "--enable-custom-modes"
  410. ,flags))))))
  411. ;; WebRTC in Chromium 88 requires an unreleased version of libvpx. Use the
  412. ;; commit mentioned in "third_party/libvpx/README.chromium".
  413. (define libvpx/chromium
  414. (package
  415. (inherit libvpx)
  416. (version "1.9.0-147-g61edec1ef")
  417. (source (origin
  418. (inherit (package-source libvpx))
  419. (uri (git-reference
  420. (url "https://chromium.googlesource.com/webm/libvpx")
  421. (commit (string-append "v" version))))
  422. (file-name (git-file-name "libvpx" version))
  423. (sha256
  424. (base32
  425. "0mw13y7j2lg8jj3alm9367c3b40b6s218fdz3nn1m2k85c78wzr7"))))))
  426. ;; 'make-ld-wrapper' can only work with an 'ld' executable, so we need
  427. ;; this trick to make it wrap 'lld'.
  428. (define (make-lld-wrapper lld)
  429. (define lld-as-ld
  430. (computed-file "lld-ld"
  431. #~(begin
  432. (mkdir #$output)
  433. (mkdir (string-append #$output "/bin"))
  434. (symlink #$(file-append lld "/bin/lld")
  435. (string-append #$output "/bin/ld")))))
  436. ;; Create a wrapper for LLD that inserts appropriate -rpath entries.
  437. (define lld-wrapper
  438. (make-ld-wrapper "lld-wrapper"
  439. #:binutils lld-as-ld))
  440. ;; Clang looks for an 'ld.lld' executable, so we need to symlink it back.
  441. (computed-file "lld-wrapped"
  442. #~(begin
  443. (mkdir #$output)
  444. (mkdir (string-append #$output "/bin"))
  445. (symlink #$(file-append lld-wrapper "/bin/ld")
  446. (string-append #$output "/bin/lld"))
  447. (symlink "lld" (string-append #$output "/bin/ld.lld")))))
  448. (define-public ungoogled-chromium
  449. (package
  450. (name "ungoogled-chromium")
  451. (version (string-append %chromium-version "-0."
  452. (match (string-split %ungoogled-revision #\-)
  453. ((version revision commits g+short)
  454. (string-drop g+short 1)))))
  455. (synopsis "Graphical web browser")
  456. (source (origin
  457. (method url-fetch)
  458. (uri (string-append "https://commondatastorage.googleapis.com"
  459. "/chromium-browser-official/chromium-"
  460. %chromium-version ".tar.xz"))
  461. (sha256
  462. (base32
  463. "04gxgimg5ygzx6nvfws5y9dppdfjg1fhyl8zbykmksbh1myk6zfr"))
  464. (modules '((guix build utils)))
  465. (snippet (force ungoogled-chromium-snippet))))
  466. (build-system gnu-build-system)
  467. (arguments
  468. `(#:tests? #f
  469. ;; FIXME: Chromiums RUNPATH lacks entries for some libraries.
  470. #:validate-runpath? #f
  471. #:modules ((guix build gnu-build-system)
  472. (guix build utils)
  473. (srfi srfi-26))
  474. #:configure-flags
  475. ;; See tools/gn/docs/cookbook.md and
  476. ;; https://www.chromium.org/developers/gn-build-configuration
  477. ;; for usage. Run "gn args . --list" in the Release
  478. ;; directory for an exhaustive list of supported flags.
  479. ;; (Note: The 'configure' phase will do that for you.)
  480. (list "is_debug=false"
  481. ;; Use the "official" release optimizations, as opposed to
  482. ;; a developer build.
  483. "is_official_build=true"
  484. "clang_use_chrome_plugins=false"
  485. "chrome_pgo_phase=0"
  486. "use_sysroot=false"
  487. "goma_dir=\"\""
  488. "enable_nacl=false"
  489. "enable_nacl_nonsfi=false"
  490. "use_unofficial_version_number=false"
  491. "treat_warnings_as_errors=false"
  492. "use_official_google_api_keys=false"
  493. "fieldtrial_testing_like_official_build=true"
  494. "safe_browsing_mode=0"
  495. "enable_mdns=false"
  496. "enable_one_click_signin=false"
  497. "enable_reading_list=false"
  498. "enable_remoting=false"
  499. "enable_reporting=false"
  500. "enable_service_discovery=false"
  501. "enable_vr=false"
  502. "enable_widevine=false"
  503. ;; Disable type-checking for the Web UI to avoid a Java dependency.
  504. "enable_js_type_check=false"
  505. ;; Disable code using TensorFlow until it has been scrutinized
  506. ;; by the ungoogled project.
  507. "build_with_tflite_lib=false"
  508. ;; Define a custom toolchain that simply looks up CC, AR and
  509. ;; friends from the environment.
  510. "custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
  511. "host_toolchain=\"//build/toolchain/linux/unbundle:default\""
  512. ;; Prefer system libraries.
  513. "use_system_freetype=true"
  514. "use_system_harfbuzz=true"
  515. "use_system_lcms2=true"
  516. "use_system_libdrm=true"
  517. "use_system_libjpeg=true"
  518. "use_system_libopenjpeg2=true"
  519. "use_system_libpng=true"
  520. "use_system_wayland_scanner=true"
  521. (string-append "system_wayland_scanner_path=\""
  522. (assoc-ref %build-inputs "wayland-scanner")
  523. "/bin/wayland-scanner\"")
  524. "use_system_zlib=true"
  525. "use_gnome_keyring=false" ;deprecated by libsecret
  526. "use_pulseaudio=true"
  527. "link_pulseaudio=true"
  528. "icu_use_data_file=false"
  529. ;; FIXME: Using system protobuf with "is_official_build" causes an
  530. ;; invalid opcode and "protoc-gen-plugin: Plugin killed by signal 4".
  531. ;;"perfetto_use_system_protobuf=true"
  532. ;; VA-API acceleration is currently only supported on x86_64-linux.
  533. ,@(if (string-prefix? "x86_64" (or (%current-target-system)
  534. (%current-system)))
  535. '("use_vaapi=true")
  536. '())
  537. "media_use_ffmpeg=true"
  538. "media_use_libvpx=true"
  539. "media_use_openh264=true"
  540. ;; Do not artifically restrict formats supported by system ffmpeg.
  541. "proprietary_codecs=true"
  542. "ffmpeg_branding=\"Chrome\""
  543. ;; WebRTC stuff.
  544. "rtc_use_h264=true"
  545. "rtc_use_pipewire=true"
  546. "rtc_link_pipewire=true"
  547. "rtc_pipewire_version=\"0.3\""
  548. ;; Don't use bundled sources.
  549. "rtc_build_json=true" ;FIXME: libc++ std::string ABI difference
  550. "rtc_build_libevent=false"
  551. "rtc_build_libvpx=false"
  552. "rtc_build_opus=false"
  553. "rtc_build_libsrtp=true" ;FIXME: fails to find headers
  554. "rtc_build_usrsctp=true" ;TODO: package this
  555. "rtc_build_ssl=true") ;XXX: the bundled BoringSSL is required?
  556. #:phases
  557. (modify-phases %standard-phases
  558. (add-after 'unpack 'patch-stuff
  559. (lambda* (#:key inputs #:allow-other-keys)
  560. (let ((openjpeg (assoc-ref inputs "openjpeg")))
  561. (substitute* "third_party/pdfium/BUILD.gn"
  562. ;; This include path is added by Debians openjpeg patch.
  563. (("/usr/include/openjpeg")
  564. (string-append openjpeg "/include/openjpeg"))))
  565. (substitute*
  566. '("base/process/launch_posix.cc"
  567. "base/third_party/dynamic_annotations/dynamic_annotations.c"
  568. "sandbox/linux/seccomp-bpf/sandbox_bpf.cc"
  569. "sandbox/linux/services/credentials.cc"
  570. "sandbox/linux/services/namespace_utils.cc"
  571. "sandbox/linux/services/syscall_wrappers.cc"
  572. "sandbox/linux/syscall_broker/broker_host.cc")
  573. (("include \"base/third_party/valgrind/") "include \"valgrind/"))
  574. (for-each (lambda (file)
  575. (substitute* file
  576. ;; Fix opus include path.
  577. ;; Do not substitute opus_private.h.
  578. (("#include \"opus\\.h\"")
  579. "#include \"opus/opus.h\"")
  580. (("#include \"opus_custom\\.h\"")
  581. "#include \"opus/opus_custom.h\"")
  582. (("#include \"opus_defines\\.h\"")
  583. "#include \"opus/opus_defines.h\"")
  584. (("#include \"opus_multistream\\.h\"")
  585. "#include \"opus/opus_multistream.h\"")
  586. (("#include \"opus_types\\.h\"")
  587. "#include \"opus/opus_types.h\"")))
  588. (find-files (string-append "third_party/webrtc/modules"
  589. "/audio_coding/codecs/opus")))
  590. ;; Many files try to include ICU headers from "third_party/icu/...".
  591. ;; Remove the "third_party/" prefix to use system headers instead.
  592. (substitute* (find-files "chrome" "\\.cc$")
  593. (("third_party/icu/source/(common|i18n)/")
  594. ""))
  595. ;; XXX: Should be unnecessary when use_system_lcms2=true.
  596. (substitute* "third_party/pdfium/core/fxcodec/icc/iccmodule.h"
  597. (("include \"third_party/lcms/include/lcms2\\.h\"")
  598. "include \"lcms2.h\""))
  599. ;; Add missing include statement.
  600. (substitute* "third_party/pdfium/core/fxcodec/png/png_decoder.cpp"
  601. (("#include \"core/fxcodec/fx_codec.h\"" all)
  602. (string-append all
  603. "\n#include \"core/fxcodec/fx_codec_def.h\"")))
  604. (substitute*
  605. "third_party/breakpad/breakpad/src/common/linux/libcurl_wrapper.h"
  606. (("include \"third_party/curl")
  607. "include \"curl"))
  608. (substitute* '("components/viz/common/gpu/vulkan_context_provider.h"
  609. "components/viz/common/resources/resource_format_utils.h"
  610. "gpu/config/gpu_util.cc")
  611. (("third_party/vulkan_headers/include/") ""))
  612. (substitute* "third_party/skia/include/gpu/vk/GrVkVulkan.h"
  613. (("include/third_party/vulkan/") ""))))
  614. (add-after 'patch-stuff 'add-absolute-references
  615. (lambda* (#:key inputs #:allow-other-keys)
  616. (let ((cups (assoc-ref inputs "cups"))
  617. (nss (assoc-ref inputs "nss"))
  618. (mesa (assoc-ref inputs "mesa"))
  619. (udev (assoc-ref inputs "udev")))
  620. (substitute* "printing/cups_config_helper.py"
  621. (("cups_config =.*")
  622. (string-append "cups_config = '" cups
  623. "/bin/cups-config'\n")))
  624. (substitute* "crypto/nss_util.cc"
  625. (("libnssckbi\\.so")
  626. (string-append nss "/lib/nss/libnssckbi.so")))
  627. (substitute* "device/udev_linux/udev1_loader.cc"
  628. (("libudev\\.so\\.1")
  629. (string-append udev "/lib/libudev.so.1")))
  630. (substitute*
  631. '("ui/ozone/platform/x11/gl_ozone_glx.cc"
  632. "ui/ozone/common/egl_util.cc"
  633. "ui/gl/init/gl_initializer_linux_x11.cc"
  634. "third_party/angle/src/libANGLE/renderer/gl/glx/FunctionsGLX.cpp")
  635. (("libGL\\.so\\.1")
  636. (string-append mesa "/lib/libGL.so.1"))
  637. (("libEGL\\.so\\.1")
  638. (string-append mesa "/lib/libEGL.so.1"))
  639. (("libGLESv2\\.so\\.2")
  640. (string-append mesa "/lib/libGLESv2.so.2"))))))
  641. (add-before 'configure 'prepare-build-environment
  642. (lambda* (#:key inputs #:allow-other-keys)
  643. ;; Define the GN toolchain.
  644. (setenv "AR" "llvm-ar") (setenv "NM" "llvm-nm")
  645. (setenv "CC" "clang") (setenv "CXX" "clang++")
  646. (let ((gcc (assoc-ref inputs "gcc")))
  647. ;; Remove the default compiler from CPLUS_INCLUDE_PATH to
  648. ;; prevent header conflict with the bundled libcxx.
  649. (setenv "CPLUS_INCLUDE_PATH"
  650. (string-join
  651. (delete (string-append gcc "/include/c++")
  652. (string-split (getenv "CPLUS_INCLUDE_PATH")
  653. #\:))
  654. ":"))
  655. (format #t
  656. "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%"
  657. (getenv "CPLUS_INCLUDE_PATH")))
  658. (setenv "CXXFLAGS"
  659. (string-join
  660. '(;; Do not optimize away null pointer safety checks.
  661. "-fno-delete-null-pointer-checks"
  662. ;; Disable warnings about unknown warnings that require
  663. ;; Clang plugins or newer versions.
  664. "-Wno-unknown-warning-option")))
  665. (setenv "CFLAGS" "-Wno-unknown-warning-option")
  666. ;; TODO: pre-compile instead. Avoids a race condition.
  667. (setenv "PYTHONDONTWRITEBYTECODE" "1")
  668. ;; XXX: How portable is this.
  669. (mkdir-p "third_party/node/linux/node-linux-x64")
  670. (symlink (string-append (assoc-ref inputs "node") "/bin")
  671. "third_party/node/linux/node-linux-x64/bin")))
  672. (replace 'configure
  673. (lambda* (#:key configure-flags #:allow-other-keys)
  674. (let ((args (string-join configure-flags " ")))
  675. ;; Generate ninja build files.
  676. (invoke "gn" "gen" "out/Release"
  677. (string-append "--args=" args))
  678. ;; Print the full list of supported arguments as well as
  679. ;; their current status for convenience.
  680. (format #t "Dumping configure flags...\n")
  681. (invoke "gn" "args" "out/Release" "--list"))))
  682. (add-before 'build 'increase-resource-limits
  683. (lambda _
  684. ;; XXX: Chromiums linking step requires a lot of simultaneous file
  685. ;; accesses. Having a too low ulimit will result in bogus linker
  686. ;; errors such as "foo.a: error adding symbols: malformed archive".
  687. ;; Try increasing the soft resource limit of max open files to 2048,
  688. ;; or equal to the hard limit, whichever is lower.
  689. (call-with-values (lambda () (getrlimit 'nofile))
  690. (lambda (soft hard)
  691. (when (and soft (< soft 2048))
  692. (if hard
  693. (setrlimit 'nofile (min hard 2048) hard)
  694. (setrlimit 'nofile 2048 #f))
  695. (format #t
  696. "increased maximum number of open files from ~d to ~d~%"
  697. soft (if hard (min hard 2048) 2048)))))))
  698. (replace 'build
  699. (lambda* (#:key (parallel-build? #t) #:allow-other-keys)
  700. (invoke "ninja" "-C" "out/Release"
  701. "-j" (if parallel-build?
  702. (number->string (parallel-job-count))
  703. "1")
  704. "chrome"
  705. "chromedriver")))
  706. (replace 'install
  707. (lambda* (#:key inputs outputs #:allow-other-keys)
  708. (let* ((out (assoc-ref outputs "out"))
  709. (bin (string-append out "/bin"))
  710. (exe (string-append bin "/chromium"))
  711. (lib (string-append out "/lib"))
  712. (man (string-append out "/share/man/man1"))
  713. (applications (string-append out "/share/applications"))
  714. (libs '("chrome_100_percent.pak"
  715. "chrome_200_percent.pak"
  716. "resources.pak"
  717. "v8_context_snapshot.bin"
  718. ;; Chromium ships its own libGL
  719. ;; implementation called ANGLE.
  720. "libEGL.so" "libGLESv2.so"))
  721. (locales (string-append lib "/locales"))
  722. (resources (string-append lib "/resources"))
  723. (preferences (assoc-ref inputs "master-preferences"))
  724. (gtk+ (assoc-ref inputs "gtk+"))
  725. (xdg-utils (assoc-ref inputs "xdg-utils"))
  726. (sh (which "sh")))
  727. (substitute* '("chrome/app/resources/manpage.1.in"
  728. "chrome/installer/linux/common/desktop.template")
  729. (("@@MENUNAME@@") "Chromium")
  730. (("@@PACKAGE@@") "chromium")
  731. (("/usr/bin/@@USR_BIN_SYMLINK_NAME@@") exe))
  732. (mkdir-p man)
  733. (copy-file "chrome/app/resources/manpage.1.in"
  734. (string-append man "/chromium.1"))
  735. (mkdir-p applications)
  736. (copy-file "chrome/installer/linux/common/desktop.template"
  737. (string-append applications "/chromium.desktop"))
  738. (mkdir-p lib)
  739. (copy-file preferences (string-append lib "/master_preferences"))
  740. (with-directory-excursion "out/Release"
  741. (for-each (cut install-file <> lib) libs)
  742. (copy-file "chrome" (string-append lib "/chromium"))
  743. (copy-recursively "locales" locales)
  744. (copy-recursively "resources" resources)
  745. (mkdir-p bin)
  746. (symlink "../lib/chromium" exe)
  747. (install-file "chromedriver" bin)
  748. (for-each (lambda (so)
  749. (install-file so (string-append lib "/swiftshader")))
  750. (find-files "swiftshader" "\\.so$"))
  751. (wrap-program exe
  752. ;; Avoid file manager crash. See <https://bugs.gnu.org/26593>.
  753. `("XDG_DATA_DIRS" ":" prefix (,(string-append gtk+ "/share")))
  754. `("PATH" ":" prefix (,(string-append xdg-utils "/bin")))))
  755. (with-directory-excursion "chrome/app/theme/chromium"
  756. (for-each
  757. (lambda (size)
  758. (let ((icons (string-append out "/share/icons/hicolor/"
  759. size "x" size "/apps")))
  760. (mkdir-p icons)
  761. (copy-file (string-append "product_logo_" size ".png")
  762. (string-append icons "/chromium.png"))))
  763. '("24" "48" "64" "128" "256")))))))))
  764. (native-inputs
  765. `(("bison" ,bison)
  766. ("clang" ,clang-11)
  767. ("gn" ,gn)
  768. ("gperf" ,gperf)
  769. ("ld-wrapper" ,(make-lld-wrapper lld))
  770. ("ninja" ,ninja)
  771. ("node" ,node)
  772. ("pkg-config" ,pkg-config)
  773. ("which" ,which)
  774. ;; This file contains defaults for new user profiles.
  775. ("master-preferences" ,(local-file "aux-files/chromium/master-preferences.json"))
  776. ;; Try unbundling these when upstream has completed its Python 3 transition.
  777. ;; ("python-beautifulsoup4" ,python-beautifulsoup4)
  778. ;; ("python-html5lib" ,python-html5lib)
  779. ("python2" ,python-2)
  780. ("python" ,python-wrapper)
  781. ("wayland-scanner" ,wayland)))
  782. (inputs
  783. `(("alsa-lib" ,alsa-lib)
  784. ("atk" ,atk)
  785. ("cups" ,cups)
  786. ("curl" ,curl)
  787. ("dbus" ,dbus)
  788. ("expat" ,expat)
  789. ("flac" ,flac)
  790. ("ffmpeg" ,ffmpeg)
  791. ("fontconfig" ,fontconfig)
  792. ("freetype" ,freetype)
  793. ("gdk-pixbuf" ,gdk-pixbuf)
  794. ("glib" ,glib)
  795. ("gtk+" ,gtk+)
  796. ("harfbuzz" ,harfbuzz)
  797. ("icu4c" ,icu4c)
  798. ("lcms" ,lcms)
  799. ("libevent" ,libevent)
  800. ("libffi" ,libffi)
  801. ("libjpeg-turbo" ,libjpeg-turbo)
  802. ("libpng" ,libpng)
  803. ("libva" ,libva)
  804. ("libvpx" ,libvpx/chromium)
  805. ("libwebp" ,libwebp)
  806. ("libx11" ,libx11)
  807. ("libxcb" ,libxcb)
  808. ("libxcomposite" ,libxcomposite)
  809. ("libxcursor" ,libxcursor)
  810. ("libxdamage" ,libxdamage)
  811. ("libxext" ,libxext)
  812. ("libxfixes" ,libxfixes)
  813. ("libxi" ,libxi)
  814. ("libxml2" ,libxml2)
  815. ("libxrandr" ,libxrandr)
  816. ("libxrender" ,libxrender)
  817. ("libxscrnsaver" ,libxscrnsaver)
  818. ("libxslt" ,libxslt)
  819. ("libxtst" ,libxtst)
  820. ;; Newer kernel headers are required for userfaultfd support; remove
  821. ;; after 'core-updates' merge.
  822. ("linux-libre-headers" ,linux-libre-headers-5.10)
  823. ("mesa" ,mesa)
  824. ("minizip" ,minizip)
  825. ("mit-krb5" ,mit-krb5)
  826. ("nss" ,nss)
  827. ("openh264" ,openh264)
  828. ("openjpeg" ,openjpeg) ;PDFium only
  829. ("opus" ,opus+custom)
  830. ("pango" ,pango)
  831. ("pciutils" ,pciutils)
  832. ("pipewire" ,pipewire-0.3)
  833. ("pulseaudio" ,pulseaudio)
  834. ("snappy" ,snappy)
  835. ("speech-dispatcher" ,speech-dispatcher)
  836. ("udev" ,eudev)
  837. ("valgrind" ,valgrind)
  838. ("vulkan-headers" ,vulkan-headers)
  839. ("wayland" ,wayland)
  840. ("xdg-utils" ,xdg-utils)))
  841. (native-search-paths
  842. (list (search-path-specification
  843. (variable "CHROMIUM_EXTENSION_DIRECTORY")
  844. (separator #f) ;single entry
  845. (files '("share/chromium/extensions")))))
  846. ;; Building Chromium takes ... a very long time. On a single core, a busy
  847. ;; mid-end x86 system may need more than 24 hours to complete the build.
  848. (properties '((timeout . 144000) ;40 hours
  849. ;; The linking step may take more than an hour on some hardware.
  850. (max-silent-time . 7200)
  851. (cpe-name . "chrome")))
  852. (home-page "https://github.com/Eloston/ungoogled-chromium")
  853. (description
  854. "Ungoogled-Chromium is the Chromium web browser, with some functionality
  855. disabled in order to protect the users privacy.")
  856. ;; Chromium is developed as BSD-3, but bundles a large number of third-party
  857. ;; components with other licenses. For full information, see chrome://credits.
  858. (license (list license:bsd-3
  859. license:bsd-2
  860. license:expat
  861. license:asl2.0
  862. license:mpl1.1
  863. license:mpl2.0
  864. license:public-domain
  865. license:isc
  866. (license:non-copyleft "chrome://credits"
  867. "See chrome://credits for more information.")
  868. license:lgpl2.1+))))
  869. (define-public ungoogled-chromium/wayland
  870. (package
  871. (inherit ungoogled-chromium)
  872. (name "ungoogled-chromium-wayland")
  873. (native-inputs '())
  874. (inputs
  875. `(("bash" ,bash-minimal)
  876. ("glibc-locales" ,glibc-utf8-locales)
  877. ("ungoogled-chromium" ,ungoogled-chromium)))
  878. (build-system trivial-build-system)
  879. (arguments
  880. '(#:modules ((guix build utils))
  881. #:builder
  882. (begin
  883. (use-modules (guix build utils))
  884. (let* ((bash (assoc-ref %build-inputs "bash"))
  885. (chromium (assoc-ref %build-inputs "ungoogled-chromium"))
  886. (locales (assoc-ref %build-inputs "glibc-locales"))
  887. (out (assoc-ref %outputs "out"))
  888. (exe (string-append out "/bin/chromium")))
  889. ;; Use a Unicode locale so we can substitute the file below.
  890. (setenv "GUIX_LOCPATH" (string-append locales "/lib/locale"))
  891. (setlocale LC_ALL "en_US.utf8")
  892. (mkdir-p (dirname exe))
  893. (symlink (string-append chromium "/bin/chromedriver")
  894. (string-append out "/bin/chromedriver"))
  895. (call-with-output-file exe
  896. (lambda (port)
  897. (format port "#!~a
  898. exec ~a --enable-features=UseOzonePlatform --ozone-platform=wayland $@"
  899. (string-append bash "/bin/bash")
  900. (string-append chromium "/bin/chromium"))))
  901. (chmod exe #o555)
  902. ;; Provide the manual and .desktop file.
  903. (copy-recursively (string-append chromium "/share")
  904. (string-append out "/share"))
  905. (substitute* (string-append
  906. out "/share/applications/chromium.desktop")
  907. ((chromium) out))
  908. #t))))))