projects/guix·blob javascript-team · refs

1217 lines · 53.4 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2019-2023 Marius Bakke <[email protected]>
3;;; Copyright © 2019 Alex Griffin <[email protected]>
4;;; Copyright © 2023 Andreas Enge <[email protected]>
5;;; Copyright © 2023 Nicolas Graves <[email protected]>
6;;; Copyright © 2025 Maxim Cournoyer <[email protected]>
7;;; Copyright © 2025 Andre Batista <[email protected]>
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages chromium)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix packages)
27 #:use-module (guix gexp)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (guix utils)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system trivial)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages bash)
36 #:use-module (gnu packages bison)
37 #:use-module (gnu packages build-tools)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages crypto)
40 #:use-module (gnu packages cups)
41 #:use-module (gnu packages curl)
42 #:use-module (gnu packages fontutils)
43 #:use-module (gnu packages freedesktop)
44 #:use-module (gnu packages ghostscript)
45 #:use-module (gnu packages gl)
46 #:use-module (gnu packages glib)
47 #:use-module (gnu packages gnome)
48 #:use-module (gnu packages gperf)
49 #:use-module (gnu packages golang)
50 #:use-module (gnu packages gtk)
51 #:use-module (gnu packages icu4c)
52 #:use-module (gnu packages image)
53 #:use-module (gnu packages libffi)
54 #:use-module (gnu packages linux)
55 #:use-module (gnu packages llvm)
56 #:use-module (gnu packages kerberos)
57 #:use-module (gnu packages maths)
58 #:use-module (gnu packages node)
59 #:use-module (gnu packages node-xyz)
60 #:use-module (gnu packages nss)
61 #:use-module (gnu packages pciutils)
62 #:use-module (gnu packages pkg-config)
63 #:use-module (gnu packages pulseaudio)
64 #:use-module (gnu packages python)
65 #:use-module (gnu packages python-web)
66 #:use-module (gnu packages python-xyz)
67 #:use-module (gnu packages qt)
68 #:use-module (gnu packages rust)
69 #:use-module (gnu packages rust-apps)
70 #:use-module (gnu packages serialization)
71 #:use-module (gnu packages speech)
72 #:use-module (gnu packages valgrind)
73 #:use-module (gnu packages vulkan)
74 #:use-module (gnu packages video)
75 #:use-module (gnu packages xdisorg)
76 #:use-module (gnu packages xiph)
77 #:use-module (gnu packages xml)
78 #:use-module (gnu packages xorg)
79 #:use-module (ice-9 match))
80
81(define %preserved-third-party-files
82 '("base/third_party/cityhash" ;Expat
83 "base/third_party/double_conversion" ;BSD-3
84 "base/third_party/icu" ;Unicode, X11-style
85 "base/third_party/superfasthash" ;BSD-3
86 "base/third_party/symbolize" ;BSD-3
87 "base/third_party/xdg_user_dirs" ;Expat
88 "net/third_party/mozilla_security_manager" ;MPL-1.1/GPL2+/LGPL2.1+
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/xxhash" ;BSD-2
94 "third_party/angle/src/third_party/ceval" ;Expat
95 "third_party/angle/src/third_party/libXNVCtrl" ;Expat
96 "third_party/angle/src/third_party/volk" ;Expat
97 "third_party/anonymous_tokens" ;ASL2.0
98 "third_party/apple_apsl" ;APSL2.0
99 "third_party/axe-core" ;MPL2.0
100 "third_party/bidimapper" ;ASL2.0
101 "third_party/blink" ;BSD-3, LGPL2+
102 "third_party/boringssl" ;OpenSSL/ISC (Google additions are ISC)
103 "third_party/boringssl/src/third_party/fiat" ;Expat
104 "third_party/breakpad" ;BSD-3
105 "third_party/catapult" ;BSD-3
106 "third_party/catapult/common/py_vulcanize/third_party/rcssmin" ;ASL2.0
107 "third_party/catapult/common/py_vulcanize/third_party/rjsmin" ;ASL2.0
108 "third_party/catapult/third_party/beautifulsoup4-4.9.3" ;Expat
109 "third_party/catapult/third_party/html5lib-1.1" ;Expat
110 "third_party/catapult/third_party/polymer" ;BSD-3
111 "third_party/catapult/third_party/six" ;Expat
112 "third_party/catapult/third_party/typ" ;ASL2.0
113 ;; XXX: This is a minified version of <https://d3js.org/>.
114 "third_party/catapult/tracing/third_party/d3" ;BSD-3
115 "third_party/catapult/tracing/third_party/gl-matrix" ;Expat
116 "third_party/catapult/tracing/third_party/jpeg-js" ;ASL2.0
117 ;; XXX: Minified version of <https://github.com/Stuk/jszip>.
118 "third_party/catapult/tracing/third_party/jszip" ;Expat or GPL3
119 "third_party/catapult/tracing/third_party/mannwhitneyu" ;Expat
120 "third_party/catapult/tracing/third_party/oboe" ;BSD-2
121 ;; XXX: Minified version of <https://github.com/nodeca/pako>.
122 "third_party/catapult/tracing/third_party/pako" ;Expat
123 "third_party/ced" ;BSD-3
124 "third_party/cld_3" ;ASL2.0
125 "third_party/closure_compiler" ;ASL2.0
126 "third_party/compiler-rt" ;ASL2.0
127 "third_party/content_analysis_sdk" ;BSD-3
128 "third_party/cpuinfo" ;BSD-2
129 "third_party/crabbyavif" ;ASL2.0
130 "third_party/crashpad" ;ASL2.0
131 "third_party/crashpad/crashpad/third_party/lss" ;ASL2.0
132 "third_party/crashpad/crashpad/third_party/zlib" ;Zlib
133 "third_party/cros_system_api" ;BSD-3
134 "third_party/dawn" ;ASL2.0
135 ;; TODO: can likely be unbundled when Vulkan is updated.
136 "third_party/dawn/third_party/EGL-Registry/src/sdk" ; ASL2.0
137 "third_party/dawn/third_party/OpenGL-Registry" ;ASL2.0
138 "third_party/dawn/third_party/gn/webgpu-cts" ;BSD-3
139 "third_party/dawn/third_party/renderdoc" ;Expat
140 "third_party/dawn/third_party/webgpu-headers" ;BSD-3
141 "third_party/depot_tools" ;BSD-3
142 "third_party/devscripts" ;GPL2.0
143 "third_party/devtools-frontend" ;BSD-3
144 "third_party/devtools-frontend/src/front_end"
145 "third_party/devtools-frontend/src/front_end/third_party"
146 "third_party/devtools-frontend/src/front_end/third_party/acorn" ;Expat
147 "third_party/devtools-frontend/src/front_end/third_party\
148/additional_readme_paths.json" ;no explicit license; trivial
149 "third_party/devtools-frontend/src/front_end/third_party/axe-core" ;MPL2.0
150 "third_party/devtools-frontend/src/front_end/third_party/chromium" ;BSD-3
151 "third_party/devtools-frontend/src/front_end/third_party/codemirror" ;Expat
152 "third_party/devtools-frontend/src/front_end/third_party/csp_evaluator" ;BSD-3
153 "third_party/devtools-frontend/src/front_end/third_party/diff" ;ASL2.0
154 "third_party/devtools-frontend/src/front_end/third_party/i18n" ;ASL2.0
155 "third_party/devtools-frontend/src/front_end/third_party/intl-messageformat" ;BSD-3
156 "third_party/devtools-frontend/src/front_end/third_party/json5" ;Expat
157 "third_party/devtools-frontend/src/front_end/third_party/legacy-javascript" ;ASL-2.0
158 "third_party/devtools-frontend/src/front_end/third_party/lighthouse" ;ASL2.0
159 "third_party/devtools-frontend/src/front_end/third_party/lit" ;BSD-3
160 "third_party/devtools-frontend/src/front_end/third_party/marked" ;Expat, BSD-3
161 "third_party/devtools-frontend/src/front_end/third_party/puppeteer" ;ASL2.0
162 "third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/third_party"
163 "third_party/devtools-frontend/src/front_end/third_party/puppeteer\
164/package/lib/third_party/mitt" ;Expat
165 "third_party/devtools-frontend/src/front_end/third_party/puppeteer/third_party/mitt" ; Expat
166 "third_party/devtools-frontend/src/front_end/third_party/puppeteer/third_party/parsel" ; Expat
167 "third_party/devtools-frontend/src/front_end/third_party/puppeteer/third_party/rxjs" ; ASL2.0
168 "third_party/devtools-frontend/src/front_end/third_party/puppeteer-replay" ;ASL2.0
169 "third_party/devtools-frontend/src/front_end/third_party/source-map-scopes-codec" ;BSD-3
170 "third_party/devtools-frontend/src/front_end/third_party\
171/vscode.web-custom-data" ;Expat
172 "third_party/devtools-frontend/src/front_end/third_party/third-party-web" ;Expat
173 "third_party/devtools-frontend/src/front_end/third_party/wasmparser" ;ASL2.0
174 "third_party/devtools-frontend/src/front_end/third_party/web-vitals" ;Expat
175 "third_party/devtools-frontend/src/third_party/i18n" ;ASL2.0
176 "third_party/devtools-frontend/src/third_party/pyjson5" ;ASL2.0
177 "third_party/devtools-frontend/src/third_party/typescript" ;BSD-3
178 "third_party/dom_distiller_js" ;BSD-3
179 "third_party/dragonbox" ;ASL2.0, Boost1.0
180 "third_party/d3" ;Non-copyleft
181 "third_party/eigen3" ;MPL2.0
182 "third_party/emoji-segmenter" ;ASL2.0
183 "third_party/farmhash" ;Expat
184 "third_party/fast_float" ;ASL2.0, Boost1.0, Expat
185 "third_party/fdlibm" ;non-copyleft
186 "third_party/federated_compute/chromium/fcp/confidentialcompute" ;ASL2.0
187 "third_party/federated_compute/chromium/fcp/protos" ;ASL2.0
188 ;no explicit license; trivial
189 "third_party/federated_compute/chromium/fcp/protos/confidentialcompute"
190 "third_party/federated_compute/chromium/fcp/secagg" ;ASL2.0
191 "third_party/federated_compute/chromium/fcp/client" ;ASL2.0
192 "third_party/federated_compute/src/fcp/base" ;ASL2.0
193 "third_party/federated_compute/src/fcp/confidentialcompute" ;ASL2.0
194 "third_party/federated_compute/src/fcp/client" ;ASL2.0
195 "third_party/federated_compute/src/fcp/protos" ;ASL2.0
196 "third_party/federated_compute/src/fcp/protos/confidentialcompute" ;ASL2.0
197 "third_party/federated_compute/src/fcp/protos/federatedcompute" ;ASL2.0
198 "third_party/federated_compute/src/fcp/secagg" ;ASL2.0
199 "third_party/federated_compute/third_party/googleapis/src/google/rpc" ;ASL2.0
200 ;ASL2.0
201 "third_party/federated_compute/third_party/googleapis/src/google/longrunning"
202 "third_party/federated_compute/third_party/googleapis/src/google/type" ;ASL2.0
203 "third_party/federated_compute/third_party/protodatastore-cpp" ;ASL2.0
204 ;ASL2.0
205 "third_party/federated_compute/third_party/tensorflow-federated/src/tensorflow_federated"
206 "third_party/ffmpeg" ; LGPL2.1+, GPL2.0+, Expat and BSD
207 "third_party/fft2d" ;non-copyleft
208 "third_party/flatbuffers" ;ASL2.0
209 "third_party/fp16" ;Expat
210 "third_party/freetype" ;GPL2.0
211 "third_party/fusejs" ;ASL2.0
212 "third_party/fxdiv" ;Expat
213 "third_party/gemmlowp" ;ASL2.0
214 "third_party/google_input_tools" ;ASL2.0
215 "third_party/google_input_tools/third_party/closure_library" ;ASL2.0
216 "third_party/google_input_tools/third_party/closure_library/third_party/closure" ;Expat
217 "third_party/googletest" ;BSD-3
218 "third_party/harfbuzz" ;Expat
219 "third_party/highway" ;ASL2.0
220 "third_party/hunspell" ;MPL1.1/GPL2+/LGPL2.1+
221 "third_party/hyphenation-patterns" ;Expat
222 "third_party/iamf_tools" ;BSD-3
223 ;; FIXME: Our icu does not have some headers such as udatamem.h.
224 "third_party/icu" ;Unicode3.0
225 "third_party/ink" ;ASL2.0
226 "third_party/inspector_protocol" ;BSD-3
227 "third_party/ipcz" ;BSD-3
228 "third_party/jinja2" ;BSD-3
229 "third_party/jsoncpp" ; Public domain, Expat
230 "third_party/khronos" ;Expat, SGI
231 "third_party/lens_server_proto" ;Non-copyleft
232 "third_party/leveldatabase" ;BSD-3
233 "third_party/libaddressinput" ;ASL2.0
234 "third_party/libaom" ;BSD-2 or "Alliance for Open Media Patent License 1.0"
235 "third_party/libaom/source/libaom/third_party/fastfeat" ;BSD-3
236 "third_party/libaom/source/libaom/third_party/vector" ;Expat
237 "third_party/libaom/source/libaom/third_party/x86inc" ;ISC
238 "third_party/libgav1" ;ASL2.0
239 "third_party/libjingle_xmpp" ;BSD-3
240 "third_party/libpfm4" ;BSD
241 "third_party/libpng" ;PNG2.0
242 "third_party/libphonenumber" ;ASL2.0
243 "third_party/libsecret" ;LGPL2.1+
244 "third_party/libsrtp" ;BSD-3
245 "third_party/libsync" ;ASL2.0
246 "third_party/libtess2" ;SGIFreeB2.0
247 "third_party/liburlpattern" ;Expat
248 "third_party/libva_protected_content" ;Expat
249
250 ;; FIXME: build/linux/unbundle/libvpx.gn does not work for all users.
251 "third_party/libvpx" ;BSD-3
252 "third_party/libvpx/source/libvpx/third_party/x86inc" ;Expat
253
254 "third_party/libwebm" ;BSD-3
255 "third_party/libx11" ;BSD
256 "third_party/libxcb-keysyms" ;BSD
257 "third_party/libxml/chromium" ;BSD-3
258 "third_party/libyuv" ;BSD-3
259 "third_party/libzip" ;BSD-3
260 "third_party/lit" ;BSD-3
261 "third_party/lit/v3_0" ;BSD-3
262 "third_party/lottie" ;Expat
263 "third_party/lss" ;BSD-3
264 "third_party/lzma_sdk" ;public domain
265 "third_party/mako" ;Expat
266 "third_party/markupsafe" ;BSD-3
267 "third_party/material_color_utilities" ;ASL2.0
268 "third_party/metrics_proto" ;BSD-3
269 "third_party/minigbm" ;BSD-3
270 "third_party/ml_dtypes" ;ASL2.0
271 "third_party/modp_b64" ;BSD-3
272 "third_party/nasm" ;BSD-2
273 "third_party/nearby" ;ASL2.0
274 "third_party/neon_2_sse" ;BSD-2
275 "third_party/node" ;Expat
276 "third_party/oak/chromium/proto" ;ASL2.0
277 "third_party/oak/chromium/proto/attestation" ;ASL2.0
278 "third_party/omnibox_proto" ;BSD-3
279 "third_party/one_euro_filter" ;BSD-3
280 "third_party/openscreen" ;BSD-3
281 "third_party/openscreen/src/third_party/tinycbor" ;Expat
282 "third_party/opus" ;BSD-3
283 "third_party/ots" ;BSD-3
284 "third_party/pdfium" ;BSD-3
285 "third_party/pdfium/third_party/agg23" ;Expat
286 "third_party/pdfium/third_party/bigint" ;Public domain, BSD-3
287 "third_party/pdfium/third_party/lcms" ;Expat
288 "third_party/pdfium/third_party/libopenjpeg" ;BDS-2
289 "third_party/pdfium/third_party/libtiff" ;non-copyleft
290 "third_party/pdfium/third_party/freetype/include/pstables.h" ;FreeType
291 "third_party/perfetto" ;ASL2.0
292 "third_party/perfetto/protos/third_party/android" ;ASL2.0
293 "third_party/perfetto/protos/third_party/chromium" ;BSD-3
294 "third_party/perfetto/protos/third_party/pprof" ;ASL2.0
295 "third_party/perfetto/protos/third_party/primes" ;ASL2.0
296 "third_party/perfetto/protos/third_party/simpleperf" ;ASL2.0
297 "third_party/pffft" ;the "FFTPACK" license
298 "third_party/ply" ;BSD-3
299 "third_party/polymer" ;BSD-3
300 "third_party/private_membership" ;ASL2.0
301 "third_party/private-join-and-compute" ;ASL2.0
302 "third_party/protobuf" ;BSD-3
303 "third_party/protobuf/third_party/utf8_range" ; Expat
304 "third_party/pthreadpool" ;BSD-2
305 "third_party/puffin" ;Non-copyleft
306 "third_party/pyyaml" ;Expat
307 "third_party/pyjson5" ;ASL2.0
308 "third_party/rapidhash" ;BSD-2
309 "third_party/readability" ;ASL2.0
310 "third_party/re2" ;Non-copyleft
311 "third_party/rnnoise" ;BSD-3
312 "third_party/rust" ; Expat
313 "third_party/ruy" ;ASL2.0
314 "third_party/s2cellid" ;ASL2.0
315 "third_party/search_engines_data" ;BSD-3
316 "third_party/securemessage" ;ASL2.0
317 "third_party/selenium-atoms" ;ASL2.0
318 "third_party/sentencepiece" ;ASL2.0
319 "third_party/sentencepiece/src/third_party/darts_clone" ;BSD-3
320 "third_party/shell-encryption" ;ASL2.0
321 "third_party/simdutf" ;Non-copyleft
322 "third_party/simplejson" ; Non-copyleft
323 "third_party/six" ;Expat
324 "third_party/skia" ;BSD-3
325 "third_party/skia/include/third_party/vulkan" ;BSD-3
326 "third_party/smhasher" ;Expat, public domain
327
328 ;; FIXME: the snappy "replacement" shim (see replace_gn_files.py below) does
329 ;; not declare a library dependency added in M93, causing a link failure.
330 "third_party/snappy" ;BSD-3
331
332 "third_party/speech-dispatcher" ;GPL2+
333 "third_party/spirv-headers" ;ASL2.0
334 "third_party/spirv-tools" ;ASL2.0
335 "third_party/sqlite" ;Public domain
336 "third_party/swiftshader" ;ASL2.0
337 "third_party/swiftshader/third_party/astc-encoder" ;ASL2.0
338 "third_party/swiftshader/third_party/llvm-10.0" ;ASL2.0, with LLVM exception
339 "third_party/swiftshader/third_party/llvm-subzero" ;NCSA
340 "third_party/swiftshader/third_party/marl" ;ASL2.0
341 "third_party/swiftshader/third_party/subzero" ;NCSA
342 "third_party/swiftshader/third_party/SPIRV-Headers" ;X11-style
343 "third_party/swiftshader/third_party/SPIRV-Tools" ;ASL2.0
344 "third_party/tensorflow-text" ;ASL2.0
345 "third_party/tensorflow_models" ;ASL2.0
346 "third_party/tflite" ;ASL2.0
347 "third_party/tflite/src/third_party/fft2d" ;ASL2.0
348 "third_party/tflite/src/third_party/xla" ;ASL2.0
349 "third_party/tflite/src/third_party/xla/xla" ;ASL2.0
350 "third_party/tflite/src/third_party/xla/xla/tsl/framework" ;ASL2.0
351 "third_party/tflite/src/third_party/xla/xla/tsl/lib/random" ;ASL2.0
352 "third_party/tflite/src/third_party/xla/xla/tsl/platform" ;ASL2.0
353 "third_party/tflite/src/third_party/xla/xla/tsl/protobuf" ;ASL2.0
354 "third_party/tflite/src/third_party/xla/xla/tsl/util" ;ASL2.0
355 "third_party/tflite/src/third_party/xla/third_party/tsl" ;ASL2.0
356 "third_party/tflite/src/third_party/xla/third_party/tsl/tsl" ;ASL2.0
357 "third_party/tflite/src/third_party/xla/third_party/tsl/tsl/platform" ;ASL2.0
358 "third_party/tflite/src/third_party/xla/third_party/tsl/tsl/profiler" ;ASL2.0
359 "third_party/ukey2" ;ASL2.0
360 "third_party/ungoogled-chromium" ;BSD-3
361 "third_party/usb_ids" ;BSD-3
362 "third_party/utf" ;Expat
363 "third_party/vulkan-deps" ;ASL2.0, BSD-3, Expat
364 "third_party/vulkan-headers" ;ASL2.0
365 "third_party/vulkan-loader" ;ASL2.0
366 "third_party/vulkan_memory_allocator" ;Expat
367 "third_party/vulkan-tools" ;ASL2.0
368 "third_party/vulkan-validation-layers" ;ASL2.0
369 "third_party/vulkan-utility-libraries" ;ASL2.0
370 "third_party/wayland" ;BSD-3, Expat
371 "third_party/wayland-protocols" ;Expat
372 "third_party/webdriver" ;ASL2.0
373 "third_party/webgpu-cts" ;BSD-3
374 "third_party/webrtc" ;BSD-3
375 "third_party/webrtc/common_audio/third_party/ooura" ;Non-copyleft
376 "third_party/webrtc/common_audio/third_party/spl_sqrt_floor" ;Public domain
377 "third_party/webrtc/modules/third_party/fft" ;Non-copyleft
378 "third_party/webrtc/modules/third_party/g711" ;Public domain
379 "third_party/webrtc/modules/third_party/g722" ;Public domain
380 "third_party/widevine/cdm/widevine_cdm_common.h" ;BSD-3
381 "third_party/woff2" ;ASL2.0
382 "third_party/wuffs" ;ASL2.0
383 "third_party/xcbproto" ;X11
384 "third_party/xnnpack" ;BSD-3
385
386 ;; These are forked components of the X11 keybinding code.
387 "third_party/libxcb-keysyms" ;X11
388 "third_party/libx11/src/KeyBind.c" ;X11
389 "third_party/libx11/src/xkb/XKBBind.c" ;X11
390 "third_party/x11proto/keysymdef.h" ;X11
391
392 "third_party/zlib/google" ;BSD-3
393 "third_party/zxcvbn-cpp" ;Expat
394 "url/third_party/mozilla" ;BSD-3, MPL1.1/GPL2+/LGPL2.1+
395 "v8/third_party/inspector_protocol" ;BSD-3
396 "v8/third_party/rapidhash-v8" ;BSD-2
397 "v8/third_party/siphash" ;CC0 1.0
398 "v8/third_party/utf8-decoder" ;Non-copyleft
399 "v8/third_party/valgrind" ;BSD
400 "v8/third_party/v8/builtins" ;PSFL2.0
401 "v8/third_party/v8/codegen" ;Expat
402 ))
403
404(define %denied-files
405 ;; 'third_party/blink/perf_tests/resources/svg/HarveyRayner.svg' carries a
406 ;; nonfree license according to LICENSES in the same directory. As we don't
407 ;; run the Blink performance tests, just remove everything to save ~70MiB.
408 '("third_party/blink/perf_tests"))
409
410(define %chromium-version "153.0.8010.52")
411(define %ungoogled-revision (string-append %chromium-version "-1"))
412(define %debian-revision (string-append "debian/" %ungoogled-revision))
413
414(define %ungoogled-origin
415 (origin
416 (method git-fetch)
417 (uri (git-reference (url "https://github.com/ungoogled-software/ungoogled-chromium")
418 (commit %ungoogled-revision)))
419 (file-name (git-file-name "ungoogled-chromium" %ungoogled-revision))
420 (sha256
421 (base32
422 "1sd34gzhc9aimqhq4bnj1zijx3z2f5i8ql7svzis5kc5j8gkcxv6"))))
423
424(define %debian-origin
425 (origin
426 (method git-fetch)
427 (uri (git-reference
428 (url "https://salsa.debian.org/chromium-team/chromium.git")
429 (commit %debian-revision)))
430 (file-name (git-file-name "debian-chromium-patches"
431 (match (string-split %debian-revision #\/)
432 ((_ version) version))))
433 (sha256
434 (base32
435 "1q43rdy7hjjfcdshlb6aw70yjmcp2ncqa32zalzf89nlkzgr869l"))))
436
437(define (origin-file origin file)
438 (computed-file
439 (basename file)
440 #~(symlink (string-append #$origin "/" #$file)
441 #$output)))
442
443(define (debian-patch name)
444 (origin-file %debian-origin (string-append "/debian/patches/" name)))
445
446(define %debian-patches
447 (map debian-patch
448 '("bookworm/foreach.patch"
449 "debianization/safe-libcxx.patch"
450 "disable/enterprise-tests.patch"
451 "disable/node-version-ck.patch"
452 "disable/rustc-allow-features.patch"
453 "fixes/bytemuck.patch"
454 "fixes/gentoo-stylesheet.patch"
455 "fixes/libcpp-headers.patch"
456 "fixes/libpng-testonly.patch"
457 "fixes/rust-clanglib.patch"
458 "llvm-22/clang22.patch"
459 "llvm-22/clone-traits.patch"
460 "llvm-22/const-profile.patch"
461 "llvm-22/ignore-for-ubsan.patch"
462 "llvm-22/keyfactory.patch"
463 "llvm-22/raw-ref-map-find.patch"
464 "system/openjpeg.patch"
465 "system/rust-cbor.patch"
466 "system/llvm.patch"
467 "trixie/bindgen-boringssl.patch"
468 "trixie/cookie-string-view.patch"
469 "trixie/nodejs-main.patch"
470 "trixie/revert-v8-sanitize.patch")))
471
472(define %guix-patches
473 (map (lambda (patch)
474 (local-file
475 (assume-valid-file-name
476 (search-patch patch))))
477 (list
478 "ungoogled-chromium-custom-compiler.patch"
479 "ungoogled-chromium-crubit.patch"
480 "ungoogled-chromium-empty-parsed-rustc-args.patch"
481 "ungoogled-chromium-extension-search-path.patch"
482 "ungoogled-chromium-golang.patch"
483 "ungoogled-chromium-increase-fortify-level.patch"
484 "ungoogled-chromium-override-libdrm-assertion.patch"
485 "ungoogled-chromium-RUNPATH.patch"
486 "ungoogled-chromium-rust-toolchain-var.patch"
487 "ungoogled-chromium-system-nspr.patch"
488 "ungoogled-chromium-typescript.patch"
489 "ungoogled-chromium-unbundle-minizip.patch")))
490
491(define %patches
492 (append %debian-patches
493 %guix-patches))
494
495(define lld-as-ld-wrapper-23
496 (make-lld-wrapper lld-23 #:lld-as-ld? #t))
497
498;; This is a source 'snippet' that does the following:
499;; *) Applies various patches for unbundling purposes and libstdc++ compatibility.
500;; *) Runs the ungoogled patch-, domain substitution-, and scrubbing scripts.
501;; *) Prunes all third_party directories that are not explicitly preserved.
502;; *) Adjusts "GN" build files such that system libraries are preferred.
503(define ungoogled-chromium-snippet
504 ;; Note: delay to cope with cyclic module imports at the top level.
505 (delay
506 #~(begin
507 (let ((chromium-dir (getcwd)))
508 (set-path-environment-variable
509 "PATH" '("bin")
510 (list #+patch #+python-wrapper #+xz #+zstd))
511
512 ;; Apply patches before running the ungoogled scripts because
513 ;; domain substitution may break some of the patches.
514 (format #t "Applying assorted build fixes...~%")
515 (force-output)
516 (for-each (lambda (patch)
517 (invoke "patch" "-p1" "--force" "--input"
518 patch "--no-backup-if-mismatch"))
519 '#+%patches)
520
521 (with-directory-excursion #+%ungoogled-origin
522 (format #t "Ungooglifying...~%")
523 (force-output)
524 (invoke "python" "utils/prune_binaries.py" chromium-dir
525 "pruning.list")
526 (invoke "python" "utils/patches.py" "apply" chromium-dir
527 "patches")
528 (invoke "python" "utils/domain_substitution.py" "apply" "-r"
529 "domain_regex.list" "-f" "domain_substitution.list"
530 "-c" "/tmp/domainscache.tar.gz" chromium-dir))
531
532 ;; Run after the ungoogled scripts to avoid interfering with
533 ;; patches or file lists.
534 (format #t "Removing denied files...~%")
535 (force-output)
536 (for-each delete-file-recursively '#$%denied-files)
537
538 (format #t "Pruning third party files...~%")
539 (force-output)
540 (apply invoke "python"
541 "build/linux/unbundle/remove_bundled_libraries.py"
542 "--do-remove" '#$%preserved-third-party-files)
543
544 (format #t "Replacing GN files...~%")
545 (force-output)
546 (substitute* "tools/generate_shim_headers/generate_shim_headers.py"
547 ;; The "is_official_build" configure option enables certain
548 ;; release optimizations like those used in the commercial
549 ;; Chrome browser. Unfortunately it also requires using the
550 ;; bundled libraries: lose that restriction.
551 (("#if defined\\(OFFICIAL_BUILD\\)")
552 "#if 0"))
553
554 ;; The complete list of replacement system libraries can be found
555 ;; at this file.
556 (invoke "python" "build/linux/unbundle/replace_gn_files.py"
557 "--system-libraries"
558 ;; abseil-cpp libraries must be used together:
559 ;; "absl_algorithm" "absl_base" "absl_cleanup" "absl_container"
560 ;; "absl_crc" "absl_debugging" "absl_flags" "absl_functional"
561 ;; "absl_hash" "absl_log" "absl_log_internal" "absl_memory"
562 ;; "absl_meta" "absl_numeric" "absl_random" "absl_status"
563 ;; "absl_strings" "absl_synchronization" "absl_time"
564 ;; "absl_types" "absl_utility"
565 "brotli"
566 "crc32c"
567 "dav1d"
568 ;; "double-conversion"
569 ;; "ffmpeg"
570 "flac"
571 ;; "flatbuffers"
572 "fontconfig"
573 "freetype"
574 "harfbuzz"
575 ;; "highway"
576 ;; "icu"
577 ;; "jsoncpp"
578 ;; "libaom"
579 "libdrm"
580 "libjpeg"
581 "libpng"
582 ;; "libsecret"
583 ;; "libusb"
584 ;; "libvpx"
585 "libwebp"
586 "libxml"
587 ;; "libXNVCtrl"
588 "libxslt"
589 ;; "libyuv"
590 "openh264"
591 "opus"
592 ;; "re2"
593 ;; "simdutf"
594 ;; "snappy"
595 ;; SPIRV must be used together
596 ;; "swiftshader-SPIRV-Headers" "swiftshader-SPIRV-Tools"
597 ;; "vulkan_memory_allocator"
598 ;; "woff2"
599 "zlib"
600 "zstd")))))
601
602(define opus+custom
603 (package/inherit opus
604 (name "opus+custom")
605 (arguments
606 (substitute-keyword-arguments arguments
607 ((#:configure-flags flags ''())
608 ;; Opus Custom is an optional extension of the Opus
609 ;; specification that allows for unsupported frame
610 ;; sizes. Chromium requires that this is enabled.
611 `(cons "--enable-custom-modes"
612 ,flags))))))
613
614(define-public ungoogled-chromium
615 (package
616 (name "ungoogled-chromium")
617 (version %ungoogled-revision)
618 (synopsis "Graphical web browser")
619 (source (origin
620 (method url-fetch)
621 (uri (string-append "https://commondatastorage.googleapis.com"
622 "/chromium-browser-official/chromium-"
623 %chromium-version "-lite.tar.xz"))
624 (sha256
625 (base32
626 "0jl476d87vz7n35h1gxxacffdxjnigx3asv13739fbzi2gwwnvzd"))
627 (modules '((guix build utils)))
628 (snippet (force ungoogled-chromium-snippet))))
629 (build-system gnu-build-system)
630 (arguments
631 (list
632 #:tests? #f
633 #:modules '((guix build gnu-build-system)
634 (guix build utils)
635 (srfi srfi-26))
636 #:configure-flags
637 ;; See tools/gn/docs/cookbook.md and
638 ;; https://www.chromium.org/developers/gn-build-configuration
639 ;; for usage. Run "gn args . --list" in the Release
640 ;; directory for an exhaustive list of supported flags.
641 ;; (Note: The 'configure' phase will do that for you.)
642 #~(list "is_debug=false"
643 "is_component_build=false"
644 ;; Use the "official" release optimizations, as opposed to
645 ;; a developer build.
646 "is_official_build=true"
647 "clang_use_chrome_plugins=false"
648 "use_clang_modules=false"
649 ; support for this is deprecated and to be removed.
650 "use_custom_libcxx=false"
651 "optimize_webui=false"
652 "webnn_use_tflite=false"
653 "webnn_use_litert=false"
654 "build_tflite_with_xnnpack=false"
655 "safe_browsing_use_unrar=false"
656 "chrome_pgo_phase=0"
657 "use_sysroot=false"
658 "goma_dir=\"\""
659 "use_unofficial_version_number=false"
660 "treat_warnings_as_errors=false"
661 "use_official_google_api_keys=false"
662 "disable_fieldtrial_testing_config=true"
663 "safe_browsing_mode=0"
664 "enable_mdns=false"
665 "enable_remoting=false"
666 "enable_reporting=false"
667 "enable_service_discovery=false"
668 "enable_vr=false"
669 "enable_enterprise_companion=false"
670 "enable_iterator_debugging=false"
671 "enable_hangout_services_extension=false"
672 "enable_widevine=false"
673 "fatal_linker_warnings=false"
674 ;; Avoid dependency on code formatting tools.
675 "blink_enable_generated_code_formatting=false"
676 ;; Don't bother building Dawn tests.
677 "build_dawn_tests=false"
678
679 "angle_has_histograms=false"
680 "angle_build_tests=false"
681 "build_angle_perftests=false"
682 "enable_perfetto_unittests=false"
683 "skia_enable_skshapper_tests=false"
684 "tint_build_unittests=false"
685 "enable_nocompile_tests=false"
686 "enable_screen_ai_browsertests=false"
687
688 "clang_warning_suppression_file=\"\""
689
690 "use_qt5=false"
691 "use_qt6=false"
692 "is_cfi=false"
693
694 "symbol_level=0"
695 "blink_symbol_level=0"
696 "v8_symbol_level=0"
697 "v8_enable_backtrace=false"
698 "v8_drumbrake_bounds_checks=true"
699
700 ;; Define a custom toolchain that simply looks up CC, AR and
701 ;; friends from the environment.
702 "custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
703 "host_toolchain=\"//build/toolchain/linux/unbundle:default\""
704
705 (string-append "clang_base_path=\""
706 (dirname (dirname (search-input-file %build-inputs
707 "/bin/clang")))
708 "\"")
709
710 (string-append "clang_version="
711 #$(version-major (package-version clang-23)))
712
713 (string-append "rust_sysroot_absolute=\""
714 (dirname (dirname (search-input-file %build-inputs
715 "/bin/rustc")))
716 "\"")
717 (string-append "rust_bindgen_root=\""
718 (dirname (dirname (search-input-file %build-inputs
719 "/bin/bindgen")))
720 "\"")
721
722 (string-append "rustc_version=\"rustc "
723 #$(package-version rust)
724 ;; These are 'don't care', but chromium's build parses
725 ;; the whole string as if returned from 'rustc --version'
726 ;; invokation and fails if it's just the version number.
727 " (f6e511eec 2024-10-15) (built from a source tarball)\"")
728
729 ;; Prefer system libraries.
730 "use_system_freetype=true"
731 "use_system_harfbuzz=true"
732 "use_system_icu=false"
733 "use_system_lcms2=true"
734 "use_system_libdrm=true"
735 "use_system_libffi=true"
736 "use_system_libjpeg=true"
737 "use_system_libopenjpeg2=true"
738 "use_system_libpng=true"
739
740 "use_system_zlib=true"
741 "use_gnome_keyring=false" ;deprecated by libsecret
742 "use_pulseaudio=true"
743 "link_pulseaudio=true"
744 "icu_use_data_file=true"
745
746 "use_typescript_go=false"
747 "devtools_use_typescript_go=false"
748
749 ;; VA-API acceleration is currently only supported on x86_64-linux.
750 #$@(if (string-prefix? "x86_64" (or (%current-target-system)
751 (%current-system)))
752 '("use_vaapi=true")
753 '())
754
755 #$@(if (string-prefix? "aarch64" (or (%current-target-system)
756 (%current-system)))
757 '("use_v4l2_codec=true"
758 "use_vaapi=true"
759 "use_av1_hw_decoder=true")
760 '())
761
762 ;; Do not artificially restrict formats supported by system ffmpeg.
763 "proprietary_codecs=true"
764 "ffmpeg_branding=\"Chrome\""
765
766 "rtc_use_pipewire=true"
767 "rtc_link_pipewire=true")
768 #:phases
769 #~(modify-phases %standard-phases
770 (add-after 'unpack 'patch-stuff
771 (lambda* (#:key inputs native-inputs #:allow-other-keys)
772 (let* ((brotli (search-input-file inputs
773 "/bin/brotli"))
774 (libopenjp2 (search-input-file inputs "lib/libopenjp2.so"))
775 (openjpeg (dirname (dirname libopenjp2)))
776 (gperf (search-input-file (or native-inputs inputs)
777 "/bin/gperf"))
778 (python3 (search-input-file (or native-inputs inputs)
779 "/bin/python3"))
780 (tsc (search-input-file (or native-inputs inputs)
781 "/bin/tsc"))
782 (compiler-rt-path (dirname
783 (dirname
784 (search-input-file (or native-inputs inputs)
785 "/bin/hwasan_symbolize")))))
786 (substitute* "third_party/brotli/BUILD.gn"
787 (("/usr/bin/brotli")
788 brotli))
789
790 (substitute* ".gn"
791 (("//third_party/cpython3/host/bin/python3")
792 python3))
793
794 ;; works on top of typescript patch.
795 (substitute* "third_party/devtools-frontend/src/third_party/typescript/typescript.py"
796 (("/usr/bin/tsc")
797 tsc))
798
799 ;; This works on top of debian's 'rust-clanglib.patch'.
800 (substitute* "build/config/clang/BUILD.gn"
801 (("\\$clang_base_path/lib/clang/\\$clang_version")
802 compiler-rt-path))
803
804 (substitute* "third_party/pdfium/BUILD.gn"
805 ;; This include path is added by Debians openjpeg patch.
806 (("/usr/include/openjpeg-")
807 (string-append openjpeg "/include/openjpeg-")))
808
809 (substitute*
810 (append
811 '("media/audio/audio_opus_encoder.h")
812 (find-files (string-append "third_party/webrtc/modules"
813 "/audio_coding/codecs/opus")))
814 ;; Fix opus include path.
815 ;; Do not substitute opus_private.h.
816 (("#include \"opus\\.h\"")
817 "#include \"opus/opus.h\"")
818 (("#include \"opus_custom\\.h\"")
819 "#include \"opus/opus_custom.h\"")
820 (("#include \"opus_defines\\.h\"")
821 "#include \"opus/opus_defines.h\"")
822 (("#include \"opus_multistream\\.h\"")
823 "#include \"opus/opus_multistream.h\"")
824 (("#include \"opus_types\\.h\"")
825 "#include \"opus/opus_types.h\"")
826 (("\"third_party/opus/src/include/([a-z_-]+\\.h)\"" _ header)
827 (string-append "<opus/" header ">")))
828
829 ;; Many files try to include ICU headers from "third_party/icu/...".
830 ;; Remove the "third_party/" prefix to use system headers instead.
831 ;(substitute* (find-files "chrome" "\\.cc$")
832 ; (("third_party/icu/source/(common|i18n)/")
833 ; ""))
834
835 ;; XXX: Should be unnecessary when use_system_lcms2=true.
836 (substitute* "third_party/pdfium/core/fxcodec/icc/icc_transform.h"
837 (("include \"third_party/lcms/include/lcms2\\.h\"")
838 "include \"lcms2.h\""))
839
840 ;; The unbundling script leaves behind an empty pyyaml directory
841 ;; which prevents the code that tries to use it from falling
842 ;; back to the pyyaml provided by Guix.
843 (delete-file-recursively "third_party/pyyaml")
844
845 ;; Since M148, gperf binary is bundled upstream and expected to
846 ;; be available here.
847 (mkdir-p "third_party/gperf/cipd")
848 (symlink (dirname gperf) "third_party/gperf/cipd/bin")
849
850 (substitute*
851 "third_party/breakpad/breakpad/src/common/linux/libcurl_wrapper.h"
852 (("include \"third_party/curl")
853 "include \"curl"))
854
855 ;; Our clang libs and rustfmt are not under bindgen root directory.
856 (substitute* '("build/rust/rust_bindgen_generator.gni"
857 "build/rust/rust_bindgen.gni")
858 (("(_libclang_path = )rust_bindgen_root" _ libclang)
859 (string-append libclang "clang_base_path"))
860 (("(_rustfmt_path = \")\\$\\{rust_bindgen_root\\}" _ rustfmt)
861 (string-append rustfmt "${rust_sysroot_absolute}"))))))
862 (add-after 'patch-stuff 'add-absolute-references
863 (lambda* (#:key inputs #:allow-other-keys)
864 (let ((cups-config (search-input-file inputs "/bin/cups-config"))
865 (libnssckbi.so (search-input-file inputs
866 "/lib/nss/libnssckbi.so"))
867 (gtk-libs '("libgio-2.0.so.0"
868 "libgdk_pixbuf-2.0.so.0"
869 "libgdk-3.so.0"
870 "libgtk-3.so.0")))
871 (for-each (lambda (lib)
872 (substitute* "ui/gtk/gtk_compat.cc"
873 ((lib) (search-input-file
874 inputs (string-append "lib/" lib)))))
875 gtk-libs)
876 (substitute* "printing/cups_config_helper.py"
877 (("cups_config =.*")
878 (string-append "cups_config = '" cups-config "'\n")))
879 (substitute* "crypto/nss_util.cc"
880 (("libnssckbi\\.so") libnssckbi.so)))))
881 (add-after 'add-absolute-references 'adjust-CPLUS_INCLUDE_PATH
882 ;; The libcxx include/c++/v1 directory is not exposed via
883 ;; CPLUS_INCLUDE_PATH by default, causing errors like
884 ;; "fatal error: 'format' file not found". Also clang is
885 ;; unable to find gcc's bits/c++config.h which is machine
886 ;; dependent.
887 (lambda* (#:key native-inputs inputs #:allow-other-keys)
888 (let* ((libcxx-v1 (search-input-directory inputs
889 "include/c++/v1"))
890 (target-system #$(nix-system->gnu-triplet
891 (or (%current-target-system)
892 (%current-system))))
893 (target-include (string-append "include/c++/"
894 target-system))
895 (gcc-bits (search-input-directory inputs
896 target-include)))
897 (setenv "CPLUS_INCLUDE_PATH"
898 (string-append libcxx-v1 ":" gcc-bits ":"
899 (getenv "CPLUS_INCLUDE_PATH"))))))
900 (add-before 'configure 'prepare-build-environment
901 (lambda* (#:key native-inputs inputs #:allow-other-keys)
902 (let ((node (search-input-file (or native-inputs inputs)
903 "/bin/node")))
904 ;; Define the GN toolchain.
905 (setenv "AR" "llvm-ar") (setenv "NM" "llvm-nm")
906 (setenv "CC" "clang") (setenv "CXX" "clang++")
907
908 (setenv "CXXFLAGS"
909 (string-append " -Wno-conversion"
910 " -Wno-unused-function"
911 " -Wno-unused-variable"
912 " -Wno-unused-private-field"
913 " -Wno-deprecated-declarations"
914 " -Wno-unknown-pragmas"
915 " -fno-delete-null-pointer-checks"
916 " -stdlib=libc++"))
917 (setenv "LDFLAGS"
918 (string-append " -stdlib=libc++"
919 " -Wl,--stats"))
920 (setenv "CLANG_MVERS" #$(version-major
921 (package-version clang-23)))
922 (setenv "RUSTC_BOOTSTRAP" "1")
923
924 ;; TODO: pre-compile instead. Avoids a race condition.
925 (setenv "PYTHONDONTWRITEBYTECODE" "1")
926
927 ;; Go compiler creates a build cache directory at home.
928 (setenv "HOME" "/tmp")
929 ;; Avoid checking for go modules online.
930 (setenv "GOPROXY" "off")
931
932 ;; XXX: How portable is this.
933 (mkdir-p "third_party/node/linux/node-linux-x64")
934 (symlink (dirname node)
935 "third_party/node/linux/node-linux-x64/bin"))))
936 (replace 'configure
937 (lambda* (#:key configure-flags #:allow-other-keys)
938 (let ((args (string-join configure-flags " ")))
939 ;; Generate ninja build files.
940 (invoke "gn" "gen" "out/Release"
941 (string-append "--args=" args))
942
943 ;; Print the full list of supported arguments as well as
944 ;; their current status for convenience.
945 (format #t "Dumping configure flags...\n")
946 (invoke "gn" "args" "out/Release" "--list"))))
947 (add-before 'build 'increase-resource-limits
948 (lambda _
949 ;; XXX: Chromiums linking step requires a lot of simultaneous file
950 ;; accesses. Having a too low ulimit will result in bogus linker
951 ;; errors such as "foo.a: error adding symbols: malformed archive".
952
953 ;; Try increasing the soft resource limit of max open files to 2048,
954 ;; or equal to the hard limit, whichever is lower.
955 (call-with-values (lambda () (getrlimit 'nofile))
956 (lambda (soft hard)
957 (when (and soft (< soft 2048))
958 (if hard
959 (setrlimit 'nofile (min hard 2048) hard)
960 (setrlimit 'nofile 2048 #f))
961 (format #t
962 "increased maximum number of open files from ~d to ~d~%"
963 soft (if hard (min hard 2048) 2048)))))))
964 (replace 'build
965 (lambda* (#:key (parallel-build? #t) #:allow-other-keys)
966 (invoke "ninja" "-C" "out/Release"
967 "-j" (if parallel-build?
968 (number->string (parallel-job-count))
969 "1")
970 "chrome"
971 "chromedriver")))
972 (replace 'install
973 (lambda* (#:key inputs outputs #:allow-other-keys)
974 (let* ((out (assoc-ref outputs "out"))
975 (bin (string-append out "/bin"))
976 (exe (string-append bin "/chromium"))
977 (lib (string-append out "/lib"))
978 (man (string-append out "/share/man/man1"))
979 (applications (string-append out "/share/applications"))
980 (libs '("chrome_100_percent.pak"
981 "chrome_200_percent.pak"
982 "resources.pak"
983 "v8_context_snapshot.bin"
984 "chrome_crashpad_handler"
985 "icudtl.dat"
986
987 ;; Swiftshader ICD.
988 "libvk_swiftshader.so"
989 "vk_swiftshader_icd.json"
990
991 ;; Chromium ships its own libGL and
992 ;; vulkan implementation called ANGLE.
993 "libvulkan.so.1"
994 "libEGL.so" "libGLESv2.so"))
995 (locales (string-append lib "/locales"))
996 (resources (string-append lib "/resources"))
997 (preferences
998 ;; This file contains defaults for new user profiles.
999 #$(local-file
1000 (search-auxiliary-file
1001 "chromium/master-preferences.json")))
1002 (gtk (dirname (dirname
1003 (search-input-file inputs "lib/libgtk-3.so"))))
1004 (mesa (dirname (search-input-file inputs "lib/libGL.so")))
1005 (xdg-utils (dirname (search-input-file inputs "bin/xdg-open"))))
1006
1007 (substitute* '("chrome/app/resources/manpage.1.in"
1008 "chrome/installer/linux/common/desktop.template")
1009 (("@@MENUNAME") "Chromium")
1010 (("@@PACKAGE") "chromium")
1011 (("/usr/bin/@@usr_bin_symlink_name") exe)
1012 (("@@uri_scheme") "x-scheme-handler/chromium;")
1013 (("@@extra_desktop_entries") "")
1014 (("@@startup_wm_class") "Chromium-browser"))
1015
1016 (mkdir-p man)
1017 (copy-file "chrome/app/resources/manpage.1.in"
1018 (string-append man "/chromium.1"))
1019
1020 (mkdir-p applications)
1021 (copy-file "chrome/installer/linux/common/desktop.template"
1022 (string-append applications "/chromium.desktop"))
1023
1024 (mkdir-p lib)
1025 (copy-file preferences (string-append lib "/master_preferences"))
1026
1027 (with-directory-excursion "out/Release"
1028 (for-each (cut install-file <> lib) libs)
1029 (copy-file "chrome" (string-append lib "/chromium"))
1030
1031 (copy-recursively "locales" locales)
1032 (copy-recursively "resources" resources)
1033
1034 (mkdir-p bin)
1035 (symlink "../lib/chromium" exe)
1036 (install-file "chromedriver" bin)
1037
1038 (wrap-program exe
1039 ;; Avoid file manager crash. See <https://bugs.gnu.org/26593>.
1040 `("XDG_DATA_DIRS" ":" prefix (,(string-append gtk "/share")))
1041 ;; Provide libGL and libvulkan without patching all references.
1042 ;; XXX: How to add on RUNPATH instead of this hack?
1043 `("LD_LIBRARY_PATH" ":" prefix
1044 (,mesa))
1045 ;; Ensure xdg-open et al. is found.
1046 `("PATH" ":" prefix (,xdg-utils))))
1047
1048 (with-directory-excursion "chrome/app/theme/chromium"
1049 (for-each
1050 (lambda (size)
1051 (let ((icons (string-append out "/share/icons/hicolor/"
1052 size "x" size "/apps")))
1053 (mkdir-p icons)
1054 (copy-file (string-append "product_logo_" size ".png")
1055 (string-append icons "/chromium.png"))))
1056 '("24" "48" "64" "128" "256")))))))))
1057 (native-inputs
1058 (list bison
1059 clang-23
1060 clang-runtime-23
1061 clang-toolchain-23
1062 gn
1063 gperf
1064 go
1065 lld-as-ld-wrapper-23
1066 llvm-23
1067 ninja
1068 node-lts
1069 node-typescript
1070 pkg-config
1071 which
1072 python-beautifulsoup4
1073 python-html5lib
1074 python-pyyaml
1075 python-wrapper
1076 rust
1077 rust-bindgen-cli
1078 rust-cbindgen
1079 wayland))
1080 (inputs
1081 (list alsa-lib
1082 at-spi2-core
1083 bash-minimal
1084 brotli
1085 crc32c
1086 cups
1087 curl
1088 dav1d
1089 dbus
1090 expat
1091 flac
1092 fontconfig
1093 fp16
1094 freetype
1095 fxdiv
1096 gdk-pixbuf
1097 glib
1098 gtk+
1099 harfbuzz
1100 icu4c-77
1101 lcms
1102 libcxx
1103 libdrm
1104 libffi
1105 libjpeg-turbo
1106 libpng
1107 libva
1108 libvpx
1109 libwebp
1110 libx11
1111 libxcb
1112 libxcomposite
1113 libxcursor
1114 libxdamage
1115 libxext
1116 libxfixes
1117 libxi
1118 libxml2
1119 libxrandr
1120 libxrender
1121 libxscrnsaver
1122 libxslt
1123 libxtst
1124 mesa
1125 minizip
1126 mit-krb5
1127 nss
1128 openh264
1129 openjpeg ;PDFium only
1130 opus+custom
1131 pango
1132 pciutils
1133 pipewire
1134 pulseaudio
1135 qtbase
1136 snappy
1137 speech-dispatcher
1138 eudev
1139 valgrind/pinned
1140 wayland
1141 xdg-utils
1142 `(,zstd "lib")))
1143 (native-search-paths
1144 (list (search-path-specification
1145 (variable "CHROMIUM_EXTENSION_DIRECTORY")
1146 (separator #f) ;single entry
1147 (files '("share/chromium/extensions")))))
1148
1149 ;; Building Chromium takes ... a very long time. On a single core, a busy
1150 ;; mid-end x86 system may need more than 24 hours to complete the build.
1151 (properties '((timeout . 144000) ;40 hours
1152 ;; The linking step may take more than an hour on some hardware.
1153 (max-silent-time . 7200)
1154 (cpe-name . "chrome")))
1155
1156 (home-page "https://ungoogled-software.github.io/")
1157 (description
1158 "Ungoogled-Chromium is the Chromium web browser, with some functionality
1159disabled in order to protect the users privacy. This package also includes
1160the @command{chromedriver} command, which can be useful for automated web
1161testing.")
1162 ;; Chromium is developed as BSD-3, but bundles a large number of third-party
1163 ;; components with other licenses. For full information, see chrome://credits.
1164 (license (list license:bsd-3
1165 license:bsd-2
1166 license:expat
1167 license:asl2.0
1168 license:mpl1.1
1169 license:mpl2.0
1170 license:public-domain
1171 license:isc
1172 (license:non-copyleft "chrome://credits"
1173 "See chrome://credits for more information.")
1174 license:lgpl2.1+))))
1175
1176(define-public ungoogled-chromium/wayland
1177 (package
1178 (inherit ungoogled-chromium)
1179 (name "ungoogled-chromium-wayland")
1180 (native-inputs '())
1181 (inputs
1182 (list bash-minimal (libc-utf8-locales-for-target) ungoogled-chromium))
1183 (build-system trivial-build-system)
1184 (arguments
1185 (list
1186 #:modules '((guix build utils))
1187 #:builder
1188 #~(begin
1189 (use-modules (guix build utils))
1190 (let* ((bash #$(this-package-input "bash-minimal"))
1191 (chromium #$(this-package-input "ungoogled-chromium"))
1192 (locales #$(this-package-input "glibc-utf8-locales"))
1193 (exe (string-append #$output "/bin/chromium")))
1194
1195 ;; Use a Unicode locale so we can substitute the file below.
1196 (setenv "GUIX_LOCPATH" (string-append locales "/lib/locale"))
1197 (setlocale LC_ALL "en_US.utf8")
1198
1199 (mkdir-p (dirname exe))
1200 (symlink (string-append chromium "/bin/chromedriver")
1201 (string-append #$output "/bin/chromedriver"))
1202
1203 (call-with-output-file exe
1204 (lambda (port)
1205 (format port "#!~a
1206exec ~a --enable-features=UseOzonePlatform --ozone-platform=wayland \
1207--enable-features=WebRTCPipeWireCapturer $@"
1208 (string-append bash "/bin/bash")
1209 (string-append chromium "/bin/chromium"))))
1210 (chmod exe #o555)
1211
1212 ;; Provide the manual and .desktop file.
1213 (copy-recursively (string-append chromium "/share")
1214 (string-append #$output "/share"))
1215 (substitute* (string-append
1216 #$output "/share/applications/chromium.desktop")
1217 ((chromium) #$output))))))))