1{ stdenv, lib, fetchurl, pkgconfig, perl
2, libjpeg, udev
3, withUtils ? true
4, withGUI ? true, alsaLib, libX11, qtbase, libGLU
5}:
6
7# See libv4l in all-packages.nix for the libs only (overrides alsa, libX11 & QT)
8
9stdenv.mkDerivation rec {
10 name = "v4l-utils-${version}";
11 version = "1.12.3";
12
13 src = fetchurl {
14 url = "http://linuxtv.org/downloads/v4l-utils/${name}.tar.bz2";
15 sha256 = "0vpl3jl0x441y7b5cn7zhdsyi954hp9h2p30jhnr1zkx1rpxsiss";
16 };
17
18 outputs = [ "out" "dev" ];
19
20 configureFlags =
21 if withUtils then [
22 "--with-udevdir=\${out}/lib/udev"
23 ] else [
24 "--disable-v4l-utils"
25 ];
26
27 postFixup = ''
28 # Create symlink for V4l1 compatibility
29 ln -s "$dev/include/libv4l1-videodev.h" "$dev/include/videodev.h"
30 '';
31
32 nativeBuildInputs = [ pkgconfig perl ];
33
34 buildInputs = [ udev ] ++ lib.optionals (withUtils && withGUI) [ alsaLib libX11 qtbase libGLU ];
35
36 propagatedBuildInputs = [ libjpeg ];
37
38 NIX_CFLAGS_COMPILE = lib.optional (withUtils && withGUI) "-std=c++11";
39
40 postPatch = ''
41 patchShebangs .
42 '';
43
44 meta = with stdenv.lib; {
45 description = "V4L utils and libv4l, provide common image formats regardless of the v4l device";
46 homepage = https://linuxtv.org/projects.php;
47 license = licenses.lgpl21Plus;
48 maintainers = with maintainers; [ codyopel viric ];
49 platforms = platforms.linux;
50 };
51}