1{ lib
2, stdenv
3, fetchFromGitHub
4, cmake
5, pkg-config
6, udev
7, libcec_platform
8, withLibraspberrypi ? false
9, libraspberrypi
10}:
11
12stdenv.mkDerivation rec {
13 pname = "libcec";
14 version = "6.0.2";
15
16 src = fetchFromGitHub {
17 owner = "Pulse-Eight";
18 repo = "libcec";
19 rev = "libcec-${version}";
20 sha256 = "sha256-OWqCn7Z0KG8sLlfMWd0btJIFJs79ET3Y1AV/y/Kj2TU=";
21 };
22
23 # Fix dlopen path
24 postPatch = ''
25 substituteInPlace include/cecloader.h --replace "libcec.so" "$out/lib/libcec.so"
26 '';
27
28 nativeBuildInputs = [ pkg-config cmake ];
29 buildInputs = [ udev libcec_platform ] ++
30 lib.optional withLibraspberrypi libraspberrypi;
31
32 cmakeFlags = [ "-DBUILD_SHARED_LIBS=1" ];
33
34 meta = with lib; {
35 description = "Allows you (with the right hardware) to control your device with your TV remote control using existing HDMI cabling";
36 homepage = "http://libcec.pulse-eight.com";
37 license = lib.licenses.gpl2Plus;
38 platforms = platforms.linux;
39 maintainers = [ maintainers.titanous ];
40 };
41}