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