diff options
| author | Hilton Chain <hako@ultrarare.space> | 2026-07-25 19:56:38 +0800 |
|---|---|---|
| committer | Hilton Chain <hako@ultrarare.space> | 2026-07-25 20:50:48 +0800 |
| commit | 2688596e16fd0b6b900d2e1c7167a9f78d3c4de3 (patch) | |
| tree | 087c1374740e19524c668aea166f4cddb3971a5a | |
| parent | b1c7d4a5fdec9931c223672067cd20f2d3dce0c5 (diff) | |
nongnu: make-google-chrome: Provide build phases and metadata only.
* nongnu/packages/chrome.scm (make-google-chrome): Provide build phases and
metadata only.
Move package name, version, and source to...
(google-chrome-stable, google-chrome-beta, google-chrome-unstable)
(google-chrome-canary): ...here.
| -rw-r--r-- | nongnu/packages/chrome.scm | 231 |
1 files changed, 135 insertions, 96 deletions
diff --git a/nongnu/packages/chrome.scm b/nongnu/packages/chrome.scm index 4f0e2f3..0074ee8 100644 --- a/nongnu/packages/chrome.scm +++ b/nongnu/packages/chrome.scm | |||
| @@ -27,83 +27,78 @@ | |||
| 27 | #:use-module (guix build-system gnu) | 27 | #:use-module (guix build-system gnu) |
| 28 | #:use-module (nonguix build-system chromium-binary) | 28 | #:use-module (nonguix build-system chromium-binary) |
| 29 | #:use-module (nonguix licenses) | 29 | #:use-module (nonguix licenses) |
| 30 | #:use-module (nonguix utils) | ||
| 30 | #:use-module (ice-9 string-fun)) | 31 | #:use-module (ice-9 string-fun)) |
| 31 | 32 | ||
| 32 | (define-public (make-google-chrome repo version hash) | 33 | (define-public (make-google-chrome repo) |
| 34 | "Build phases and metadata for Google Chrome packages." | ||
| 33 | (let* ((name (string-append "google-chrome-" repo)) | 35 | (let* ((name (string-append "google-chrome-" repo)) |
| 34 | (appname (if (string=? repo "stable") | 36 | (appname (if (string=? repo "stable") |
| 35 | "chrome" | 37 | "chrome" |
| 36 | (string-replace-substring name "google-" "")))) | 38 | (string-replace-substring name "google-" "")))) |
| 37 | (package | 39 | (package |
| 38 | (name name) | 40 | (name #f) |
| 39 | (version version) | 41 | (version #f) |
| 40 | (source (origin | 42 | (source #f) |
| 41 | (method url-fetch) | 43 | (build-system chromium-binary-build-system) |
| 42 | (uri | 44 | (arguments |
| 43 | (string-append | 45 | (list |
| 44 | "https://dl.google.com/linux/chrome/deb/pool/main/g/" | ||
| 45 | name "/" name "_" version "-1_amd64.deb")) | ||
| 46 | (sha256 | ||
| 47 | (base32 hash)))) | ||
| 48 | (build-system chromium-binary-build-system) | ||
| 49 | (arguments | ||
| 50 | (list | ||
| 51 | ;; almost 300MB, faster to download and build from Google servers | 46 | ;; almost 300MB, faster to download and build from Google servers |
| 52 | #:substitutable? #f | 47 | #:substitutable? #f |
| 53 | #:wrapper-plan | 48 | #:wrapper-plan |
| 54 | #~(let ((path (string-append "opt/google/" #$appname "/"))) | 49 | #~(let ((path (string-append "opt/google/" #$appname "/"))) |
| 55 | (map (lambda (file) | 50 | (map (lambda (file) |
| 56 | (string-append path file)) | 51 | (string-append path file)) |
| 57 | '("chrome" | 52 | '("chrome" |
| 58 | "chrome-sandbox" | 53 | "chrome-sandbox" |
| 59 | "chrome_crashpad_handler" | 54 | "chrome_crashpad_handler" |
| 60 | "libEGL.so" | 55 | "libEGL.so" |
| 61 | "libGLESv2.so" | 56 | "libGLESv2.so" |
| 62 | "liboptimization_guide_internal.so" | 57 | "liboptimization_guide_internal.so" |
| 63 | "libqt5_shim.so" | 58 | "libqt5_shim.so" |
| 64 | "libqt6_shim.so" | 59 | "libqt6_shim.so" |
| 65 | "libvk_swiftshader.so" | 60 | "libvk_swiftshader.so" |
| 66 | "libvulkan.so.1" | 61 | "libvulkan.so.1" |
| 67 | "WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so"))) | 62 | "WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so"))) |
| 68 | #:install-plan | 63 | #:install-plan |
| 69 | #~'(("opt/" "/share") | 64 | #~'(("opt/" "/share") |
| 70 | ("usr/share/" "/share")) | 65 | ("usr/share/" "/share")) |
| 71 | #:phases | 66 | #:phases |
| 72 | #~(modify-phases %standard-phases | 67 | #~(modify-phases %standard-phases |
| 73 | (add-before 'install 'patch-assets | 68 | (add-before 'install 'patch-assets |
| 74 | ;; Many thanks to | 69 | ;; Many thanks to |
| 75 | ;; https://github.com/NixOS/nixpkgs/blob/nixos-23.05-small/pkgs/applications/networking/browsers/google-chrome/default.nix | 70 | ;; https://github.com/NixOS/nixpkgs/blob/nixos-23.05-small/pkgs/applications/networking/browsers/google-chrome/default.nix |
| 76 | (lambda _ | 71 | (lambda _ |
| 77 | (let* ((bin (string-append #$output "/bin")) | 72 | (let* ((bin (string-append #$output "/bin")) |
| 78 | (share (string-append #$output "/share")) | 73 | (share (string-append #$output "/share")) |
| 79 | (opt "./opt") | 74 | (opt "./opt") |
| 80 | (usr/share "./usr/share") | 75 | (usr/share "./usr/share") |
| 81 | (old-exe (string-append "/opt/google/" #$appname "/google-" #$appname)) | 76 | (old-exe (string-append "/opt/google/" #$appname "/google-" #$appname)) |
| 82 | (exe (string-append bin "/google-" #$appname))) | 77 | (exe (string-append bin "/google-" #$appname))) |
| 83 | ;; This allows us to override CHROME_WRAPPER later. | 78 | ;; This allows us to override CHROME_WRAPPER later. |
| 84 | (substitute* (string-append opt "/google/" #$appname "/google-" #$appname) | 79 | (substitute* (string-append opt "/google/" #$appname "/google-" #$appname) |
| 85 | (("CHROME_WRAPPER") "WRAPPER")) | 80 | (("CHROME_WRAPPER") "WRAPPER")) |
| 86 | (substitute* (string-append usr/share "/applications/google-" #$appname ".desktop") | 81 | (substitute* (string-append usr/share "/applications/google-" #$appname ".desktop") |
| 87 | (("^Exec=.*") (string-append "Exec=" exe "\n"))) | 82 | (("^Exec=.*") (string-append "Exec=" exe "\n"))) |
| 88 | (substitute* (string-append usr/share "/gnome-control-center/default-apps/google-" #$appname ".xml") | 83 | (substitute* (string-append usr/share "/gnome-control-center/default-apps/google-" #$appname ".xml") |
| 89 | ((old-exe) exe))))) | 84 | ((old-exe) exe))))) |
| 90 | (add-after 'install 'install-icons | 85 | (add-after 'install 'install-icons |
| 91 | (lambda _ | 86 | (lambda _ |
| 92 | (define (format-icon-size name) | 87 | (define (format-icon-size name) |
| 93 | (car | 88 | (car |
| 94 | (string-split | 89 | (string-split |
| 95 | (string-drop-right (string-drop name 13) 4) | 90 | (string-drop-right (string-drop name 13) 4) |
| 96 | #\_))) | 91 | #\_))) |
| 97 | (let ((icons (string-append #$output "/share/icons/hicolor")) | 92 | (let ((icons (string-append #$output "/share/icons/hicolor")) |
| 98 | (share (string-append #$output "/share/google/" #$appname))) | 93 | (share (string-append #$output "/share/google/" #$appname))) |
| 99 | (for-each (lambda (icon) | 94 | (for-each (lambda (icon) |
| 100 | (let* ((icon-name (basename icon)) | 95 | (let* ((icon-name (basename icon)) |
| 101 | (icon-size (format-icon-size icon-name)) | 96 | (icon-size (format-icon-size icon-name)) |
| 102 | (target (string-append icons "/" icon-size "x" icon-size "/apps/google-" #$appname ".png"))) | 97 | (target (string-append icons "/" icon-size "x" icon-size "/apps/google-" #$appname ".png"))) |
| 103 | (mkdir-p (dirname target)) | 98 | (mkdir-p (dirname target)) |
| 104 | (rename-file icon target))) | 99 | (rename-file icon target))) |
| 105 | (find-files share "product_logo_.*\\.png"))))) | 100 | (find-files share "product_logo_.*\\.png"))))) |
| 106 | (add-before 'install-wrapper 'install-exe | 101 | (add-before 'install-wrapper 'install-exe |
| 107 | (lambda _ | 102 | (lambda _ |
| 108 | (let* ((bin (string-append #$output "/bin")) | 103 | (let* ((bin (string-append #$output "/bin")) |
| 109 | (exe (string-append bin "/google-" #$appname)) | 104 | (exe (string-append bin "/google-" #$appname)) |
| @@ -113,33 +108,33 @@ | |||
| 113 | (symlink chrome-target exe) | 108 | (symlink chrome-target exe) |
| 114 | (wrap-program exe | 109 | (wrap-program exe |
| 115 | '("CHROME_WRAPPER" = (#$appname))))))))) | 110 | '("CHROME_WRAPPER" = (#$appname))))))))) |
| 116 | (inputs | 111 | (inputs |
| 117 | (list bzip2 | 112 | (list bzip2 |
| 118 | curl | 113 | curl |
| 119 | flac | 114 | flac |
| 120 | font-liberation | 115 | font-liberation |
| 121 | gdk-pixbuf | 116 | gdk-pixbuf |
| 122 | gtk | 117 | gtk |
| 123 | harfbuzz | 118 | harfbuzz |
| 124 | libexif | 119 | libexif |
| 125 | libglvnd | 120 | libglvnd |
| 126 | libpng | 121 | libpng |
| 127 | libva | 122 | libva |
| 128 | libxscrnsaver | 123 | libxscrnsaver |
| 129 | opus | 124 | opus |
| 130 | pciutils | 125 | pciutils |
| 131 | pipewire | 126 | pipewire |
| 132 | qtbase-5 | 127 | qtbase-5 |
| 133 | qtbase | 128 | qtbase |
| 134 | snappy | 129 | snappy |
| 135 | util-linux | 130 | util-linux |
| 136 | xdg-utils | 131 | xdg-utils |
| 137 | wget)) | 132 | wget)) |
| 138 | (synopsis "Freeware web browser") | 133 | (synopsis "Freeware web browser") |
| 139 | (supported-systems '("x86_64-linux")) | 134 | (supported-systems '("x86_64-linux")) |
| 140 | (description "Google Chrome is a cross-platform web browser developed by Google.") | 135 | (description "Google Chrome is a cross-platform web browser developed by Google.") |
| 141 | (home-page "https://www.google.com/chrome/") | 136 | (home-page "https://www.google.com/chrome/") |
| 142 | (license (nonfree "https://www.google.com/intl/en/chrome/terms/"))))) | 137 | (license (nonfree "https://www.google.com/intl/en/chrome/terms/"))))) |
| 143 | 138 | ||
| 144 | ;; Available versions can be here: https://chromereleases.googleblog.com | 139 | ;; Available versions can be here: https://chromereleases.googleblog.com |
| 145 | ;; The following has a nicer representation: https://deb.pkgs.org/apps/google-amd64/ | 140 | ;; The following has a nicer representation: https://deb.pkgs.org/apps/google-amd64/ |
| @@ -161,13 +156,57 @@ | |||
| 161 | ;; TODO: write a nice importer for this in Scheme. | 156 | ;; TODO: write a nice importer for this in Scheme. |
| 162 | 157 | ||
| 163 | (define-public google-chrome-stable | 158 | (define-public google-chrome-stable |
| 164 | (make-google-chrome "stable" "148.0.7778.215" "091d2hk0dvxnpmiq0hmdc389sdg87h0zl9d001yv5h70v2i8q8i3")) | 159 | (package |
| 160 | (inherit (make-google-chrome "stable")) | ||
| 161 | (name "google-chrome-stable") | ||
| 162 | (version "148.0.7778.215") | ||
| 163 | (source | ||
| 164 | (origin | ||
| 165 | (method url-fetch) | ||
| 166 | (uri (string-append | ||
| 167 | "https://dl.google.com/linux/chrome/deb/pool/main/g/" name "/" | ||
| 168 | name "_" version "-1_amd64.deb")) | ||
| 169 | (sha256 | ||
| 170 | (base32 "091d2hk0dvxnpmiq0hmdc389sdg87h0zl9d001yv5h70v2i8q8i3")))))) | ||
| 165 | 171 | ||
| 166 | (define-public google-chrome-beta | 172 | (define-public google-chrome-beta |
| 167 | (make-google-chrome "beta" "149.0.7827.22" "1sa41cly7vckpyc7f72yrkjrcm02vahvlfcjn3ng8z8sci18yglr")) | 173 | (package |
| 174 | (inherit (make-google-chrome "beta")) | ||
| 175 | (name "google-chrome-beta") | ||
| 176 | (version "149.0.7827.22") | ||
| 177 | (source | ||
| 178 | (origin | ||
| 179 | (method url-fetch) | ||
| 180 | (uri (string-append | ||
| 181 | "https://dl.google.com/linux/chrome/deb/pool/main/g/" name "/" | ||
| 182 | name "_" version "-1_amd64.deb")) | ||
| 183 | (sha256 | ||
| 184 | (base32 "1sa41cly7vckpyc7f72yrkjrcm02vahvlfcjn3ng8z8sci18yglr")))))) | ||
| 168 | 185 | ||
| 169 | (define-public google-chrome-unstable | 186 | (define-public google-chrome-unstable |
| 170 | (make-google-chrome "unstable" "150.0.7846.4" "02js9266yagzl0b575zdn0830bvk17jsqwjrgga9kg3mbn18a8wn")) | 187 | (package |
| 188 | (inherit (make-google-chrome "unstable")) | ||
| 189 | (name "google-chrome-unstable") | ||
| 190 | (version "150.0.7846.4") | ||
| 191 | (source | ||
| 192 | (origin | ||
| 193 | (method url-fetch) | ||
| 194 | (uri (string-append | ||
| 195 | "https://dl.google.com/linux/chrome/deb/pool/main/g/" name "/" | ||
| 196 | name "_" version "-1_amd64.deb")) | ||
| 197 | (sha256 | ||
| 198 | (base32 "02js9266yagzl0b575zdn0830bvk17jsqwjrgga9kg3mbn18a8wn")))))) | ||
| 171 | 199 | ||
| 172 | (define-public google-chrome-canary | 200 | (define-public google-chrome-canary |
| 173 | (make-google-chrome "canary" "150.0.7862.0" "1qg4bdh0wgb62indh62glrq2qfsa0p7jn883w5sf76dywf44d9hr")) | 201 | (package |
| 202 | (inherit (make-google-chrome "canary")) | ||
| 203 | (name "google-chrome-canary") | ||
| 204 | (version "150.0.7862.0") | ||
| 205 | (source | ||
| 206 | (origin | ||
| 207 | (method url-fetch) | ||
| 208 | (uri (string-append | ||
| 209 | "https://dl.google.com/linux/chrome/deb/pool/main/g/" name "/" | ||
| 210 | name "_" version "-1_amd64.deb")) | ||
| 211 | (sha256 | ||
| 212 | (base32 "1qg4bdh0wgb62indh62glrq2qfsa0p7jn883w5sf76dywf44d9hr")))))) | ||
