media-libs/widevine: update metadata, patch script

This commit is contained in:
Jared Allard 2024-02-24 17:22:46 -08:00
parent 913793d45c
commit 7c7f52bd4d
Signed by: jaredallard
SSH key fingerprint: SHA256:wyRyyv28jBYw8Yp/oABNPUYvbGd6hyZj23XVXEm5G/U
3 changed files with 168 additions and 65 deletions

View file

@ -1,62 +0,0 @@
#!/usr/bin/env bash
# Modified from the original widevine-installer script to not prompt or
# download files.
# SPDX-License-Identifier: MIT
set -e
# Set to 0 if packaged and the configs are pre-installed
: ${COPY_CONFIGS=1}
: ${DESTDIR:=/}
: ${CONFDIR:=/etc}
: ${LIBDIR:=/usr/lib64}
: ${BINDIR:=/usr/bin}
: ${LIBEXECDIR:=/usr/libexec}
: ${STATEDIR:=/var/lib}
: ${SCRIPT_BASE:=$LIBEXECDIR/widevine-installer}
: ${INSTALL_BASE:=$STATEDIR/widevine}
: ${DISTFILES_BASE:=https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles}
: ${LACROS_NAME:=chromeos-lacros-arm64-squash-zstd}
: ${LACROS_VERSION:=120.0.6098.0}
: ${WIDEVINE_VERSION:=4.10.2662.3}
: ${CHROME_WIDEVINE_BASE:=$LIBDIR/chromium-browser}
: ${MOZ_PREF_BASE:=$LIBDIR/firefox/defaults/pref}
install_configs() {
cd "$SCRIPT_BASE"
echo "Copying config files..."
install -d -m 0755 "$DESTDIR/$INSTALL_BASE"
install -p -m 0644 -t "$DESTDIR/$INSTALL_BASE" ./conf/README
install -d -m 0755 "$DESTDIR/$CONFDIR/profile.d/"
install -p -m 0644 -t "$DESTDIR/$CONFDIR/profile.d/" ./conf/gmpwidevine.sh
install -d -m 0755 "$DESTDIR/$CHROME_WIDEVINE_BASE"
ln -sf "$INSTALL_BASE/WidevineCdm" "$DESTDIR/$CHROME_WIDEVINE_BASE/WidevineCdm"
install -d -m 0755 "$DESTDIR/$MOZ_PREF_BASE"
install -p -m 0644 -t "$DESTDIR/$MOZ_PREF_BASE" ./conf/gmpwidevine.js
}
echo "Extracting Widevine..."
unsquashfs -q lacros.squashfs 'WidevineCdm/*'
python3 "$SCRIPT_BASE/widevine_fixup.py" squashfs-root/WidevineCdm/_platform_specific/cros_arm64/libwidevinecdm.so libwidevinecdm.so
echo
echo "Installing..."
install -d -m 0755 "$DESTDIR/$INSTALL_BASE"
install -p -m 0755 -t "$DESTDIR/$INSTALL_BASE" libwidevinecdm.so
install -p -m 0644 -t "$DESTDIR/$INSTALL_BASE" squashfs-root/WidevineCdm/manifest.json
install -p -m 0644 -t "$DESTDIR/$INSTALL_BASE" squashfs-root/WidevineCdm/LICENSE
echo "Setting up plugin for Firefox and Chromium-based browsers..."
mkdir -p "$DESTDIR/$INSTALL_BASE"/gmp-widevinecdm/system-installed
ln -sf ../../manifest.json "$DESTDIR/$INSTALL_BASE"/gmp-widevinecdm/system-installed/
ln -sf ../../libwidevinecdm.so "$DESTDIR/$INSTALL_BASE"/gmp-widevinecdm/system-installed/
mkdir -p "$DESTDIR/$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_{arm64,x64}
# Hack because Chromium hardcodes a check for this right now...
touch "$DESTDIR/$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so
ln -sf ../manifest.json "$DESTDIR/$INSTALL_BASE"/WidevineCdm
ln -sf ../../../libwidevinecdm.so "$DESTDIR/$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_arm64/
if [ "$COPY_CONFIGS" = 1 ]; then
install_configs
fi

View file

