pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

wip/openwv: Load .wvd from file



Module Name:	pkgsrc-wip
Committed By:	Ryo ONODERA <ryoon%NetBSD.org@localhost>
Pushed By:	ryoon
Date:		Wed Jan 21 22:48:11 2026 +0900
Changeset:	2f946da51804ea97622b94a576910ebdca5f5d32

Modified Files:
	openwv/MESSAGE
	openwv/Makefile
	openwv/distinfo
Added Files:
	openwv/patches/patch-src_config.rs
	openwv/patches/patch-src_openwv.rs

Log Message:
wip/openwv: Load .wvd from file

* Use patches from OpenBSD Ports.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=2f946da51804ea97622b94a576910ebdca5f5d32

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 openwv/MESSAGE                     |  2 ++
 openwv/Makefile                    |  9 +++++++--
 openwv/distinfo                    |  2 ++
 openwv/patches/patch-src_config.rs | 23 +++++++++++++++++++++++
 openwv/patches/patch-src_openwv.rs | 34 ++++++++++++++++++++++++++++++++++
 5 files changed, 68 insertions(+), 2 deletions(-)

diffs:
diff --git a/openwv/MESSAGE b/openwv/MESSAGE
index 416917ed51..9b2d4dcaf3 100644
--- a/openwv/MESSAGE
+++ b/openwv/MESSAGE
@@ -1,6 +1,8 @@
 ===========================================================================
 $NetBSD: MESSAGE,v 1.1 2011/03/03 10:51:59 ryoon Exp $
 
+For Firefox web browser:
+
 (1) Open about:support in www/firefox and get profile name.
 (2) Create gmp-widevinecdm/openwv directory under profile directory.
 $ mkdir -p ~/.mozilla/<profile>/gmp-widevinecdm/openwv
diff --git a/openwv/Makefile b/openwv/Makefile
index f41f42b11f..bccef3b447 100644
--- a/openwv/Makefile
+++ b/openwv/Makefile
@@ -1,6 +1,7 @@
 # $NetBSD$
 
 DISTNAME=	openwv-1.1.3
+PKGREVISION=	1
 CATEGORIES=	multimedia
 # Tarball contains Git submodule and result of `cargo vendor`.
 MASTER_SITES=	https://www.ryoon.net/~ryoon/
@@ -13,14 +14,18 @@ LICENSE=	gnu-lgpl-v3
 
 USE_LANGUAGES=	c c++
 
+SUBST_CLASSES+=		etc
+SUBST_STAGE.etc=	pre-configure
+SUBST_MESSAGE.etc=	Setting PKG_SYSCONFDIR
+SUBST_FILES.etc+=	src/openwv.rs
+SUBST_VARS.etc+=	PKG_SYSCONFDIR
+
 INSTALLATION_DIRS+=	share/openwv
 
 post-extract:
 	# Adjust for vendor handling of cargo.mk
 	cd ${WRKSRC} && \
 		${MV} vendor ..
-	# Copy embedded.wvd file to ${WRKSRC} manually.
-	#${CP} ${SOMEWHERE}/keydive.wvd ${WRKSRC}/embedded.wvd
 
 do-install:
 	${INSTALL_LIB} ${WRKSRC}/target/release/libwidevinecdm.so \
diff --git a/openwv/distinfo b/openwv/distinfo
index c7f309e804..e9a8633193 100644
--- a/openwv/distinfo
+++ b/openwv/distinfo
@@ -4,3 +4,5 @@ BLAKE2s (openwv-1.1.3.tar.bz2) = 2457e67c8cfcc33b7cc4161ad59fdb96176fe5f37805141
 SHA512 (openwv-1.1.3.tar.bz2) = 1168029017b0ccc92c119e860a37e565940d54f9f4b2759e26da9ae615c1940f83483cffea642c2e36e958d77f99c6bc58df9c747d08b3d229bc839093f4766f
 Size (openwv-1.1.3.tar.bz2) = 23790667 bytes
 SHA1 (patch-Cargo.toml) = bdda1d5ee91423d173e659bd4c305d4362a6f0c8
+SHA1 (patch-src_config.rs) = 80c6aee2b32fa9376b71f530719e88f6f3e70285
+SHA1 (patch-src_openwv.rs) = 5cb12ef32d13f7c0806f81d05501c2b1ebc5b53d
diff --git a/openwv/patches/patch-src_config.rs b/openwv/patches/patch-src_config.rs
new file mode 100644
index 0000000000..0214abac73
--- /dev/null
+++ b/openwv/patches/patch-src_config.rs
@@ -0,0 +1,23 @@
+$NetBSD$
+
+* Load .wvd data from file. Taken from OpenBSD Ports.
+
+--- src/config.rs.orig	2026-01-20 13:27:18.000000000 +0000
++++ src/config.rs
+@@ -3,16 +3,11 @@ pub const CONFIG: OpenWvConfig = OpenWvConfig {
+ /// go in a configuration file. See the comments on the structs and enums below
+ /// for information on the meaning of each parameter.
+ pub const CONFIG: OpenWvConfig = OpenWvConfig {
+-    widevine_device: include_bytes!("../embedded.wvd"),
+     log_level: log::LevelFilter::Info,
+     encrypt_client_id: EncryptClientId::Always,
+ };
+ 
+ pub struct OpenWvConfig {
+-    /// A pywidevine `.wvd` file containing the private key and Client ID to
+-    /// present in license requests. You must obtain this on your own.
+-    pub widevine_device: &'static [u8],
+-
+     /// This can be overridden by the OPENWV_LOG environment variable, but some
+     /// browsers like Firefox don't let CDMs see the full environment.
+     pub log_level: log::LevelFilter,
diff --git a/openwv/patches/patch-src_openwv.rs b/openwv/patches/patch-src_openwv.rs
new file mode 100644
index 0000000000..e563534cd3
--- /dev/null
+++ b/openwv/patches/patch-src_openwv.rs
@@ -0,0 +1,34 @@
+$NetBSD$
+
+* Load .wvd data from file. Taken from OpenBSD Ports.
+
+--- src/openwv.rs.orig	2026-01-20 13:27:18.000000000 +0000
++++ src/openwv.rs
+@@ -1,13 +1,13 @@ use std::ffi::{c_char, c_int, c_uchar, c_void};
+ use autocxx::subclass::{CppSubclassSelfOwned, subclass};
+ use log::{debug, error, info, trace, warn};
+ use std::ffi::{c_char, c_int, c_uchar, c_void};
++use std::fs::File;
+ use std::pin::Pin;
+ use std::ptr::{null, null_mut};
+ use std::sync::OnceLock;
+ 
+ use crate::CdmError;
+ use crate::common_host::{CommonHost, downcast_host};
+-use crate::config::CONFIG;
+ use crate::decrypt::{DecryptError, decrypt_buf};
+ use crate::ffi::cdm;
+ use crate::service_certificate::{ServerCertificate, parse_service_certificate};
+@@ -27,7 +27,11 @@ extern "C" fn InitializeCdmModule_4() {
+ 
+     info!("OpenWV version {} initializing", env!("CARGO_PKG_VERSION"));
+ 
+-    let mut embedded_wvd = std::io::Cursor::new(CONFIG.widevine_device);
++    let f = File::open("@PKG_SYSCONFDIR@/openwv/widevine_device.wvd");
++    let mut embedded_wvd = match f {
++        Ok(file) => file,
++        Err(_) => return(),
++    };
+     match wvd_file::parse_wvd(&mut embedded_wvd) {
+         Ok(dev) => {
+             if DEVICE.set(dev).is_err() {


Home | Main Index | Thread Index | Old Index