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 = [
33 "-DBUILD_SHARED_LIBS=1"
34 ] ++ lib.optionals stdenv.isLinux [
35 "-DHAVE_LINUX_API=1"
36 ];
37
38 meta = with lib; {
39 description = "Allows you (with the right hardware) to control your device with your TV remote control using existing HDMI cabling";
40 homepage = "http://libcec.pulse-eight.com";
41 license = lib.licenses.gpl2Plus;
42 platforms = platforms.linux;
43 maintainers = teams.kodi.members;
44 };
45}