@ -0,0 +1,164 @@
diff --git a/widevine-installer b/widevine-installer
index 78a1191..ed6f4a9 100755
--- a/widevine-installer
+++ b/widevine-installer
@@ -1,4 +1,6 @@
-#!/bin/sh
+#!/usr/bin/env bash
+# Modified from the original widevine-installer script to not prompt or
+# download files.
# SPDX-License-Identifier: MIT
set -e
@@ -20,129 +22,42 @@ set -e
: ${CHROME_WIDEVINE_BASE:=$LIBDIR/chromium-browser}
: ${MOZ_PREF_BASE:=$LIBDIR/firefox/defaults/pref}
-[ -e $(dirname "$0")/widevine_fixup.py ] && SCRIPT_BASE="$(realpath "$(dirname "$0")")"
-
install_configs() {
- cd "$SCRIPT_BASE"
- echo "Copying config files..."
- install -d -m 0755 "$DESTDIR/$INSTALL_BASE"
- install -p -m 0644 -t "$DESTDIR/$INSTALL_BASE" ./conf/README
- install -d -m 0755 "$DESTDIR/$CONFDIR/profile.d/"
- install -p -m 0644 -t "$DESTDIR/$CONFDIR/profile.d/" ./conf/gmpwidevine.sh
- install -d -m 0755 "$DESTDIR/$CHROME_WIDEVINE_BASE"
- ln -sf "$INSTALL_BASE/WidevineCdm" "$DESTDIR/$CHROME_WIDEVINE_BASE/WidevineCdm"
- install -d -m 0755 "$DESTDIR/$MOZ_PREF_BASE"
- install -p -m 0644 -t "$DESTDIR/$MOZ_PREF_BASE" ./conf/gmpwidevine.js
-}
-
-if [ "$1" = "--distinstall" ]; then
- install_configs
- install -d -m 0755 "$DESTDIR/$LIBEXECDIR/widevine-installer"
- install -p -m 0644 -t "$DESTDIR/$LIBEXECDIR/widevine-installer" ./widevine_fixup.py
- install -d -m 0755 "$DESTDIR/$BINDIR"
- install -p -m 0755 -t "$DESTDIR/$BINDIR" ./widevine-installer
- exit 0
-fi
-
-if [ "$(uname -m)" != "aarch64" ]; then
- echo "This tool is only supported on aarch64 (ARM64) systems."
- exit 1
-fi
-
-if [ "$(whoami)" != "root" ]; then
- echo "This tool needs to be run as root."
- exit 1
-fi
-
-verchk() {
- (
- echo "2.36"
- ldd --version | head -1 | cut -d" " -f4
- ) | sort -CV
+ cd "$SCRIPT_BASE"
+ echo "Copying config files..."
+ install -d -m 0755 "$DESTDIR/$INSTALL_BASE"
+ install -p -m 0644 -t "$DESTDIR/$INSTALL_BASE" ./conf/README
+ install -d -m 0755 "$DESTDIR/$CONFDIR/profile.d/"
+ install -p -m 0644 -t "$DESTDIR/$CONFDIR/profile.d/" ./conf/gmpwidevine.sh
+ install -d -m 0755 "$DESTDIR/$CHROME_WIDEVINE_BASE"
+ ln -sf "$INSTALL_BASE/WidevineCdm" "$DESTDIR/$CHROME_WIDEVINE_BASE/WidevineCdm"
+ install -d -m 0755 "$DESTDIR/$MOZ_PREF_BASE"
+ install -p -m 0644 -t "$DESTDIR/$MOZ_PREF_BASE" ./conf/gmpwidevine.js
}
-if ! verchk; then
- echo "Your glibc version is too old. Widevine requires glibc 2.36 or newer."
- exit 1
-fi
-
-echo "This script will download, adapt, and install a copy of the Widevine"
-echo "Content Decryption Module for aarch64 systems."
-echo
-echo "Widevine is a proprietary DRM technology developed by Google."
-echo "This script uses ARM64 builds intended for ChromeOS images and is"
-echo "not supported nor endorsed by Google. The Asahi Linux community"
-echo "also cannot provide direct support for using this proprietary"
-echo "software, nor any guarantees about its security, quality,"
-echo "functionality, nor privacy. You assume all responsibility for"
-echo "usage of this script and of the installed CDM."
-echo
-echo "This installer will only adapt the binary file format of the CDM"
-echo "for interoperability purposes, to make it function on vanilla"
-echo "ARM64 systems (instead of just ChromeOS). The CDM software"
-echo "itself will not be modified in any way."
-echo
-echo "Widevine version to be installed: $WIDEVINE_VERSION"
-echo
-echo "Press enter to proceed, or Ctrl-C to cancel."
-read dummy
-
-workdir="$(mktemp -d /tmp/widevine-installer.XXXXXXXX)"
-[ -z "$workdir" ] && exit 1 # sanity check
-[ ! -d "$workdir" ] && exit 1 # sanity check
-
-cd "$workdir"
-
-echo "Downloading LaCrOS (Chrome) image..."
-URL="$DISTFILES_BASE/$LACROS_NAME-$LACROS_VERSION"
-echo "URL: $URL"
-curl -# -o lacros.squashfs "$URL"
-
-echo
echo "Extracting Widevine..."
unsquashfs -q lacros.squashfs 'WidevineCdm/*'
-echo
-echo "The Widevine license agreement follows:"
-echo
-echo ===================================================================================
-cat squashfs-root/WidevineCdm/LICENSE
-echo ===================================================================================
-echo
-echo "Press enter to proceed, or Ctrl-C to cancel."
-read dummy
-
python3 "$SCRIPT_BASE/widevine_fixup.py" squashfs-root/WidevineCdm/_platform_specific/cros_arm64/libwidevinecdm.so libwidevinecdm.so
echo
echo "Installing..."
-install -d -m 0755 "$INSTALL_BASE"
-install -p -m 0755 -t "$INSTALL_BASE" libwidevinecdm.so
-install -p -m 0644 -t "$INSTALL_BASE" squashfs-root/WidevineCdm/manifest.json
-install -p -m 0644 -t "$INSTALL_BASE" squashfs-root/WidevineCdm/LICENSE
+install -d -m 0755 "$DESTDIR/$INSTALL_BASE"
+install -p -m 0755 -t "$DESTDIR/$INSTALL_BASE" libwidevinecdm.so
+install -p -m 0644 -t "$DESTDIR/$INSTALL_BASE" squashfs-root/WidevineCdm/manifest.json
+install -p -m 0644 -t "$DESTDIR/$INSTALL_BASE" squashfs-root/WidevineCdm/LICENSE
echo "Setting up plugin for Firefox and Chromium-based browsers..."
-mkdir -p "$INSTALL_BASE"/gmp-widevinecdm/system-installed
-ln -sf ../../manifest.json "$INSTALL_BASE"/gmp-widevinecdm/system-installed/
-ln -sf ../../libwidevinecdm.so "$INSTALL_BASE"/gmp-widevinecdm/system-installed/
-mkdir -p "$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_{arm64,x64}
+mkdir -p "$DESTDIR/$INSTALL_BASE"/gmp-widevinecdm/system-installed
+ln -sf ../../manifest.json "$DESTDIR/$INSTALL_BASE"/gmp-widevinecdm/system-installed/
+ln -sf ../../libwidevinecdm.so "$DESTDIR/$INSTALL_BASE"/gmp-widevinecdm/system-installed/
+mkdir -p "$DESTDIR/$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_{arm64,x64}
# Hack because Chromium hardcodes a check for this right now...
-touch "$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so
-ln -sf ../manifest.json "$INSTALL_BASE"/WidevineCdm
-ln -sf ../../../libwidevinecdm.so "$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_arm64/
+touch "$DESTDIR/$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so
+ln -sf ../manifest.json "$DESTDIR/$INSTALL_BASE"/WidevineCdm
+ln -sf ../../../libwidevinecdm.so "$DESTDIR/$INSTALL_BASE"/WidevineCdm/_platform_specific/linux_arm64/
if [ "$COPY_CONFIGS" = 1 ]; then
- install_configs
+ install_configs
fi
-echo "Cleaning up..."
-cd /
-rm -rf "$workdir"
-
-echo
-echo "Installation complete!"
-if [ "$COPY_CONFIGS" = 1 ]; then
- echo "You may need to log out and back in for the changes to take effect."
-else
- echo "Please restart your browser for the changes to take effect."
-fi

