decklink: update to 12.5

This commit is contained in:
hexchen 2023-08-03 19:44:16 +00:00 committed by Jörg Thalheim
parent 59271ebaa5
commit 08f93ba684
2 changed files with 78 additions and 24 deletions

View File

@ -1,14 +1,16 @@
{ stdenv, lib, requireFile, fetchpatch, kernel }: { stdenv
, lib
, blackmagic-desktop-video
, kernel
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "decklink"; pname = "decklink";
version = "12.2a12";
src = requireFile { # the download is a horrible curl mess. we reuse it between the kernel module
name = "Blackmagic_Desktop_Video_Linux_${lib.versions.majorMinor version}.tar.gz"; # and desktop service, since the version of the two have to match anyways.
url = "https://www.blackmagicdesign.com/support/download/33abc1034cd54cf99101f9acd2edd93d/Linux"; # See pkgs/tools/video/blackmagic-desktop-video/default.nix for more.
sha256 = "62954a18b60d9040aa4a959dff30ac9c260218ef78d6a63cbb243788f7abc05f"; inherit (blackmagic-desktop-video) src version;
};
KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; KERNELDIR = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build";
INSTALL_MOD_PATH = placeholder "out"; INSTALL_MOD_PATH = placeholder "out";

View File

@ -1,20 +1,78 @@
{ stdenv, requireFile, lib, { stdenv
libcxx, libcxxabi , cacert
, curl
, runCommandLocal
, lib
, autoPatchelfHook
, libcxx
, libcxxabi
, libGL
, gcc7
}: }:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "blackmagic-desktop-video"; pname = "blackmagic-desktop-video";
version = "12.2a12"; version = "12.5a15";
buildInputs = [ buildInputs = [
libcxx libcxxabi autoPatchelfHook
libcxx
libcxxabi
libGL
gcc7.cc.lib
]; ];
src = requireFile { # yes, the below download function is an absolute mess.
name = "Blackmagic_Desktop_Video_Linux_${lib.versions.majorMinor version}.tar.gz"; # blame blackmagicdesign.
url = "https://www.blackmagicdesign.com/support/download/33abc1034cd54cf99101f9acd2edd93d/Linux"; src = runCommandLocal "${pname}-${lib.versions.majorMinor version}-src.tar.gz"
sha256 = "62954a18b60d9040aa4a959dff30ac9c260218ef78d6a63cbb243788f7abc05f"; rec {
}; outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "sha256-ss7Ab5dy7cmXp9LBirFXMeGY4ZbYHvWnXmYvNeBq0RY=";
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
nativeBuildInputs = [ curl ];
# ENV VARS
SSL_CERT_FILE = "${cacert}/etc/ssl/certs/ca-bundle.crt";
# from the URL that the POST happens to, see browser console
DOWNLOADID = "fecacc0f9b2f4c2e8bf2863e9e26c8e1";
# from the URL the download page where you click the "only download" button is at
REFERID = "052d944af6744608b27da496dfc4396d";
SITEURL = "https://www.blackmagicdesign.com/api/register/us/download/${DOWNLOADID}";
USERAGENT = builtins.concatStringsSep " " [
"User-Agent: Mozilla/5.0 (X11; Linux ${stdenv.targetPlatform.linuxArch})"
"AppleWebKit/537.36 (KHTML, like Gecko)"
"Chrome/77.0.3865.75"
"Safari/537.36"
];
REQJSON = builtins.toJSON {
"country" = "nl";
"downloadOnly" = true;
"platform" = "Linux";
"policy" = true;
};
} ''
RESOLVEURL=$(curl \
-s \
-H "$USERAGENT" \
-H 'Content-Type: application/json;charset=UTF-8' \
-H "Referer: https://www.blackmagicdesign.com/support/download/$REFERID/Linux" \
--data-ascii "$REQJSON" \
--compressed \
"$SITEURL")
curl \
--retry 3 --retry-delay 3 \
--compressed \
"$RESOLVEURL" \
> $out
'';
postUnpack = '' postUnpack = ''
tar xf Blackmagic_Desktop_Video_Linux_${lib.versions.majorMinor version}/other/${stdenv.hostPlatform.uname.processor}/desktopvideo-${version}-${stdenv.hostPlatform.uname.processor}.tar.gz tar xf Blackmagic_Desktop_Video_Linux_${lib.versions.majorMinor version}/other/${stdenv.hostPlatform.uname.processor}/desktopvideo-${version}-${stdenv.hostPlatform.uname.processor}.tar.gz
@ -28,8 +86,6 @@ stdenv.mkDerivation rec {
cp -r $unpacked/usr/share/doc/desktopvideo $out/share/doc cp -r $unpacked/usr/share/doc/desktopvideo $out/share/doc
cp $unpacked/usr/lib/*.so $out/lib cp $unpacked/usr/lib/*.so $out/lib
cp $unpacked/usr/lib/systemd/system/DesktopVideoHelper.service $out/lib/systemd/system cp $unpacked/usr/lib/systemd/system/DesktopVideoHelper.service $out/lib/systemd/system
ln -s ${libcxx}/lib/* ${libcxxabi}/lib/* $out/lib
cp $unpacked/usr/lib/blackmagic/DesktopVideo/libgcc_s.so.1 $out/lib/
cp $unpacked/usr/lib/blackmagic/DesktopVideo/DesktopVideoHelper $out/bin/ cp $unpacked/usr/lib/blackmagic/DesktopVideo/DesktopVideoHelper $out/bin/
substituteInPlace $out/lib/systemd/system/DesktopVideoHelper.service --replace "/usr/lib/blackmagic/DesktopVideo/DesktopVideoHelper" "$out/bin/DesktopVideoHelper" substituteInPlace $out/lib/systemd/system/DesktopVideoHelper.service --replace "/usr/lib/blackmagic/DesktopVideo/DesktopVideoHelper" "$out/bin/DesktopVideoHelper"
@ -37,12 +93,8 @@ stdenv.mkDerivation rec {
runHook postInstall runHook postInstall
''; '';
# i know this is ugly, but it's the cleanest way i found to tell the DesktopVideoHelper where to find its own library
postFixup = '' appendRunpaths = [ "$ORIGIN/../lib" ];
patchelf --set-interpreter ${stdenv.cc.bintools.dynamicLinker} \
--set-rpath "$out/lib:${lib.makeLibraryPath [ libcxx libcxxabi ]}" \
$out/bin/DesktopVideoHelper
'';
meta = with lib; { meta = with lib; {
homepage = "https://www.blackmagicdesign.com/support/family/capture-and-playback"; homepage = "https://www.blackmagicdesign.com/support/family/capture-and-playback";