From 952321811239cdec5785f15ed73506ce3dde5ede Mon Sep 17 00:00:00 2001 From: Petr Hodina Date: Mon, 29 Aug 2022 11:14:09 +0200 Subject: [PATCH] nongnu: Add chromium-widevine. * nongnu/packages/chromium.scm (chromium-widevine): New variable. --- nongnu/packages/chromium.scm | 68 ++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/nongnu/packages/chromium.scm b/nongnu/packages/chromium.scm index 56d0c6e..acb3c36 100644 --- a/nongnu/packages/chromium.scm +++ b/nongnu/packages/chromium.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2022 Pierre Neidhardt +;;; Copyright © 2022 Petr Hodina ;;; ;;; This file is not part of GNU Guix. ;;; @@ -18,6 +19,7 @@ (define-module (nongnu packages chromium) #:use-module ((guix licenses) #:prefix license:) + #:use-module ((nonguix licenses) #:prefix license-nonfree:) #:use-module (guix packages) #:use-module (guix gexp) #:use-module (guix download) @@ -28,6 +30,7 @@ #:use-module (gnu packages base) #:use-module (gnu packages cmake) #:use-module (gnu packages cups) + #:use-module (gnu packages freedesktop) #:use-module (gnu packages gcc) #:use-module (gnu packages gl) #:use-module (gnu packages glib) @@ -161,3 +164,68 @@ applications. @end itemize\n") (home-page "https://bitbucket.org/chromiumembedded/cef") (license license:bsd-3)))) + +(define-public chromium-widevine + (let ((version "4.10.2449.0") + (chromium-version "103.0.5060.114")) + (package + (name "chromium-widevine") + (version version) + (source (origin + (method url-fetch) + (uri (string-append + "https://dl.google.com/linux/deb/pool/main/g/google-chrome-stable/google-chrome-stable_" + chromium-version "-1_amd64.deb")) + (sha256 + (base32 + "1qxbnnnq0miizazprwynvxxvgaaw9dd9y7bssybvmga3g2c00fk9")))) + (build-system binary-build-system) + (arguments + (list + ;; #:patchelf-plan + ;; #~`(("" ("gcc" + ;; "glib" + ;; "glibc" + ;; "nspr" + ;; ("nss" "/lib/nss") + ;; "pango"))) + #:install-plan #~`(("opt/google/chrome" "usr/")) + #:phases #~(modify-phases %standard-phases + (replace 'unpack + (lambda* (#:key inputs #:allow-other-keys) + (invoke "ar" "x" + #$source) + (invoke "tar" "xJf" "data.tar.xz"))) + (add-after 'install 'xdg-utils + (lambda* _ + (let* ((chrome (string-append #$output + "/usr/chrome/")) + (xdg-mime (string-append chrome + "/xdg-mime")) + (xdg-settings (string-append chrome + "/xdg-settings"))) + (delete-file xdg-mime) + (delete-file xdg-settings) + (symlink (string-append #$xdg-utils + "/bin/xdg-utils") + xdg-mime) + (symlink (string-append #$xdg-utils + "/bin/xdg-settings") + xdg-settings))))))) + ;; TODO: attempt to replace libvulkan.so.1 from vulkan-loader + ;; TODO: attempt to replace also chrome with our own + ;; -> learn how the WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so + ;; works - is it loaded by Chrome as it scans the dirs or does the chrome + ;; binary in this package have additional code which loads it + (inputs (list `(,gcc "lib") + wayland + glib + nspr + nss + xdg-utils)) + (synopsis "Embed Chromium-based browsers in other applications") + (supported-systems '("armhf-linux" "aarch64-linux" "x86_64-linux")) + (description "") + (home-page "https://www.widevine.com") + (license (license-nonfree:nonfree + "https://developers.google.com/widevine/drm/overview#issuing_widevine_licenses")))))