View file

@ -8,8 +8,8 @@ inherit toolchain-funcs
INSTALLER_SHA="7a3928fe1342fb07d96f61c2b094e3287588958b" INSTALLER_SHA="7a3928fe1342fb07d96f61c2b094e3287588958b"
LACROS_VERSION="122.0.6261.69" LACROS_VERSION="122.0.6261.69"
DESCRIPTION="A file archiver with a high compression ratio" DESCRIPTION="Widevine CDM installer for arm64"
HOMEPAGE="https://7-zip.org" HOMEPAGE="https://github.com/AsahiLinux/widevine-installer"
SRC_URI=" SRC_URI="
https://github.com/AsahiLinux/widevine-installer/archive/${INSTALLER_SHA}.zip -> installer.zip https://github.com/AsahiLinux/widevine-installer/archive/${INSTALLER_SHA}.zip -> installer.zip
https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/chromeos-lacros-arm64-squash-zstd-${LACROS_VERSION} -> lacros.squashfs https://commondatastorage.googleapis.com/chromeos-localmirror/distfiles/chromeos-lacros-arm64-squash-zstd-${LACROS_VERSION} -> lacros.squashfs
@ -40,6 +40,7 @@ src_install() {
pushd "${S}/widevine-installer"-* >/dev/null || return 1 pushd "${S}/widevine-installer"-* >/dev/null || return 1
export SCRIPT_BASE="$(pwd)" export SCRIPT_BASE="$(pwd)"
"${FILESDIR}/widevine-installer" || die "Installation failed" patch -p1 <"${FILESDIR}/widevine-installer.patch" || die "Failed to apply patch"
"./widevine-installer" || die "Installation failed"
popd >/dev/null || return 1 popd >/dev/null || return 1
} }