2017-02-18 14:44:31 +00:00
|
|
|
{ stdenv, fetchurl, kernel, alsaLib }:
|
|
|
|
|
2017-09-04 02:50:09 +01:00
|
|
|
with stdenv.lib;
|
|
|
|
|
2017-02-18 14:44:31 +00:00
|
|
|
# The Magewell Pro Capture drivers are not supported for kernels older than 3.2
|
2017-09-04 02:50:09 +01:00
|
|
|
assert versionAtLeast kernel.version "3.2.0";
|
2017-02-18 14:44:31 +00:00
|
|
|
|
|
|
|
# this package currently only supports x86 and x86_64, as I have no ARM device to test on
|
|
|
|
assert (stdenv.system == "x86_64-linux") || (stdenv.system == "i686-linux");
|
|
|
|
|
|
|
|
let
|
|
|
|
bits =
|
|
|
|
if stdenv.is64bit then "64"
|
|
|
|
else "32";
|
|
|
|
|
2017-09-04 02:50:09 +01:00
|
|
|
libpath = makeLibraryPath [ stdenv.cc.cc stdenv.glibc alsaLib ];
|
2017-02-18 14:44:31 +00:00
|
|
|
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "mwprocapture-1.2.${version}-${kernel.version}";
|
2017-12-24 06:16:48 +00:00
|
|
|
version = "3773";
|
2017-02-18 14:44:31 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2017-12-24 06:16:48 +00:00
|
|
|
url = "http://www.magewell.com/files/drivers/ProCaptureForLinux_${version}.tar.gz";
|
|
|
|
sha256 = "1ri7c4l4xgkhpz0f15jra1p7mpzi8ir6lpwjm7q7hc9m4cvxcs1g";
|
2017-02-18 14:44:31 +00:00
|
|
|
};
|
|
|
|
|
2018-01-02 00:01:44 +00:00
|
|
|
nativeBuildInputs = [ kernel.moduleBuildDependencies ];
|
|
|
|
|
2017-12-24 06:16:48 +00:00
|
|
|
patches = [ ./linux_4_14_fix.patch ];
|
2017-05-03 08:05:08 +01:00
|
|
|
|
2017-02-18 14:44:31 +00:00
|
|
|
preConfigure =
|
|
|
|
''
|
|
|
|
cd ./src
|
|
|
|
export INSTALL_MOD_PATH="$out"
|
|
|
|
'';
|
|
|
|
|
|
|
|
hardeningDisable = [ "pic" "format" ];
|
|
|
|
|
|
|
|
makeFlags = [
|
|
|
|
"KERNELDIR=${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"
|
|
|
|
];
|
|
|
|
|
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2017-09-04 02:50:09 +01:00
|
|
|
meta = {
|
2017-02-18 14:44:31 +00:00
|
|
|
homepage = http://www.magewell.com/;
|
|
|
|
description = "Linux driver for the Magewell Pro Capture family";
|
|
|
|
license = licenses.unfreeRedistributable;
|
|
|
|
maintainers = with maintainers; [ MP2E ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|