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