nongnu: google-chrome-stable: Update to 108.0.5359.124.

The main point of this patch is to make Chrome rely as little as
possible on the environment it's run into, allowing for easier
debugging. The next step would probably be to generate this list from
the input package-name.

* nongnu/packages/chrome.scm (google-chrome-stable): Update to 108.0.5359.124;
[arguments]{patchelf-inputs}: move to outer scope;
{LD_LIBRARY_PATH}: wrap the entrypoint with all of Chrome's input, this
should prevent loading libraries that are not listed as inputs from the
outer environment;
[inputs]: add some inputs following Nix's package definition to try and
fix #215.

Signed-off-by: Jonathan Brielmaier <jonathan.brielmaier@web.de>
This commit is contained in:
Giacomo Leidi 2022-12-11 01:43:36 +01:00 committed by Jonathan Brielmaier
parent 4ef2d82528
commit 5a6c35a429
No known key found for this signature in database
GPG key ID: ECFC83988B4E4B9F

View file

@ -6,17 +6,26 @@
(define-module (nongnu packages chrome) (define-module (nongnu packages chrome)
#:use-module (gnu packages base) #:use-module (gnu packages base)
#:use-module (gnu packages compression) #:use-module (gnu packages compression)
#:use-module (gnu packages curl)
#:use-module (gnu packages cups) #:use-module (gnu packages cups)
#:use-module (gnu packages fontutils) #:use-module (gnu packages fontutils)
#:use-module (gnu packages fonts)
#:use-module (gnu packages freedesktop)
#:use-module (gnu packages databases) #:use-module (gnu packages databases)
#:use-module (gnu packages gcc) #:use-module (gnu packages gcc)
#:use-module (gnu packages gl) #:use-module (gnu packages gl)
#:use-module (gnu packages glib) #:use-module (gnu packages glib)
#:use-module (gnu packages gnome) #:use-module (gnu packages gnome)
#:use-module (gnu packages gtk) #:use-module (gnu packages gtk)
#:use-module (gnu packages image)
#:use-module (gnu packages linux) #:use-module (gnu packages linux)
#:use-module (gnu packages nss) #:use-module (gnu packages nss)
#:use-module (gnu packages pciutils)
#:use-module (gnu packages photo)
#:use-module (gnu packages video)
#:use-module (gnu packages wget)
#:use-module (gnu packages xdisorg) #:use-module (gnu packages xdisorg)
#:use-module (gnu packages xiph)
#:use-module (gnu packages xml) #:use-module (gnu packages xml)
#:use-module (gnu packages xorg) #:use-module (gnu packages xorg)
#:use-module (guix download) #:use-module (guix download)
@ -31,7 +40,14 @@
(let* ((name (string-append "google-chrome-" repo)) (let* ((name (string-append "google-chrome-" repo))
(appname (if (string=? repo "stable") (appname (if (string=? repo "stable")
"chrome" "chrome"
(string-replace-substring name "google-" "")))) (string-replace-substring name "google-" "")))
(patchelf-inputs (list "alsa-lib" "at-spi2-atk" "at-spi2-core" "atk" "cairo" "cups"
"dbus" "eudev" "expat" "freetype" "fontconfig-minimal" "gcc" "gdk-pixbuf"
"glib" "gtk" "harfbuzz" "libdrm" "libnotify" "libsecret" "libx11"
"libxcb" "libexif" "libxcomposite" "libxcursor" "libxdamage"
"libxext" "libxfixes" "libxi" "libxkbcommon" "libxkbfile" "libxrandr"
"libxrender" "libxtst" "libnotify" "mesa" "nspr" "pango" "pipewire"
"sqlcipher" "xdg-utils" "zlib")))
(package (package
(name name) (name name)
(version version) (version version)
@ -49,13 +65,7 @@
;; almost 300MB, faster to download and build from Google servers ;; almost 300MB, faster to download and build from Google servers
#:substitutable? #f #:substitutable? #f
#:patchelf-plan #:patchelf-plan
#~(let ((patchelf-inputs #~(let ((patchelf-inputs (list #$@patchelf-inputs))
'("alsa-lib" "at-spi2-atk" "at-spi2-core" "atk" "cairo" "cups"
"dbus" "expat" "fontconfig-minimal" "gcc" "gdk-pixbuf" "glib"
"gtk" "libdrm" "libnotify" "libsecret" "libx11" "libxcb"
"libxcomposite" "libxcursor" "libxdamage" "libxext" "libxfixes"
"libxi" "libxkbcommon" "libxkbfile" "libxrandr" "libxrender"
"libxtst" "mesa" "nspr" "pango" "zlib"))
(path (string-append "opt/google/" #$appname "/"))) (path (string-append "opt/google/" #$appname "/")))
(map (lambda (file) (map (lambda (file)
(cons (string-append path file) (list patchelf-inputs))) (cons (string-append path file) (list patchelf-inputs)))
@ -106,7 +116,11 @@
(let* ((bin (string-append #$output "/bin")) (let* ((bin (string-append #$output "/bin"))
(exe (string-append bin "/google-" #$appname)) (exe (string-append bin "/google-" #$appname))
(share (string-append #$output "/share")) (share (string-append #$output "/share"))
(chrome-target (string-append share "/google/" #$appname "/google-" #$appname))) (chrome-target (string-append share "/google/" #$appname "/google-" #$appname))
(patchelf-inputs-packages (list #$@(map (lambda (i) (this-package-input i)) patchelf-inputs)))
(ld-library-libs (map (lambda (input)
(string-append input "/lib"))
patchelf-inputs-packages)))
(mkdir-p bin) (mkdir-p bin)
(symlink chrome-target exe) (symlink chrome-target exe)
(wrap-program exe (wrap-program exe
@ -118,19 +132,11 @@
":"))) ":")))
`("LD_LIBRARY_PATH" ":" prefix `("LD_LIBRARY_PATH" ":" prefix
(,(string-join (,(string-join
(list (append
(string-append #$(this-package-input "nss") "/lib/nss") ld-library-libs
(string-append #$(this-package-input "eudev") "/lib") (list
(string-append #$(this-package-input "gcc") "/lib") (string-append #$(this-package-input "nss") "/lib/nss")
(string-append #$(this-package-input "mesa") "/lib") #$output))
(string-append #$(this-package-input "libxkbfile") "/lib")
(string-append #$(this-package-input "zlib") "/lib")
(string-append #$(this-package-input "libsecret") "/lib")
(string-append #$(this-package-input "sqlcipher") "/lib")
(string-append #$(this-package-input "libnotify") "/lib")
(string-append #$(this-package-input "libdrm") "/lib")
(string-append #$(this-package-input "pipewire") "/lib")
#$output)
":"))) ":")))
'("CHROME_WRAPPER" = (#$appname))))))))) '("CHROME_WRAPPER" = (#$appname)))))))))
(native-inputs (list tar)) (native-inputs (list tar))
@ -139,19 +145,30 @@
at-spi2-atk at-spi2-atk
at-spi2-core at-spi2-core
atk atk
bzip2
cairo cairo
curl
cups cups
dbus dbus
eudev eudev
expat expat
flac
fontconfig fontconfig
freetype
font-liberation
`(,gcc "lib") `(,gcc "lib")
gdk-pixbuf
glib glib
gtk gtk
harfbuzz
libdrm libdrm
libexif
libglvnd
libnotify libnotify
libpng
librsvg librsvg
libsecret libsecret
libva
libx11 libx11
libxcb libxcb
libxcomposite libxcomposite
@ -163,14 +180,22 @@
libxkbcommon libxkbcommon
libxkbfile libxkbfile
libxrandr libxrandr
libxscrnsaver
libxshmfence
libxrender libxrender
libxtst libxtst
mesa mesa
nspr nspr
nss nss
opus
pango pango
pciutils
pipewire-0.3 pipewire-0.3
snappy
sqlcipher sqlcipher
util-linux
xdg-utils
wget
zlib)) zlib))
(synopsis "Freeware web browser") (synopsis "Freeware web browser")
(supported-systems '("x86_64-linux")) (supported-systems '("x86_64-linux"))
@ -179,7 +204,7 @@
(license (nonfree "https://www.google.com/intl/en/chrome/terms/"))))) (license (nonfree "https://www.google.com/intl/en/chrome/terms/")))))
(define-public google-chrome-stable (define-public google-chrome-stable
(make-google-chrome "stable" "107.0.5304.68" "1x9svz5s8fm2zhnpzjpqckzfp37hjni3nf3pm63rwnvbd06y48ja")) (make-google-chrome "stable" "108.0.5359.124" "00c11svz9dzkg57484jg7c558l0jz8jbgi5zyjs1w7xp24vpnnpg"))
(define-public google-chrome-beta (define-public google-chrome-beta
(make-google-chrome "beta" "108.0.5359.40" "1zd8dbs5w2vdnck91pqiymwa2bnz53jgjbg89cr96y6jwab3i4b0")) (make-google-chrome "beta" "108.0.5359.40" "1zd8dbs5w2vdnck91pqiymwa2bnz53jgjbg89cr96y6jwab3i4b0"))