From 7e56eeca56a8d582f8c288d3dce33217c9d001da Mon Sep 17 00:00:00 2001 From: Krzysztof Baranowski Date: Sun, 16 Jun 2024 16:15:48 -0700 Subject: [PATCH] nongnu: google-chrome: Parameterize toolkits. Chrome supports both GTK and QT and the two newest versions of each for a total of four UI Toolkits. This impacts closure size and requires building a LOT of unnecessary packages (relevant to compile-your-own-system people like me and maybe others). The solution: gate off and parameterize these toolkits. The default is to build with all toolkits which is the same behavior currently. --- nongnu/packages/chrome.scm | 103 ++++++++++++++++++++++++------------- 1 file changed, 66 insertions(+), 37 deletions(-) diff --git a/nongnu/packages/chrome.scm b/nongnu/packages/chrome.scm index 1fb40ab..0bb6825 100644 --- a/nongnu/packages/chrome.scm +++ b/nongnu/packages/chrome.scm @@ -26,9 +26,12 @@ #:use-module (guix build-system gnu) #:use-module (nonguix build-system chromium-binary) #:use-module (nonguix licenses) - #:use-module (ice-9 string-fun)) + #:use-module (ice-9 string-fun) + #:use-module (srfi srfi-26) + #:export (make-google-chrome)) -(define-public (make-google-chrome repo version hash) +(define* (make-google-chrome repo version hash + #:key (toolkits '(gtk3 gtk4 qt5 qt6))) (let* ((name (string-append "google-chrome-" repo)) (appname (if (string=? repo "stable") "chrome" @@ -53,17 +56,22 @@ #~(let ((path (string-append "opt/google/" #$appname "/"))) (map (lambda (file) (string-append path file)) - '("chrome" - "chrome-sandbox" - "chrome_crashpad_handler" - "libEGL.so" - "libGLESv2.so" - "liboptimization_guide_internal.so" - "libqt5_shim.so" - "libqt6_shim.so" - "libvk_swiftshader.so" - "libvulkan.so.1" - "WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so"))) + (append + '("chrome" + "chrome-sandbox" + "chrome_crashpad_handler" + "libEGL.so" + "libGLESv2.so" + "liboptimization_guide_internal.so" + "libvk_swiftshader.so" + "libvulkan.so.1" + "WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so") + (if (member 'qt5 '#$toolkits) + '("libqt5_shim.so") + '()) + (if (member 'qt6 '#$toolkits) + '("libqt6_shim.so") + '())))) #:install-plan #~'(("opt/" "/share") ("usr/share/" "/share")) @@ -116,38 +124,59 @@ (wrap-program exe '("CHROME_WRAPPER" = (#$appname))))))))) (inputs - (list bzip2 - curl - flac - font-liberation - gdk-pixbuf - gtk - harfbuzz - libexif - libglvnd - libpng - libva - libxscrnsaver - opus - pciutils - pipewire - qtbase-5 - qtbase - snappy - util-linux - xdg-utils - wget)) + (append + (list bzip2 + curl + flac + font-liberation + gdk-pixbuf + harfbuzz + libexif + libglvnd + libpng + libva + libxscrnsaver + opus + pciutils + pipewire + snappy + util-linux + xdg-utils + wget) + ;; TODO: Currently the chromium binary build system always adds GTK+ as + ;; an input so gating it here wouldn't do anything. + ;; (if (member 'gtk3 toolkits) + ;; (list gtk+) + ;; '()) + (if (member 'gtk4 toolkits) + (list gtk) + '()) + (if (member 'qt5 toolkits) + (list qtbase-5) + '()) + (if (member 'qt6 toolkits) + (list qtbase) + '()))) (synopsis "Freeware web browser") (supported-systems '("x86_64-linux")) (description "Google Chrome is a cross-platform web browser developed by Google.") (home-page "https://www.google.com/chrome/") (license (nonfree "https://www.google.com/intl/en/chrome/terms/"))))) +(define-public make-google-chrome-stable + (cut make-google-chrome "stable" "127.0.6533.99" "0n6dxjzvbc5p4nhpa9f68isgfvs42d59j4argkiga2xqm14qphd4" <...>)) + (define-public google-chrome-stable - (make-google-chrome "stable" "127.0.6533.99" "0n6dxjzvbc5p4nhpa9f68isgfvs42d59j4argkiga2xqm14qphd4")) + (make-google-chrome-stable)) + +(define-public make-google-chrome-beta + (cut make-google-chrome "beta" "128.0.6613.27" "1v5p4zvln8yyh4622fla4hdpf5kfxlf1j3ydj8n2i2glb1vmmnrm" <...>)) (define-public google-chrome-beta - (make-google-chrome "beta" "128.0.6613.27" "1v5p4zvln8yyh4622fla4hdpf5kfxlf1j3ydj8n2i2glb1vmmnrm")) + (make-google-chrome-beta)) + +(define-public make-google-chrome-unstable + (cut make-google-chrome "unstable" "129.0.6643.2" "08kc914p5fk1mgn59nvb1qkfndinmzvwk0yzfsc2z4maicg4isqn" <...>)) (define-public google-chrome-unstable - (make-google-chrome "unstable" "129.0.6643.2" "08kc914p5fk1mgn59nvb1qkfndinmzvwk0yzfsc2z4maicg4isqn")) + (make-google-chrome-unstable))