about summary refs log tree commit diff
path: root/pkgs/development/libraries/libcec/default.nix
blob: 78746cf012541cac6f45916b99779704e169f56b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
{ lib
, stdenv
, fetchFromGitHub
, cmake
, pkg-config
, udev
, libcec_platform
, withLibraspberrypi ? false
, libraspberrypi
}:

stdenv.mkDerivation rec {
  pname = "libcec";
  version = "6.0.2";

  src = fetchFromGitHub {
    owner = "Pulse-Eight";
    repo = "libcec";
    rev = "libcec-${version}";
    sha256 = "sha256-OWqCn7Z0KG8sLlfMWd0btJIFJs79ET3Y1AV/y/Kj2TU=";
  };

  # Fix dlopen path
  postPatch = ''
    substituteInPlace include/cecloader.h --replace "libcec.so" "$out/lib/libcec.so"
  '';

  nativeBuildInputs = [ pkg-config cmake ];
  buildInputs = [ udev libcec_platform ] ++
    lib.optional withLibraspberrypi libraspberrypi;

  cmakeFlags = [
    "-DBUILD_SHARED_LIBS=1"
  ] ++ lib.optionals stdenv.isLinux [
    "-DHAVE_LINUX_API=1"
  ];

  meta = with lib; {
    description = "Allows you (with the right hardware) to control your device with your TV remote control using existing HDMI cabling";
    homepage = "http://libcec.pulse-eight.com";
    license = lib.licenses.gpl2Plus;
    platforms = platforms.linux;
    maintainers = teams.kodi.members;
  };
}