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