nongnu: make-google-chrome: Use chromium-binary-build-system.

* nongnu/packages/chrome.scm (make-google-chrome) [patchelf-inputs]:
Drop them since the build system adds all inputs to the patchelf plan;
[build-system]: Use chromium-binary-build-system;
[patchelf-plan]: Drop it since the build system figures it out from the
wrapper plan;
[wrapper-plan]: New argument;
[phases]: Adjust to chromium-build-system;
[inputs]: Drop the inputs provided by the build system.

Signed-off-by: Jonathan Brielmaier <jonathan.brielmaier@web.de>
This commit is contained in:
Giacomo Leidi 2023-05-19 16:04:15 +02:00 committed by Jonathan Brielmaier
parent f2970727de
commit cd4870d1d7
No known key found for this signature in database
GPG key ID: ECFC83988B4E4B9F

View file

@ -1,5 +1,5 @@
;;; SPDX-License-Identifier: GPL-3.0-or-later ;;; SPDX-License-Identifier: GPL-3.0-or-later
;;; Copyright © 2022 Giacomo Leidi <goodoldpaul@autistici.org> ;;; Copyright © 2022, 2023 Giacomo Leidi <goodoldpaul@autistici.org>
;;; Copyright © 2022 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2022 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2022 Jonathan Brielmaier <jonathan.brielmaier@web.de> ;;; Copyright © 2022 Jonathan Brielmaier <jonathan.brielmaier@web.de>
@ -7,32 +7,23 @@
#: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 curl)
#:use-module (gnu packages cups)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages fonts) #:use-module (gnu packages fonts)
#:use-module (gnu packages freedesktop) #:use-module (gnu packages freedesktop)
#:use-module (gnu packages databases)
#:use-module (gnu packages gcc)
#:use-module (gnu packages gl) #:use-module (gnu packages gl)
#:use-module (gnu packages glib)
#:use-module (gnu packages gnome)
#:use-module (gnu packages gtk) #:use-module (gnu packages gtk)
#:use-module (gnu packages image) #:use-module (gnu packages image)
#:use-module (gnu packages linux) #:use-module (gnu packages linux)
#:use-module (gnu packages nss)
#:use-module (gnu packages pciutils) #:use-module (gnu packages pciutils)
#:use-module (gnu packages photo) #:use-module (gnu packages photo)
#:use-module (gnu packages video) #:use-module (gnu packages video)
#:use-module (gnu packages wget) #:use-module (gnu packages wget)
#:use-module (gnu packages xdisorg)
#:use-module (gnu packages xiph) #:use-module (gnu packages xiph)
#:use-module (gnu packages xml)
#:use-module (gnu packages xorg) #:use-module (gnu packages xorg)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix gexp) #:use-module (guix gexp)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (nonguix build-system binary) #:use-module (nonguix build-system chromium-binary)
#:use-module (nonguix licenses) #:use-module (nonguix licenses)
#:use-module (ice-9 string-fun)) #:use-module (ice-9 string-fun))
@ -40,14 +31,7 @@
(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)
@ -59,16 +43,15 @@
name "/" name "_" version "-1_amd64.deb")) name "/" name "_" version "-1_amd64.deb"))
(sha256 (sha256
(base32 hash)))) (base32 hash))))
(build-system binary-build-system) (build-system chromium-binary-build-system)
(arguments (arguments
(list (list
;; 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 #:wrapper-plan
#~(let ((patchelf-inputs (list #$@patchelf-inputs)) #~(let ((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))) (string-append path file))
'("chrome" '("chrome"
"chrome-sandbox" "chrome-sandbox"
"chrome_crashpad_handler" "chrome_crashpad_handler"
@ -111,92 +94,36 @@
(("/opt") share) (("/opt") share)
((old-exe) exe)) ((old-exe) exe))
#t))) #t)))
(add-after 'install 'install-wrapper (add-before 'install-wrapper 'install-exe
(lambda _ (lambda _
(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
`("FONTCONFIG_PATH" ":" prefix
(,(string-join
(list
(string-append #$(this-package-input "fontconfig-minimal") "/etc/fonts")
#$output)
":")))
`("LD_LIBRARY_PATH" ":" prefix
(,(string-join
(append
ld-library-libs
(list
(string-append #$(this-package-input "nss") "/lib/nss")
#$output))
":")))
'("CHROME_WRAPPER" = (#$appname))))))))) '("CHROME_WRAPPER" = (#$appname)))))))))
(native-inputs (list tar)) (native-inputs (list tar))
(inputs (inputs
(list alsa-lib (list bzip2
at-spi2-atk
at-spi2-core
atk
bzip2
cairo
curl curl
cups
dbus
eudev
expat
flac flac
fontconfig
freetype
font-liberation font-liberation
`(,gcc "lib")
gdk-pixbuf gdk-pixbuf
glib
gtk
harfbuzz harfbuzz
libdrm
libexif libexif
libglvnd libglvnd
libnotify
libpng libpng
librsvg
libsecret
libva libva
libx11
libxcb
libxcomposite
libxcursor
libxdamage
libxext
libxfixes
libxi
libxkbcommon
libxkbfile
libxrandr
libxscrnsaver libxscrnsaver
libxshmfence
libxrender
libxtst
mesa
nspr
nss
opus opus
pango
pciutils pciutils
pipewire pipewire
snappy snappy
sqlcipher
util-linux util-linux
xdg-utils xdg-utils
wget wget))
zlib))
(synopsis "Freeware web browser") (synopsis "Freeware web browser")
(supported-systems '("x86_64-linux")) (supported-systems '("x86_64-linux"))
(description "Google Chrome is a cross-platform web browser developed by Google.") (description "Google Chrome is a cross-platform web browser developed by Google.")