depot/third_party/nixpkgs/pkgs/os-specific/linux/tbs/default.nix
Default email e7ec2969af Project import generated by Copybara.
GitOrigin-RevId: 9b19f5e77dd906cb52dade0b7bd280339d2a1f3d
2024-01-13 09:15:51 +01:00

71 lines
1.9 KiB
Nix

{ stdenv, lib, fetchFromGitHub, kernel, kmod, patchutils, perlPackages }:
let
media = fetchFromGitHub rec {
name = repo;
owner = "tbsdtv";
repo = "linux_media";
rev = "d0a7e44358f28064697e0eed309db03166dcd83b";
hash = "sha256-BTHlnta5qv2bdPjD2bButwYGpwR/bq99/AUoZqTHHYw=";
};
build = fetchFromGitHub rec {
name = repo;
owner = "tbsdtv";
repo = "media_build";
rev = "88764363a3e3d36b3c59a0a2bf2244e262035d47";
hash = "sha256-LFTxYVPudflxqYTSBIDNkTrGs09MOuYBXwpGYqWfEFQ=";
};
in
stdenv.mkDerivation {
pname = "tbs";
version = "20231210-${kernel.version}";
srcs = [ media build ];
sourceRoot = build.name;
# https://github.com/tbsdtv/linux_media/wiki
preConfigure = ''
make dir DIR=../${media.name}
make allyesconfig
sed --regexp-extended --in-place v4l/.config \
-e 's/(^CONFIG.*_RC.*=)./\1n/g' \
-e 's/(^CONFIG.*_IR.*=)./\1n/g' \
-e 's/(^CONFIG_VIDEO_VIA_CAMERA=)./\1n/g'
'';
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)" ];
hardeningDisable = [ "pic" ];
nativeBuildInputs = [ patchutils kmod perlPackages.ProcProcessTable ]
++ kernel.moduleBuildDependencies;
postInstall = ''
find $out/lib/modules/${kernel.modDirVersion} -name "*.ko" -exec xz {} \;
'';
meta = with lib; {
homepage = "https://www.tbsdtv.com/";
description = "Linux driver for TBSDTV cards";
license = licenses.gpl2;
maintainers = with maintainers; [ ck3d ];
priority = -1;
broken = kernel.kernelOlder "4.14" || kernel.kernelAtLeast "6.6";
};
}