nixpkgs/pkgs/os-specific/linux/mwprocapture/default.nix
Martin Wimpress 09212d71c1
linuxPackages.mwprocapture: 1.3.0.4236 -> 1.3.0.4328
Version V1.3.0.4236 of mwprocapture (the Linux driver for the Magewell Pro Capture family) FTBFS when building against Linux 6.1 or newer. 

This patch bumps the driver version to 1.3.0.4328 that Magewell published to address this issue. The 1.3.0.4328 release notes state:

> Fix problem: driver installation may fail on an operating system with kernel version 6.1 or 6.2.

pci.patch has also been dropped as that fix is now applied upstream.
2023-03-16 13:05:00 -03:00

67 lines
1.7 KiB
Nix

{ lib, stdenv, fetchurl, kernel, alsa-lib }:
with lib;
let
bits =
if stdenv.is64bit then "64"
else "32";
libpath = makeLibraryPath [ stdenv.cc.cc stdenv.cc.libc alsa-lib ];
in
stdenv.mkDerivation rec {
pname = "mwprocapture";
subVersion = "4328";
version = "1.3.0.${subVersion}-${kernel.version}";
src = fetchurl {
url = "https://www.magewell.com/files/drivers/ProCaptureForLinux_${subVersion}.tar.gz";
sha256 = "197l86ad52ijmmq5an6891gd1chhkxqiagamcchirrky4c50qs36";
};
nativeBuildInputs = kernel.moduleBuildDependencies;
preConfigure = ''
cd ./src
export INSTALL_MOD_PATH="$out"
'';
hardeningDisable = [ "pic" "format" ];
makeFlags = [
"KERNELDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
];
env.NIX_CFLAGS_COMPILE = "-Wno-error=implicit-fallthrough";
postInstall = ''
cd ../
mkdir -p $out/bin
cp bin/mwcap-control_${bits} $out/bin/mwcap-control
cp bin/mwcap-info_${bits} $out/bin/mwcap-info
mkdir -p $out/lib/udev/rules.d
# source has a filename typo
cp scripts/10-procatpure-event-dev.rules $out/lib/udev/rules.d/10-procapture-event-dev.rules
cp -r src/res $out
patchelf \
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
--set-rpath "${libpath}" \
"$out"/bin/mwcap-control
patchelf \
--set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) \
--set-rpath "${libpath}" \
"$out"/bin/mwcap-info
'';
meta = {
homepage = "https://www.magewell.com/";
description = "Linux driver for the Magewell Pro Capture family";
license = licenses.unfreeRedistributable;
maintainers = with maintainers; [ MP2E ];
platforms = platforms.linux;
};
}