gnu: ungoogled-chromium: Update to 107.0.5304.121-1.
[jackhill/guix/guix.git] / gnu / packages / chromium.scm
CommitLineData
f1e9de4d 1;;; GNU Guix --- Functional package management for GNU
23adb414 2;;; Copyright © 2019, 2020, 2021, 2022 Marius Bakke <marius@gnu.org>
3df7b15e 3;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
f1e9de4d
MB
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
20(define-module (gnu packages chromium)
21 #:use-module ((guix licenses) #:prefix license:)
22 #:use-module (guix packages)
23 #:use-module (guix gexp)
f1e9de4d
MB
24 #:use-module (guix download)
25 #:use-module (guix git-download)
26 #:use-module (guix utils)
27 #:use-module (guix build-system gnu)
689d8845 28 #:use-module (guix build-system trivial)
f1e9de4d
MB
29 #:use-module (gnu packages)
30 #:use-module (gnu packages assembly)
31 #:use-module (gnu packages base)
689d8845 32 #:use-module (gnu packages bash)
f1e9de4d
MB
33 #:use-module (gnu packages bison)
34 #:use-module (gnu packages build-tools)
35 #:use-module (gnu packages compression)
36 #:use-module (gnu packages cups)
37 #:use-module (gnu packages curl)
38 #:use-module (gnu packages fontutils)
82ccfb1d 39 #:use-module (gnu packages freedesktop)
f1e9de4d
MB
40 #:use-module (gnu packages ghostscript)
41 #:use-module (gnu packages gl)
42 #:use-module (gnu packages glib)
43 #:use-module (gnu packages gnome)
f1e9de4d
MB
44 #:use-module (gnu packages gperf)
45 #:use-module (gnu packages gtk)
46 #:use-module (gnu packages icu4c)
47 #:use-module (gnu packages image)
48 #:use-module (gnu packages libevent)
49 #:use-module (gnu packages libffi)
50 #:use-module (gnu packages linux)
f613d459 51 #:use-module (gnu packages llvm)
f1e9de4d 52 #:use-module (gnu packages kerberos)
d6e649f9 53 #:use-module (gnu packages maths)
f1e9de4d
MB
54 #:use-module (gnu packages ninja)
55 #:use-module (gnu packages node)
aff0cce9 56 #:use-module (gnu packages nss)
f1e9de4d
MB
57 #:use-module (gnu packages pciutils)
58 #:use-module (gnu packages pkg-config)
c91c132f 59 #:use-module (gnu packages protobuf)
f1e9de4d
MB
60 #:use-module (gnu packages pulseaudio)
61 #:use-module (gnu packages python)
6a805f22
MB
62 #:use-module (gnu packages python-web)
63 #:use-module (gnu packages python-xyz)
d9686315 64 #:use-module (gnu packages qt)
f1e9de4d
MB
65 #:use-module (gnu packages regex)
66 #:use-module (gnu packages serialization)
67 #:use-module (gnu packages speech)
f1e9de4d
MB
68 #:use-module (gnu packages valgrind)
69 #:use-module (gnu packages vulkan)
70 #:use-module (gnu packages video)
71 #:use-module (gnu packages xiph)
72 #:use-module (gnu packages xml)
73 #:use-module (gnu packages xdisorg)
4cac5579 74 #:use-module (gnu packages xorg)
25590118
MB
75 #:use-module (ice-9 match)
76 #:use-module (srfi srfi-1))
f1e9de4d
MB
77
78(define %preserved-third-party-files
7f2e8522 79 '("base/third_party/cityhash" ;Expat
ba261f63 80 "base/third_party/double_conversion" ;BSD-3
f1e9de4d
MB
81 "base/third_party/dynamic_annotations" ;BSD-2
82 "base/third_party/icu" ;Unicode, X11-style
83 "base/third_party/superfasthash" ;BSD-3
84 "base/third_party/symbolize" ;BSD-3
85 "base/third_party/xdg_mime" ;LGPL2.0+ or Academic 2.0
86 "base/third_party/xdg_user_dirs" ;Expat
87 "chrome/third_party/mozilla_security_manager" ;MPL-1.1/GPL2+/LGPL2.1+
88 "courgette/third_party/bsdiff" ;BSD-2, BSD protection license
89 "courgette/third_party/divsufsort" ;Expat
f1e9de4d
MB
90 "net/third_party/mozilla_security_manager" ;MPL-1.1/GPL2+/LGPL2.1+
91 "net/third_party/nss" ;MPL-2.0
7f2e8522 92 "net/third_party/quiche" ;BSD-3
f1e9de4d
MB
93 "net/third_party/uri_template" ;ASL2.0
94 "third_party/abseil-cpp" ;ASL2.0
f1e9de4d
MB
95 "third_party/angle" ;BSD-3
96 "third_party/angle/src/common/third_party/base" ;BSD-3
97 "third_party/angle/src/common/third_party/smhasher" ;Public domain
98 "third_party/angle/src/common/third_party/xxhash" ;BSD-2
f1e9de4d
MB
99 "third_party/angle/src/third_party/libXNVCtrl" ;Expat
100 "third_party/angle/src/third_party/trace_event" ;BSD-3
75527eb1 101 "third_party/angle/src/third_party/volk" ;Expat
f1e9de4d 102 "third_party/apple_apsl" ;APSL2.0
136eeb0b 103 "third_party/axe-core" ;MPL2.0
a065c6e0 104 "third_party/bidimapper" ;ASL2.0
f1e9de4d
MB
105 "third_party/blink" ;BSD-3, LGPL2+
106 "third_party/boringssl" ;OpenSSL/ISC (Google additions are ISC)
107 "third_party/boringssl/src/third_party/fiat" ;Expat
108 "third_party/breakpad" ;BSD-3
109 "third_party/brotli" ;Expat
f1e9de4d
MB
110 "third_party/catapult" ;BSD-3
111 "third_party/catapult/common/py_vulcanize/third_party/rcssmin" ;ASL2.0
112 "third_party/catapult/common/py_vulcanize/third_party/rjsmin" ;ASL2.0
113 "third_party/catapult/third_party/polymer" ;BSD-3
26d68d4f 114 "third_party/catapult/third_party/six" ;Expat
f613d459 115 ;; XXX: This is a minified version of <https://d3js.org/>.
f1e9de4d
MB
116 "third_party/catapult/tracing/third_party/d3" ;BSD-3
117 "third_party/catapult/tracing/third_party/gl-matrix" ;Expat
75527eb1 118 "third_party/catapult/tracing/third_party/jpeg-js" ;ASL2.0
f613d459 119 ;; XXX: Minified version of <https://github.com/Stuk/jszip>.
f1e9de4d
MB
120 "third_party/catapult/tracing/third_party/jszip" ;Expat or GPL3
121 "third_party/catapult/tracing/third_party/mannwhitneyu" ;Expat
122 "third_party/catapult/tracing/third_party/oboe" ;BSD-2
f613d459 123 ;; XXX: Minified version of <https://github.com/nodeca/pako>.
f1e9de4d
MB
124 "third_party/catapult/tracing/third_party/pako" ;Expat
125 "third_party/ced" ;BSD-3
126 "third_party/cld_3" ;ASL2.0
ba261f63 127 "third_party/closure_compiler" ;ASL2.0
cd10a235 128 "third_party/content_analysis_sdk" ;BSD-3
d6e649f9 129 "third_party/cpuinfo" ;BSD-2
f1e9de4d 130 "third_party/crashpad" ;ASL2.0
136eeb0b 131 "third_party/crashpad/crashpad/third_party/lss" ;ASL2.0
f1e9de4d
MB
132 "third_party/crashpad/crashpad/third_party/zlib/zlib_crashpad.h" ;Zlib
133 "third_party/crc32c" ;BSD-3
134 "third_party/cros_system_api" ;BSD-3
af74e435 135 "third_party/dav1d" ;BSD-2
136eeb0b 136 "third_party/dawn" ;ASL2.0
098f2eea
MB
137 ;; TODO: can likely be unbundled when Vulkan is updated.
138 "third_party/dawn/third_party/khronos" ;ASL2.0
dcae16e5 139 "third_party/dawn/third_party/gn/webgpu-cts" ;BSD-3
f613d459 140 "third_party/devtools-frontend" ;BSD-3
c91c132f 141 "third_party/devtools-frontend/src/front_end/third_party/acorn" ;Expat
8e8b8ffd
MB
142 "third_party/devtools-frontend/src/front_end/third_party\
143/additional_readme_paths.json" ;no explicit license; trivial
689d8845 144 "third_party/devtools-frontend/src/front_end/third_party/axe-core" ;MPL2.0
f01ec472 145 "third_party/devtools-frontend/src/front_end/third_party/chromium" ;BSD-3
c91c132f 146 "third_party/devtools-frontend/src/front_end/third_party/codemirror" ;Expat
26d68d4f 147 "third_party/devtools-frontend/src/front_end/third_party/diff" ;ASL2.0
f01ec472
MB
148 "third_party/devtools-frontend/src/front_end/third_party/i18n" ;ASL2.0
149 "third_party/devtools-frontend/src/front_end/third_party/intl-messageformat" ;BSD-3
75527eb1 150 "third_party/devtools-frontend/src/front_end/third_party/lighthouse" ;ASL2.0
f01ec472
MB
151 "third_party/devtools-frontend/src/front_end/third_party/lit-html" ;BSD-3
152 "third_party/devtools-frontend/src/front_end/third_party/lodash-isequal" ;Expat
153 "third_party/devtools-frontend/src/front_end/third_party/marked" ;Expat, BSD-3
689d8845 154 "third_party/devtools-frontend/src/front_end/third_party/puppeteer" ;ASL2.0
25c93be6 155 "third_party/devtools-frontend/src/front_end/third_party/wasmparser" ;ASL2.0
d64584cf 156 "third_party/devtools-frontend/src/third_party/pyjson5" ;ASL2.0
25c93be6 157 "third_party/devtools-frontend/src/third_party/typescript" ;ASL2.0
e3f70c94 158 "third_party/distributed_point_functions" ;ASL2.0
f1e9de4d 159 "third_party/dom_distiller_js" ;BSD-3
8dcbd8a3 160 "third_party/eigen3" ;MPL2.0
af74e435 161 "third_party/emoji-segmenter" ;ASL2.0
8dcbd8a3
MB
162 "third_party/farmhash" ;Expat
163 "third_party/fdlibm" ;non-copyleft
164 "third_party/fft2d" ;non-copyleft
f1e9de4d 165 "third_party/flatbuffers" ;ASL2.0
91bfb6d1 166 "third_party/fusejs" ;ASL2.0
8dcbd8a3 167 "third_party/gemmlowp" ;ASL2.0
f1e9de4d
MB
168 "third_party/google_input_tools" ;ASL2.0
169 "third_party/google_input_tools/third_party/closure_library" ;ASL2.0
170 "third_party/google_input_tools/third_party/closure_library/third_party/closure" ;Expat
171 "third_party/googletest" ;BSD-3
75527eb1 172 "third_party/harfbuzz-ng" ;Expat
304895d5 173 "third_party/highway" ;ASL2.0
f1e9de4d
MB
174 "third_party/hunspell" ;MPL1.1/GPL2+/LGPL2.1+
175 "third_party/iccjpeg" ;IJG
176 "third_party/inspector_protocol" ;BSD-3
a065c6e0 177 "third_party/ipcz" ;BSD-3
f1e9de4d
MB
178 "third_party/jinja2" ;BSD-3
179 "third_party/jstemplate" ;ASL2.0
180 "third_party/khronos" ;Expat, SGI
181 "third_party/leveldatabase" ;BSD-3
c91c132f 182 "third_party/libavif" ;BSD-2
f1e9de4d
MB
183 "third_party/libaddressinput" ;ASL2.0
184 "third_party/libaom" ;BSD-2 or "Alliance for Open Media Patent License 1.0"
8dcbd8a3 185 "third_party/libaom/source/libaom/third_party/fastfeat" ;BSD-3
f1e9de4d
MB
186 "third_party/libaom/source/libaom/third_party/vector" ;Expat
187 "third_party/libaom/source/libaom/third_party/x86inc" ;ISC
304895d5 188 "third_party/libjxl" ;ASL2.0
8dcbd8a3 189 "third_party/libgav1" ;ASL2.0
f613d459 190 "third_party/libgifcodec" ;MPL1.1/GPL2+/LGPL2.1+, BSD-3, BSD-2
f1e9de4d
MB
191 "third_party/libjingle_xmpp" ;BSD-3
192 "third_party/libphonenumber" ;ASL2.0
193 "third_party/libsecret" ;LGPL2.1+
194 "third_party/libsrtp" ;BSD-3
195 "third_party/libsync" ;ASL2.0
196 "third_party/libudev" ;LGPL2.1+
1155a883
MB
197 "third_party/liburlpattern" ;Expat
198 "third_party/libva_protected_content" ;Expat
f01ec472
MB
199
200 ;; FIXME: build/linux/unbundle/libvpx.gn does not work for all users.
201 "third_party/libvpx" ;BSD-3
202 "third_party/libvpx/source/libvpx/third_party/x86inc" ;Expat
203
f1e9de4d
MB
204 "third_party/libwebm" ;BSD-3
205 "third_party/libxml/chromium" ;BSD-3
206 "third_party/libyuv" ;BSD-3
8dcbd8a3 207 "third_party/libzip" ;BSD-3
c91c132f 208 "third_party/lottie" ;Expat
f1e9de4d 209 "third_party/lss" ;BSD-3
75527eb1 210 "third_party/mako" ;Expat
f1e9de4d
MB
211 "third_party/markupsafe" ;BSD-3
212 "third_party/mesa_headers" ;Expat, SGI
213 "third_party/metrics_proto" ;BSD-3
1155a883 214 "third_party/minigbm" ;BSD-3
f1e9de4d
MB
215 "third_party/modp_b64" ;BSD-3
216 "third_party/nasm" ;BSD-2
f01ec472 217 "third_party/nearby" ;ASL2.0
f1e9de4d 218 "third_party/node" ;Expat
d9686315 219 "third_party/omnibox_proto" ;BSD-3
ba261f63 220 "third_party/one_euro_filter" ;BSD-3
7f2e8522 221 "third_party/openscreen" ;BSD-3
ba261f63 222 "third_party/openscreen/src/third_party/tinycbor" ;Expat
c91c132f 223 "third_party/openscreen/src/third_party/mozilla" ;MPL1.1/GPL2+/LGPL2.1+, BSD-3
f1e9de4d
MB
224 "third_party/ots" ;BSD-3
225 "third_party/pdfium" ;BSD-3
226 "third_party/pdfium/third_party/agg23" ;Expat
227 "third_party/pdfium/third_party/base" ;BSD-3
228 "third_party/pdfium/third_party/bigint" ;Public domain, BSD-3
8dcbd8a3 229 "third_party/pdfium/third_party/libtiff" ;non-copyleft
f1e9de4d
MB
230 "third_party/pdfium/third_party/skia_shared" ;BSD-3
231 "third_party/pdfium/third_party/freetype/include/pstables.h" ;FreeType
d64584cf 232 "third_party/perfetto" ;ASL2.0
1155a883
MB
233 "third_party/perfetto/protos/third_party/chromium" ;BSD-3
234 "third_party/pffft" ;the "FFTPACK" license
f1e9de4d
MB
235 "third_party/ply" ;BSD-3
236 "third_party/polymer" ;BSD-3
689d8845 237 "third_party/private_membership" ;ASL2.0
ba261f63 238 "third_party/private-join-and-compute" ;ASL2.0
f1e9de4d
MB
239 "third_party/protobuf" ;BSD-3
240 "third_party/protobuf/third_party/six" ;Expat
d6e649f9 241 "third_party/pthreadpool" ;BSD-2
f1e9de4d
MB
242 "third_party/pyjson5" ;ASL2.0
243 "third_party/qcms" ;Expat
244 "third_party/rnnoise" ;BSD-3
8dcbd8a3 245 "third_party/ruy" ;ASL2.0
f1e9de4d 246 "third_party/s2cellid" ;ASL2.0
f01ec472 247 "third_party/securemessage" ;ASL2.0
689d8845 248 "third_party/shell-encryption" ;ASL2.0
f1e9de4d 249 "third_party/skia" ;BSD-3
7f2e8522 250 "third_party/skia/third_party/vulkanmemoryallocator" ;BSD-3, Expat
f1e9de4d 251 "third_party/smhasher" ;Expat, public domain
6a805f22
MB
252
253 ;; FIXME: the snappy "replacement" shim (see replace_gn_files.py below) does
254 ;; not declare a library dependency added in M93, causing a link failure.
255 "third_party/snappy" ;BSD-3
256
f1e9de4d 257 "third_party/speech-dispatcher" ;GPL2+
f1e9de4d 258 "third_party/sqlite" ;Public domain
75527eb1
MB
259 "third_party/swiftshader" ;ASL2.0
260 "third_party/swiftshader/third_party/astc-encoder" ;ASL2.0
f01ec472 261 "third_party/swiftshader/third_party/llvm-10.0" ;ASL2.0, with LLVM exception
75527eb1
MB
262 "third_party/swiftshader/third_party/llvm-subzero" ;NCSA
263 "third_party/swiftshader/third_party/marl" ;ASL2.0
264 "third_party/swiftshader/third_party/subzero" ;NCSA
265 "third_party/swiftshader/third_party/SPIRV-Headers" ;X11-style
dcae16e5 266 "third_party/swiftshader/third_party/SPIRV-Tools" ;ASL2.0
8dcbd8a3
MB
267 "third_party/tensorflow-text" ;ASL2.0
268 "third_party/tflite" ;ASL2.0
269 "third_party/tflite/src/third_party/eigen3" ;MPL2.0
270 "third_party/tflite/src/third_party/fft2d" ;ASL2.0
f01ec472 271 "third_party/ukey2" ;ASL2.0
f1e9de4d 272 "third_party/usb_ids" ;BSD-3
8dcbd8a3 273 "third_party/utf" ;Expat
1155a883 274 "third_party/vulkan-deps" ;ASL2.0, BSD-3, Expat
c91c132f 275 "third_party/vulkan_memory_allocator" ;Expat
689d8845
MB
276 "third_party/wayland/protocol" ;Expat
277 "third_party/wayland/stubs" ;BSD-3, Expat
82ccfb1d
MB
278 "third_party/wayland/wayland_scanner_wrapper.py" ;BSD-3
279 "third_party/wayland-protocols" ;Expat
f1e9de4d
MB
280 "third_party/web-animations-js" ;ASL2.0
281 "third_party/webdriver" ;ASL2.0
304895d5 282 "third_party/webgpu-cts" ;BSD-3
f1e9de4d 283 "third_party/webrtc" ;BSD-3
c91c132f 284 "third_party/webrtc/common_audio/third_party/ooura" ;Non-copyleft
f1e9de4d
MB
285 "third_party/webrtc/common_audio/third_party/spl_sqrt_floor" ;Public domain
286 "third_party/webrtc/modules/third_party/fft" ;Non-copyleft
287 "third_party/webrtc/modules/third_party/g711" ;Public domain
288 "third_party/webrtc/modules/third_party/g722" ;Public domain
289 "third_party/webrtc/rtc_base/third_party/base64" ;Non-copyleft
290 "third_party/webrtc/rtc_base/third_party/sigslot" ;Public domain
291 "third_party/widevine/cdm/widevine_cdm_version.h" ;BSD-3
292 "third_party/widevine/cdm/widevine_cdm_common.h" ;BSD-3
293 "third_party/woff2" ;ASL2.0
8dcbd8a3 294 "third_party/wuffs" ;ASL2.0
f01ec472 295 "third_party/xcbproto" ;X11
f1e9de4d 296 "third_party/xdg-utils" ;Expat
d6e649f9 297 "third_party/xnnpack" ;BSD-3
91bfb6d1
MB
298
299 ;; These are forked components of the X11 keybinding code.
300 "third_party/libxcb-keysyms" ;X11
301 "third_party/libx11/src/KeyBind.c" ;X11
302 "third_party/libx11/src/xkb/XKBBind.c" ;X11
303 "third_party/x11proto/keysymdef.h" ;X11
304
f1e9de4d 305 "third_party/zlib/google" ;BSD-3
f01ec472 306 "third_party/zxcvbn-cpp" ;Expat
f1e9de4d 307 "url/third_party/mozilla" ;BSD-3, MPL1.1/GPL2+/LGPL2.1+
105fa9fc 308 "v8/src/third_party/siphash" ;Public domain
f1e9de4d
MB
309 "v8/src/third_party/utf8-decoder" ;Expat
310 "v8/src/third_party/valgrind" ;BSD-4
311 "v8/third_party/inspector_protocol" ;BSD-3
312 "v8/third_party/v8/builtins")) ;PSFL
313
e6db8912
MB
314(define %blacklisted-files
315 ;; 'third_party/blink/perf_tests/resources/svg/HarveyRayner.svg' carries a
316 ;; nonfree license according to LICENSES in the same directory. As we don't
f01ec472 317 ;; run the Blink performance tests, just remove everything to save ~70MiB.
e6db8912
MB
318 '("third_party/blink/perf_tests"))
319
ec10258c 320(define %chromium-version "107.0.5304.121")
d4482e9a 321(define %ungoogled-revision (string-append %chromium-version "-1"))
dcae16e5 322(define %debian-revision "debian/102.0.5005.61-1")
a065c6e0 323(define %arch-revision "6afedb08139b97089ce8ef720ece5cd14c83948c")
c71dca05
MB
324
325(define %ungoogled-origin
159b94cf 326 (origin
c71dca05
MB
327 (method git-fetch)
328 (uri (git-reference (url "https://github.com/Eloston/ungoogled-chromium")
329 (commit %ungoogled-revision)))
330 (file-name (git-file-name "ungoogled-chromium" %ungoogled-revision))
331 (sha256
332 (base32
ec10258c 333 "1ns664y7qx0ry8hg8r704z64jmx8j6rpxn2lkliv0xjfwlrbbfx3"))))
159b94cf 334
dcae16e5 335(define %debian-origin
75527eb1 336 (origin
dcae16e5
MB
337 (method git-fetch)
338 (uri (git-reference
339 (url "https://salsa.debian.org/chromium-team/chromium.git")
340 (commit %debian-revision)))
341 (file-name (git-file-name "debian-chromium-patches"
342 (match (string-split %debian-revision #\/)
343 ((_ version) version))))
344 (sha256
345 (base32
346 "1ln6r1qzlr7dsgvcbssvvc34my4mpkwv9hmvlb2dhjncs7isp65j"))))
347
cd10a235 348(define (origin-file origin file)
dcae16e5 349 (computed-file
cd10a235
MB
350 (basename file)
351 #~(symlink (string-append #$origin "/" #$file)
dcae16e5 352 #$output)))
75527eb1 353
cd10a235
MB
354(define (debian-patch name)
355 (origin-file %debian-origin (string-append "/debian/patches/" name)))
356
75527eb1 357(define %debian-patches
dcae16e5 358 (map debian-patch
d6e649f9 359 '("system/jsoncpp.patch"
dcae16e5
MB
360 "system/zlib.patch"
361 "system/openjpeg.patch")))
362
cd10a235 363(define %gcc-patches
d9686315 364 '())
a065c6e0
MB
365
366(define (arch-patch revision name hash)
dcae16e5
MB
367 (origin
368 (method url-fetch)
a065c6e0
MB
369 (uri (string-append "https://raw.githubusercontent.com/archlinux"
370 "/svntogit-packages/" revision "/trunk/" name))
371 (sha256 (base32 hash))))
372
373(define %reverse-patches
374 (list
375 ;; These patches revert changes that require an unreleased ffmpeg.
376 (arch-patch %arch-revision "REVERT-roll-src-third_party-ffmpeg-m102.patch"
377 "0i7crn6fcwq09kd6a4smqnffaldyv61lmv2p0drcnpfrwalmkprh")
378 (arch-patch %arch-revision "REVERT-roll-src-third_party-ffmpeg-m106.patch"
379 "0li10cvxnppmmmsc7w77b1s7z02s5bzd39zsal9x768708fx64jc")
380 ;; Fix crash when using Global Media Controls.
381 (arch-patch %arch-revision "REVERT-enable-GlobalMediaControlsCastStartStop.patch"
382 "1ilsw421lylkjnq3lvc607bdx7cvwlish8qzgwx9s84l4hzv37vp")))
75527eb1 383
867e3830 384(define %guix-patches
a5945a60 385 (list (local-file
a5945a60 386 (assume-valid-file-name
6a805f22 387 (search-patch "ungoogled-chromium-extension-search-path.patch")))
48a1bb31
MB
388 (local-file
389 (assume-valid-file-name
390 (search-patch "ungoogled-chromium-RUNPATH.patch")))
6a805f22
MB
391 (local-file
392 (assume-valid-file-name
393 (search-patch "ungoogled-chromium-ffmpeg-compat.patch")))
4a943cfd
MB
394 (local-file
395 (assume-valid-file-name
396 (search-patch "ungoogled-chromium-system-ffmpeg.patch")))
6a805f22
MB
397 (local-file
398 (assume-valid-file-name
399 (search-patch "ungoogled-chromium-system-nspr.patch")))))
867e3830 400
7eb8ae5f
MB
401;; This is a source 'snippet' that does the following:
402;; *) Applies various patches for unbundling purposes and libstdc++ compatibility.
403;; *) Runs the ungoogled patch-, domain substitution-, and scrubbing scripts.
105fa9fc
MB
404;; *) Prunes all third_party directories that are not explicitly preserved.
405;; *) Adjusts "GN" build files such that system libraries are preferred.
7eb8ae5f
MB
406(define ungoogled-chromium-snippet
407 ;; Note: delay to cope with cyclic module imports at the top level.
408 (delay
409 #~(begin
410 (let ((chromium-dir (getcwd)))
411 (set-path-environment-variable
412 "PATH" '("bin")
413 (list #+patch #+python-wrapper #+xz))
7f2e8522 414
7eb8ae5f
MB
415 ;; Apply patches before running the ungoogled scripts because
416 ;; domain substitution may break some of the patches.
417 (format #t "Applying assorted build fixes...~%")
418 (force-output)
419 (for-each (lambda (patch)
420 (invoke "patch" "-p1" "--force" "--input"
421 patch "--no-backup-if-mismatch"))
cd10a235
MB
422 (append '#+%debian-patches '#+%guix-patches
423 '#+%gcc-patches))
f1e9de4d 424
a065c6e0
MB
425 ;; These patches are "reversed", i.e. their changes should be undone.
426 (for-each (lambda (patch)
427 (invoke "patch" "-Rp1" "-F3" "--force" "--input"
428 patch "--no-backup-if-mismatch"))
429 '#+%reverse-patches)
dcae16e5 430
7eb8ae5f
MB
431 (with-directory-excursion #+%ungoogled-origin
432 (format #t "Ungooglifying...~%")
433 (force-output)
434 (invoke "python" "utils/prune_binaries.py" chromium-dir
435 "pruning.list")
f01ec472
MB
436 (invoke "python" "utils/patches.py" "apply" chromium-dir
437 "patches")
7eb8ae5f
MB
438 (invoke "python" "utils/domain_substitution.py" "apply" "-r"
439 "domain_regex.list" "-f" "domain_substitution.list"
440 "-c" "/tmp/domainscache.tar.gz" chromium-dir))
f1e9de4d 441
e6db8912
MB
442 ;; Run after the ungoogled scripts to avoid interfering with
443 ;; patches or file lists.
444 (format #t "Removing blacklisted files...~%")
445 (force-output)
446 (for-each delete-file-recursively '#$%blacklisted-files)
447
7eb8ae5f
MB
448 (format #t "Pruning third party files...~%")
449 (force-output)
6a805f22 450 (apply invoke "python"
7eb8ae5f
MB
451 "build/linux/unbundle/remove_bundled_libraries.py"
452 "--do-remove" '#$%preserved-third-party-files)
f1e9de4d 453
7eb8ae5f
MB
454 (format #t "Replacing GN files...~%")
455 (force-output)
71c237bd
MB
456 (substitute* "tools/generate_shim_headers/generate_shim_headers.py"
457 ;; The "is_official_build" configure option enables certain
458 ;; release optimizations like those used in the commercial
459 ;; Chrome browser. Unfortunately it also requires using the
460 ;; bundled libraries: lose that restriction.
461 (("#if defined\\(OFFICIAL_BUILD\\)")
462 "#if 0"))
7eb8ae5f
MB
463 (invoke "python" "build/linux/unbundle/replace_gn_files.py"
464 "--system-libraries" "ffmpeg" "flac" "fontconfig"
465 "freetype" "harfbuzz-ng" "icu" "libdrm" "libevent"
f01ec472 466 "libjpeg" "libpng" "libwebp" "libxml" "libxslt"
0cadd09a 467 "openh264" "opus" "re2" "zlib")))))
f1e9de4d
MB
468
469(define opus+custom
470 (package/inherit opus
471 (name "opus+custom")
472 (arguments
473 (substitute-keyword-arguments (package-arguments opus)
474 ((#:configure-flags flags ''())
475 ;; Opus Custom is an optional extension of the Opus
476 ;; specification that allows for unsupported frame
477 ;; sizes. Chromium requires that this is enabled.
478 `(cons "--enable-custom-modes"
479 ,flags))))))
480
481(define-public ungoogled-chromium
482 (package
483 (name "ungoogled-chromium")
159b94cf
MB
484 (version (if (string-prefix? %chromium-version %ungoogled-revision)
485 %ungoogled-revision
486 ;; ungoogled-chromium version tags always have a "-1" suffix,
487 ;; so we can hijack "-0" in cases where the Chromium source
488 ;; is newer than the latest available tag.
489 (string-append %chromium-version "-0")))
f1e9de4d 490 (synopsis "Graphical web browser")
7eb8ae5f
MB
491 (source (origin
492 (method url-fetch)
493 (uri (string-append "https://commondatastorage.googleapis.com"
494 "/chromium-browser-official/chromium-"
8dcbd8a3 495 %chromium-version ".tar.xz"))
7eb8ae5f
MB
496 (sha256
497 (base32
ec10258c 498 "12z0fhgxcsdkf6shnsg9maj3v901226cjcy8y2x8m88maw2apc0j"))
7eb8ae5f
MB
499 (modules '((guix build utils)))
500 (snippet (force ungoogled-chromium-snippet))))
f1e9de4d
MB
501 (build-system gnu-build-system)
502 (arguments
4b4ea166
MB
503 (list
504 #:tests? #f
505 #:modules '((guix build gnu-build-system)
f1e9de4d 506 (guix build utils)
f1e9de4d 507 (srfi srfi-26))
4b4ea166
MB
508 #:configure-flags
509 ;; See tools/gn/docs/cookbook.md and
510 ;; https://www.chromium.org/developers/gn-build-configuration
511 ;; for usage. Run "gn args . --list" in the Release
512 ;; directory for an exhaustive list of supported flags.
513 ;; (Note: The 'configure' phase will do that for you.)
514 #~(list "is_debug=false"
515 ;; Use the "official" release optimizations, as opposed to
516 ;; a developer build.
517 "is_official_build=true"
518 "clang_use_chrome_plugins=false"
0cadd09a 519 "use_custom_libcxx=false"
4b4ea166
MB
520 "chrome_pgo_phase=0"
521 "use_sysroot=false"
522 "goma_dir=\"\""
523 "enable_nacl=false"
4b4ea166
MB
524 "use_unofficial_version_number=false"
525 "treat_warnings_as_errors=false"
526 "use_official_google_api_keys=false"
527 "disable_fieldtrial_testing_config=true"
528 "safe_browsing_mode=0"
529 "enable_mdns=false"
4b4ea166
MB
530 "enable_reading_list=false"
531 "enable_remoting=false"
532 "enable_reporting=false"
533 "enable_service_discovery=false"
534 "enable_vr=false"
535 "enable_widevine=false"
536 ;; Disable type-checking for the Web UI to avoid a Java dependency.
537 "enable_js_type_check=false"
538 ;; Disable code using TensorFlow until it has been scrutinized
539 ;; by the ungoogled project.
540 "build_with_tflite_lib=false"
541 ;; Avoid dependency on code formatting tools.
542 "blink_enable_generated_code_formatting=false"
dcae16e5
MB
543 ;; Don't bother building Dawn tests.
544 "build_dawn_tests=false"
4b4ea166
MB
545
546 ;; Define a custom toolchain that simply looks up CC, AR and
547 ;; friends from the environment.
548 "custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
549 "host_toolchain=\"//build/toolchain/linux/unbundle:default\""
550
d9686315
MB
551 (string-append "clang_base_path=\""
552 (dirname (dirname (search-input-file %build-inputs
553 "/bin/clang")))
554 "\"")
555
4b4ea166
MB
556 ;; Prefer system libraries.
557 "use_system_freetype=true"
558 "use_system_harfbuzz=true"
559 "use_system_lcms2=true"
560 "use_system_libdrm=true"
561 "use_system_libjpeg=true"
562 "use_system_libopenjpeg2=true"
563 "use_system_libpng=true"
d9686315 564 "use_system_libwayland_server=true"
4b4ea166
MB
565 "use_system_wayland_scanner=true"
566 (string-append "system_wayland_scanner_path=\""
567 (search-input-file %build-inputs
568 "/bin/wayland-scanner")
569 "\"")
570
571 "use_system_zlib=true"
572 "use_gnome_keyring=false" ;deprecated by libsecret
573 "use_pulseaudio=true"
574 "link_pulseaudio=true"
575 "icu_use_data_file=false"
576
577 ;; FIXME: Using system protobuf with "is_official_build" causes an
578 ;; invalid opcode and "protoc-gen-plugin: Plugin killed by signal 4".
579 ;;"perfetto_use_system_protobuf=true"
580
581 ;; VA-API acceleration is currently only supported on x86_64-linux.
582 #$@(if (string-prefix? "x86_64" (or (%current-target-system)
583 (%current-system)))
584 '("use_vaapi=true")
585 '())
586
587 "media_use_ffmpeg=true"
588 "media_use_libvpx=true"
589 "media_use_openh264=true"
590
591 ;; Do not artifically restrict formats supported by system ffmpeg.
592 "proprietary_codecs=true"
593 "ffmpeg_branding=\"Chrome\""
594
595 ;; WebRTC stuff.
596 "rtc_use_h264=true"
597 "rtc_use_pipewire=true"
598 "rtc_link_pipewire=true"
599 ;; Don't use bundled sources.
0cadd09a
MB
600 "rtc_build_json=false"
601 (string-append "rtc_jsoncpp_root=\""
602 (search-input-directory %build-inputs
603 "include/json")
604 "\"")
4b4ea166 605 "rtc_build_libevent=false"
f3b73e46
MB
606 ;; XXX: Use the bundled libvpx for WebRTC because unbundling
607 ;; currently fails (see above), and the versions must match.
608 "rtc_build_libvpx=true"
4b4ea166
MB
609 "rtc_build_opus=false"
610 "rtc_build_libsrtp=true" ;FIXME: fails to find headers
4b4ea166
MB
611 "rtc_build_ssl=true") ;XXX: requires BoringSSL
612 #:phases
613 #~(modify-phases %standard-phases
614 (add-after 'unpack 'patch-stuff
615 (lambda* (#:key inputs #:allow-other-keys)
616 (let ((openjpeg (search-input-directory
617 inputs "include/openjpeg-2.4")))
618 (substitute* "third_party/pdfium/BUILD.gn"
619 ;; This include path is added by Debians openjpeg patch.
620 (("/usr/include/openjpeg-2.4") openjpeg))
621
a065c6e0 622 ;; Adjust minizip header inclusions.
d01310f2
MB
623 (substitute* (find-files "third_party/tflite_support\
624/src/tensorflow_lite_support/metadata/cc")
d9686315
MB
625 (("#include \"contrib/minizip/ioapi\\.h\"")
626 ;; This one can be removed for M108 or so.
627 "#include \"minizip/ioapi.h\"")
628 (("third_party/zlib/contrib/minizip/")
d01310f2
MB
629 "minizip/"))
630
4b4ea166
MB
631 (substitute*
632 '("base/process/launch_posix.cc"
633 "base/third_party/dynamic_annotations/dynamic_annotations.c"
634 "sandbox/linux/seccomp-bpf/sandbox_bpf.cc"
635 "sandbox/linux/services/credentials.cc"
636 "sandbox/linux/services/namespace_utils.cc"
637 "sandbox/linux/services/syscall_wrappers.cc"
638 "sandbox/linux/syscall_broker/broker_host.cc")
639 (("include \"base/third_party/valgrind/") "include \"valgrind/"))
640
cd10a235
MB
641 (substitute*
642 (append
643 '("media/audio/audio_opus_encoder.h")
644 (find-files (string-append "third_party/webrtc/modules"
645 "/audio_coding/codecs/opus")))
646 ;; Fix opus include path.
647 ;; Do not substitute opus_private.h.
648 (("#include \"opus\\.h\"")
649 "#include \"opus/opus.h\"")
650 (("#include \"opus_custom\\.h\"")
651 "#include \"opus/opus_custom.h\"")
652 (("#include \"opus_defines\\.h\"")
653 "#include \"opus/opus_defines.h\"")
654 (("#include \"opus_multistream\\.h\"")
655 "#include \"opus/opus_multistream.h\"")
656 (("#include \"opus_types\\.h\"")
657 "#include \"opus/opus_types.h\"")
658 (("\"third_party/opus/src/include/([a-z_-]+\\.h)\"" _ header)
659 (string-append "<opus/" header ">")))
4b4ea166 660
0cadd09a
MB
661 (substitute* "third_party/webrtc/rtc_base/strings/json.h"
662 (("#include \"third_party/jsoncpp/")
663 "#include \"json/"))
664
4b4ea166
MB
665 ;; Many files try to include ICU headers from "third_party/icu/...".
666 ;; Remove the "third_party/" prefix to use system headers instead.
667 (substitute* (find-files "chrome" "\\.cc$")
668 (("third_party/icu/source/(common|i18n)/")
669 ""))
670
671 ;; XXX: Should be unnecessary when use_system_lcms2=true.
672 (substitute* "third_party/pdfium/core/fxcodec/icc/icc_transform.h"
673 (("include \"third_party/lcms/include/lcms2\\.h\"")
674 "include \"lcms2.h\""))
675
676 (substitute*
677 "third_party/breakpad/breakpad/src/common/linux/libcurl_wrapper.h"
678 (("include \"third_party/curl")
679 "include \"curl"))
680
681 (substitute* '("components/viz/common/gpu/vulkan_context_provider.h"
682 "components/viz/common/resources/resource_format_utils.h"
683 "gpu/config/gpu_util.cc")
684 (("third_party/vulkan_headers/include/") ""))
685
d9686315 686 (substitute* "third_party/skia/include/private/gpu/vk/SkiaVulkan.h"
4b4ea166
MB
687 (("include/third_party/vulkan/") "")))))
688 (add-after 'patch-stuff 'add-absolute-references
689 (lambda* (#:key inputs #:allow-other-keys)
690 (let ((cups-config (search-input-file inputs "/bin/cups-config"))
691 (libnssckbi.so (search-input-file inputs
692 "/lib/nss/libnssckbi.so"))
693 (libudev.so.1 (search-input-file inputs "/lib/libudev.so.1"))
694 (libvulkan.so.1 (search-input-file inputs
695 "/lib/libvulkan.so.1"))
0b3f5205 696 (icd.d (search-input-directory inputs "share/vulkan/icd.d"))
4b4ea166 697 (mesa-lib (dirname (search-input-file inputs
8e8b8ffd
MB
698 "/lib/libGL.so.1")))
699 (gtk-libs '("libgio-2.0.so.0"
700 "libgdk_pixbuf-2.0.so.0"
701 "libgdk-3.so.0"
702 "libgtk-3.so.0")))
703 (for-each (lambda (lib)
704 (substitute* "ui/gtk/gtk_compat.cc"
705 ((lib) (search-input-file
706 inputs (string-append "lib/" lib)))))
707 gtk-libs)
4b4ea166
MB
708 (substitute* "printing/cups_config_helper.py"
709 (("cups_config =.*")
710 (string-append "cups_config = '" cups-config "'\n")))
711 (substitute* "crypto/nss_util.cc"
712 (("libnssckbi\\.so") libnssckbi.so))
713 (substitute* "device/udev_linux/udev1_loader.cc"
714 (("libudev\\.so\\.1") libudev.so.1))
0b3f5205
MB
715
716 ;; Patch libvulkan.so everywhere.
717 (substitute*
718 '("third_party/swiftshader/include/vulkan/vulkan.hpp"
719 "third_party/vulkan-deps/vulkan-tools\
720/src/vulkaninfo/vulkaninfo.h"
721 "third_party/vulkan-deps/vulkan-headers\
722/src/include/vulkan/vulkan.hpp"
723 "content/gpu/gpu_sandbox_hook_linux.cc"
724 "ui/ozone/platform/wayland/gpu/vulkan_implementation_wayland.cc"
725 "ui/ozone/platform/drm/gpu/vulkan_implementation_gbm.cc"
726 "ui/ozone/platform/x11/vulkan_implementation_x11.cc"
727 "third_party/skia/tools/sk_app/unix\
728/DawnVulkanWindowContext_unix.cpp")
4b4ea166 729 (("libvulkan\\.so\\.1") libvulkan.so.1))
0b3f5205
MB
730 (substitute* "content/gpu/gpu_sandbox_hook_linux.cc"
731 (("/usr/share/vulkan/icd\\.d") icd.d))
732
733 ;; Add the libvulkan directory to dawn built-in search paths.
734 (substitute* "third_party/dawn/src/dawn/native/Instance.cpp"
735 (("^([[:blank:]]+)mRuntimeSearchPaths\\.push_back\\(\"\"\\);"
736 all indent)
737 (string-append indent "mRuntimeSearchPaths.push_back(\""
738 (dirname libvulkan.so.1) "/\");\n" all)))
739
4b4ea166
MB
740 (substitute*
741 '("ui/ozone/platform/x11/gl_ozone_glx.cc"
742 "ui/ozone/common/egl_util.cc"
4b4ea166
MB
743 "third_party/angle/src/libANGLE/renderer/gl/glx\
744/FunctionsGLX.cpp")
745 (("libGL\\.so\\.1")
746 (string-append mesa-lib "/libGL.so.1"))
747 (("libEGL\\.so\\.1")
748 (string-append mesa-lib "/libEGL.so.1"))
749 (("libGLESv2\\.so\\.2")
750 (string-append mesa-lib "/libGLESv2.so.2"))))))
751 (add-before 'configure 'prepare-build-environment
752 (lambda* (#:key native-inputs inputs #:allow-other-keys)
753 (let ((c++ (search-input-directory (or native-inputs inputs)
754 "include/c++"))
755 (node (search-input-file (or native-inputs inputs)
756 "/bin/node")))
4b4ea166
MB
757 ;; Define the GN toolchain.
758 (setenv "AR" "llvm-ar") (setenv "NM" "llvm-nm")
759 (setenv "CC" "clang") (setenv "CXX" "clang++")
760
761 ;; TODO: pre-compile instead. Avoids a race condition.
762 (setenv "PYTHONDONTWRITEBYTECODE" "1")
763
764 ;; XXX: How portable is this.
765 (mkdir-p "third_party/node/linux/node-linux-x64")
766 (symlink (dirname node)
767 "third_party/node/linux/node-linux-x64/bin"))))
768 (replace 'configure
769 (lambda* (#:key configure-flags #:allow-other-keys)
770 (let ((args (string-join configure-flags " ")))
771 ;; Generate ninja build files.
772 (invoke "gn" "gen" "out/Release"
773 (string-append "--args=" args))
774
775 ;; Print the full list of supported arguments as well as
776 ;; their current status for convenience.
777 (format #t "Dumping configure flags...\n")
778 (invoke "gn" "args" "out/Release" "--list"))))
779 (add-before 'build 'increase-resource-limits
780 (lambda _
781 ;; XXX: Chromiums linking step requires a lot of simultaneous file
782 ;; accesses. Having a too low ulimit will result in bogus linker
783 ;; errors such as "foo.a: error adding symbols: malformed archive".
784
785 ;; Try increasing the soft resource limit of max open files to 2048,
786 ;; or equal to the hard limit, whichever is lower.
787 (call-with-values (lambda () (getrlimit 'nofile))
788 (lambda (soft hard)
789 (when (and soft (< soft 2048))
790 (if hard
791 (setrlimit 'nofile (min hard 2048) hard)
792 (setrlimit 'nofile 2048 #f))
793 (format #t
794 "increased maximum number of open files from ~d to ~d~%"
795 soft (if hard (min hard 2048) 2048)))))))
796 (replace 'build
797 (lambda* (#:key (parallel-build? #t) #:allow-other-keys)
798 (invoke "ninja" "-C" "out/Release"
799 "-j" (if parallel-build?
800 (number->string (parallel-job-count))
801 "1")
802 "chrome"
803 "chromedriver")))
804 (replace 'install
805 (lambda* (#:key inputs outputs #:allow-other-keys)
806 (let* ((out (assoc-ref outputs "out"))
807 (bin (string-append out "/bin"))
808 (exe (string-append bin "/chromium"))
809 (lib (string-append out "/lib"))
810 (man (string-append out "/share/man/man1"))
811 (applications (string-append out "/share/applications"))
812 (libs '("chrome_100_percent.pak"
813 "chrome_200_percent.pak"
814 "resources.pak"
815 "v8_context_snapshot.bin"
e954e708 816 "chrome_crashpad_handler"
4b4ea166
MB
817
818 ;; Swiftshader ICD.
819 "libvk_swiftshader.so"
820 "vk_swiftshader_icd.json"
821
822 ;; Chromium ships its own libGL
823 ;; implementation called ANGLE.
824 "libEGL.so" "libGLESv2.so"))
825 (locales (string-append lib "/locales"))
826 (resources (string-append lib "/resources"))
827 (preferences
828 ;; This file contains defaults for new user profiles.
c334b7c5
LC
829 #$(local-file
830 (search-auxiliary-file
831 "chromium/master-preferences.json")))
8e8b8ffd
MB
832 (gtk (dirname (dirname
833 (search-input-file inputs "lib/libgtk-3.so"))))
834 (xdg-utils (dirname (search-input-file inputs "bin/xdg-open"))))
4b4ea166
MB
835
836 (substitute* '("chrome/app/resources/manpage.1.in"
837 "chrome/installer/linux/common/desktop.template")
838 (("@@MENUNAME@@") "Chromium")
839 (("@@PACKAGE@@") "chromium")
840 (("/usr/bin/@@USR_BIN_SYMLINK_NAME@@") exe))
841
842 (mkdir-p man)
843 (copy-file "chrome/app/resources/manpage.1.in"
844 (string-append man "/chromium.1"))
845
846 (mkdir-p applications)
847 (copy-file "chrome/installer/linux/common/desktop.template"
848 (string-append applications "/chromium.desktop"))
849
850 (mkdir-p lib)
851 (copy-file preferences (string-append lib "/master_preferences"))
852
853 (with-directory-excursion "out/Release"
854 (for-each (cut install-file <> lib) libs)
855 (copy-file "chrome" (string-append lib "/chromium"))
856
857 (copy-recursively "locales" locales)
858 (copy-recursively "resources" resources)
859
860 (mkdir-p bin)
861 (symlink "../lib/chromium" exe)
862 (install-file "chromedriver" bin)
863
864 (for-each (lambda (so)
865 (install-file so (string-append lib "/swiftshader")))
866 (find-files "swiftshader" "\\.so$"))
867
868 (wrap-program exe
869 ;; Avoid file manager crash. See <https://bugs.gnu.org/26593>.
8e8b8ffd
MB
870 `("XDG_DATA_DIRS" ":" prefix (,(string-append gtk "/share")))
871 `("PATH" ":" prefix (,xdg-utils))))
4b4ea166
MB
872
873 (with-directory-excursion "chrome/app/theme/chromium"
874 (for-each
875 (lambda (size)
876 (let ((icons (string-append out "/share/icons/hicolor/"
877 size "x" size "/apps")))
878 (mkdir-p icons)
879 (copy-file (string-append "product_logo_" size ".png")
880 (string-append icons "/chromium.png"))))
881 '("24" "48" "64" "128" "256")))))))))
f1e9de4d 882 (native-inputs
4b4ea166 883 (list bison
28074f1e 884 clang-15
4b4ea166
MB
885 gn
886 gperf
28074f1e 887 lld-as-ld-wrapper-15
4b4ea166
MB
888 ninja
889 node-lts
890 pkg-config
891 which
892 python-beautifulsoup4
893 python-html5lib
894 python-wrapper
895 wayland))
f1e9de4d 896 (inputs
23adb414
MB
897 (list alsa-lib
898 atk
8e8b8ffd 899 at-spi2-atk
23adb414
MB
900 cups
901 curl
902 dbus
903 expat
904 flac
905 ffmpeg
906 fontconfig
d6e649f9 907 fp16
23adb414 908 freetype
d6e649f9 909 fxdiv
23adb414
MB
910 gdk-pixbuf
911 glib
912 gtk+
3af92828 913 harfbuzz-3
d6e649f9 914 icu4c-71
0cadd09a 915 jsoncpp
23adb414
MB
916 lcms
917 libevent
918 libffi
919 libjpeg-turbo
920 libpng
921 libva
922 libvpx
923 libwebp
924 libx11
925 libxcb
926 libxcomposite
927 libxcursor
928 libxdamage
929 libxext
930 libxfixes
931 libxi
932 libxml2
933 libxrandr
934 libxrender
935 libxscrnsaver
936 libxslt
937 libxtst
938 mesa
939 minizip
940 mit-krb5
941 nss
942 openh264
4b4ea166 943 openjpeg ;PDFium only
23adb414
MB
944 opus+custom
945 pango
946 pciutils
947 pipewire-0.3
948 pulseaudio
d9686315 949 qtbase-5
0cadd09a 950 re2
23adb414
MB
951 snappy
952 speech-dispatcher
953 eudev
954 valgrind
955 vulkan-headers
956 vulkan-loader
957 wayland
958 xdg-utils))
867e3830
MB
959 (native-search-paths
960 (list (search-path-specification
961 (variable "CHROMIUM_EXTENSION_DIRECTORY")
962 (separator #f) ;single entry
963 (files '("share/chromium/extensions")))))
c94cc6de 964
760d90cc
MB
965 ;; Building Chromium takes ... a very long time. On a single core, a busy
966 ;; mid-end x86 system may need more than 24 hours to complete the build.
a009a3ee
MB
967 (properties '((timeout . 144000) ;40 hours
968 ;; The linking step may take more than an hour on some hardware.
acac3b94
MB
969 (max-silent-time . 7200)
970 (cpe-name . "chrome")))
c94cc6de 971
f1e9de4d
MB
972 (home-page "https://github.com/Eloston/ungoogled-chromium")
973 (description
974 "Ungoogled-Chromium is the Chromium web browser, with some functionality
d08f90be
MC
975disabled in order to protect the users privacy. This package also includes
976the @command{chromedriver} command, which can be useful for automated web
977testing.")
f1e9de4d
MB
978 ;; Chromium is developed as BSD-3, but bundles a large number of third-party
979 ;; components with other licenses. For full information, see chrome://credits.
980 (license (list license:bsd-3
981 license:bsd-2
982 license:expat
983 license:asl2.0
984 license:mpl1.1
985 license:mpl2.0
986 license:public-domain
987 license:isc
988 (license:non-copyleft "chrome://credits"
989 "See chrome://credits for more information.")
990 license:lgpl2.1+))))
82ccfb1d
MB
991
992(define-public ungoogled-chromium/wayland
689d8845
MB
993 (package
994 (inherit ungoogled-chromium)
82ccfb1d 995 (name "ungoogled-chromium-wayland")
689d8845 996 (native-inputs '())
82ccfb1d 997 (inputs
689d8845
MB
998 `(("bash" ,bash-minimal)
999 ("glibc-locales" ,glibc-utf8-locales)
1000 ("ungoogled-chromium" ,ungoogled-chromium)))
1001 (build-system trivial-build-system)
82ccfb1d 1002 (arguments
689d8845
MB
1003 '(#:modules ((guix build utils))
1004 #:builder
1005 (begin
1006 (use-modules (guix build utils))
1007 (let* ((bash (assoc-ref %build-inputs "bash"))
1008 (chromium (assoc-ref %build-inputs "ungoogled-chromium"))
1009 (locales (assoc-ref %build-inputs "glibc-locales"))
1010 (out (assoc-ref %outputs "out"))
1011 (exe (string-append out "/bin/chromium")))
1012
1013 ;; Use a Unicode locale so we can substitute the file below.
1014 (setenv "GUIX_LOCPATH" (string-append locales "/lib/locale"))
1015 (setlocale LC_ALL "en_US.utf8")
1016
1017 (mkdir-p (dirname exe))
1018 (symlink (string-append chromium "/bin/chromedriver")
1019 (string-append out "/bin/chromedriver"))
1020
1021 (call-with-output-file exe
1022 (lambda (port)
1023 (format port "#!~a
d69b90e9
AT
1024exec ~a --enable-features=UseOzonePlatform --ozone-platform=wayland \
1025--enable-features=WebRTCPipeWireCapturer $@"
689d8845
MB
1026 (string-append bash "/bin/bash")
1027 (string-append chromium "/bin/chromium"))))
1028 (chmod exe #o555)
1029
1030 ;; Provide the manual and .desktop file.
1031 (copy-recursively (string-append chromium "/share")
1032 (string-append out "/share"))
1033 (substitute* (string-append
1034 out "/share/applications/chromium.desktop")
1035 ((chromium) out))
1036 #t))))))