projects/guix·blob python-team · refs

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