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