Browse Source

gnu: ungoogled-chromium: Enable all release optimizations.

* gnu/packages/chromium.scm (ungoogled-chromium-snippet): Add substitution to
allow using unbundled dependencies in "official" builds.
(lld-as-ld, lld-wrapper, lld/wrapped): New variables.
(ungoogled-chromium)[arguments]: Add "is_official_build" to #:configure-flags.
Remove redundant or unnecessary flags, disable system protobuf.  Use llvm-ar
and llvm-nm instead of their binutils equivalents.
[native-inputs]: Add LLD/WRAPPED.
[inputs]: Remove PROTOBUF.
Marius Bakke 1 year ago
No known key found for this signature in database GPG Key ID: A2A06DF2A33A54FA
  1. 49


@ -385,6 +385,13 @@ chromium-fix-vaapi-on-intel.patch?h=packages/chromium\
(format #t "Replacing GN files...~%")
(substitute* "tools/generate_shim_headers/"
;; The "is_official_build" configure option enables certain
;; release optimizations like those used in the commercial
;; Chrome browser. Unfortunately it also requires using the
;; bundled libraries: lose that restriction.
(("#if defined\\(OFFICIAL_BUILD\\)")
"#if 0"))
(invoke "python" "build/linux/unbundle/"
"--system-libraries" "ffmpeg" "flac" "fontconfig"
"freetype" "harfbuzz-ng" "icu" "libdrm" "libevent"
@ -414,6 +421,31 @@ chromium-fix-vaapi-on-intel.patch?h=packages/chromium\
`(("pkg-config" ,pkg-config)
("python" ,python-2)))))
;; 'make-ld-wrapper' can only work with an 'ld' executable, so we need
;; this trick to make it wrap 'lld'.
(define lld-as-ld
(computed-file "lld-ld"
(mkdir #$output)
(mkdir (string-append #$output "/bin"))
(symlink #$(file-append lld "/bin/lld")
(string-append #$output "/bin/ld")))))
;; Create a wrapper for LLD that inserts appropriate -rpath entries.
(define lld-wrapper
(make-ld-wrapper "lld-wrapper"
#:binutils lld-as-ld))
;; Clang looks for an 'ld.lld' executable, so we need to symlink it back.
(define lld/wrapped
(computed-file "lld-wrapped"
(mkdir #$output)
(mkdir (string-append #$output "/bin"))
(symlink #$(file-append lld-wrapper "/bin/ld")
(string-append #$output "/bin/lld"))
(symlink "lld" (string-append #$output "/bin/ld.lld")))))
(define-public ungoogled-chromium
(name "ungoogled-chromium")
@ -447,16 +479,14 @@ chromium-fix-vaapi-on-intel.patch?h=packages/chromium\
;; directory for an exhaustive list of supported flags.
;; (Note: The 'configure' phase will do that for you.)
(list "is_debug=false"
;; Use the "official" release optimizations, as opposed to
;; a developer build.
(string-append "max_jobs_per_link="
(number->string (parallel-job-count)))
@ -499,7 +529,10 @@ chromium-fix-vaapi-on-intel.patch?h=packages/chromium\
;; FIXME: Using system protobuf with "is_official_build" causes an
;; invalid opcode and "protoc-gen-plugin: Plugin killed by signal 4".
;; VA-API acceleration is currently only supported on x86_64-linux.
,@(if (string-prefix? "x86_64" (or (%current-target-system)
@ -628,7 +661,7 @@ chromium-fix-vaapi-on-intel.patch?h=packages/chromium\
(lambda* (#:key inputs #:allow-other-keys)
;; Make sure the right build tools are used.
(setenv "AR" "ar") (setenv "NM" "nm")
(setenv "AR" "llvm-ar") (setenv "NM" "llvm-nm")
(setenv "CC" "clang") (setenv "CXX" "clang++")
(setenv "CXXFLAGS"
@ -755,6 +788,7 @@ chromium-fix-vaapi-on-intel.patch?h=packages/chromium\
("clang" ,clang-10)
("gn" ,gn)
("gperf" ,gperf)
("ld-wrapper" ,lld/wrapped)
("ninja" ,ninja)
("node" ,node)
("pkg-config" ,pkg-config)
@ -816,7 +850,6 @@ chromium-fix-vaapi-on-intel.patch?h=packages/chromium\
("opus" ,opus+custom)
("pango" ,pango)
("pciutils" ,pciutils)
("protobuf" ,protobuf)
("pulseaudio" ,pulseaudio)
("re2" ,re2)
("snappy" ,snappy)