1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2019 Marius Bakke <mbakke@fastmail.com>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu packages chromium)
20 #:use-module ((guix licenses) #:prefix license:)
21 #:use-module (guix packages)
22 #:use-module (guix gexp)
23 #:use-module (guix store)
24 #:use-module (guix monads)
25 #:use-module (guix download)
26 #:use-module (guix git-download)
27 #:use-module (guix utils)
28 #:use-module (guix build-system gnu)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages assembly)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages bison)
33 #:use-module (gnu packages build-tools)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages cups)
36 #:use-module (gnu packages curl)
37 #:use-module (gnu packages fontutils)
38 #:use-module (gnu packages gcc)
39 #:use-module (gnu packages ghostscript)
40 #:use-module (gnu packages gl)
41 #:use-module (gnu packages glib)
42 #:use-module (gnu packages gnome)
43 #:use-module (gnu packages gperf)
44 #:use-module (gnu packages gtk)
45 #:use-module (gnu packages icu4c)
46 #:use-module (gnu packages image)
47 #:use-module (gnu packages libevent)
48 #:use-module (gnu packages libffi)
49 #:use-module (gnu packages linux)
50 #:use-module (gnu packages kerberos)
51 #:use-module (gnu packages ninja)
52 #:use-module (gnu packages node)
53 #:use-module (gnu packages nss)
54 #:use-module (gnu packages pciutils)
55 #:use-module (gnu packages pkg-config)
56 #:use-module (gnu packages pulseaudio)
57 #:use-module (gnu packages python)
58 #:use-module (gnu packages python-web)
59 #:use-module (gnu packages python-xyz)
60 #:use-module (gnu packages regex)
61 #:use-module (gnu packages serialization)
62 #:use-module (gnu packages speech)
63 #:use-module (gnu packages tls)
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)
70 #:use-module (gnu packages xorg))
72 (define %preserved-third-party-files
73 '("base/third_party/dmg_fp" ;X11-style
74 "base/third_party/dynamic_annotations" ;BSD-2
75 "base/third_party/icu" ;Unicode, X11-style
76 "base/third_party/superfasthash" ;BSD-3
77 "base/third_party/symbolize" ;BSD-3
78 "base/third_party/xdg_mime" ;LGPL2.0+ or Academic 2.0
79 "base/third_party/xdg_user_dirs" ;Expat
80 "chrome/third_party/mozilla_security_manager" ;MPL-1.1/GPL2+/LGPL2.1+
81 "courgette/third_party/bsdiff" ;BSD-2, BSD protection license
82 "courgette/third_party/divsufsort" ;Expat
83 "net/third_party/mozilla_security_manager" ;MPL-1.1/GPL2+/LGPL2.1+
84 "net/third_party/nss" ;MPL-2.0
85 "net/third_party/quic" ;BSD-3
86 "net/third_party/uri_template" ;ASL2.0
87 "third_party/abseil-cpp" ;ASL2.0
88 "third_party/adobe/flash/flapper_version.h" ;no license, trivial
89 "third_party/angle" ;BSD-3
90 "third_party/angle/src/common/third_party/base" ;BSD-3
91 "third_party/angle/src/common/third_party/smhasher" ;Public domain
92 "third_party/angle/src/common/third_party/xxhash" ;BSD-2
93 "third_party/angle/src/third_party/compiler" ;BSD-2
94 "third_party/angle/src/third_party/libXNVCtrl" ;Expat
95 "third_party/angle/src/third_party/trace_event" ;BSD-3
96 "third_party/angle/third_party/vulkan-headers" ;ASL2.0
97 "third_party/angle/third_party/vulkan-loader" ;ASL2.0
98 "third_party/angle/third_party/vulkan-tools" ;ASL2.0
99 "third_party/angle/third_party/vulkan-validation-layers" ;ASL2.0
100 "third_party/apple_apsl" ;APSL2.0
101 "third_party/blink" ;BSD-3, LGPL2+
102 "third_party/boringssl" ;OpenSSL/ISC (Google additions are ISC)
103 "third_party/boringssl/src/third_party/fiat" ;Expat
104 "third_party/breakpad" ;BSD-3
105 "third_party/brotli" ;Expat
106 "third_party/cacheinvalidation" ;ASL2.0
107 "third_party/catapult" ;BSD-3
108 "third_party/catapult/common/py_vulcanize/third_party/rcssmin" ;ASL2.0
109 "third_party/catapult/common/py_vulcanize/third_party/rjsmin" ;ASL2.0
110 "third_party/catapult/third_party/polymer" ;BSD-3
111 "third_party/catapult/tracing/third_party/d3" ;BSD-3
112 "third_party/catapult/tracing/third_party/gl-matrix" ;Expat
113 "third_party/catapult/tracing/third_party/jszip" ;Expat or GPL3
114 "third_party/catapult/tracing/third_party/mannwhitneyu" ;Expat
115 "third_party/catapult/tracing/third_party/oboe" ;BSD-2
116 "third_party/catapult/tracing/third_party/pako" ;Expat
117 "third_party/ced" ;BSD-3
118 "third_party/cld_3" ;ASL2.0
119 "third_party/crashpad" ;ASL2.0
120 "third_party/crashpad/crashpad/third_party/zlib/zlib_crashpad.h" ;Zlib
121 "third_party/crc32c" ;BSD-3
122 "third_party/cros_system_api" ;BSD-3
123 "third_party/dav1d" ;BSD-2
124 "third_party/dom_distiller_js" ;BSD-3
125 "third_party/emoji-segmenter" ;ASL2.0
126 "third_party/fips181" ;BSD-3
127 "third_party/flatbuffers" ;ASL2.0
128 "third_party/glslang" ;BSD-3, Expat, ASL2.0
129 "third_party/google_input_tools" ;ASL2.0
130 "third_party/google_input_tools/third_party/closure_library" ;ASL2.0
131 "third_party/google_input_tools/third_party/closure_library/third_party/closure" ;Expat
132 "third_party/googletest" ;BSD-3
133 "third_party/hunspell" ;MPL1.1/GPL2+/LGPL2.1+
134 "third_party/iccjpeg" ;IJG
135 "third_party/inspector_protocol" ;BSD-3
136 "third_party/jinja2" ;BSD-3
137 "third_party/jstemplate" ;ASL2.0
138 "third_party/khronos" ;Expat, SGI
139 "third_party/leveldatabase" ;BSD-3
140 "third_party/libXNVCtrl" ;Expat
141 "third_party/libaddressinput" ;ASL2.0
142 "third_party/libaom" ;BSD-2 or "Alliance for Open Media Patent License 1.0"
143 "third_party/libaom/source/libaom/third_party/vector" ;Expat
144 "third_party/libaom/source/libaom/third_party/x86inc" ;ISC
145 "third_party/libjingle_xmpp" ;BSD-3
146 "third_party/libphonenumber" ;ASL2.0
147 "third_party/libsecret" ;LGPL2.1+
148 "third_party/libsrtp" ;BSD-3
149 "third_party/libsync" ;ASL2.0
150 "third_party/libudev" ;LGPL2.1+
151 "third_party/libwebm" ;BSD-3
152 "third_party/libxml/chromium" ;BSD-3
153 "third_party/libyuv" ;BSD-3
154 "third_party/lss" ;BSD-3
155 "third_party/markupsafe" ;BSD-3
156 "third_party/mesa_headers" ;Expat, SGI
157 "third_party/metrics_proto" ;BSD-3
158 "third_party/modp_b64" ;BSD-3
159 "third_party/nasm" ;BSD-2
160 "third_party/node" ;Expat
161 "third_party/node/node_modules/polymer-bundler/lib/third_party/UglifyJS2" ;BSD-2
162 "third_party/ots" ;BSD-3
163 "third_party/pdfium" ;BSD-3
164 "third_party/pdfium/third_party/agg23" ;Expat
165 "third_party/pdfium/third_party/base" ;BSD-3
166 "third_party/pdfium/third_party/bigint" ;Public domain, BSD-3
167 "third_party/pdfium/third_party/skia_shared" ;BSD-3
168 "third_party/pdfium/third_party/freetype/include/pstables.h" ;FreeType
169 "third_party/ply" ;BSD-3
170 "third_party/polymer" ;BSD-3
171 "third_party/protobuf" ;BSD-3
172 "third_party/protobuf/third_party/six" ;Expat
173 "third_party/pyjson5" ;ASL2.0
174 "third_party/qcms" ;Expat
175 "third_party/rnnoise" ;BSD-3
176 "third_party/s2cellid" ;ASL2.0
177 "third_party/sfntly" ;ASL2.0
178 "third_party/skia" ;BSD-3
179 "third_party/skia/third_party/gif" ;MPL1.1/GPL2+/LGPL2.1+
180 "third_party/skia/third_party/skcms" ;BSD-3
181 "third_party/skia/third_party/vulkan" ;BSD-3
182 "third_party/smhasher" ;Expat, public domain
183 "third_party/speech-dispatcher" ;GPL2+
184 "third_party/spirv-headers" ;ASL2.0
185 "third_party/SPIRV-Tools" ;ASL2.0
186 "third_party/sqlite" ;Public domain
187 "third_party/ungoogled" ;BSD-3
188 "third_party/usb_ids" ;BSD-3
189 "third_party/usrsctp" ;BSD-2
190 "third_party/web-animations-js" ;ASL2.0
191 "third_party/webdriver" ;ASL2.0
192 "third_party/webrtc" ;BSD-3
193 "third_party/webrtc/common_audio/third_party/fft4g" ;Non-copyleft
194 "third_party/webrtc/common_audio/third_party/spl_sqrt_floor" ;Public domain
195 "third_party/webrtc/modules/third_party/fft" ;Non-copyleft
196 "third_party/webrtc/modules/third_party/g711" ;Public domain
197 "third_party/webrtc/modules/third_party/g722" ;Public domain
198 "third_party/webrtc/rtc_base/third_party/base64" ;Non-copyleft
199 "third_party/webrtc/rtc_base/third_party/sigslot" ;Public domain
200 "third_party/widevine/cdm/widevine_cdm_version.h" ;BSD-3
201 "third_party/widevine/cdm/widevine_cdm_common.h" ;BSD-3
202 "third_party/woff2" ;ASL2.0
203 "third_party/xdg-utils" ;Expat
204 "third_party/yasm/run_yasm.py" ;BSD-2 or BSD-3
205 "third_party/zlib/google" ;BSD-3
206 "url/third_party/mozilla" ;BSD-3, MPL1.1/GPL2+/LGPL2.1+
207 "v8/src/third_party/siphash" ;Public domain
208 "v8/src/third_party/utf8-decoder" ;Expat
209 "v8/src/third_party/valgrind" ;BSD-4
210 "v8/third_party/inspector_protocol" ;BSD-3
211 "v8/third_party/v8/builtins")) ;PSFL
213 (define* (computed-origin-method gexp-promise hash-algo hash
214 #:optional (name "source")
215 #:key (system (%current-system))
216 (guile (default-guile)))
217 "Return a derivation that executes the G-expression that results
218 from forcing GEXP-PROMISE."
219 (mlet %store-monad ((guile (package->derivation guile system)))
220 (gexp->derivation (or name "computed-origin")
222 #:graft? #f ;nothing to graft
224 #:guile-for-build guile)))
226 (define %chromium-version "74.0.3729.131")
227 (define %ungoogled-revision "9e33022f3ac7de2a12e3c7a7923799c9bbbf8194")
228 (define %debian-revision "debian/74.0.3729.108-1")
229 (define package-revision "0")
231 (define %package-version (string-append %chromium-version "-"
233 (string-take %ungoogled-revision 7)))
235 ;; This is a "computed" origin that does the following:
236 ;; *) Runs the Ungoogled scripts on a pristine Chromium tarball.
237 ;; *) Applies Debians Chromium patches, for their unbundling and GCC work.
238 ;; *) Prunes all third_party directories that are not explicitly preserved.
239 ;; *) Adjusts "GN" build files such that system libraries are preferred.
240 (define ungoogled-chromium-source
241 (let ((chromium-source
244 (uri (string-append "https://commondatastorage.googleapis.com"
245 "/chromium-browser-official/chromium-"
246 %chromium-version ".tar.xz"))
249 "11m9mlzrqzmz7rhl0ff7lry2s4yjrdkfi36qfv48m1cg5y2cfy6i"))))
253 (uri (git-reference (url "https://github.com/Eloston/ungoogled-chromium")
254 (commit %ungoogled-revision)))
255 (file-name (git-file-name "ungoogled-chromium"
256 (string-take %ungoogled-revision 7)))
259 "08whx582p3a2nivkj7kwin09a8acybr00z6344smb9xjlxy9rkp4"))))
264 (url "https://salsa.debian.org/chromium-team/chromium.git")
265 (commit %debian-revision)))
266 (file-name (git-file-name "debian-chromium-packaging"
267 (if (string-prefix? "debian/" %debian-revision)
268 (cadr (string-split %debian-revision #\/))
269 (string-take %debian-revision 7))))
272 "1bn0c86sxkkxgdz0i88y0zh4zr39l6379r2rhgk3b3qbvwz25s3j")))))
275 (method computed-origin-method)
276 (file-name (string-append "ungoogled-chromium-" %package-version ".tar.xz"))
280 (with-imported-modules '((guix build utils))
282 (use-modules (guix build utils)
286 (let ((chromium-dir (string-append "chromium-" #$%chromium-version))
287 (preserved-files (list #$@%preserved-third-party-files)))
289 (set-path-environment-variable
291 (list #+(canonical-package patch)
292 #+(canonical-package xz)
293 #+(canonical-package tar)
297 (copy-recursively #+ungoogled-source "/tmp/ungoogled")
299 (with-directory-excursion "/tmp/ungoogled"
301 (format #t "Unpacking chromium tarball...~%")
303 (invoke "tar" "xf" #+chromium-source)
305 (format #t "Ungooglifying...~%")
307 (invoke "python3" "utils/prune_binaries.py" chromium-dir
309 (invoke "python3" "utils/patches.py" "apply"
310 chromium-dir "patches")
311 (invoke "python3" "utils/domain_substitution.py" "apply" "-r"
312 "domain_regex.list" "-f" "domain_substitution.list"
313 "-c" "/tmp/domainscache.tar.gz" chromium-dir)
315 (with-directory-excursion chromium-dir
317 (format #t "applying Debian patches...~%")
319 (let* ((debian #+debian-source)
320 (patches (string-append debian "/debian/patches"))
321 (series (string-append patches "/series"))
322 (grep-q (lambda (query file)
323 (with-input-from-file file
325 (let loop ((line (read-line))
327 (if (or match (eof-object? line))
330 (string-contains line query)))))))))
331 (with-input-from-file series
333 (let loop ((line (read-line)))
334 (unless (eof-object? line)
335 (when (and (> (string-length line) 1)
336 ;; Skip the Debian-specific ones.
337 (not (string-prefix? "debianization/" line))
338 (not (string-prefix? "gcc6/" line))
339 ;; And those that conflict with Ungoogled.
340 (not (any (cute string-suffix? <> line)
341 '("widevine-buildflag.patch"
343 "third-party-cookies.patch")))
344 ;; Ungoogled includes a subset of the Debian
345 ;; patches. Exclude those already present.
346 (not (grep-q line "../patches/series")))
347 (invoke "patch" "--force" "-p1" "--input"
348 (string-append patches "/" line)
349 "--no-backup-if-mismatch"))
350 (loop (read-line)))))))
352 (format #t "Pruning third party files...~%")
354 (apply invoke "python"
355 "build/linux/unbundle/remove_bundled_libraries.py"
356 "--do-remove" preserved-files)
358 (format #t "Replacing GN files...~%")
360 (invoke "python3" "build/linux/unbundle/replace_gn_files.py"
361 "--system-libraries" "ffmpeg" "flac" "fontconfig"
362 "freetype" "harfbuzz-ng" "icu" "libdrm" "libevent"
363 "libjpeg" "libpng" "libvpx" "libwebp" "libxml"
364 "libxslt" "openh264" "opus" "re2" "snappy" "yasm"
367 (format #t (string-append "Packing new ungoogled tarball ...~%"))
369 (invoke "tar" "cvfa" #$output
370 ;; Avoid non-determinism in the archive.
380 (package/inherit opus
383 (substitute-keyword-arguments (package-arguments opus)
384 ((#:configure-flags flags ''())
385 ;; Opus Custom is an optional extension of the Opus
386 ;; specification that allows for unsupported frame
387 ;; sizes. Chromium requires that this is enabled.
388 `(cons "--enable-custom-modes"
391 (define-public ungoogled-chromium
393 (name "ungoogled-chromium")
394 (version %package-version)
395 (synopsis "Graphical web browser")
396 (source ungoogled-chromium-source)
397 (build-system gnu-build-system)
400 ;; FIXME: Chromiums RUNPATH lacks entries for some libraries, so
401 ;; we have to disable validation and add a wrapper below.
402 #:validate-runpath? #f
403 #:modules ((guix build gnu-build-system)
409 ;; See tools/gn/docs/cookbook.md and
410 ;; https://www.chromium.org/developers/gn-build-configuration
411 ;; for usage. Run "./gn args . --list" in the Release
412 ;; directory for an exhaustive list of supported flags.
413 ;; (Note: The 'configure' phase will do that for you.)
414 (list "is_debug=false"
417 "linux_use_bundled_binutils=false"
418 "use_custom_libcxx=false"
420 "enable_precompiled_headers=false"
423 "enable_nacl_nonsfi=false"
424 "use_allocator=\"none\""
425 "use_unofficial_version_number=false"
426 "treat_warnings_as_errors=false"
427 "use_official_google_api_keys=false"
428 "fieldtrial_testing_like_official_build=true"
429 "safe_browsing_mode=0"
431 "enable_one_click_signin=false"
432 "enable_reading_list=false"
433 "enable_remoting=false"
434 "enable_reporting=false"
435 "enable_service_discovery=false"
436 "enable_swiftshader=false"
437 "enable_widevine=false"
438 ;; Disable type-checking for the Web UI to avoid a Java dependency.
439 "closure_compile=false"
441 ;; Define a custom toolchain that simply looks up CC, AR and
442 ;; friends from the environment.
443 "custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
444 "host_toolchain=\"//build/toolchain/linux/unbundle:default\""
445 ;; Don't assume it's clang.
447 ;; Disable debugging features to save space. These are normally
448 ;; pulled in by "is_official_build", but that requires "is_clang".
449 "blink_symbol_level=0"
450 "enable_iterator_debugging=false"
451 "exclude_unwind_tables=true"
452 ;; Optimize for building everything at once, as opposed to
453 ;; incrementally for development. See "docs/jumbo.md".
454 "use_jumbo_build=true"
456 ;; Prefer system libraries.
457 "use_system_freetype=true"
458 "use_system_harfbuzz=true"
459 "use_system_lcms2=true"
460 "use_system_libdrm=true"
461 "use_system_libjpeg=true"
462 "use_system_libopenjpeg2=true"
463 "use_system_libpng=true"
464 "use_system_zlib=true"
465 "use_gnome_keyring=false" ;deprecated by libsecret
467 "use_pulseaudio=true"
468 "link_pulseaudio=true"
470 ;; VA-API acceleration is currently only supported on x86_64-linux.
471 ,@(if (string-prefix? "x86_64" (or (%current-target-system)
476 ;; Don't arbitrarily restrict formats supported by system ffmpeg.
477 "proprietary_codecs=true"
478 "ffmpeg_branding=\"Chrome\""
482 ;; Don't use bundled sources.
483 "rtc_build_json=false"
484 "rtc_build_libevent=false"
485 "rtc_build_libvpx=false"
486 "rtc_build_opus=false"
487 "rtc_build_ssl=false"
488 "rtc_build_libsrtp=true" ;FIXME: fails to find headers
489 "rtc_build_usrsctp=true" ;TODO: package this
490 (string-append "rtc_jsoncpp_root=\""
491 (assoc-ref %build-inputs "jsoncpp")
492 "/include/jsoncpp/json\"")
493 (string-append "rtc_ssl_root=\""
494 (assoc-ref %build-inputs "openssl")
495 "/include/openssl\""))
497 (modify-phases %standard-phases
498 (add-after 'unpack 'patch-stuff
499 (lambda* (#:key inputs #:allow-other-keys)
500 (substitute* "printing/cups_config_helper.py"
502 (string-append "cups_config = '" (assoc-ref inputs "cups")
503 "/bin/cups-config'\n")))
506 '("base/process/launch_posix.cc"
507 "base/third_party/dynamic_annotations/dynamic_annotations.c"
508 "sandbox/linux/seccomp-bpf/sandbox_bpf.cc"
509 "sandbox/linux/services/credentials.cc"
510 "sandbox/linux/services/namespace_utils.cc"
511 "sandbox/linux/services/syscall_wrappers.cc"
512 "sandbox/linux/syscall_broker/broker_host.cc")
513 (("include \"base/third_party/valgrind/") "include \"valgrind/"))
515 (for-each (lambda (file)
517 ;; Fix opus include path.
518 ;; Do not substitute opus_private.h.
519 (("#include \"opus\\.h\"")
520 "#include \"opus/opus.h\"")
521 (("#include \"opus_custom\\.h\"")
522 "#include \"opus/opus_custom.h\"")
523 (("#include \"opus_defines\\.h\"")
524 "#include \"opus/opus_defines.h\"")
525 (("#include \"opus_multistream\\.h\"")
526 "#include \"opus/opus_multistream.h\"")
527 (("#include \"opus_types\\.h\"")
528 "#include \"opus/opus_types.h\"")))
529 (find-files (string-append "third_party/webrtc/modules"
530 "/audio_coding/codecs/opus")))
532 (substitute* "chrome/common/chrome_paths.cc"
533 (("/usr/share/chromium/extensions")
534 ;; TODO: Add ~/.guix-profile.
535 "/run/current-system/profile/share/chromium/extensions"))
537 ;; XXX: Should be unnecessary when use_system_lcms2=true.
538 (substitute* "third_party/pdfium/core/fxcodec/codec/ccodec_iccmodule.h"
539 (("include \"third_party/lcms/include/lcms2\\.h\"")
540 "include \"lcms2.h\""))
543 "third_party/breakpad/breakpad/src/common/linux/libcurl_wrapper.h"
544 (("include \"third_party/curl") "include \"curl"))
546 (substitute* "third_party/webrtc/rtc_base/strings/json.h"
547 (("#include \"third_party/jsoncpp/") "#include \"json/"))
549 (substitute* '("ui/gfx/skia_util.h"
550 "components/viz/common/resources/resource_format_utils.h")
551 (("third_party/vulkan/include/") ""))
553 (substitute* "third_party/skia/include/gpu/vk/GrVkVulkan.h"
554 (("\\.\\./\\.\\./include/third_party/vulkan/") ""))
556 ;; Building chromedriver embeds some files using the ZIP
557 ;; format which doesn't support timestamps before
558 ;; 1980. Therefore, advance the timestamps of the files
559 ;; which are included so that building chromedriver
561 (let ((circa-1980 (* 10 366 24 60 60)))
562 (for-each (lambda (file)
563 (utime file circa-1980 circa-1980))
564 '("chrome/test/chromedriver/extension/background.js"
565 "chrome/test/chromedriver/extension/manifest.json")))
568 (add-before 'configure 'prepare-build-environment
569 (lambda* (#:key inputs #:allow-other-keys)
571 ;; Make sure the right build tools are used.
572 (setenv "AR" "ar") (setenv "NM" "nm")
573 (setenv "CC" "gcc") (setenv "CXX" "g++")
575 ;; Work around <https://bugs.gnu.org/30756>.
576 (unsetenv "C_INCLUDE_PATH")
577 (unsetenv "CPLUS_INCLUDE_PATH")
579 ;; TODO: pre-compile instead. Avoids a race condition.
580 (setenv "PYTHONDONTWRITEBYTECODE" "1")
582 ;; XXX: How portable is this.
583 (mkdir-p "third_party/node/linux/node-linux-x64")
584 (symlink (string-append (assoc-ref inputs "node") "/bin")
585 "third_party/node/linux/node-linux-x64/bin")
589 (lambda* (#:key configure-flags #:allow-other-keys)
590 (let ((args (string-join configure-flags " ")))
591 ;; Generate ninja build files.
592 (invoke "gn" "gen" "out/Release"
593 (string-append "--args=" args))
595 ;; Print the full list of supported arguments as well as
596 ;; their current status for convenience.
597 (format #t "Dumping configure flags...\n")
598 (invoke "gn" "args" "out/Release" "--list"))))
600 (lambda* (#:key outputs #:allow-other-keys)
601 (invoke "ninja" "-C" "out/Release"
602 "-j" (number->string (parallel-job-count))
606 (lambda* (#:key inputs outputs #:allow-other-keys)
607 (let* ((out (assoc-ref outputs "out"))
608 (bin (string-append out "/bin"))
609 (exe (string-append bin "/chromium"))
610 (lib (string-append out "/lib"))
611 (man (string-append out "/share/man/man1"))
612 (applications (string-append out "/share/applications"))
613 (install-regexp (make-regexp "\\.(bin|pak)$"))
614 (locales (string-append lib "/locales"))
615 (resources (string-append lib "/resources"))
616 (preferences (assoc-ref inputs "master-preferences"))
617 (gtk+ (assoc-ref inputs "gtk+"))
618 (mesa (assoc-ref inputs "mesa"))
619 (nss (assoc-ref inputs "nss"))
620 (udev (assoc-ref inputs "udev"))
623 (substitute* '("chrome/app/resources/manpage.1.in"
624 "chrome/installer/linux/common/desktop.template")
625 (("@@MENUNAME@@") "Chromium")
626 (("@@PACKAGE@@") "chromium")
627 (("/usr/bin/@@USR_BIN_SYMLINK_NAME@@") exe))
630 (copy-file "chrome/app/resources/manpage.1.in"
631 (string-append man "/chromium.1"))
633 (mkdir-p applications)
634 (copy-file "chrome/installer/linux/common/desktop.template"
635 (string-append applications "/chromium.desktop"))
638 (copy-file preferences (string-append lib "/master_preferences"))
640 (with-directory-excursion "out/Release"
641 (for-each (lambda (file)
642 (install-file file lib))
643 (scandir "." (cut regexp-exec install-regexp <>)))
644 (copy-file "chrome" (string-append lib "/chromium"))
646 ;; TODO: Install icons from "../../chrome/app/themes" into
647 ;; "out/share/icons/hicolor/$size".
649 "product_logo_48.png"
650 (string-append out "/share/icons/48x48/chromium.png"))
652 (copy-recursively "locales" locales)
653 (copy-recursively "resources" resources)
656 (symlink "../lib/chromium" exe)
657 (install-file "chromedriver" bin)
660 ;; TODO: Get these in RUNPATH.
661 `("LD_LIBRARY_PATH" ":" prefix
662 (,(string-append lib ":" nss "/lib/nss:" mesa "/lib:"
664 ;; Avoid file manager crash. See <https://bugs.gnu.org/26593>.
665 `("XDG_DATA_DIRS" ":" prefix (,(string-append gtk+ "/share"))))
674 ("pkg-config" ,pkg-config)
678 ;; This file contains defaults for new user profiles.
679 ("master-preferences" ,(local-file "aux-files/chromium/master-preferences.json"))
681 ("python-beautifulsoup4" ,python2-beautifulsoup4)
682 ("python-html5lib" ,python2-html5lib)
683 ("python" ,python-2)))
685 `(("alsa-lib" ,alsa-lib)
690 ("dbus-glib" ,dbus-glib)
694 ("fontconfig" ,fontconfig)
695 ("freetype" ,freetype)
696 ("gdk-pixbuf" ,gdk-pixbuf)
699 ("harfbuzz" ,harfbuzz)
703 ("libevent" ,libevent)
705 ("libjpeg-turbo" ,libjpeg-turbo)
712 ("libxcomposite" ,libxcomposite)
713 ("libxcursor" ,libxcursor)
714 ("libxdamage" ,libxdamage)
716 ("libxfixes" ,libxfixes)
719 ("libxrandr" ,libxrandr)
720 ("libxrender" ,libxrender)
721 ("libxscrnsaver" ,libxscrnsaver)
726 ("mit-krb5" ,mit-krb5)
728 ("openh264" ,openh264)
729 ("openjpeg" ,openjpeg) ;PDFium only
731 ("opus" ,opus+custom)
733 ("pciutils" ,pciutils)
734 ("pulseaudio" ,pulseaudio)
737 ("speech-dispatcher" ,speech-dispatcher)
739 ("valgrind" ,valgrind)
740 ("vulkan-headers" ,vulkan-headers)))
741 (home-page "https://github.com/Eloston/ungoogled-chromium")
743 "Ungoogled-Chromium is the Chromium web browser, with some functionality
744 disabled in order to protect the users privacy.")
745 ;; Chromium is developed as BSD-3, but bundles a large number of third-party
746 ;; components with other licenses. For full information, see chrome://credits.
747 (license (list license:bsd-3
753 license:public-domain
755 (license:non-copyleft "chrome://credits"
756 "See chrome://credits for more information.")