2018-07-21 01:44:44 +01:00
|
|
|
{ stdenv, lib, fetchFromGitHub, kernel, kmod, perl, patchutils, perlPackages }:
|
2017-11-25 22:03:36 +00:00
|
|
|
let
|
2018-04-23 22:54:04 +01:00
|
|
|
|
|
|
|
media = fetchFromGitHub rec {
|
|
|
|
name = repo;
|
2017-11-25 22:03:36 +00:00
|
|
|
owner = "tbsdtv";
|
|
|
|
repo = "linux_media";
|
2018-04-23 22:54:04 +01:00
|
|
|
rev = "efe31531b77efd3a4c94516504a5823d31cdc776";
|
|
|
|
sha256 = "1533qi3sb91v00289hl5zaj4l35r2sf9fqc6z5ky1vbb7byxgnlr";
|
2017-11-25 22:03:36 +00:00
|
|
|
};
|
2018-04-23 22:54:04 +01:00
|
|
|
|
|
|
|
build = fetchFromGitHub rec {
|
|
|
|
name = repo;
|
2017-11-25 22:03:36 +00:00
|
|
|
owner = "tbsdtv";
|
|
|
|
repo = "media_build";
|
2018-04-23 22:54:04 +01:00
|
|
|
rev = "a0d62eba4d429e0e9d2c2f910fb203e817cac84b";
|
|
|
|
sha256 = "1329s7w9xlqjqwkpaqsd6b5dmzhm97jw0c7c7zzmmbdkl289i4i4";
|
2017-11-25 22:03:36 +00:00
|
|
|
};
|
2018-04-23 22:54:04 +01:00
|
|
|
|
2017-11-25 22:03:36 +00:00
|
|
|
in stdenv.mkDerivation {
|
2018-04-23 22:54:04 +01:00
|
|
|
name = "tbs-2018.04.18-${kernel.version}";
|
2017-11-25 22:03:36 +00:00
|
|
|
|
|
|
|
srcs = [ media build ];
|
|
|
|
sourceRoot = "${build.name}";
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
make dir DIR=../${media.name}
|
|
|
|
'';
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs .
|
|
|
|
|
|
|
|
sed -i v4l/Makefile \
|
|
|
|
-i v4l/scripts/make_makefile.pl \
|
|
|
|
-e 's,/sbin/depmod,${kmod}/bin/depmod,g' \
|
|
|
|
-e 's,/sbin/lsmod,${kmod}/bin/lsmod,g'
|
|
|
|
|
|
|
|
sed -i v4l/Makefile \
|
|
|
|
-e 's,^OUTDIR ?= /lib/modules,OUTDIR ?= ${kernel.dev}/lib/modules,' \
|
|
|
|
-e 's,^SRCDIR ?= /lib/modules,SRCDIR ?= ${kernel.dev}/lib/modules,'
|
|
|
|
'';
|
|
|
|
|
|
|
|
buildFlags = [ "VER=${kernel.modDirVersion}" ];
|
|
|
|
installFlags = [ "DESTDIR=$(out)" ];
|
|
|
|
|
2018-05-02 14:03:39 +01:00
|
|
|
hardeningDisable = [ "all" ];
|
2017-11-25 22:03:36 +00:00
|
|
|
|
2018-04-23 22:54:04 +01:00
|
|
|
nativeBuildInputs = [ patchutils kmod perl perlPackages.ProcProcessTable ]
|
2018-05-02 14:03:39 +01:00
|
|
|
++ kernel.moduleBuildDependencies;
|
|
|
|
|
|
|
|
postInstall = ''
|
2018-09-29 09:32:37 +01:00
|
|
|
find $out/lib/modules/${kernel.modDirVersion} -name "*.ko" -exec xz {} \;
|
2018-05-02 14:03:39 +01:00
|
|
|
'';
|
2018-04-23 22:54:04 +01:00
|
|
|
|
|
|
|
meta = with lib; {
|
2017-11-25 22:03:36 +00:00
|
|
|
homepage = https://www.tbsdtv.com/;
|
2018-04-23 22:54:04 +01:00
|
|
|
description = "Linux driver for TBSDTV cards";
|
2017-11-25 22:03:36 +00:00
|
|
|
license = licenses.gpl2;
|
|
|
|
maintainers = with maintainers; [ ck3d ];
|
2018-05-02 14:03:39 +01:00
|
|
|
priority = -1;
|
2018-08-20 23:21:18 +01:00
|
|
|
broken = stdenv.lib.versionAtLeast kernel.version "4.18";
|
2017-11-25 22:03:36 +00:00
|
|
|
};
|
|
|
|
}
|