1{ stdenv, fetchurl, cmake, pkgconfig, udev, libcec_platform }:
2
3let version = "4.0.2"; in
4
5stdenv.mkDerivation {
6 name = "libcec-${version}";
7
8 src = fetchurl {
9 url = "https://github.com/Pulse-Eight/libcec/archive/libcec-${version}.tar.gz";
10 sha256 = "09xsw9hfymzl9fi9r2r8n5cxk80fc00x9drsy1r59pgbycqxvf5q";
11 };
12
13 nativeBuildInputs = [ pkgconfig ];
14 buildInputs = [ cmake udev libcec_platform ];
15
16 cmakeFlags = [ "-DBUILD_SHARED_LIBS=1" ];
17
18 # Fix dlopen path
19 patchPhase = ''
20 substituteInPlace include/cecloader.h --replace "libcec.so" "$out/lib/libcec.so"
21 '';
22
23 meta = with stdenv.lib; {
24 description = "Allows you (with the right hardware) to control your device with your TV remote control using existing HDMI cabling";
25 homepage = http://libcec.pulse-eight.com;
26 repositories.git = "https://github.com/Pulse-Eight/libcec.git";
27 license = stdenv.lib.licenses.gpl2Plus;
28 platforms = platforms.linux;
29 maintainers = [ maintainers.titanous ];
30 };
31}